itsf_backend 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/itsf/backend/application/pagination-size.coffee +13 -0
  3. data/app/assets/javascripts/itsf/backend/application/table-column-sorting.coffee +20 -0
  4. data/app/assets/javascripts/itsf/backend/vendor/jquery.dragtable.js +403 -0
  5. data/app/assets/stylesheets/itsf/backend/application.css.less +2 -0
  6. data/app/assets/stylesheets/itsf/backend/application/input-xs.css.less +6 -0
  7. data/app/assets/stylesheets/itsf/backend/vendor/jquery.dragtable.css +40 -0
  8. data/app/controllers/concerns/controller/pagination_concern.rb +2 -1
  9. data/app/controllers/itsf/backend/resource/base_controller.rb +1 -0
  10. data/app/inputs/fake_checkbox_input.rb +19 -0
  11. data/app/inputs/fake_text_input.rb +6 -0
  12. data/app/views/itsf/backend/dashboard/_head_extras.html.haml +0 -0
  13. data/app/views/itsf/backend/dashboard/index.html.haml +1 -2
  14. data/app/views/itsf/backend/home/_dashboard_panel.html.haml +11 -2
  15. data/app/views/itsf/backend/home/_head_extras.html.haml +0 -0
  16. data/app/views/itsf/backend/resource/base/_form.html.haml +7 -1
  17. data/app/views/itsf/backend/resource/base/_head_extras.html.haml +0 -0
  18. data/app/views/itsf/backend/resource/base/_index_extras.html.haml +0 -0
  19. data/app/views/itsf/backend/resource/base/edit.html.haml +0 -1
  20. data/app/views/itsf/backend/resource/base/index.html.haml +8 -1
  21. data/app/views/itsf/backend/service/base/_head_extras.html.haml +0 -0
  22. data/app/views/layouts/itsf/backend/_main_navigation.html.haml +1 -1
  23. data/app/views/layouts/itsf/backend/base.html.haml +1 -0
  24. data/config/locales/de.yml +4 -0
  25. data/config/locales/en.yml +7 -0
  26. data/lib/itsf/backend/version.rb +1 -1
  27. metadata +15 -3
  28. data/app/controllers/itsf/backend/base_controller.rb +0 -34
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ebd9339bc6c1c4810ae3b5e1cb9b8004441798a0
4
- data.tar.gz: ad16f76072b276e1741568c1edb09bb67ded7680
3
+ metadata.gz: 0ffa546d06fa0354188bd813e8008669f78c7414
4
+ data.tar.gz: 8beb0930dca5b42b1255e7d8eca157c0f2073c89
5
5
  SHA512:
6
- metadata.gz: decbd4f71a41b5cc7d451c0dd4f9b5209d9e9f8962b7f940203b982a862bac400b7d7f5b315791faa8d34e26c6c246de21fa2125d370d2d6dc6f65d479ccf944
7
- data.tar.gz: d25718197e4b72a7201d0b3851334c2d99cf0177f739e914dd21003665aa17c554763089aef73d4eca09ad61c3ae85dbcb421a07c7c67b857c0e2b0bdde1dc9e
6
+ metadata.gz: 3805570e74492a6b1319c473f7973a8dbe99fd5a40fe9c105a926f6bd9624b051e5779aaead6fbe84f7afcd2795a0fdd1db59b1bc467ff42f447645ab68f26d8
7
+ data.tar.gz: 9bf3b6ce775cc2146332376515ba3cf12ecfea1f6eed1b04757bcaaf3efccec756622e3b7f9ef0bf3215ab16d37fd88912b0dbc8755a9b5fd0d342ae9665873a
@@ -0,0 +1,13 @@
1
+ $ ->
2
+ $('#pagination-size').on 'change', (e) ->
3
+ queryParameters = {}
4
+ queryString = location.search.substring(1)
5
+ re = /([^&=]+)=([^&]*)/g
6
+ m = undefined
7
+
8
+ while m = re.exec(queryString)
9
+ queryParameters[decodeURIComponent(m[1])] = decodeURIComponent(m[2])
10
+
11
+ per_page = $(@).val()
12
+ queryParameters['per_page'] = per_page
13
+ location.search = $.param(queryParameters)
@@ -0,0 +1,20 @@
1
+ $ ->
2
+ $('table.dragtable').dragtable
3
+ persistState: (table) ->
4
+ if !window.sessionStorage
5
+ return
6
+ ss = window.sessionStorage
7
+ table.el.find('th').each (i) ->
8
+ if @id != ''
9
+ table.sortOrder[@id] = i
10
+ return
11
+ ss.setItem "column-order.#{window.location.pathname}", JSON.stringify(table.sortOrder)
12
+ console.log(ss)
13
+ return
14
+ restoreState: eval('(' + window.sessionStorage.getItem("column-order.#{window.location.pathname}") + ')')
15
+
16
+ $ ->
17
+ $('[data-reset-column-order]').on 'click', (e) ->
18
+ window.sessionStorage.removeItem "column-order.#{window.location.pathname}"
19
+ window.location.reload()
20
+ false
@@ -0,0 +1,403 @@
1
+ /*!
2
+ * dragtable
3
+ *
4
+ * @Version 2.0.14
5
+ *
6
+ * Copyright (c) 2010-2013, Andres akottr@gmail.com
7
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
8
+ * and GPL (GPL-LICENSE.txt) licenses.
9
+ *
10
+ * Inspired by the the dragtable from Dan Vanderkam (danvk.org/dragtable/)
11
+ * Thanks to the jquery and jqueryui comitters
12
+ *
13
+ * Any comment, bug report, feature-request is welcome
14
+ * Feel free to contact me.
15
+ */
16
+
17
+ /* TOKNOW:
18
+ * For IE7 you need this css rule:
19
+ * table {
20
+ * border-collapse: collapse;
21
+ * }
22
+ * Or take a clean reset.css (see http://meyerweb.com/eric/tools/css/reset/)
23
+ */
24
+
25
+ /* TODO: investigate
26
+ * Does not work properly with css rule:
27
+ * html {
28
+ * overflow: -moz-scrollbars-vertical;
29
+ * }
30
+ * Workaround:
31
+ * Fixing Firefox issues by scrolling down the page
32
+ * http://stackoverflow.com/questions/2451528/jquery-ui-sortable-scroll-helper-element-offset-firefox-issue
33
+ *
34
+ * var start = $.noop;
35
+ * var beforeStop = $.noop;
36
+ * if($.browser.mozilla) {
37
+ * var start = function (event, ui) {
38
+ * if( ui.helper !== undefined )
39
+ * ui.helper.css('position','absolute').css('margin-top', $(window).scrollTop() );
40
+ * }
41
+ * var beforeStop = function (event, ui) {
42
+ * if( ui.offset !== undefined )
43
+ * ui.helper.css('margin-top', 0);
44
+ * }
45
+ * }
46
+ *
47
+ * and pass this as start and stop function to the sortable initialisation
48
+ * start: start,
49
+ * beforeStop: beforeStop
50
+ */
51
+ /*
52
+ * Special thx to all pull requests comitters
53
+ */
54
+
55
+ (function($) {
56
+ $.widget("akottr.dragtable", {
57
+ options: {
58
+ revert: false, // smooth revert
59
+ dragHandle: '.table-handle', // handle for moving cols, if not exists the whole 'th' is the handle
60
+ maxMovingRows: 40, // 1 -> only header. 40 row should be enough, the rest is usually not in the viewport
61
+ excludeFooter: false, // excludes the footer row(s) while moving other columns. Make sense if there is a footer with a colspan. */
62
+ onlyHeaderThreshold: 100, // TODO: not implemented yet, switch automatically between entire col moving / only header moving
63
+ dragaccept: null, // draggable cols -> default all
64
+ persistState: null, // url or function -> plug in your custom persistState function right here. function call is persistState(originalTable)
65
+ restoreState: null, // JSON-Object or function: some kind of experimental aka Quick-Hack TODO: do it better
66
+ exact: true, // removes pixels, so that the overlay table width fits exactly the original table width
67
+ clickDelay: 10, // ms to wait before rendering sortable list and delegating click event
68
+ containment: null, // @see http://api.jqueryui.com/sortable/#option-containment, use it if you want to move in 2 dimesnions (together with axis: null)
69
+ cursor: 'move', // @see http://api.jqueryui.com/sortable/#option-cursor
70
+ cursorAt: false, // @see http://api.jqueryui.com/sortable/#option-cursorAt
71
+ distance: 0, // @see http://api.jqueryui.com/sortable/#option-distance, for immediate feedback use "0"
72
+ tolerance: 'pointer', // @see http://api.jqueryui.com/sortable/#option-tolerance
73
+ axis: 'x', // @see http://api.jqueryui.com/sortable/#option-axis, Only vertical moving is allowed. Use 'x' or null. Use this in conjunction with the 'containment' setting
74
+ beforeStart: $.noop, // returning FALSE will stop the execution chain.
75
+ beforeMoving: $.noop,
76
+ beforeReorganize: $.noop,
77
+ beforeStop: $.noop
78
+ },
79
+ originalTable: {
80
+ el: null,
81
+ selectedHandle: null,
82
+ sortOrder: null,
83
+ startIndex: 0,
84
+ endIndex: 0
85
+ },
86
+ sortableTable: {
87
+ el: $(),
88
+ selectedHandle: $(),
89
+ movingRow: $()
90
+ },
91
+ persistState: function() {
92
+ var _this = this;
93
+ this.originalTable.el.find('th').each(function(i) {
94
+ if (this.id !== '') {
95
+ _this.originalTable.sortOrder[this.id] = i;
96
+ }
97
+ });
98
+ $.ajax({
99
+ url: this.options.persistState,
100
+ data: this.originalTable.sortOrder
101
+ });
102
+ },
103
+ /*
104
+ * persistObj looks like
105
+ * {'id1':'2','id3':'3','id2':'1'}
106
+ * table looks like
107
+ * | id2 | id1 | id3 |
108
+ */
109
+ _restoreState: function(persistObj) {
110
+ for (var n in persistObj) {
111
+ this.originalTable.startIndex = $('#' + n).closest('th').prevAll().size() + 1;
112
+ this.originalTable.endIndex = parseInt(persistObj[n], 10) + 1;
113
+ this._bubbleCols();
114
+ }
115
+ },
116
+ // bubble the moved col left or right
117
+ _bubbleCols: function() {
118
+ var i, j, col1, col2;
119
+ var from = this.originalTable.startIndex;
120
+ var to = this.originalTable.endIndex;
121
+ /* Find children thead and tbody.
122
+ * Only to process the immediate tr-children. Bugfix for inner tables
123
+ */
124
+ var thtb = this.originalTable.el.children();
125
+ if (this.options.excludeFooter) {
126
+ thtb = thtb.not('tfoot');
127
+ }
128
+ if (from < to) {
129
+ for (i = from; i < to; i++) {
130
+ col1 = thtb.find('> tr > td:nth-child(' + i + ')')
131
+ .add(thtb.find('> tr > th:nth-child(' + i + ')'));
132
+ col2 = thtb.find('> tr > td:nth-child(' + (i + 1) + ')')
133
+ .add(thtb.find('> tr > th:nth-child(' + (i + 1) + ')'));
134
+ for (j = 0; j < col1.length; j++) {
135
+ swapNodes(col1[j], col2[j]);
136
+ }
137
+ }
138
+ } else {
139
+ for (i = from; i > to; i--) {
140
+ col1 = thtb.find('> tr > td:nth-child(' + i + ')')
141
+ .add(thtb.find('> tr > th:nth-child(' + i + ')'));
142
+ col2 = thtb.find('> tr > td:nth-child(' + (i - 1) + ')')
143
+ .add(thtb.find('> tr > th:nth-child(' + (i - 1) + ')'));
144
+ for (j = 0; j < col1.length; j++) {
145
+ swapNodes(col1[j], col2[j]);
146
+ }
147
+ }
148
+ }
149
+ },
150
+ _rearrangeTableBackroundProcessing: function() {
151
+ var _this = this;
152
+ return function() {
153
+ _this._bubbleCols();
154
+ _this.options.beforeStop(_this.originalTable);
155
+ _this.sortableTable.el.remove();
156
+ restoreTextSelection();
157
+ // persist state if necessary
158
+ if (_this.options.persistState !== null) {
159
+ $.isFunction(_this.options.persistState) ? _this.options.persistState(_this.originalTable) : _this.persistState();
160
+ }
161
+ };
162
+ },
163
+ _rearrangeTable: function() {
164
+ var _this = this;
165
+ return function() {
166
+ // remove handler-class -> handler is now finished
167
+ _this.originalTable.selectedHandle.removeClass('dragtable-handle-selected');
168
+ // add disabled class -> reorgorganisation starts soon
169
+ _this.sortableTable.el.sortable("disable");
170
+ _this.sortableTable.el.addClass('dragtable-disabled');
171
+ _this.options.beforeReorganize(_this.originalTable, _this.sortableTable);
172
+ // do reorganisation asynchronous
173
+ // for chrome a little bit more than 1 ms because we want to force a rerender
174
+ _this.originalTable.endIndex = _this.sortableTable.movingRow.prevAll().size() + 1;
175
+ setTimeout(_this._rearrangeTableBackroundProcessing(), 50);
176
+ };
177
+ },
178
+ /*
179
+ * Disrupts the table. The original table stays the same.
180
+ * But on a layer above the original table we are constructing a list (ul > li)
181
+ * each li with a separate table representig a single col of the original table.
182
+ */
183
+ _generateSortable: function(e) {
184
+ !e.cancelBubble && (e.cancelBubble = true);
185
+ var _this = this;
186
+ // table attributes
187
+ var attrs = this.originalTable.el[0].attributes;
188
+ var attrsString = '';
189
+ for (var i = 0; i < attrs.length; i++) {
190
+ if (attrs[i].nodeValue && attrs[i].nodeName != 'id' && attrs[i].nodeName != 'width') {
191
+ attrsString += attrs[i].nodeName + '="' + attrs[i].nodeValue + '" ';
192
+ }
193
+ }
194
+
195
+ // row attributes
196
+ var rowAttrsArr = [];
197
+ //compute height, special handling for ie needed :-(
198
+ var heightArr = [];
199
+ this.originalTable.el.find('tr').slice(0, this.options.maxMovingRows).each(function(i, v) {
200
+ // row attributes
201
+ var attrs = this.attributes;
202
+ var attrsString = "";
203
+ for (var j = 0; j < attrs.length; j++) {
204
+ if (attrs[j].nodeValue && attrs[j].nodeName != 'id') {
205
+ attrsString += " " + attrs[j].nodeName + '="' + attrs[j].nodeValue + '"';
206
+ }
207
+ }
208
+ rowAttrsArr.push(attrsString);
209
+ heightArr.push($(this).height());
210
+ });
211
+
212
+ // compute width, no special handling for ie needed :-)
213
+ var widthArr = [];
214
+ // compute total width, needed for not wrapping around after the screen ends (floating)
215
+ var totalWidth = 0;
216
+ /* Find children thead and tbody.
217
+ * Only to process the immediate tr-children. Bugfix for inner tables
218
+ */
219
+ var thtb = _this.originalTable.el.children();
220
+ if (this.options.excludeFooter) {
221
+ thtb = thtb.not('tfoot');
222
+ }
223
+ thtb.find('> tr > th').each(function(i, v) {
224
+ var w = $(this).outerWidth();
225
+ widthArr.push(w);
226
+ totalWidth += w;
227
+ });
228
+ if(_this.options.exact) {
229
+ var difference = totalWidth - _this.originalTable.el.outerWidth();
230
+ widthArr[0] -= difference;
231
+ }
232
+ // one extra px on right and left side
233
+ totalWidth += 2
234
+
235
+ var sortableHtml = '<ul class="dragtable-sortable" style="position:absolute; width:' + totalWidth + 'px;">';
236
+ // assemble the needed html
237
+ thtb.find('> tr > th').each(function(i, v) {
238
+ var width_li = $(this).outerWidth();
239
+ sortableHtml += '<li style="width:' + width_li + 'px;">';
240
+ sortableHtml += '<table ' + attrsString + '>';
241
+ var row = thtb.find('> tr > th:nth-child(' + (i + 1) + ')');
242
+ if (_this.options.maxMovingRows > 1) {
243
+ row = row.add(thtb.find('> tr > td:nth-child(' + (i + 1) + ')').slice(0, _this.options.maxMovingRows - 1));
244
+ }
245
+ row.each(function(j) {
246
+ // TODO: May cause duplicate style-Attribute
247
+ var row_content = $(this).clone().wrap('<div></div>').parent().html();
248
+ if (row_content.toLowerCase().indexOf('<th') === 0) sortableHtml += "<thead>";
249
+ sortableHtml += '<tr ' + rowAttrsArr[j] + '" style="height:' + heightArr[j] + 'px;">';
250
+ sortableHtml += row_content;
251
+ if (row_content.toLowerCase().indexOf('<th') === 0) sortableHtml += "</thead>";
252
+ sortableHtml += '</tr>';
253
+ });
254
+ sortableHtml += '</table>';
255
+ sortableHtml += '</li>';
256
+ });
257
+ sortableHtml += '</ul>';
258
+ this.sortableTable.el = this.originalTable.el.before(sortableHtml).prev();
259
+ // set width if necessary
260
+ this.sortableTable.el.find('> li > table').each(function(i, v) {
261
+ $(this).css('width', widthArr[i] + 'px');
262
+ });
263
+
264
+ // assign this.sortableTable.selectedHandle
265
+ this.sortableTable.selectedHandle = this.sortableTable.el.find('th .dragtable-handle-selected');
266
+
267
+ var items = !this.options.dragaccept ? 'li' : 'li:has(' + this.options.dragaccept + ')';
268
+ this.sortableTable.el.sortable({
269
+ items: items,
270
+ stop: this._rearrangeTable(),
271
+ // pass thru options for sortable widget
272
+ revert: this.options.revert,
273
+ tolerance: this.options.tolerance,
274
+ containment: this.options.containment,
275
+ cursor: this.options.cursor,
276
+ cursorAt: this.options.cursorAt,
277
+ distance: this.options.distance,
278
+ axis: this.options.axis
279
+ });
280
+
281
+ // assign start index
282
+ this.originalTable.startIndex = $(e.target).closest('th').prevAll().size() + 1;
283
+
284
+ this.options.beforeMoving(this.originalTable, this.sortableTable);
285
+ // Start moving by delegating the original event to the new sortable table
286
+ this.sortableTable.movingRow = this.sortableTable.el.find('> li:nth-child(' + this.originalTable.startIndex + ')');
287
+
288
+ // prevent the user from drag selecting "highlighting" surrounding page elements
289
+ disableTextSelection();
290
+ // clone the initial event and trigger the sort with it
291
+ this.sortableTable.movingRow.trigger($.extend($.Event(e.type), {
292
+ which: 1,
293
+ clientX: e.clientX,
294
+ clientY: e.clientY,
295
+ pageX: e.pageX,
296
+ pageY: e.pageY,
297
+ screenX: e.screenX,
298
+ screenY: e.screenY
299
+ }));
300
+
301
+ // Some inner divs to deliver the posibillity to style the placeholder more sophisticated
302
+ var placeholder = this.sortableTable.el.find('.ui-sortable-placeholder');
303
+ if(!placeholder.height() <= 0) {
304
+ placeholder.css('height', this.sortableTable.el.find('.ui-sortable-helper').height());
305
+ }
306
+
307
+ placeholder.html('<div class="outer" style="height:100%;"><div class="inner" style="height:100%;"></div></div>');
308
+ },
309
+ bindTo: {},
310
+ _create: function() {
311
+ this.originalTable = {
312
+ el: this.element,
313
+ selectedHandle: $(),
314
+ sortOrder: {},
315
+ startIndex: 0,
316
+ endIndex: 0
317
+ };
318
+ // bind draggable to 'th' by default
319
+ this.bindTo = this.originalTable.el.find('th');
320
+ // filter only the cols that are accepted
321
+ if (this.options.dragaccept) {
322
+ this.bindTo = this.bindTo.filter(this.options.dragaccept);
323
+ }
324
+ // bind draggable to handle if exists
325
+ if (this.bindTo.find(this.options.dragHandle).size() > 0) {
326
+ this.bindTo = this.bindTo.find(this.options.dragHandle);
327
+ }
328
+ // restore state if necessary
329
+ if (this.options.restoreState !== null) {
330
+ $.isFunction(this.options.restoreState) ? this.options.restoreState(this.originalTable) : this._restoreState(this.options.restoreState);
331
+ }
332
+ var _this = this;
333
+ this.bindTo.mousedown(function(evt) {
334
+ // listen only to left mouse click
335
+ if(evt.which!==1) return;
336
+ if (_this.options.beforeStart(_this.originalTable) === false) {
337
+ return;
338
+ }
339
+ clearTimeout(this.downTimer);
340
+ this.downTimer = setTimeout(function() {
341
+ _this.originalTable.selectedHandle = $(this);
342
+ _this.originalTable.selectedHandle.addClass('dragtable-handle-selected');
343
+ _this._generateSortable(evt);
344
+ }, _this.options.clickDelay);
345
+ }).mouseup(function(evt) {
346
+ clearTimeout(this.downTimer);
347
+ });
348
+ },
349
+ redraw: function(){
350
+ this.destroy();
351
+ this._create();
352
+ },
353
+ destroy: function() {
354
+ this.bindTo.unbind('mousedown');
355
+ $.Widget.prototype.destroy.apply(this, arguments); // default destroy
356
+ // now do other stuff particular to this widget
357
+ }
358
+ });
359
+
360
+ /** closure-scoped "private" functions **/
361
+
362
+ var body_onselectstart_save = $(document.body).attr('onselectstart'),
363
+ body_unselectable_save = $(document.body).attr('unselectable');
364
+
365
+ // css properties to disable user-select on the body tag by appending a <style> tag to the <head>
366
+ // remove any current document selections
367
+
368
+ function disableTextSelection() {
369
+ // jQuery doesn't support the element.text attribute in MSIE 8
370
+ // http://stackoverflow.com/questions/2692770/style-style-textcss-appendtohead-does-not-work-in-ie
371
+ var $style = $('<style id="__dragtable_disable_text_selection__" type="text/css">body { -ms-user-select:none;-moz-user-select:-moz-none;-khtml-user-select:none;-webkit-user-select:none;user-select:none; }</style>');
372
+ $(document.head).append($style);
373
+ $(document.body).attr('onselectstart', 'return false;').attr('unselectable', 'on');
374
+ if (window.getSelection) {
375
+ window.getSelection().removeAllRanges();
376
+ } else {
377
+ document.selection.empty(); // MSIE http://msdn.microsoft.com/en-us/library/ms535869%28v=VS.85%29.aspx
378
+ }
379
+ }
380
+
381
+ // remove the <style> tag, and restore the original <body> onselectstart attribute
382
+
383
+ function restoreTextSelection() {
384
+ $('#__dragtable_disable_text_selection__').remove();
385
+ if (body_onselectstart_save) {
386
+ $(document.body).attr('onselectstart', body_onselectstart_save);
387
+ } else {
388
+ $(document.body).removeAttr('onselectstart');
389
+ }
390
+ if (body_unselectable_save) {
391
+ $(document.body).attr('unselectable', body_unselectable_save);
392
+ } else {
393
+ $(document.body).removeAttr('unselectable');
394
+ }
395
+ }
396
+
397
+ function swapNodes(a, b) {
398
+ var aparent = a.parentNode;
399
+ var asibling = a.nextSibling === b ? a : a.nextSibling;
400
+ b.parentNode.insertBefore(a, b);
401
+ aparent.insertBefore(b, asibling);
402
+ }
403
+ })(jQuery);
@@ -17,6 +17,7 @@
17
17
  @import "application/button-responsive.css.less";
18
18
  @import "application/check-box-margin-fix.css.less";
19
19
  @import "application/code.css.less";
20
+ @import "application/input-xs.css.less";
20
21
  @import "application/itsf-dashboard-panels.css.less";
21
22
  @import "application/itsf-logo.css.less";
22
23
  @import "application/form-errors.css.less";
@@ -27,4 +28,5 @@
27
28
  @import "application/panel-with-actions.css.less";
28
29
  @import "application/table-actions.css.less";
29
30
  @import "application/table-responsive.css.less";
31
+ @import "vendor/jquery.dragtable.css";
30
32
  @import "vendor/timeline.min.css";
@@ -0,0 +1,6 @@
1
+ .input-xs, select.input-xs {
2
+ height: 20px;
3
+ line-height: 20px;
4
+ padding: 1px 3px;
5
+ font-size: 85%;
6
+ }
@@ -0,0 +1,40 @@
1
+ /*
2
+ * dragtable
3
+ *
4
+ * @Version 2.0.14
5
+ *
6
+ * default css
7
+ *
8
+ */
9
+ /*##### the dragtable stuff #####*/
10
+ .dragtable-sortable {
11
+ list-style-type: none; margin: 0; padding: 0; -moz-user-select: none;
12
+ }
13
+ .dragtable-sortable li {
14
+ margin: 0; padding: 0; float: left; font-size: 1em; background: white;
15
+ }
16
+
17
+ .dragtable-sortable th, .dragtable-sortable td{
18
+ border-left: 0px;
19
+ }
20
+
21
+ .dragtable-sortable li:first-child th, .dragtable-sortable li:first-child td {
22
+ border-left: 1px solid #CCC;
23
+ }
24
+
25
+ .ui-sortable-helper {
26
+ opacity: 0.7;filter: alpha(opacity=70);
27
+ }
28
+ .ui-sortable-placeholder {
29
+ -moz-box-shadow: 4px 5px 4px #C6C6C6 inset;
30
+ -webkit-box-shadow: 4px 5px 4px #C6C6C6 inset;
31
+ box-shadow: 4px 5px 4px #C6C6C6 inset;
32
+ border-bottom: 1px solid #CCCCCC;
33
+ border-top: 1px solid #CCCCCC;
34
+ visibility: visible !important;
35
+ background: #EFEFEF !important;
36
+ visibility: visible !important;
37
+ }
38
+ .ui-sortable-placeholder * {
39
+ opacity: 0.0; visibility: hidden;
40
+ }
@@ -9,7 +9,8 @@ module Controller
9
9
  end
10
10
 
11
11
  def pagination_size
12
- Itsf::Backend::Configuration.default_pagination_size
12
+ return collection_scope.count if params[:per_page] == 'all'
13
+ params[:per_page] || Itsf::Backend::Configuration.default_pagination_size
13
14
  end
14
15
  end
15
16
  end
@@ -17,6 +17,7 @@ module Itsf::Backend
17
17
  include Controller::PaginationConcern if Itsf::Backend.features?(:kaminari)
18
18
  include Controller::JsonApiConcern
19
19
  helper Itsf::Backend::ApplicationHelper
20
+ helper MultiClientHelper if Itsf::Backend.features?(:multi_client)
20
21
 
21
22
  helper_method :resource_class
22
23
 
@@ -0,0 +1,19 @@
1
+ class FakeCheckboxInput < SimpleForm::Inputs::BooleanInput
2
+ def input(wrapper_options = nil)
3
+ merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
4
+
5
+ if template.params.has_key?(attribute_name)
6
+ merged_input_options[:checked] = 'checked'
7
+ end
8
+
9
+ template.check_box_tag("#{attribute_name}", nil, merged_input_options.has_key?(:checked)) # , merged_input_options)
10
+
11
+ # params_container_name = object.class.name.demodulize.underscore.to_sym
12
+
13
+ # if template.params.has_key?(params_container_name) && template.params[params_container_name].has_key?(attribute_name)
14
+ # merged_input_options[:checked] = 'checked'
15
+ # end
16
+
17
+ # template.check_box_tag("#{params_container_name}[#{attribute_name}]", nil, false) # , merged_input_options)
18
+ end
19
+ end
@@ -0,0 +1,6 @@
1
+ class FakeTextInput < SimpleForm::Inputs::StringInput
2
+ def input(wrapper_options = nil)
3
+ merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
4
+ template.text_field_tag(attribute_name, nil, merged_input_options)
5
+ end
6
+ end
@@ -3,5 +3,4 @@
3
3
 
4
4
  - Itsf::Backend::Configuration.backend_engines.each do |engine|
5
5
  - if !Itsf::Backend.features?(:pundit) || engine_policy(engine).access?
6
- .col-lg-6= render 'dashboard_panel', engine: engine
7
-
6
+ .col-lg-6= render 'dashboard_panel', engine: engine
@@ -12,7 +12,13 @@
12
12
  = "#{kontroller.resource_class.where("updated_at > ?", current_user.last_sign_in_at).count}/#{kontroller.resource_class.count}"
13
13
  - else
14
14
  = kontroller.resource_class.count
15
- %td.text-right= link_to(t('.view'), { controller: kontroller.name.underscore.gsub('_controller', '') }, id: "link-to-#{kontroller.name.underscore.gsub('_controller', '').gsub(/[\/_]/, '-')}-index" ,class: 'btn btn-primary btn-xs')
15
+ %td.text-right
16
+ = link_to({ controller: kontroller.name.underscore.gsub('_controller', ''), action: 'new' }, id: "link-to-#{kontroller.name.underscore.gsub('_controller', '').gsub(/[\/_]/, '-')}-new", class: 'btn btn-success btn-xs btn-responsive') do
17
+ %span.glyphicon.glyphicon-plus
18
+ %span.btn-text= t('.new')
19
+ = link_to({ controller: kontroller.name.underscore.gsub('_controller', '') }, id: "link-to-#{kontroller.name.underscore.gsub('_controller', '').gsub(/[\/_]/, '-')}-index" ,class: 'btn btn-primary btn-xs btn-responsive') do
20
+ %span.glyphicon.glyphicon-eye-open
21
+ %span.btn-text= t('.view')
16
22
 
17
23
 
18
24
  .panel.panel-default
@@ -23,4 +29,7 @@
23
29
  - "#{engine.to_s.deconstantize}::Configuration".constantize.registered_services.call.each do |kontroller|
24
30
  %tr
25
31
  %th.col-md-3= t("classes.#{kontroller.service_class.name.underscore}")
26
- %td.text-right= link_to(t('.view'), { controller: kontroller.name.underscore.gsub('_controller', '') }, id: "link-to-#{kontroller.name.underscore.gsub('_controller', '').gsub(/[\/_]/, '-')}-invoke" ,class: 'btn btn-primary btn-xs')
32
+ %td.text-right
33
+ = link_to({ controller: kontroller.name.underscore.gsub('_controller', '') }, { id: "link-to-#{kontroller.name.underscore.gsub('_controller', '').gsub(/[\/_]/, '-')}-invoke", class: 'btn btn-primary btn-xs btn-responsive' }) do
34
+ %span.glyphicon.glyphicon-eye-open
35
+ %span.btn-text= t('.view')
@@ -1,2 +1,8 @@
1
1
  - resource_class.attribute_names.delete_if { |name| Itsf::Backend.hidden_attributes_for[:edit].include?(name.to_sym) }.each do |name|
2
- = form.input name
2
+ - if form.object.class.columns_hash[name].type == :hstore
3
+ = simple_fields_for name do |hstore_form|
4
+ - if form.object.send(name).respond_to?(:each)
5
+ - form.object.send(name).each do |key, value|
6
+ = hstore_form.input key, input_html: { value: value }
7
+ - else
8
+ = form.input name
@@ -6,7 +6,6 @@
6
6
  = render partial: 'form_errors', locals: { resource: f.object }
7
7
  = render 'form', form: f
8
8
  = f.button :submit, class: 'btn btn-success'
9
- .panel-footer
10
9
 
11
10
  .well.well-sm
12
11
  = link_to resource_path(@resource), class: 'btn btn-primary btn-responsive' do
@@ -13,6 +13,11 @@
13
13
  %span.btn-text= t('.new', inflections)
14
14
 
15
15
  .panel.panel-default.panel-with-actions
16
+ - if Itsf::Backend.features?(:kaminari)
17
+ .panel-heading
18
+ .pull-right.form-inline
19
+ = select_tag(:per_page, options_for_select({ '1': 1, '5': 5, '10': 10, '15': 15, '20': 20, '50': 50, '100': 100, t('.all') => 'all' }, (params[:per_page] || Itsf::Backend::Configuration.default_pagination_size)), 'data-select-pagination-size': true, id: 'pagination-size', class: 'form-control input-xs')
20
+ = button_tag(t('.reset_column_order'), class: 'btn btn-default btn-xs', data: { 'reset-column-order': true})
16
21
  - if Itsf::Backend.features?(:ransack)
17
22
  .panel-body
18
23
  #filter
@@ -29,7 +34,7 @@
29
34
  = f.submit
30
35
 
31
36
  .table-responsive
32
- = render_collection(@collection, resource_class, as: :bootstrap_table) do |table|
37
+ = render_collection(@collection, resource_class, as: :bootstrap_table, table_html_options: { class: 'table table-responsive table-condensed table-striped table-hover dragtable' }) do |table|
33
38
  = render 'table', table: table
34
39
  = render 'table_actions', table: table
35
40
 
@@ -41,6 +46,8 @@
41
46
  .text-center= paginate @collection, theme: 'twitter-bootstrap-3'
42
47
  .col-md-4
43
48
 
49
+ = render 'index_extras', collection: @collection
50
+
44
51
  .well.well-sm
45
52
  .btn-container-right
46
53
  = link_to root_path, class: 'btn btn-default btn-responsive' do
@@ -1,5 +1,5 @@
1
1
  - Itsf::Backend::Configuration.backend_engines.each do |engine|
2
- - if respond_to?(:engine_policy) && engine_policy(engine).access?
2
+ - if !respond_to?(:engine_policy) || engine_policy(engine).access?
3
3
  - if request.original_url =~ /#{main_app.send("#{engine.engine_name}_path")}/
4
4
  = render partial: 'layouts/itsf/backend/main_navigation_drop_down', locals: { engine: engine }
5
5
  - else
@@ -16,6 +16,7 @@
16
16
  = favicon_link_tag 'apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png'
17
17
  = favicon_link_tag 'itsf/backend/favicon.png', :rel => 'shortcut icon'
18
18
  = javascript_include_tag "itsf_backend"
19
+ = render 'head_extras'
19
20
 
20
21
  - Itsf::Backend::Configuration.backend_engines.each do |engine|
21
22
  = "<!-- Javascript for #{engine} -->".html_safe
@@ -44,10 +44,12 @@ de:
44
44
  home:
45
45
  dashboard_panel:
46
46
  back: "Zurück"
47
+ new: "Hinzufügen"
47
48
  resources: 'Resourcen'
48
49
  services: 'Dienste'
49
50
  view: 'Anzeigen'
50
51
  index:
52
+ back: "Zurück"
51
53
  title: "Willkommen im %{engine_name}-Modul"
52
54
  dashboard:
53
55
  dashboard_panel:
@@ -61,8 +63,10 @@ de:
61
63
  show: "Anzeigen"
62
64
  title: "%{resource_name} bearbeiten"
63
65
  index:
66
+ all: "Alle"
64
67
  back: "Zurück"
65
68
  new: "%{resource_name} hinzufügen"
69
+ reset_column_order: "Tabellenspalten zurücksetzen"
66
70
  title: "%{collection_name}"
67
71
  new:
68
72
  back: "Zurück"
@@ -15,6 +15,10 @@ en:
15
15
  booleans:
16
16
  'true': Yes
17
17
  'false': No
18
+ cocoon:
19
+ defaults:
20
+ add: "Add"
21
+ remove: "Remove"
18
22
  confirmations:
19
23
  delete: "Are you sure?"
20
24
  classes:
@@ -40,6 +44,7 @@ en:
40
44
  home:
41
45
  dashboard_panel:
42
46
  back: "Back"
47
+ resources: 'Resources'
43
48
  services: 'Services'
44
49
  view: 'Show'
45
50
  index:
@@ -56,8 +61,10 @@ en:
56
61
  show: "Show"
57
62
  title: "Edit %{resource_name}"
58
63
  index:
64
+ all: "All"
59
65
  back: "Back"
60
66
  new: "New %{resource_name}"
67
+ reset_column_order: "Reset column order"
61
68
  title: "%{collection_name}"
62
69
  new:
63
70
  back: "Back"
@@ -1,5 +1,5 @@
1
1
  module Itsf
2
2
  module Backend
3
- VERSION = '1.0.1'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itsf_backend
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-09 00:00:00.000000000 Z
11
+ date: 2016-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -462,7 +462,10 @@ files:
462
462
  - app/assets/javascripts/itsf/backend/application/autofocus-last.coffee
463
463
  - app/assets/javascripts/itsf/backend/application/drop-down-hover.coffee
464
464
  - app/assets/javascripts/itsf/backend/application/itsf-logo.coffee
465
+ - app/assets/javascripts/itsf/backend/application/pagination-size.coffee
466
+ - app/assets/javascripts/itsf/backend/application/table-column-sorting.coffee
465
467
  - app/assets/javascripts/itsf/backend/vendor/jQueryRotate.js
468
+ - app/assets/javascripts/itsf/backend/vendor/jquery.dragtable.js
466
469
  - app/assets/javascripts/itsf/backend/vendor/jquery.redirect.js
467
470
  - app/assets/javascripts/itsf_backend.js
468
471
  - app/assets/stylesheets/itsf/backend/application.css.less
@@ -476,6 +479,7 @@ files:
476
479
  - app/assets/stylesheets/itsf/backend/application/form-errors.css.less
477
480
  - app/assets/stylesheets/itsf/backend/application/form-inline-margin-fixes.css.less
478
481
  - app/assets/stylesheets/itsf/backend/application/hexagon.css.less
482
+ - app/assets/stylesheets/itsf/backend/application/input-xs.css.less
479
483
  - app/assets/stylesheets/itsf/backend/application/itsf-dashboard-panels.css.less
480
484
  - app/assets/stylesheets/itsf/backend/application/itsf-logo.css.less
481
485
  - app/assets/stylesheets/itsf/backend/application/navigation-logo.css.less
@@ -484,6 +488,7 @@ files:
484
488
  - app/assets/stylesheets/itsf/backend/application/table-actions.css.less
485
489
  - app/assets/stylesheets/itsf/backend/application/table-responsive.css.less
486
490
  - app/assets/stylesheets/itsf/backend/bootstrap_and_overrides.css.less
491
+ - app/assets/stylesheets/itsf/backend/vendor/jquery.dragtable.css
487
492
  - app/assets/stylesheets/itsf/backend/vendor/timeline.min.css
488
493
  - app/assets/stylesheets/itsf_backend.css
489
494
  - app/concerns/routing/service_concern.rb
@@ -494,7 +499,6 @@ files:
494
499
  - app/controllers/concerns/controller/ransack_concern.rb
495
500
  - app/controllers/concerns/controller/rest_actions_concern_with_pundit.rb
496
501
  - app/controllers/itsf/backend/application_controller.rb
497
- - app/controllers/itsf/backend/base_controller.rb
498
502
  - app/controllers/itsf/backend/dashboard_controller.rb
499
503
  - app/controllers/itsf/backend/home_controller.rb
500
504
  - app/controllers/itsf/backend/resource/base_controller.rb
@@ -514,19 +518,25 @@ files:
514
518
  - app/extensions/concerns/resource_row/timestamp_extensions.rb
515
519
  - app/extensions/concerns/simple_form_form_builder_extensions.rb
516
520
  - app/helpers/itsf/backend/application_helper.rb
521
+ - app/inputs/fake_checkbox_input.rb
522
+ - app/inputs/fake_text_input.rb
517
523
  - app/policies/itsf/backend/base_policy.rb
518
524
  - app/policies/itsf/backend/dashboard_policy.rb
519
525
  - app/policies/itsf/backend/engine_policy.rb
520
526
  - app/policies/itsf/backend/service/base_policy.rb
521
527
  - app/presenters/bootstrap_table_presenter.rb.old
522
528
  - app/views/itsf/backend/dashboard/_dashboard_panel.html.haml
529
+ - app/views/itsf/backend/dashboard/_head_extras.html.haml
523
530
  - app/views/itsf/backend/dashboard/index.html.haml
524
531
  - app/views/itsf/backend/home/_dashboard_panel.html.haml
532
+ - app/views/itsf/backend/home/_head_extras.html.haml
525
533
  - app/views/itsf/backend/home/_index_extras.html.haml
526
534
  - app/views/itsf/backend/home/index.html.haml
527
535
  - app/views/itsf/backend/i18n/_navigation.html.haml
528
536
  - app/views/itsf/backend/resource/base/_form.html.haml
529
537
  - app/views/itsf/backend/resource/base/_form_errors.html.haml
538
+ - app/views/itsf/backend/resource/base/_head_extras.html.haml
539
+ - app/views/itsf/backend/resource/base/_index_extras.html.haml
530
540
  - app/views/itsf/backend/resource/base/_scopes.html.haml
531
541
  - app/views/itsf/backend/resource/base/_search.html.haml
532
542
  - app/views/itsf/backend/resource/base/_show.html.haml
@@ -539,6 +549,7 @@ files:
539
549
  - app/views/itsf/backend/resource/base/show.html.haml
540
550
  - app/views/itsf/backend/service/base/_form.html.haml
541
551
  - app/views/itsf/backend/service/base/_form_errors.html.haml
552
+ - app/views/itsf/backend/service/base/_head_extras.html.haml
542
553
  - app/views/itsf/backend/service/base/_messages.html.erb
543
554
  - app/views/itsf/backend/service/base/index.html.haml
544
555
  - app/views/itsf/backend/service/base/invoke.html.haml
@@ -686,3 +697,4 @@ test_files:
686
697
  - spec/dummy/bin/rails
687
698
  - spec/dummy/bin/bundle
688
699
  - spec/dummy/bin/setup
700
+ has_rdoc:
@@ -1,34 +0,0 @@
1
- require 'ransack' if Itsf::Backend.features?(:ransack)
2
- require 'kaminari' if Itsf::Backend.features?(:kaminari)
3
-
4
- module Itsf::Backend
5
- class BaseController < Configuration.resource_base_controller.constantize
6
- if Itsf::Backend.features?(:pundit)
7
- include Controller::RestActionsConcernWithPundit
8
- include Pundit
9
- prepend Controller::PunditNamespacedAuthorizeConcern
10
- helper_method :engine_policy
11
- else
12
- include Controller::RestActionsConcern
13
- end
14
- include Controller::ResourceUrlsConcern
15
- include Controller::ResourceInflectionsConcern
16
- include Controller::RansackConcern if Itsf::Backend.features?(:ransack)
17
- include Controller::PaginationConcern if Itsf::Backend.features?(:kaminari)
18
- include Controller::JsonApiConcern
19
- helper Itsf::Backend::ApplicationHelper
20
- helper MultiClientHelper if Itsf::Backend.features?(:multi_client)
21
-
22
- helper_method :resource_class
23
-
24
- helper ResourceRenderer::ViewHelper
25
-
26
- def self.resource_class
27
- name.gsub('Controller', '').constantize
28
- end
29
-
30
- def resource_class
31
- self.class.resource_class
32
- end
33
- end
34
- end