caboose-cms 0.4.117 → 0.4.118
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/assets/javascripts/caboose/model/index_table.js +46 -34
- data/lib/caboose/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTZmMTJmMzc3ZmZmMmNiYjJkY2I3MDk3NmMyZWJjOTZiZTZiM2NhMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Mzg2OTJjZDFmM2NjOGNkZmQ1YjMwOWVjMTE0OTFmZTVkMWNiOTg2Mg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTE3NmE3MWUyN2Y2MmU3ZDhjMWE4OTI2ZWQwNGU0OTFiZDg1Y2Y3ZWY3Mzg4
|
10
|
+
MTNlNzdmMzA1ODdmZjllYmQ1NGI3NzZmZjY2NWRiYzAwNjJiN2ZlN2E0MjI0
|
11
|
+
MjgxOGQ4MTI5MTBkNzE5MjVhMTdhMDJmODVlNmYxODMzZjk2OWM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
148
|
-
|
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(
|
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/>')
|
227
|
-
|
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(' '));
|
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
|
-
|
263
|
-
|
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
|
-
|
281
|
-
|
282
|
-
|
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) {
|
data/lib/caboose/version.rb
CHANGED