caboose-cms 0.8.60 → 0.8.61
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 +4 -4
- data/app/assets/javascripts/caboose/model/index_table.js +70 -21
- data/lib/caboose/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f36c7fdecc5fc40895fc8cf1cbfa7c0af91b7e10
|
|
4
|
+
data.tar.gz: d76ad213171289b7f79ba6260c657dfbd37e6f00
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 25b912cdbafbedbe3c6e420ca5af6a2e47157274a56151902e2336c25a166a6fe5be288fc7f67015690eb66a8aebcd9cbb835504f222f0d02c7397abc40fdd45
|
|
7
|
+
data.tar.gz: 3ebe5da2b93ccb8ae12d8dc8bd172dd88441dac80b53618ff44e6e705aa28659bdf4290df51bfd967d76ac3568331ebd9d470c644d68381d04e95aacdd07f82f
|
|
@@ -90,7 +90,16 @@ IndexTable.prototype = {
|
|
|
90
90
|
after_print: false,
|
|
91
91
|
table_class: 'data',
|
|
92
92
|
allow_export: false,
|
|
93
|
-
export_urls: false,
|
|
93
|
+
export_urls: false, // Example:
|
|
94
|
+
// [
|
|
95
|
+
// {
|
|
96
|
+
// name: 'My Export',
|
|
97
|
+
// url: '<url that starts export process>',
|
|
98
|
+
// wait_for_processing: true,
|
|
99
|
+
// status_url: function(resp) { return resp.status_url; },
|
|
100
|
+
// ready: function(resp) { return resp.redirect_url; }
|
|
101
|
+
// }
|
|
102
|
+
// ]
|
|
94
103
|
|
|
95
104
|
//============================================================================
|
|
96
105
|
// End of parameters
|
|
@@ -693,31 +702,71 @@ IndexTable.prototype = {
|
|
|
693
702
|
},
|
|
694
703
|
|
|
695
704
|
csv_export: function()
|
|
705
|
+
{
|
|
706
|
+
var that = this;
|
|
707
|
+
|
|
708
|
+
var defaults = {
|
|
709
|
+
name: "Export",
|
|
710
|
+
url: that.base_url + '/export.csv',
|
|
711
|
+
type: 'get',
|
|
712
|
+
wait_for_processing: false,
|
|
713
|
+
status_url: function(resp) { return resp.status_url; },
|
|
714
|
+
ready: function(resp) { return resp.redirect_url.length > 0; },
|
|
715
|
+
final_url: function(resp) { return resp.redirect_url; }
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
var p = $('<p/>');
|
|
719
|
+
$.each(that.export_urls, function(i, h) {
|
|
720
|
+
that.export_urls[i] = $.extend({}, defaults, h);
|
|
721
|
+
p.append($('<input/>').attr('type', 'button').val(that.export_urls[i].name).click(function(e) { that.csv_export_start($(this).val()); })).append(' ');
|
|
722
|
+
});
|
|
723
|
+
|
|
724
|
+
var div = $('<div/>').addClass('note')
|
|
725
|
+
.append($('<p/>').append('Which export would you like to run?'))
|
|
726
|
+
.append(p)
|
|
727
|
+
.append($('<div/>').attr('id', 'export_message'))
|
|
728
|
+
.append($('<p/>').append($('<input/>').attr('type', 'button').val('Cancel').click(function(e) { that.hide_message(); })));
|
|
729
|
+
that.show_message(div);
|
|
730
|
+
},
|
|
731
|
+
|
|
732
|
+
csv_export_start: function(name)
|
|
696
733
|
{
|
|
697
734
|
var that = this;
|
|
698
|
-
var p =
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
735
|
+
var p = that.pager_params();
|
|
736
|
+
|
|
737
|
+
var h = false;
|
|
738
|
+
$.each(that.export_urls, function(i, h2) {
|
|
739
|
+
if (h2.name == name) { h = h2; return false; }
|
|
702
740
|
});
|
|
703
|
-
//var url = that.export_url ? that.export_url : that.base_url + '/export.csv';
|
|
704
741
|
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
if (urls.length == 1)
|
|
708
|
-
window.location = url + '?' + qs.join('&');
|
|
709
|
-
else
|
|
742
|
+
if (!h.wait_for_processing)
|
|
710
743
|
{
|
|
711
|
-
var
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
744
|
+
var qs = [];
|
|
745
|
+
$.each(p, function(k,v) { if (k != '[object Object]') qs.push('' + k + '=' + encodeURIComponent(v)); });
|
|
746
|
+
window.location = h.url + '?' + qs.join('&');
|
|
747
|
+
return;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
$('#export_message').html("<p class='loading'>Creating export...</p>");
|
|
751
|
+
var qs = {};
|
|
752
|
+
$.each(p, function(k,v) { if (k != '[object Object]') qs[k] = v; });
|
|
753
|
+
$.ajax({ url: h.url, type: h.type, data: qs, success: function(resp) { h.status_url = h.status_url(resp); }, async: false });
|
|
754
|
+
setTimeout(function() { that.csv_export_status(h); }, 1000);
|
|
755
|
+
},
|
|
756
|
+
|
|
757
|
+
csv_export_status: function(h)
|
|
758
|
+
{
|
|
759
|
+
var that = this;
|
|
760
|
+
$.ajax({
|
|
761
|
+
url: h.status_url,
|
|
762
|
+
type: 'get',
|
|
763
|
+
success: function(resp) {
|
|
764
|
+
if (h.ready(resp))
|
|
765
|
+
window.location = h.final_url(resp);
|
|
766
|
+
else
|
|
767
|
+
setTimeout(function() { that.csv_export_status(h); }, 1000);
|
|
768
|
+
}
|
|
769
|
+
});
|
|
721
770
|
},
|
|
722
771
|
|
|
723
772
|
pager_div: function(summary)
|
data/lib/caboose/version.rb
CHANGED