caboose-cms 0.9.120 → 0.9.121

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb5683a980021f404392a2f015b989295670fa6e
4
- data.tar.gz: 346da7005b08035b52ec6e16e3a399d30513d38b
3
+ metadata.gz: 40081c5b9ede11a0391f5e4da0ff379da12c82b5
4
+ data.tar.gz: c465273a24c8b4eb5b8e36aebfabe31b4511ac41
5
5
  SHA512:
6
- metadata.gz: fabbf562e74acb49526d3d1e2e1244b588e37978c8a55c0236ef6baf6538b8fce103fe1d537fe37309435e2c40de874e9f81ff5949fa5a9c1ec8f945540b2b85
7
- data.tar.gz: 5daf70440e4f8dd445b0035b420112ea65fcea692d64cb4d4a8d4e19f3aca566a0e0338ba78edb78c99297863e18ea10672a19aaefa7a952c517c323e8c000f3
6
+ metadata.gz: 363cf1391eb58ac7f9094fbc3b257895cb17cb2a9f9dd4f3f20ddb229a71c383c78c5e098ea121e5311690496f02a4b41e461899022f6b431a128b0d88520fc0
7
+ data.tar.gz: fb631f145a885bcdcb959a37eb5bab69f47ce4813215caeb9a4eae565e3f29a247fda56c651868b2fc0264f15159235b8a84a2eace9654d9c3a1c91fb4b4f4b1
@@ -79,6 +79,7 @@ IndexTable.prototype = {
79
79
  allow_bulk_edit: true,
80
80
  allow_bulk_delete: true,
81
81
  allow_bulk_import: true,
82
+ allow_bulk_file_import: false,
82
83
  allow_duplicate: true,
83
84
  allow_advanced_edit: true,
84
85
  bulk_import_fields: false,
@@ -291,14 +292,15 @@ IndexTable.prototype = {
291
292
  else
292
293
  {
293
294
  var controls = $('<p/>');
294
- if (this.allow_add ) controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_new' ).val(that.new_model_text ).click(function(e) { that.new_form(); })).append(' ');
295
- controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_toggle_columns' ).val('Show/Hide Columns' ).click(function(e) { that.toggle_columns(); })).append(' ');
296
- if (this.search_fields ) controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_toggle_search' ).val('Show/Hide Search Form' ).click(function(e) { that.toggle_search_form(); })).append(' ');
297
- if (this.allow_bulk_edit ) controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_bulk_edit' ).val('Bulk Edit' ).click(function(e) { that.bulk_edit(); })).append(' ');
298
- if (this.allow_bulk_import ) controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_bulk_import' ).val('Import' ).click(function(e) { that.bulk_import(); })).append(' ');
299
- if (this.allow_duplicate ) controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_duplicate' ).val('Duplicate' ).click(function(e) { that.duplicate(); })).append(' ');
300
- if (this.allow_bulk_delete ) controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_bulk_delete' ).val('Delete' ).click(function(e) { that.bulk_delete(); })).append(' ');
301
- if (this.allow_export ) controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_export' ).val('Export' ).click(function(e) { that.csv_export(); })).append(' ');
295
+ if (this.allow_add ) controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_new' ).val(that.new_model_text ).click(function(e) { that.new_form(); })).append(' ');
296
+ controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_toggle_columns' ).val('Show/Hide Columns' ).click(function(e) { that.toggle_columns(); })).append(' ');
297
+ if (this.search_fields ) controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_toggle_search' ).val('Show/Hide Search Form' ).click(function(e) { that.toggle_search_form(); })).append(' ');
298
+ if (this.allow_bulk_edit ) controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_bulk_edit' ).val('Bulk Edit' ).click(function(e) { that.bulk_edit(); })).append(' ');
299
+ if (this.allow_bulk_import ) controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_bulk_import' ).val('Import' ).click(function(e) { that.bulk_import(); })).append(' ');
300
+ if (this.allow_bulk_file_import ) controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_bulk_file_import' ).val('Import File' ).click(function(e) { that.bulk_file_import(); })).append(' ');
301
+ if (this.allow_duplicate ) controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_duplicate' ).val('Duplicate' ).click(function(e) { that.duplicate(); })).append(' ');
302
+ if (this.allow_bulk_delete ) controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_bulk_delete' ).val('Delete' ).click(function(e) { that.bulk_delete(); })).append(' ');
303
+ if (this.allow_export ) controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_export' ).val('Export' ).click(function(e) { that.csv_export(); })).append(' ');
302
304
 
303
305
  var c = $('#' + that.container);
304
306
  c.empty();
@@ -654,6 +656,63 @@ IndexTable.prototype = {
654
656
  }
655
657
  });
656
658
  },
659
+
660
+ bulk_file_import: function(file)
661
+ {
662
+ var that = this;
663
+ if (!file)
664
+ {
665
+ var div = $('<div/>').addClass('note')
666
+ .append($('<h2/>').html('Bulk Import File'))
667
+ .append($('<p/>').attr('id', that.container + '_bulk_import_name'))
668
+ .append($('<div/>')
669
+ .attr('id', that.container + '_bulk_import_fake_file_input')
670
+ .addClass('mb_fake_file_input')
671
+ .append($('<input/>')
672
+ .attr('type', 'button')
673
+ .attr('id', that.container + '_bulk_import_update_button')
674
+ .val('Select File')
675
+ .click(function() { $('#' + that.container + '_bulk_import_file').click(); })
676
+ )
677
+ .append($('<input/>')
678
+ .attr('type', 'file')
679
+ .attr('id', that.container + '_bulk_import_file')
680
+ .attr('name', 'file')
681
+ .change(function() { $('#' + that.container + '_bulk_import_name').html($('#' + that.container + '_bulk_import_file')[0].files[0]['name']); })
682
+ )
683
+ )
684
+ .append($('<input/>')
685
+ .attr('type', 'submit')
686
+ .val('Upload')
687
+ .click(function() { that.bulk_file_import($('#' + that.container + '_bulk_import_file')[0].files[0]); })
688
+ )
689
+
690
+ that.show_message(div, 'bulk_import_form');
691
+ return;
692
+ }
693
+ that.show_message("<p class='loading'>Adding...</p>", 'bulk_import_loading');
694
+
695
+ var formData = new FormData();
696
+ formData.append('file', file);
697
+
698
+ $.ajax({
699
+ url: this.bulk_import_url,
700
+ type: 'post',
701
+ data: formData,
702
+ processData: false,
703
+ contentType: false,
704
+ success: function(resp) {
705
+ if (resp.error)
706
+ that.show_message("<p class='note error'>" + resp.error + "</p>", 'bulk_file_import_error');
707
+ else
708
+ {
709
+ that.show_message("<p class='note success'>Added successfully.</p>", 'bulk_file_import_success');
710
+ setTimeout(function() { that.hide_message(); }, 3000);
711
+ that.refresh();
712
+ }
713
+ }
714
+ });
715
+ },
657
716
 
658
717
  model_for_id: function(model_id)
659
718
  {
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.120'
2
+ VERSION = '0.9.121'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.120
4
+ version: 0.9.121
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-29 00:00:00.000000000 Z
11
+ date: 2018-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -1238,7 +1238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1238
1238
  version: '0'
1239
1239
  requirements: []
1240
1240
  rubyforge_project:
1241
- rubygems_version: 2.2.0
1241
+ rubygems_version: 2.5.1
1242
1242
  signing_key:
1243
1243
  specification_version: 4
1244
1244
  summary: CMS built on rails.