caboose-cms 0.4.117 → 0.4.118

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Y2FlYzBlYWM0ODEzOTEyYmViMjhhYWI1Y2UxN2FhZTM4YmEyM2M4NA==
4
+ ZTZmMTJmMzc3ZmZmMmNiYjJkY2I3MDk3NmMyZWJjOTZiZTZiM2NhMg==
5
5
  data.tar.gz: !binary |-
6
- MTk2ZDEzMDhjMjYxMTlkMDQ1ZmNjODI1MjBkYTI5OGNmNDg1YjRmZA==
6
+ Mzg2OTJjZDFmM2NjOGNkZmQ1YjMwOWVjMTE0OTFmZTVkMWNiOTg2Mg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NWJjYzcxMDJmYjlhZjdjZTIzZmI2OTU2NWFmOTU0ODBhM2IwNzkwNWU1NGYz
10
- OWFiMTliNWM5ODFiYmE5MTEzMTExZjRkMmUxNjhlMWI4NWE3YjViMGJkNDJh
11
- MmNhZWMwN2QzMGQ2MTNkZGFmNmNjZTkyNjVmYWFlYjIyMjljMWE=
9
+ ZTE3NmE3MWUyN2Y2MmU3ZDhjMWE4OTI2ZWQwNGU0OTFiZDg1Y2Y3ZWY3Mzg4
10
+ MTNlNzdmMzA1ODdmZjllYmQ1NGI3NzZmZjY2NWRiYzAwNjJiN2ZlN2E0MjI0
11
+ MjgxOGQ4MTI5MTBkNzE5MjVhMTdhMDJmODVlNmYxODMzZjk2OWM=
12
12
  data.tar.gz: !binary |-
13
- ODhlODYxZDcwYmZjYzk5MTI2ZTIzY2Y1M2ZkYjk5NmRhNTU5YTg0OGFjNTBk
14
- ZWQ0NjdmZThlZGRiYTBiZDM1ZDA4N2M3NzU2YjhjOTdiMzBhZjU5MjNmMTZk
15
- NmIwMTNjNTUwODMzZWQwZjAzNGI1N2MwNjA2YmU1MzRjMmI2YzA=
13
+ MjBhYzg5ODA3ZGFiNTU1YzI1ZTEzY2Y3Mzk2NDhlMDBlODE1YzhjOTYwYzkw
14
+ NTdiNmU2ZTU5N2NjZDlkNmY3NDNmM2Y4NWEyMzQ2OTlhMDcyNzNmZTA5NWJl
15
+ M2IxY2IyZjBjYzQ5MWQ1N2E1NDdjZWJiNjdlYTc1MGEyNTI1ZjU=
@@ -52,6 +52,10 @@ IndexTable.prototype = {
52
52
 
53
53
  // The post/get in the original request
54
54
  post_get: false,
55
+
56
+ allow_bulk_edit: true,
57
+ allow_bulk_delete: true,
58
+ allow_duplicate: true,
55
59
 
56
60
  //============================================================================
57
61
  // End of required parameters
@@ -142,11 +146,13 @@ IndexTable.prototype = {
142
146
  data: that.pager_params,
143
147
  success: function(resp) {
144
148
  for (var thing in resp['pager'])
145
- that.pager_params[thing] = resp['pager'][thing];
149
+ that.pager_params[thing] = resp['pager'][thing];
146
150
  that.models = resp['models'];
147
- $.each(that.models, function(i, m) {
148
- m.id = parseInt(m.id);
149
- });
151
+ for (var i=0; i<that.models.length; i++)
152
+ {
153
+ var m = that.models[i];
154
+ m.id = parseInt(m.id);
155
+ }
150
156
  that.print();
151
157
 
152
158
  // Set the history state
@@ -180,7 +186,11 @@ IndexTable.prototype = {
180
186
  }
181
187
  else
182
188
  {
183
- var columns = this.column_checkboxes();
189
+ var columns = this.column_checkboxes();
190
+ var controls = $('<p/>');
191
+ if (this.allow_bulk_edit ) controls.append($('<input/>').attr('type', 'button').attr('id', 'bulk_edit' ).val('Bulk Edit' ).click(function(e) { that.bulk_edit(); })).append(' ');
192
+ if (this.allow_bulk_delete ) controls.append($('<input/>').attr('type', 'button').attr('id', 'bulk_delete').val('Bulk Delete').click(function(e) { that.bulk_delete(); })).append(' ');
193
+ if (this.allow_duplicate ) controls.append($('<input/>').attr('type', 'button').attr('id', 'duplicate' ).val('Duplicate' ).click(function(e) { that.duplicate(); }));
184
194
 
185
195
  $('#' + that.container).empty()
186
196
  .append($('<a/>').attr('href', '#').html('Show/Hide Columns').click(function(e) { e.preventDefault(); $('#columns').slideToggle(); }))
@@ -188,11 +198,7 @@ IndexTable.prototype = {
188
198
  .append($('<div/>').attr('id', 'table_container').append(table))
189
199
  .append($('<div/>').attr('id', 'pager').append(pager))
190
200
  .append($('<div/>').attr('id', 'message'))
191
- .append($('<p/>')
192
- .append($('<input/>').attr('type', 'button').attr('id', 'bulk_edit' ).val('Bulk Edit' ).click(function(e) { that.bulk_edit(); })).append(' ')
193
- .append($('<input/>').attr('type', 'button').attr('id', 'bulk_delete').val('Bulk Delete').click(function(e) { that.bulk_delete(); })).append(' ')
194
- .append($('<input/>').attr('type', 'button').attr('id', 'duplicate' ).val('Duplicate' ).click(function(e) { that.duplicate(); }))
195
- );
201
+ .append(controls);
196
202
  $('#columns').hide();
197
203
  }
198
204
 
@@ -222,9 +228,11 @@ IndexTable.prototype = {
222
228
 
223
229
  table_headers: function()
224
230
  {
225
- var that = this;
226
- var tr = $('<tr/>').append($('<th/>').html('&nbsp;'));
227
- //var url = this.base_url + this.base_url.indexOf('?') > -1 ? '&' : '?';
231
+ var that = this;
232
+ var tr = $('<tr/>');
233
+
234
+ if (this.allow_bulk_edit || this.allow_bulk_delete || this.allow_duplicate)
235
+ tr.append($('<th/>').html('&nbsp;'));
228
236
 
229
237
  $.each(this.fields, function(i, field) {
230
238
  if (field.show)
@@ -236,7 +244,7 @@ IndexTable.prototype = {
236
244
  sort: field.sort,
237
245
  desc: (that.pager_params.sort == field.sort ? (parseInt(that.pager_params.desc) == 1 ? '0' : '1') : '0')
238
246
  });
239
-
247
+
240
248
  var input = $('<input/>').attr('type', 'checkbox').attr('id', 'quick_edit_' + field.name).val(field.name)
241
249
  .change(function() {
242
250
  that.quick_edit_field = $(this).prop('checked') ? $(this).val() : false;
@@ -259,27 +267,31 @@ IndexTable.prototype = {
259
267
  table_row: function(m)
260
268
  {
261
269
  var that = this;
262
- var checkbox = $('<input/>').attr('type', 'checkbox').attr('id', 'model_' + m.id)
263
- .click(function(e) {
264
- e.stopPropagation();
265
- var model_id = $(this).attr('id').replace('model_', '');
266
- if (model_id == 'NaN')
267
- alert("Error: invalid model id.");
268
- else
269
- {
270
- model_id = parseInt(model_id);
271
- var checked = $(this).prop('checked');
272
- var i = that.model_ids.indexOf(model_id);
273
- if (checked && i == -1) that.model_ids.push(model_id);
274
- if (!checked && i > -1) that.model_ids.splice(i, 1);
275
- }
276
- });
277
- if (that.model_ids.indexOf(m.id) > -1)
278
- checkbox.prop('checked', 'true');
270
+
271
+ var tr = $('<tr/>').attr('id', 'model_row_' + m.id);
279
272
 
280
- var tr = $('<tr/>')
281
- .attr('id', 'model_row_' + m.id)
282
- .append($('<td/>').append(checkbox));
273
+ if (that.allow_bulk_edit || that.allow_bulk_delete || that.allow_duplicate)
274
+ {
275
+ var checkbox = $('<input/>').attr('type', 'checkbox').attr('id', 'model_' + m.id)
276
+ .click(function(e) {
277
+ e.stopPropagation();
278
+ var model_id = $(this).attr('id').replace('model_', '');
279
+ if (model_id == 'NaN')
280
+ alert("Error: invalid model id.");
281
+ else
282
+ {
283
+ model_id = parseInt(model_id);
284
+ var checked = $(this).prop('checked');
285
+ var i = that.model_ids.indexOf(model_id);
286
+ if (checked && i == -1) that.model_ids.push(model_id);
287
+ if (!checked && i > -1) that.model_ids.splice(i, 1);
288
+ }
289
+ });
290
+ if (that.model_ids.indexOf(m.id) > -1)
291
+ checkbox.prop('checked', 'true');
292
+ tr.append($('<td/>').append(checkbox));
293
+ }
294
+
283
295
  if (!that.quick_edit_field)
284
296
  {
285
297
  tr.click(function(e) {
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.4.117'
2
+ VERSION = '0.4.118'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.117
4
+ version: 0.4.118
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry