dashstrap 0.1.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.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.yardopts +1 -0
- data/Gemfile +8 -0
- data/LICENSE +339 -0
- data/README.md +40 -0
- data/Rakefile +13 -0
- data/TODO.org +3 -0
- data/app/assets/fonts/BYekan.eot +0 -0
- data/app/assets/fonts/BYekan.ttf +0 -0
- data/app/assets/fonts/BYekan.woff +0 -0
- data/app/assets/javascripts/dashstrap/application.js +2 -0
- data/app/assets/javascripts/dashstrap/functions.js +27 -0
- data/app/assets/javascripts/dashstrap/locales/translations.fa.js +5 -0
- data/app/assets/javascripts/dashstrap/modules/init.js +1 -0
- data/app/assets/javascripts/dashstrap/modules/list-view.js +376 -0
- data/app/assets/javascripts/dashstrap/modules/modules.js +79 -0
- data/app/assets/javascripts/dashstrap/modules/navigation.js +24 -0
- data/app/assets/javascripts/locales/translations.fa.js +5 -0
- data/app/assets/locales/templates.pot +92 -0
- data/app/assets/locales/translate.fa.pot +93 -0
- data/app/assets/stylesheets/dashstrap/ltr/application.css +17 -0
- data/app/assets/stylesheets/dashstrap/ltr/ltr.scss +15 -0
- data/app/assets/stylesheets/dashstrap/main.css.scss +63 -0
- data/app/assets/stylesheets/dashstrap/rtl/#application.css# +4 -0
- data/app/assets/stylesheets/dashstrap/rtl/application.css +18 -0
- data/app/assets/stylesheets/dashstrap/rtl/rtl.scss +38 -0
- data/app/assets/stylesheets/dashstrap/share.scss +7 -0
- data/app/assets/stylesheets/faalis/ltr/application.css +0 -0
- data/app/assets/stylesheets/faalis/rtl/application.css +0 -0
- data/app/assets/stylesheets/simple/ltr/application.css +4 -0
- data/app/assets/stylesheets/simple/rtl/application.css +5 -0
- data/app/assets/stylesheets/simple/rtl/rtl.scss +16 -0
- data/app/assets/stylesheets/simple/share.scss +11 -0
- data/app/views/angular/auth/groups/details.html +21 -0
- data/app/views/angular/auth/groups/index.html.slim +2 -0
- data/app/views/angular/auth/groups/new.html.slim +44 -0
- data/app/views/angular/auth/index.html +30 -0
- data/app/views/angular/auth/profile/edit.html +54 -0
- data/app/views/angular/auth/users/details.html +28 -0
- data/app/views/angular/auth/users/index.html +6 -0
- data/app/views/angular/auth/users/new.html +57 -0
- data/app/views/angular/fields/accordion/accordion-group.html +10 -0
- data/app/views/angular/fields/accordion/accordion.html +1 -0
- data/app/views/angular/fields/alert/alert.html +7 -0
- data/app/views/angular/fields/boolean/boolean.html +4 -0
- data/app/views/angular/fields/carousel/carousel.html +8 -0
- data/app/views/angular/fields/carousel/slide.html +7 -0
- data/app/views/angular/fields/control-combo/control-list.html +19 -0
- data/app/views/angular/fields/datepicker/datepicker.html +5 -0
- data/app/views/angular/fields/datepicker/day.html +21 -0
- data/app/views/angular/fields/datepicker/month.html +16 -0
- data/app/views/angular/fields/datepicker/popup.html +10 -0
- data/app/views/angular/fields/datepicker/year.html +16 -0
- data/app/views/angular/fields/datetime/datetime.html +10 -0
- data/app/views/angular/fields/datetime/time.html +25 -0
- data/app/views/angular/fields/float/float.html +4 -0
- data/app/views/angular/fields/image/image.html +1 -0
- data/app/views/angular/fields/integer/integer.html +4 -0
- data/app/views/angular/fields/modal/backdrop.html +4 -0
- data/app/views/angular/fields/modal/window.html +3 -0
- data/app/views/angular/fields/pagination/pager.html +4 -0
- data/app/views/angular/fields/pagination/pagination.html +7 -0
- data/app/views/angular/fields/popover/popover.html +8 -0
- data/app/views/angular/fields/progressbar/bar.html +1 -0
- data/app/views/angular/fields/progressbar/progress.html +1 -0
- data/app/views/angular/fields/progressbar/progressbar.html +3 -0
- data/app/views/angular/fields/rating/rating.html +5 -0
- data/app/views/angular/fields/relation/relation.html +43 -0
- data/app/views/angular/fields/string/string.html +22 -0
- data/app/views/angular/fields/tabs/tab.html +3 -0
- data/app/views/angular/fields/tabs/tabset.html +10 -0
- data/app/views/angular/fields/tag/tag.html +3 -0
- data/app/views/angular/fields/text/text.html +4 -0
- data/app/views/angular/fields/timepicker/timepicker.html +26 -0
- data/app/views/angular/fields/tooltip/tooltip-html-unsafe-popup.html +4 -0
- data/app/views/angular/fields/tooltip/tooltip-popup.html +4 -0
- data/app/views/angular/fields/typeahead/typeahead-match.html +1 -0
- data/app/views/angular/fields/typeahead/typeahead-popup.html +5 -0
- data/app/views/angular/index.html +448 -0
- data/app/views/angular/list-view/index.html +161 -0
- data/app/views/angular/modules.html +46 -0
- data/app/views/angular/nav.html.erb +273 -0
- data/app/views/dashstrap/.keep +0 -0
- data/app/views/devise/registrations/edit.html.erb +29 -0
- data/app/views/devise/registrations/new.html.erb +36 -0
- data/app/views/devise/sessions/new.html.erb +33 -0
- data/app/views/devise/shared/_links.erb +19 -0
- data/app/views/devise/shared/_omni_link.erb +15 -0
- data/app/views/faalis/dashboard/index.html.erb +44 -0
- data/app/views/faalis/dashboard/login_required_page.html.erb +5 -0
- data/app/views/layouts/dashstrap/.keep +0 -0
- data/app/views/layouts/faalis/application.html.erb +83 -0
- data/app/views/layouts/faalis/dashboard.html.erb +26 -0
- data/app/views/layouts/faalis/simple.html.erb +22 -0
- data/dashstrap.gemspec +39 -0
- data/lib/dashstrap/engine.rb +29 -0
- data/lib/dashstrap/version.rb +3 -0
- data/lib/dashstrap.rb +4 -0
- data/lib/generators/dashstrap/install_generator.rb +14 -0
- data/lib/generators/templates/js/list_view/README +31 -0
- data/lib/generators/templates/js/list_view/details.html.erb +25 -0
- data/lib/generators/templates/js/list_view/index.html.erb +89 -0
- data/lib/generators/templates/js/list_view/module.js.erb +10 -0
- data/lib/generators/templates/js/list_view/new.html.erb +81 -0
- data/lib/generators/templates/js/list_view/partials/add_controller.js.erb +103 -0
- data/lib/generators/templates/js/list_view/partials/config.js.erb +20 -0
- data/lib/generators/templates/js/list_view/partials/index_controller.js.erb +199 -0
- data/lib/generators/templates/js/list_view/partials/menu.js.erb +6 -0
- data/lib/generators/templates/stylesheets/application.css +13 -0
- data/lib/generators/templates/stylesheets/dashboard/ltr/application.css +1 -0
- data/lib/generators/templates/stylesheets/dashboard/rtl/application.css +1 -0
- data/lib/generators/templates/stylesheets/ltr/application.css +6 -0
- data/lib/generators/templates/stylesheets/rtl/application.css +4 -0
- data/lib/tasks/.keep +0 -0
- data/lib/tasks/build.rake +15 -0
- data/lib/tasks/grunt/Gruntfile.js +30 -0
- data/vendor/assets/fonts/FontAwesome.otf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.svg +414 -0
- data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/vendor/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/vendor/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/vendor/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/vendor/assets/fonts/ionicons.eot +0 -0
- data/vendor/assets/fonts/ionicons.svg +1623 -0
- data/vendor/assets/fonts/ionicons.ttf +0 -0
- data/vendor/assets/fonts/ionicons.woff +0 -0
- data/vendor/assets/javascripts/.keep +0 -0
- data/vendor/assets/javascripts/AdminLTE/app.js +1037 -0
- data/vendor/assets/javascripts/AdminLTE/dashboard.js +254 -0
- data/vendor/assets/javascripts/bootstrap.js +2114 -0
- data/vendor/assets/javascripts/ui-bootstrap.js +3799 -0
- data/vendor/assets/stylesheets/.keep +0 -0
- data/vendor/assets/stylesheets/AdminLTE.css +3024 -0
- data/vendor/assets/stylesheets/bootstrap.css +7118 -0
- data/vendor/assets/stylesheets/rtl/AdminLTE.css +3032 -0
- data/vendor/assets/stylesheets/rtl/bootstrap-rtl.css +442 -0
- data/vendor/assets/stylesheets/rtl/bootstrap.css +6239 -0
- metadata +366 -0
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
var ListView = angular.module("ListView", ['ngGrid', 'Permissions']);
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* <element object-action></element> directive defination
|
|
5
|
+
*/
|
|
6
|
+
ListView.directive("objectAction", function(){
|
|
7
|
+
|
|
8
|
+
function link(scope, element, attrs){
|
|
9
|
+
|
|
10
|
+
var object = scope.object;
|
|
11
|
+
var action = scope.action;
|
|
12
|
+
|
|
13
|
+
if ("route" in object){
|
|
14
|
+
element.attr("href", object.route);
|
|
15
|
+
}
|
|
16
|
+
else if ("action" in object) {
|
|
17
|
+
element.on("click", object.action);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Actual object
|
|
22
|
+
return {
|
|
23
|
+
restrict: "A",
|
|
24
|
+
scope: {
|
|
25
|
+
object: "="
|
|
26
|
+
},
|
|
27
|
+
link: link
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
* <list-view></list-view> directive defination
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
ListView.directive('listView', ["$filter", "gettext", "UserPermissions", function($filter, gettext, User) {
|
|
38
|
+
|
|
39
|
+
function link(scope, element, attrs){
|
|
40
|
+
var ltr = is_ltr();
|
|
41
|
+
var _item_per_page = parseInt(scope.item_per_page, 10) || 10;
|
|
42
|
+
var _current_page = 1;
|
|
43
|
+
|
|
44
|
+
scope.list_view = true;
|
|
45
|
+
scope.grid_view = false;
|
|
46
|
+
|
|
47
|
+
var use_permissions;
|
|
48
|
+
|
|
49
|
+
if (scope.use_permissions === undefined) {
|
|
50
|
+
use_permissions = true;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
use_permissions = false;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
scope.get_attr = function(object, attr_name, default_value) {
|
|
58
|
+
if (typeof(object[attr_name]) == "function") {
|
|
59
|
+
return object[attr_name]();
|
|
60
|
+
}
|
|
61
|
+
else if (object[attr_name] !== undefined) {
|
|
62
|
+
return object[attr_name] || default_value;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
var value = scope.title(object);
|
|
66
|
+
if ( value == false) {
|
|
67
|
+
throw "No attribute '" + attr_name + "' found for '" + object.toString() + "'";
|
|
68
|
+
}
|
|
69
|
+
return value;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
scope.title = function(object, t) {
|
|
74
|
+
console.log(scope.title_attr);
|
|
75
|
+
if (typeof(scope.title_attr) == "function") {
|
|
76
|
+
return scope.title_attr(object);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (object[scope.title_attr] !== undefined) {
|
|
80
|
+
return object[scope.title_attr];
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
var filtered_objects = function(){
|
|
88
|
+
var filterby = {};
|
|
89
|
+
|
|
90
|
+
if (typeof(scope.title_attr) == "function") {
|
|
91
|
+
filterby = scope.title_attr;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
filterby[scope.title_attr] = scope.searchterm;
|
|
95
|
+
}
|
|
96
|
+
var result = $filter('filter')(scope.objects, filterby, function(expected, actual){
|
|
97
|
+
var re = new RegExp(".*" + actual + ".*", "ig");
|
|
98
|
+
scope.go_to_first_page();
|
|
99
|
+
if( expected.match(re) ){
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
return false;
|
|
103
|
+
});
|
|
104
|
+
// TODO: Double check this or condition
|
|
105
|
+
return result || [];
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
scope.grid_options = {
|
|
109
|
+
data: 'objects',
|
|
110
|
+
headerRowHeight: 30,
|
|
111
|
+
rowHeight: 30,
|
|
112
|
+
enablePaging: true,
|
|
113
|
+
afterSelectionChange: function(rowitem, event){
|
|
114
|
+
console.dir(rowitem);
|
|
115
|
+
console.dir(event);
|
|
116
|
+
},
|
|
117
|
+
columnDefs: scope.column_defs
|
|
118
|
+
};
|
|
119
|
+
var delete_method = scope.on_delete || function(x){
|
|
120
|
+
console.log( "undefined on delete method" );
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
scope.is_ltr = ltr;
|
|
124
|
+
scope.handle_icon = "fa-eye";
|
|
125
|
+
scope.first_page_icon = ltr ? "fa-angle-double-left" : "fa-angle-double-right";
|
|
126
|
+
scope.last_page_icon = ltr ? "fa-angle-double-right" : "fa-angle-double-left";
|
|
127
|
+
scope.prev_page_icon = ltr ? "fa-angle-left" : "fa-angle-right";
|
|
128
|
+
scope.next_page_icon = ltr ? "fa-angle-right" : "fa-angle-left";
|
|
129
|
+
scope.hand_icon = ltr ? "fa-hand-o-right" : "fa-hand-o-left";
|
|
130
|
+
scope.is_all_selected = false;
|
|
131
|
+
|
|
132
|
+
scope.handle_icon_expand = function(object){
|
|
133
|
+
if(scope.should_view(object)) {
|
|
134
|
+
return "fa-eye-slash";
|
|
135
|
+
}
|
|
136
|
+
return "";
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// View an item details
|
|
140
|
+
scope.toggle_details = function(object){
|
|
141
|
+
if (object['view_details'] !== undefined){
|
|
142
|
+
object.view_details = ! object.view_details;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
object.view_details = true;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
// Should we open details section
|
|
150
|
+
scope.should_view = function(object){
|
|
151
|
+
if ((object !== undefined) && (object['view_details'] !== undefined)) {
|
|
152
|
+
return object.view_details;
|
|
153
|
+
}
|
|
154
|
+
return false;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
scope.delete_items = function(){
|
|
158
|
+
|
|
159
|
+
var len = scope.selected_count();
|
|
160
|
+
var objects_to_delete = [];
|
|
161
|
+
|
|
162
|
+
if( confirm(gettext("Are sure you want to delete ") + len + gettext(" item(s)?")) ){
|
|
163
|
+
var objects_list = filtered_objects();
|
|
164
|
+
|
|
165
|
+
for(var i = 0 ; i < objects_list.length; i++){
|
|
166
|
+
|
|
167
|
+
if (objects_list[i].is_selected === true) {
|
|
168
|
+
objects_to_delete.push(objects_list[i]);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
delete_method(objects_to_delete);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
};
|
|
178
|
+
// Selection related methods -----------------------------------
|
|
179
|
+
// Select a row in table
|
|
180
|
+
scope.select_item = function(object) {
|
|
181
|
+
if (object['is_selected'] !== undefined) {
|
|
182
|
+
object.is_selected = ! object.is_selected;
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
object.is_selected = true;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
scope.toggle_select = function (){
|
|
191
|
+
var objects_list = filtered_objects();
|
|
192
|
+
|
|
193
|
+
for(i = 0 ; i < objects_list.length; i++){
|
|
194
|
+
objects_list[i].is_selected = ! objects_list[i].is_selected;
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
scope.toggle_select = function (){
|
|
199
|
+
var objects_list = filtered_objects();
|
|
200
|
+
|
|
201
|
+
for(i = 0 ; i < objects_list.length; i++){
|
|
202
|
+
objects_list[i].is_selected = ! objects_list[i].is_selected;
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
scope.select_all = function (){
|
|
207
|
+
var objects_list = filtered_objects();
|
|
208
|
+
|
|
209
|
+
for(i = 0 ; i < objects_list.length; i++){
|
|
210
|
+
objects_list[i].is_selected = ! scope.is_all_selected;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
scope.is_all_selected = ! scope.is_all_selected;
|
|
214
|
+
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
scope.selected_count = function(){
|
|
218
|
+
var myobjects = filtered_objects();
|
|
219
|
+
var count = 0;
|
|
220
|
+
for(var i = 0; i < myobjects.length; i++) {
|
|
221
|
+
if(myobjects[i].is_selected !== undefined){
|
|
222
|
+
if(myobjects[i].is_selected) {
|
|
223
|
+
count++;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
}
|
|
228
|
+
return count;
|
|
229
|
+
};
|
|
230
|
+
// Pagination methods ---------------------------------
|
|
231
|
+
|
|
232
|
+
scope.has_pagination = function(){
|
|
233
|
+
return scope.total_pages() > 1 ? true : false;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
scope.total_pages = function(){
|
|
237
|
+
var len = filtered_objects().length;
|
|
238
|
+
var pages = parseInt(len / _item_per_page, 10);
|
|
239
|
+
|
|
240
|
+
if (len % _item_per_page > 0 || len < _item_per_page) {
|
|
241
|
+
pages++;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return pages;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
scope.current_page = function(){
|
|
248
|
+
return _current_page;
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
scope.go_to_next_page = function(){
|
|
252
|
+
if (_current_page < scope.total_pages()) {
|
|
253
|
+
_current_page++;
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
_current_page = scope.total_pages();
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
scope.go_to_prev_page = function(){
|
|
261
|
+
if (_current_page > 1) {
|
|
262
|
+
_current_page--;
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
_current_page = 1;
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
scope.go_to_last_page = function(){
|
|
270
|
+
_current_page = scope.total_pages();
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
scope.go_to_first_page = function(){
|
|
274
|
+
_current_page = 1;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
scope.go_to_page = function($event, value){
|
|
278
|
+
if( $event.which == 13 ){
|
|
279
|
+
|
|
280
|
+
var page = parseInt(value, 10);
|
|
281
|
+
|
|
282
|
+
if (page > 0 && page <= scope.total_pages()) {
|
|
283
|
+
_current_page = page;
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
value = _current_page;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
scope.get_current_page = function(){
|
|
294
|
+
var start = (scope.current_page() * _item_per_page) - _item_per_page;
|
|
295
|
+
var end = (scope.current_page() * _item_per_page);
|
|
296
|
+
|
|
297
|
+
return filtered_objects().slice(start, end);
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
scope.objects_count = function(){
|
|
301
|
+
return filtered_objects().length;
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
scope.has_permission = function(button) {
|
|
305
|
+
if (use_permissions === true) {
|
|
306
|
+
if( button.permission !== undefined ){
|
|
307
|
+
if ((!("name" in button.permission)) || (!("model" in button.permission))) {
|
|
308
|
+
console.log("Button permission should be an object and has 'name' and 'model' keys");
|
|
309
|
+
throw "Button permission should be an object and has 'name' and 'model' keys";
|
|
310
|
+
}
|
|
311
|
+
return User.can(button.permission.name, button.permission.model);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return true;
|
|
315
|
+
};
|
|
316
|
+
scope.can = function(perm, model) {
|
|
317
|
+
if (use_permissions === true) {
|
|
318
|
+
return User.can(perm, model);
|
|
319
|
+
}
|
|
320
|
+
return true;
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
// Actual object of <list-view> directive
|
|
326
|
+
return {
|
|
327
|
+
templateUrl: template("list-view/index"),
|
|
328
|
+
restrict: "E",
|
|
329
|
+
transclude: true,
|
|
330
|
+
scope: {
|
|
331
|
+
// Header section custom buttons
|
|
332
|
+
buttons: "=buttons",
|
|
333
|
+
|
|
334
|
+
// Objects which should listed
|
|
335
|
+
objects: "=",
|
|
336
|
+
|
|
337
|
+
// Object attribute which should show as title in main li
|
|
338
|
+
title_attr: "=titleAttribute",
|
|
339
|
+
|
|
340
|
+
// Template address for details section
|
|
341
|
+
details_template: "=detailsTemplate",
|
|
342
|
+
|
|
343
|
+
// Number of item per pages
|
|
344
|
+
item_per_page: "=itemPerPage",
|
|
345
|
+
|
|
346
|
+
// Search input
|
|
347
|
+
search: "=",
|
|
348
|
+
|
|
349
|
+
// Grid columns
|
|
350
|
+
column_defs: "=columnDefs",
|
|
351
|
+
|
|
352
|
+
// Permissions
|
|
353
|
+
use_permissions: "=usePermissions",
|
|
354
|
+
|
|
355
|
+
// Permission model
|
|
356
|
+
permission_model: "=model",
|
|
357
|
+
|
|
358
|
+
// On delete method
|
|
359
|
+
on_delete: "=onDelete",
|
|
360
|
+
|
|
361
|
+
// Title of list box
|
|
362
|
+
list_title: '=listTitle',
|
|
363
|
+
|
|
364
|
+
// Tools array to use/show for each row
|
|
365
|
+
tools_processor: '=toolsProcessor',
|
|
366
|
+
|
|
367
|
+
// Custom delete title method
|
|
368
|
+
delete_title: "=deleteTitle",
|
|
369
|
+
|
|
370
|
+
//Badge operation function
|
|
371
|
+
badge_processor: '=badgeProcessor'
|
|
372
|
+
|
|
373
|
+
},
|
|
374
|
+
link: link
|
|
375
|
+
};
|
|
376
|
+
}]);
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// Module module :P
|
|
2
|
+
var Modules = angular.module("Modules", ["ngRoute", "ngAnimate"]);
|
|
3
|
+
|
|
4
|
+
add_dependency("Modules");
|
|
5
|
+
|
|
6
|
+
// This controller is responsible to parse modules and load them
|
|
7
|
+
Modules.controller("ModulesController", ["$location", "$scope", "$controller", "UserPermissions", function($location, $scope, $controller, User){
|
|
8
|
+
|
|
9
|
+
var that = this;
|
|
10
|
+
this.modules = _.filter(DModules, function(module){
|
|
11
|
+
|
|
12
|
+
// Check if current module should be appear in side bar
|
|
13
|
+
if (module.sidemenu === true) {
|
|
14
|
+
|
|
15
|
+
// If module is a sidebar module, it have to have a controller which
|
|
16
|
+
// represent the submenu. Name of the controller should be like:
|
|
17
|
+
// ```javascript
|
|
18
|
+
/// <modulename>MenuController
|
|
19
|
+
///```
|
|
20
|
+
var menu_items = $controller(camelCase(module.resource) + "MenuController", {$scope: $scope}).menu_items;
|
|
21
|
+
module.menu_items = [];
|
|
22
|
+
|
|
23
|
+
// Iterate over submenu items
|
|
24
|
+
_.each(menu_items, function(menu) {
|
|
25
|
+
// If menu item provided a permission attribute we have to check user permission for that
|
|
26
|
+
if ("permission" in menu){
|
|
27
|
+
|
|
28
|
+
if ((!("action" in menu.permission)) || (!("model" in menu.permission))) {
|
|
29
|
+
console.log("Button permission should be an object and has 'action' and 'model' keys");
|
|
30
|
+
throw "Button permission should be an object and has 'name' and 'model' keys";
|
|
31
|
+
}
|
|
32
|
+
// Check if user can pass the permission
|
|
33
|
+
if (User.can(menu.permission.action, menu.permission.model)) {
|
|
34
|
+
console.debug("You have " + menu.permission.action + " permission on " + menu.permission.model);
|
|
35
|
+
module.menu_items.push(menu);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
console.debug("User don't have " + menu.permission.action + " permission on " + menu.permission.model);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
// Add item to submenu item list
|
|
43
|
+
module.menu_items.push(menu);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
// Close the submenu section
|
|
47
|
+
module.show_menu = false;
|
|
48
|
+
}
|
|
49
|
+
return module.sidemenu || false;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Event handler on menu click
|
|
53
|
+
this.on_click = function(url){
|
|
54
|
+
$location.path(url);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// Event handler of click on menu itself
|
|
58
|
+
this.view_menu = function(module) {
|
|
59
|
+
_.each(this.modules, function(x){
|
|
60
|
+
if (x !== module) {
|
|
61
|
+
x.show_menu = false;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
module.show_menu = !module.show_menu;
|
|
65
|
+
};
|
|
66
|
+
}]);
|
|
67
|
+
|
|
68
|
+
// Animations of slide effect
|
|
69
|
+
Modules.animation(".slide", function(){
|
|
70
|
+
return {
|
|
71
|
+
leave: function(elem, done){
|
|
72
|
+
$(elem).slideUp(700, done);
|
|
73
|
+
},
|
|
74
|
+
enter: function(elem, done){
|
|
75
|
+
$(elem).slideDown(700, done);
|
|
76
|
+
return function(cancelled){};
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var Nav = angular.module("Navigation", []);
|
|
2
|
+
|
|
3
|
+
add_dependency("Navigation");
|
|
4
|
+
|
|
5
|
+
Nav.controller("NavigationController", ["$rootScope", function($rootScope){
|
|
6
|
+
var that = this;
|
|
7
|
+
|
|
8
|
+
$rootScope.show_sidebar = true;
|
|
9
|
+
|
|
10
|
+
this.toggle_sidebar = function() {
|
|
11
|
+
|
|
12
|
+
if ($(window).width() <= 992) {
|
|
13
|
+
$('.row-offcanvas').toggleClass('active');
|
|
14
|
+
$('.left-side').removeClass("collapse-left");
|
|
15
|
+
$(".right-side").removeClass("strech");
|
|
16
|
+
$('.row-offcanvas').toggleClass("relative");
|
|
17
|
+
} else {
|
|
18
|
+
//Else, enable content streching
|
|
19
|
+
$('.left-side').toggleClass("collapse-left");
|
|
20
|
+
$(".right-side").toggleClass("strech");
|
|
21
|
+
}
|
|
22
|
+
$rootScope.show_sidebar = !$rootScope.show_sidebar;
|
|
23
|
+
};
|
|
24
|
+
}]);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
angular.module('Dashboard').run(['gettextCatalog', function (gettextCatalog) {
|
|
2
|
+
/* jshint -W100 */
|
|
3
|
+
gettextCatalog.setStrings('fa', {"Are sure you want to delete":"آیا از حذف اطمینان دارید","Click to pick a date":"برای انتخاب تاریخ کلیک کنید","Current Page":"صفحه جاری","Dashboard":"پنل کاربری","Facility Name":"نام وسیله","Go!":"برو!","Item(s)":"آیتم(ها)","Note":"متن","Number":"عدد","Online":"آنلاین","Price?":"قیمت؟","Search":"جستجو","Selected":"انتخاب شده","There is no data!":"تاریخ نامعتبر","Toggle Select":"پین انتخاب","Total Pages":"کل صفحات","item(s)?":"آیتیم(ها)؟"});
|
|
4
|
+
/* jshint +W100 */
|
|
5
|
+
}]);
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
2
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
3
|
+
"#-#-#-#-# translate.fa.pot #-#-#-#-#\n"
|
|
4
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
5
|
+
"Last-Translator: Behnam Ahmad Khan Beigi <yottanamI@gnu.org>\n"
|
|
6
|
+
"Language: fa\n"
|
|
7
|
+
"Language-Team: Persian <>\n"
|
|
8
|
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
|
9
|
+
"PO-Revision-Date: 2014-09-02 11:11+0430\n"
|
|
10
|
+
"X-Generator: Gtranslator 2.91.6\n"
|
|
11
|
+
|
|
12
|
+
msgid ""
|
|
13
|
+
msgstr ""
|
|
14
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
15
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
16
|
+
|
|
17
|
+
#: app/assets/javascripts/dashstrap/modules/list-view.js
|
|
18
|
+
msgid "Are sure you want to delete"
|
|
19
|
+
msgstr ""
|
|
20
|
+
|
|
21
|
+
#: app/views/angularjs_templates/fields/datetime/datetime.html
|
|
22
|
+
msgid "Click to pick a date"
|
|
23
|
+
msgstr ""
|
|
24
|
+
|
|
25
|
+
#: app/views/angularjs_templates/list-view/index.html
|
|
26
|
+
msgid "Current Page"
|
|
27
|
+
msgstr ""
|
|
28
|
+
|
|
29
|
+
#: app/views/angularjs_templates/modules.html
|
|
30
|
+
msgid "Dashboard"
|
|
31
|
+
msgstr ""
|
|
32
|
+
|
|
33
|
+
#: app/views/angularjs_templates/fields/control-combo/control-list.html
|
|
34
|
+
msgid "Facility Name"
|
|
35
|
+
msgstr ""
|
|
36
|
+
|
|
37
|
+
#: app/views/angularjs_templates/list-view/index.html
|
|
38
|
+
msgid "Go!"
|
|
39
|
+
msgstr ""
|
|
40
|
+
|
|
41
|
+
#: app/views/angularjs_templates/list-view/index.html
|
|
42
|
+
msgid "Item(s)"
|
|
43
|
+
msgstr ""
|
|
44
|
+
|
|
45
|
+
#: app/views/angularjs_templates/fields/control-combo/control-list.html
|
|
46
|
+
msgid "Note"
|
|
47
|
+
msgstr ""
|
|
48
|
+
|
|
49
|
+
#: app/views/angularjs_templates/fields/control-combo/control-list.html
|
|
50
|
+
msgid "Number"
|
|
51
|
+
msgstr ""
|
|
52
|
+
|
|
53
|
+
#: app/views/angularjs_templates/index.html
|
|
54
|
+
#: app/views/angularjs_templates/modules.html
|
|
55
|
+
msgid "Online"
|
|
56
|
+
msgstr ""
|
|
57
|
+
|
|
58
|
+
#: app/views/angularjs_templates/fields/control-combo/control-list.html
|
|
59
|
+
msgid "Price?"
|
|
60
|
+
msgstr ""
|
|
61
|
+
|
|
62
|
+
#: app/views/angularjs_templates/list-view/index.html
|
|
63
|
+
msgid "Search"
|
|
64
|
+
msgstr ""
|
|
65
|
+
|
|
66
|
+
#: app/views/angularjs_templates/list-view/index.html
|
|
67
|
+
msgid "Selected"
|
|
68
|
+
msgstr ""
|
|
69
|
+
|
|
70
|
+
#: app/views/angularjs_templates/list-view/index.html
|
|
71
|
+
msgid "There is no data!"
|
|
72
|
+
msgstr ""
|
|
73
|
+
|
|
74
|
+
#: app/views/angularjs_templates/list-view/index.html
|
|
75
|
+
msgid "Toggle Select"
|
|
76
|
+
msgstr ""
|
|
77
|
+
|
|
78
|
+
#: app/views/angularjs_templates/list-view/index.html
|
|
79
|
+
msgid "Total Pages"
|
|
80
|
+
msgstr ""
|
|
81
|
+
|
|
82
|
+
#: app/assets/javascripts/dashstrap/modules/list-view.js
|
|
83
|
+
msgid "item(s)?"
|
|
84
|
+
msgstr ""
|
|
85
|
+
|
|
86
|
+
#: app/views/angularjs_templates/fields/string/string.html
|
|
87
|
+
msgid "{{ item.title }}"
|
|
88
|
+
msgstr ""
|
|
89
|
+
|
|
90
|
+
#: app/views/angularjs_templates/modules.html
|
|
91
|
+
msgid "{{ module.title}}"
|
|
92
|
+
msgstr ""
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
2
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
3
|
+
"#-#-#-#-# translate.fa.pot #-#-#-#-#\n"
|
|
4
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
5
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
6
|
+
"Last-Translator: Behnam Ahmad Khan Beigi <yottanamI@gnu.org>\n"
|
|
7
|
+
"Language: fa\n"
|
|
8
|
+
"Language-Team: Persian <>\n"
|
|
9
|
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
|
10
|
+
"PO-Revision-Date: 2014-09-02 11:11+0430\n"
|
|
11
|
+
"X-Generator: Gtranslator 2.91.6\n"
|
|
12
|
+
|
|
13
|
+
msgid ""
|
|
14
|
+
msgstr ""
|
|
15
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
16
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
17
|
+
|
|
18
|
+
#: app/assets/javascripts/dashstrap/modules/list-view.js
|
|
19
|
+
msgid "Are sure you want to delete"
|
|
20
|
+
msgstr "آیا از حذف اطمینان دارید"
|
|
21
|
+
|
|
22
|
+
#: app/views/angularjs_templates/fields/datetime/datetime.html
|
|
23
|
+
msgid "Click to pick a date"
|
|
24
|
+
msgstr "برای انتخاب تاریخ کلیک کنید"
|
|
25
|
+
|
|
26
|
+
#: app/views/angularjs_templates/list-view/index.html
|
|
27
|
+
msgid "Current Page"
|
|
28
|
+
msgstr "صفحه جاری"
|
|
29
|
+
|
|
30
|
+
#: app/views/angularjs_templates/modules.html
|
|
31
|
+
msgid "Dashboard"
|
|
32
|
+
msgstr "پنل کاربری"
|
|
33
|
+
|
|
34
|
+
#: app/views/angularjs_templates/fields/control-combo/control-list.html
|
|
35
|
+
msgid "Facility Name"
|
|
36
|
+
msgstr "نام وسیله"
|
|
37
|
+
|
|
38
|
+
#: app/views/angularjs_templates/list-view/index.html
|
|
39
|
+
msgid "Go!"
|
|
40
|
+
msgstr "برو!"
|
|
41
|
+
|
|
42
|
+
#: app/views/angularjs_templates/list-view/index.html
|
|
43
|
+
msgid "Item(s)"
|
|
44
|
+
msgstr "آیتم(ها)"
|
|
45
|
+
|
|
46
|
+
#: app/views/angularjs_templates/fields/control-combo/control-list.html
|
|
47
|
+
msgid "Note"
|
|
48
|
+
msgstr "متن"
|
|
49
|
+
|
|
50
|
+
#: app/views/angularjs_templates/fields/control-combo/control-list.html
|
|
51
|
+
msgid "Number"
|
|
52
|
+
msgstr "عدد"
|
|
53
|
+
|
|
54
|
+
#: app/views/angularjs_templates/index.html
|
|
55
|
+
#: app/views/angularjs_templates/modules.html
|
|
56
|
+
msgid "Online"
|
|
57
|
+
msgstr "آنلاین"
|
|
58
|
+
|
|
59
|
+
#: app/views/angularjs_templates/fields/control-combo/control-list.html
|
|
60
|
+
msgid "Price?"
|
|
61
|
+
msgstr "قیمت؟"
|
|
62
|
+
|
|
63
|
+
#: app/views/angularjs_templates/list-view/index.html
|
|
64
|
+
msgid "Search"
|
|
65
|
+
msgstr "جستجو"
|
|
66
|
+
|
|
67
|
+
#: app/views/angularjs_templates/list-view/index.html
|
|
68
|
+
msgid "Selected"
|
|
69
|
+
msgstr "انتخاب شده"
|
|
70
|
+
|
|
71
|
+
#: app/views/angularjs_templates/list-view/index.html
|
|
72
|
+
msgid "There is no data!"
|
|
73
|
+
msgstr "تاریخ نامعتبر"
|
|
74
|
+
|
|
75
|
+
#: app/views/angularjs_templates/list-view/index.html
|
|
76
|
+
msgid "Toggle Select"
|
|
77
|
+
msgstr "پین انتخاب"
|
|
78
|
+
|
|
79
|
+
#: app/views/angularjs_templates/list-view/index.html
|
|
80
|
+
msgid "Total Pages"
|
|
81
|
+
msgstr "کل صفحات"
|
|
82
|
+
|
|
83
|
+
#: app/assets/javascripts/dashstrap/modules/list-view.js
|
|
84
|
+
msgid "item(s)?"
|
|
85
|
+
msgstr "آیتیم(ها)؟"
|
|
86
|
+
|
|
87
|
+
#: app/views/angularjs_templates/fields/string/string.html
|
|
88
|
+
msgid "{{ item.title }}"
|
|
89
|
+
msgstr ""
|
|
90
|
+
|
|
91
|
+
#: app/views/angularjs_templates/modules.html
|
|
92
|
+
msgid "{{ module.title}}"
|
|
93
|
+
msgstr ""
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//= require bootstrap
|
|
2
|
+
//= require font-awesome
|
|
3
|
+
/*
|
|
4
|
+
ionicons
|
|
5
|
+
morris
|
|
6
|
+
jquery-jvectormap-1.2.2
|
|
7
|
+
datepicker3.css
|
|
8
|
+
daterangepicker-bs3
|
|
9
|
+
bootstrap3-wysihtml5
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
//= require AdminLTE
|
|
13
|
+
//= require dashstrap/share
|
|
14
|
+
//= require dashstrap/main
|
|
15
|
+
//= require dashstrap/ltr/ltr
|
|
16
|
+
//= require select2/select2
|
|
17
|
+
//= require select2/select2-bootstrap
|