faalis 0.11.1 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/faalis/dashboard/app.js +0 -19
  3. data/app/assets/javascripts/faalis/dashboard/functions.js.erb +5 -22
  4. data/app/assets/javascripts/faalis/dashboard/init.js +1 -20
  5. data/app/assets/javascripts/faalis/dashboard/modules/anim.js +0 -19
  6. data/app/assets/javascripts/faalis/dashboard/modules/api.js +0 -19
  7. data/app/assets/javascripts/faalis/dashboard/modules/auth/auth.js +2 -21
  8. data/app/assets/javascripts/faalis/dashboard/modules/auth/group.js +0 -19
  9. data/app/assets/javascripts/faalis/dashboard/modules/auth/profile.js +0 -19
  10. data/app/assets/javascripts/faalis/dashboard/modules/auth/user.js +0 -18
  11. data/app/assets/javascripts/faalis/dashboard/modules/conversations.js +33 -32
  12. data/app/assets/javascripts/faalis/dashboard/modules/errors.js +7 -20
  13. data/app/assets/javascripts/faalis/dashboard/modules/fields/boolean.js +14 -21
  14. data/app/assets/javascripts/faalis/dashboard/modules/fields/controlcombo-field.js +63 -0
  15. data/app/assets/javascripts/faalis/dashboard/modules/fields/datetime.js +18 -20
  16. data/app/assets/javascripts/faalis/dashboard/modules/fields/fields.js +1 -1
  17. data/app/assets/javascripts/faalis/dashboard/modules/fields/float.js +50 -0
  18. data/app/assets/javascripts/faalis/dashboard/modules/fields/input-grid.js +46 -0
  19. data/app/assets/javascripts/faalis/dashboard/modules/fields/input-list.js +31 -0
  20. data/app/assets/javascripts/faalis/dashboard/modules/fields/integer.js +22 -22
  21. data/app/assets/javascripts/faalis/dashboard/modules/fields/relation.js +25 -19
  22. data/app/assets/javascripts/faalis/dashboard/modules/fields/string.js +11 -20
  23. data/app/assets/javascripts/faalis/dashboard/modules/fields/text.js +10 -19
  24. data/app/assets/javascripts/faalis/dashboard/modules/fields/time.js +123 -0
  25. data/app/assets/javascripts/faalis/dashboard/modules/filter.js +0 -19
  26. data/app/assets/javascripts/faalis/dashboard/modules/list-view.js +43 -25
  27. data/app/assets/javascripts/faalis/dashboard/modules/logs.js +0 -18
  28. data/app/assets/javascripts/faalis/dashboard/modules/modules.js +22 -21
  29. data/app/assets/javascripts/faalis/dashboard/modules/nav.js.erb +0 -19
  30. data/app/assets/javascripts/faalis/dashboard/modules/permissions.js +1 -20
  31. data/app/assets/javascripts/faalis/dashboard/objects.js +37 -0
  32. data/app/assets/stylesheets/faalis/dashboard/dashboard.css.scss +4 -0
  33. data/app/assets/stylesheets/faalis/dashboard/ltr/application.css +2 -0
  34. data/app/assets/stylesheets/faalis/dashboard/ltr/buttons.css.scss.erb +7 -0
  35. data/app/assets/stylesheets/faalis/dashboard/ltr/time.css.scss +58 -0
  36. data/app/assets/stylesheets/faalis/dashboard/ltr/time.css_flymake.scss +58 -0
  37. data/app/assets/stylesheets/faalis/dashboard/rtl/application.css +1 -0
  38. data/app/assets/stylesheets/faalis/dashboard/share/time.css.scss +55 -0
  39. data/app/assets/stylesheets/faalis/ltr/application.css +1 -1
  40. data/app/assets/stylesheets/faalis/rtl/buttons.css.scss.erb +5 -0
  41. data/app/controllers/faalis/api/v1/conversations_controller.rb +55 -27
  42. data/app/controllers/faalis/api/v1/groups_controller.rb +1 -1
  43. data/app/controllers/faalis/api/v1/permissions_controller.rb +1 -0
  44. data/app/views/angularjs_templates/conversations/details.html +3 -2
  45. data/app/views/angularjs_templates/conversations/index.html +8 -1
  46. data/app/views/angularjs_templates/conversations/show_details.html +6 -9
  47. data/app/views/angularjs_templates/fields/boolean/boolean.html +2 -2
  48. data/app/views/angularjs_templates/fields/control-combo/control-list.html +19 -0
  49. data/app/views/angularjs_templates/fields/datetime/datetime.html +1 -1
  50. data/app/views/angularjs_templates/fields/datetime/time.html +25 -0
  51. data/app/views/angularjs_templates/fields/float/float.html +4 -0
  52. data/app/views/angularjs_templates/fields/relation/relation.html +4 -3
  53. data/app/views/angularjs_templates/list-view/index.html +6 -5
  54. data/app/views/faalis/api/v1/conversations/destroy.json.jbuilder +1 -0
  55. data/app/views/faalis/api/v1/conversations/reply.json.jbuilder +1 -0
  56. data/app/views/faalis/api/v1/conversations/show.json.jbuilder +12 -8
  57. data/app/views/faalis/api/v1/conversations/trash.json.jbuilder +1 -0
  58. data/config/routes.rb +3 -3
  59. data/lib/faalis/permissions.rb +1 -1
  60. data/lib/faalis/version.rb +1 -1
  61. data/lib/generators/faalis/js_scaffold_generator.rb +10 -0
  62. data/lib/generators/faalis/templates/angularjs/index.html.erb +1 -1
  63. data/lib/generators/faalis/templates/angularjs/module.js.erb +14 -2
  64. data/lib/tasks/faalis_tasks.rake +11 -0
  65. metadata +255 -250
  66. data/spec/dummy/db/test.sqlite3 +0 -0
  67. data/spec/dummy/log/development.log +0 -0
  68. data/spec/dummy/log/test.log +0 -15
  69. data/spec/dummy/tmp/ember-rails/ember-data.js +0 -10204
  70. data/spec/dummy/tmp/ember-rails/ember.js +0 -36991
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 51c65def59ed76316939971e4a3ea8f73aa9bcdc
4
- data.tar.gz: 3ff82b9fa6aab48e7c09a889dc6c27a8d846762c
3
+ metadata.gz: e393d3c1a760d84edd2080b46616efdc10e19fa1
4
+ data.tar.gz: 461d47e4c36d3fc1454c31cf3f5d41d6e0bc6d7b
5
5
  SHA512:
6
- metadata.gz: 353e68754e80ee0079e9ec5b816ef51bb46592054e4df572dedf95b2cbc72201749e12917a192759d4af4171fe826481c164fccdf2a70b35123b71a66947ad54
7
- data.tar.gz: 686429d477d1e789649dad65b864f2dcb42c204a11b7c6f7ff43e71b1b71555d869f0da874c270153cffcc5bfd38ce761838e8acf1d85f32379de09c900ef83d
6
+ metadata.gz: d898bf821ea373e35338187b9315e5ce6e0a446865d1a8fcdf98e1f8b2bdccd2b55de322a6f497b908c4535ba69873d1092ec70b95608b080cf98dc949011701
7
+ data.tar.gz: bd8f791a75b14f81909e0814f598da84e162f2d779fc3bda5556444b945cfa4f3aff3e90ee2341258067788956b82e8cc625d80ac5671ef59dbaddfff671c296
@@ -1,22 +1,3 @@
1
- /* -----------------------------------------------------------------------------
2
- Red Base - Basic website skel engine
3
- Copyright (C) 2012-2013 Yellowen
4
-
5
- This program is free software; you can redistribute it and/or modify
6
- it under the terms of the GNU General Public License as published by
7
- the Free Software Foundation; either version 2 of the License, or
8
- (at your option) any later version.
9
-
10
- This program is distributed in the hope that it will be useful,
11
- but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- GNU General Public License for more details.
14
-
15
- You should have received a copy of the GNU General Public License along
16
- with this program; if not, write to the Free Software Foundation, Inc.,
17
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- ----------------------------------------------------------------------------- */
19
-
20
1
  //= require ./functions
21
2
  //= require_tree ./modules
22
3
  //= require_self
@@ -1,25 +1,8 @@
1
- /* -----------------------------------------------------------------------------
2
- Red Base - Basic website skel engine
3
- Copyright (C) 2012-2013 Yellowen
4
-
5
- This program is free software; you can redistribute it and/or modify
6
- it under the terms of the GNU General Public License as published by
7
- the Free Software Foundation; either version 2 of the License, or
8
- (at your option) any later version.
9
-
10
- This program is distributed in the hope that it will be useful,
11
- but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- GNU General Public License for more details.
14
-
15
- You should have received a copy of the GNU General Public License along
16
- with this program; if not, write to the Free Software Foundation, Inc.,
17
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- ----------------------------------------------------------------------------- */
19
-
20
-
21
- function can(action, model) {
22
- console.log(">>>>>>>>>>>>");
1
+ function to_boolean(value) {
2
+ if (value) {
3
+ return true;
4
+ }
5
+ return false;
23
6
  }
24
7
  /*
25
8
  * This function convert snake_type to CamelCase
@@ -1,24 +1,5 @@
1
- /* -----------------------------------------------------------------------------
2
- Red Base - Basic website skel engine
3
- Copyright (C) 2012-2013 Yellowen
4
-
5
- This program is free software; you can redistribute it and/or modify
6
- it under the terms of the GNU General Public License as published by
7
- the Free Software Foundation; either version 2 of the License, or
8
- (at your option) any later version.
9
-
10
- This program is distributed in the hope that it will be useful,
11
- but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- GNU General Public License for more details.
14
-
15
- You should have received a copy of the GNU General Public License along
16
- with this program; if not, write to the Free Software Foundation, Inc.,
17
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- ----------------------------------------------------------------------------- */
19
-
20
1
  //= require faalis/dashboard/functions
21
-
2
+ //= require faalis/dashboard/objects
22
3
  // Get all the modules syncly
23
4
  $.ajax({method: 'GET', type: 'json', async: false,
24
5
  url: DashboardURL + '/modules.json'})
@@ -1,22 +1,3 @@
1
- /* -----------------------------------------------------------------------------
2
- Red Base - Basic website skel engine
3
- Copyright (C) 2012-2014 Yellowen
4
-
5
- This program is free software; you can redistribute it and/or modify
6
- it under the terms of the GNU General Public License as published by
7
- the Free Software Foundation; either version 2 of the License, or
8
- (at your option) any later version.
9
-
10
- This program is distributed in the hope that it will be useful,
11
- but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- GNU General Public License for more details.
14
-
15
- You should have received a copy of the GNU General Public License along
16
- with this program; if not, write to the Free Software Foundation, Inc.,
17
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- ----------------------------------------------------------------------------- */
19
-
20
1
  var Anim = angular.module("Anim", ["ngAnimate"]);
21
2
 
22
3
  Anim.animation(".fade_anim", function(){
@@ -1,22 +1,3 @@
1
- /* -----------------------------------------------------------------------------
2
- Red Base - Basic website skel engine
3
- Copyright (C) 2012-2013 Yellowen
4
-
5
- This program is free software; you can redistribute it and/or modify
6
- it under the terms of the GNU General Public License as published by
7
- the Free Software Foundation; either version 2 of the License, or
8
- (at your option) any later version.
9
-
10
- This program is distributed in the hope that it will be useful,
11
- but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- GNU General Public License for more details.
14
-
15
- You should have received a copy of the GNU General Public License along
16
- with this program; if not, write to the Free Software Foundation, Inc.,
17
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- ----------------------------------------------------------------------------- */
19
-
20
1
  var API = angular.module("API", []);
21
2
 
22
3
  API.provider("API", function(){
@@ -1,22 +1,3 @@
1
- /* -----------------------------------------------------------------------------
2
- Red Base - Basic website skel engine
3
- Copyright (C) 2012-2013 Yellowen
4
-
5
- This program is free software; you can redistribute it and/or modify
6
- it under the terms of the GNU General Public License as published by
7
- the Free Software Foundation; either version 2 of the License, or
8
- (at your option) any later version.
9
-
10
- This program is distributed in the hope that it will be useful,
11
- but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- GNU General Public License for more details.
14
-
15
- You should have received a copy of the GNU General Public License along
16
- with this program; if not, write to the Free Software Foundation, Inc.,
17
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- ----------------------------------------------------------------------------- */
19
-
20
1
  var Auth = angular.module("Auth", ["User","Group"]);
21
2
 
22
3
  Auth.config(["$routeProvider", function($routeProvider){
@@ -28,7 +9,7 @@ Auth.config(["$routeProvider", function($routeProvider){
28
9
 
29
10
  Auth.controller("AuthMenuController", ["$scope", "gettext", function($scope, gettext){
30
11
  this.menu_items = [
31
- {title: gettext("Users"), url: "/auth/users"},
32
- {title: gettext("Groups"), url: "/auth/groups"}
12
+ {title: gettext("Users"), url: "/auth/users", permission: {action: "read", model: "Faalis::User"}},
13
+ {title: gettext("Groups"), url: "/auth/groups", permission: {action: "read", model: "Faalis::Group"}}
33
14
  ];
34
15
  }]);
@@ -1,22 +1,3 @@
1
- /* -----------------------------------------------------------------------------
2
- Red Base - Basic website skel engine
3
- Copyright (C) 2012-2013 Yellowen
4
-
5
- This program is free software; you can redistribute it and/or modify
6
- it under the terms of the GNU General Public License as published by
7
- the Free Software Foundation; either version 2 of the License, or
8
- (at your option) any later version.
9
-
10
- This program is distributed in the hope that it will be useful,
11
- but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- GNU General Public License for more details.
14
-
15
- You should have received a copy of the GNU General Public License along
16
- with this program; if not, write to the Free Software Foundation, Inc.,
17
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- ----------------------------------------------------------------------------- */
19
-
20
1
  var Group = angular.module("Group", ["ListView", "Errors"]);
21
2
 
22
3
  Group.config(["$routeProvider", function($routeProvider){
@@ -1,22 +1,3 @@
1
- /* -----------------------------------------------------------------------------
2
- Red Base - Basic website skel engine
3
- Copyright (C) 2012-2013 Yellowen
4
-
5
- This program is free software; you can redistribute it and/or modify
6
- it under the terms of the GNU General Public License as published by
7
- the Free Software Foundation; either version 2 of the License, or
8
- (at your option) any later version.
9
-
10
- This program is distributed in the hope that it will be useful,
11
- but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- GNU General Public License for more details.
14
-
15
- You should have received a copy of the GNU General Public License along
16
- with this program; if not, write to the Free Software Foundation, Inc.,
17
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- ----------------------------------------------------------------------------- */
19
-
20
1
  var Profile = angular.module("Profile", []);
21
2
 
22
3
  Profile.config(["$routeProvider", function($routeProvider){
@@ -1,21 +1,3 @@
1
- /* -----------------------------------------------------------------------------
2
- Red Base - Basic website skel engine
3
- Copyright (C) 2012-2013 Yellowen
4
-
5
- This program is free software; you can redistribute it and/or modify
6
- it under the terms of the GNU General Public License as published by
7
- the Free Software Foundation; either version 2 of the License, or
8
- (at your option) any later version.
9
-
10
- This program is distributed in the hope that it will be useful,
11
- but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- GNU General Public License for more details.
14
-
15
- You should have received a copy of the GNU General Public License along
16
- with this program; if not, write to the Free Software Foundation, Inc.,
17
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- ----------------------------------------------------------------------------- */
19
1
  var User = angular.module("User", ["ListView", "Errors"]);
20
2
 
21
3
  User.config(["$routeProvider", function($routeProvider){
@@ -1,21 +1,3 @@
1
- /* -----------------------------------------------------------------------------
2
- Red Base - Basic website skel engine
3
- Copyright (C) 2012-2013 Yellowen
4
-
5
- This program is free software; you can redistribute it and/or modify
6
- it under the terms of the GNU General Public License as published by
7
- the Free Software Foundation; either version 2 of the License, or
8
- (at your option) any later version.
9
-
10
- This program is distributed in the hope that it will be useful,
11
- but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- GNU General Public License for more details.
14
-
15
- You should have received a copy of the GNU General Public License along
16
- with this program; if not, write to the Free Software Foundation, Inc.,
17
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- ----------------------------------------------------------------------------- */
19
1
  var Conversation = angular.module("Conversation",["ListView", "Errors"]);
20
2
 
21
3
 
@@ -41,10 +23,10 @@ Conversation.config(["$routeProvider", function($routeProvider){
41
23
 
42
24
  Conversation.controller("ConversationControllerIndex",["$scope", "Restangular", "gettext", "catch_error", "$routeParams","$location", function($scope, API, gettext, catch_error, $routeParams, $location){
43
25
  if ($routeParams.id){
26
+ $scope.id = $routeParams.id;
44
27
  $scope.details_template = template("conversations/show_details");
45
- console.log($scope.details_templates);
46
28
  API.all("conversations").get($routeParams.id).then(function(data){
47
- $scope.conversations = data;
29
+ $scope.conversations = data.messages;
48
30
  });
49
31
  }else{
50
32
  $scope.details_template = template("conversations/details");
@@ -74,6 +56,12 @@ Conversation.controller("ConversationControllerIndex",["$scope", "Restangular",
74
56
  classes: "btn tiny green",
75
57
  route: "#conversations/new"
76
58
  },
59
+ {
60
+ title: gettext("Inbox"),
61
+ icon: "fa fa-plus",
62
+ classes: "btn tiny green",
63
+ route: "#/conversations/inbox"
64
+ },
77
65
  {
78
66
  title: gettext("Sent box"),
79
67
  icon: "fa fa-plus",
@@ -88,20 +76,19 @@ Conversation.controller("ConversationControllerIndex",["$scope", "Restangular",
88
76
  }
89
77
  ];
90
78
 
91
- $scope.message_title = function(conversation){
92
- console.log(conversation);
93
- console.log('fix me : check why multiple run');
94
- return conversation.message.subject;
79
+ $scope.box_type = function(){
80
+ return type;
95
81
  };
96
82
 
83
+ $scope.message_title = function(conversation){
84
+ return conversation.subject;
85
+ };
97
86
  $scope.on_trash = function(conversations){
98
- return conversations;
99
87
  var query = [];
100
88
  conversations.forEach(function(conversation){
101
89
  query.push(conversation.id);
102
90
  });
103
-
104
- API.all("conversations",query.join(",")).post()
91
+ API.all("conversations").all("trash").post({id: query.join(",")})
105
92
  .then(function(data) {
106
93
 
107
94
  $scope.conversations = _.filter($scope.Conversations, function(x){
@@ -114,12 +101,28 @@ Conversation.controller("ConversationControllerIndex",["$scope", "Restangular",
114
101
  };
115
102
 
116
103
  $scope.on_untrash = function(conversations){
104
+ console.log("hereeer");
117
105
  var query = [];
118
106
  conversations.forEach(function(conversation){
119
107
  query.push(conversation.id);
120
108
  });
109
+ API.all("conversations").all("untrash").post({id: query.join(",")})
110
+ .then(function(data){
111
+
112
+ $scope.conversations = _.filter($scope.Conversations, function(x){
113
+ return !(query.indexOf(x.id) != -1);
114
+ });
115
+ success_message(data.msg);
116
+ })
117
+ .catch(catch_error);
118
+ };
121
119
 
122
- API.all("conversations",query.join(",")).post()
120
+ $scope.on_delete = function(conversations){
121
+ var query = [];
122
+ conversations.forEach(function(conversation){
123
+ query.push(conversation.id);
124
+ });
125
+ API.all("conversations").customDELETE(query.join(","))
123
126
  .then(function(data) {
124
127
 
125
128
  $scope.conversations = _.filter($scope.Conversations, function(x){
@@ -128,12 +131,11 @@ Conversation.controller("ConversationControllerIndex",["$scope", "Restangular",
128
131
  success_message(data.msg);
129
132
  })
130
133
  .catch(catch_error);
131
- };
132
134
 
135
+ };
133
136
 
134
137
  }]);
135
138
 
136
-
137
139
  Conversation.controller("ConversationControllerNew", ["$scope", "Restangular", "gettext", "catch_error", "$routeParams", "$location", function($scope, API, gettext, catch_error, $routeParams, $location){
138
140
  $scope.obj_id = null;
139
141
  if("id" in $routeParams){
@@ -152,12 +154,11 @@ Conversation.controller("ConversationControllerNew", ["$scope", "Restangular", "
152
154
  }
153
155
 
154
156
  $scope.save = function() {
155
- var conversation = {conversation: {
157
+ var conversation = {message:{
156
158
  recipients: $scope.recipients,
157
159
  subject: $scope.subject,
158
160
  body: $scope.body
159
161
  }};
160
- console.log(conversation);
161
162
  if ($scope.obj_id){
162
163
  API.all("conversations").one($scope.obj_id).one("reply").customPOST(conversation,"",{}).then(function(){
163
164
  success_message(gettext("Message sent successfully."));
@@ -1,26 +1,14 @@
1
- /* -----------------------------------------------------------------------------
2
- Red Base - Basic website skel engine
3
- Copyright (C) 2012-2013 Yellowen
4
-
5
- This program is free software; you can redistribute it and/or modify
6
- it under the terms of the GNU General Public License as published by
7
- the Free Software Foundation; either version 2 of the License, or
8
- (at your option) any later version.
9
-
10
- This program is distributed in the hope that it will be useful,
11
- but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- GNU General Public License for more details.
14
-
15
- You should have received a copy of the GNU General Public License along
16
- with this program; if not, write to the Free Software Foundation, Inc.,
17
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- ----------------------------------------------------------------------------- */
1
+ // Error Handling Service
2
+ // ----------------------
3
+ // This module is responsible for handling errors and show suitable messages to user.
4
+ // It's neccessary to use this service in your code. Make sure to specify this module
5
+ // as your module dependency
19
6
  var Errors = angular.module("Errors", []);
20
7
 
8
+ // Error service defination
21
9
  Errors.factory('catch_error', ["gettext", function(gettext) {
22
- return function(error) {
23
10
 
11
+ return function(error) {
24
12
  if ("data" in error) {
25
13
  if ((typeof(error.data) == "object") && ("fields" in error.data)) {
26
14
  _.each(error.data.fields, function(value, key) {
@@ -42,6 +30,5 @@ Errors.factory('catch_error', ["gettext", function(gettext) {
42
30
  }
43
31
  console.log(error);
44
32
  error_message(gettext("Unkown error: please try again or contact to administrator."));
45
-
46
33
  };
47
34
  }]);
@@ -1,22 +1,3 @@
1
- /* -----------------------------------------------------------------------------
2
- Red Base - Basic website skel engine
3
- Copyright (C) 2012-2014 Yellowen
4
-
5
- This program is free software; you can redistribute it and/or modify
6
- it under the terms of the GNU General Public License as published by
7
- the Free Software Foundation; either version 2 of the License, or
8
- (at your option) any later version.
9
-
10
- This program is distributed in the hope that it will be useful,
11
- but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- GNU General Public License for more details.
14
-
15
- You should have received a copy of the GNU General Public License along
16
- with this program; if not, write to the Free Software Foundation, Inc.,
17
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- ----------------------------------------------------------------------------- */
19
-
20
1
  var Boolean_ = angular.module("BooleanField", []);
21
2
 
22
3
  /*
@@ -24,23 +5,35 @@ var Boolean_ = angular.module("BooleanField", []);
24
5
  */
25
6
  Boolean_.directive('booleanField', ["$filter", "gettext", function($filter, gettext) {
26
7
 
27
- function link(scope, element, attrs){
8
+ function link(scope, element, attrs, ngModel){
28
9
  var ltr = is_ltr();
29
10
  scope.element_id = "id_" + scope.field;
30
11
  scope.msg_element_id = "id_" + scope.field + "_msg";
12
+
13
+ if (scope.on_change !== undefined) {
14
+ // Watch event changes
15
+ scope.$watch("model", function(newv, oldv, $scope) {
16
+ // TODO: maybe we should pass locals to $eval
17
+ scope.$parent.$eval(scope.on_change);
18
+ }, true);
19
+ }
31
20
  }
32
21
  // Actual object of <boolean-field> directive
33
22
  return {
34
23
  templateUrl: template("fields/boolean/boolean"),
35
24
  replace: true,
36
25
  restrict: "E",
26
+ //require: "ngModel",
37
27
  scope: {
38
28
  cssClasses: '=cssClass',
39
-
29
+ // string to shown as label for control
30
+ label: "@",
40
31
  // fieldname
41
32
  field: "=fieldName",
42
33
  // Does this field is required
43
34
  required: "=",
35
+ // A call back to pass to field ng-change directive
36
+ on_change: "@onChange",
44
37
  // Actual Angularjs ng-model
45
38
  model: '='
46
39
  },