caboose-cms 0.9.44 → 0.9.45

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: 6fbbd00c48eed01800eb9778a028c755fea1c8c7
4
- data.tar.gz: 8351b765c406a3c786178389be493728e8012b0a
3
+ metadata.gz: e45d310e511ea1133be2c81e81d4f9aa9fe8398c
4
+ data.tar.gz: c2491ae0770cb1eee05adb3607f7e7f2d5f25156
5
5
  SHA512:
6
- metadata.gz: f606ef52d93d62c70270e58b732cb7461caf1cfc5e48bf6b5c03244a83ea93a3d6d9a26e79b549f68a7d0387ef917bfbe8430415a7e69b66b35c14fdb29a0577
7
- data.tar.gz: 2d905019b06a99aca52bb2d029299724fd88f4a270961fe26f6881a09e16132cab69d5cb59f3dc6b9e734de742556594cb8d12d685829cc470e065d81f036e8a
6
+ metadata.gz: d487a8fa40d900ec40578c8d7016274b172786c9041830b96a5a74431ce99607a621a968d4106e628e87b43510982a2a062a345a219e9673997d272abd50cbcd
7
+ data.tar.gz: 50b8e3e8bb22855e7be22a111054715cef712b8ded6b54acdad874baaafd5063d9768f10e57f625ab1a36fd68ac55e5995e6ce5d54cb44db2e030e772092e82e
@@ -188,8 +188,8 @@ IndexTable.prototype = {
188
188
  // Set both hash and querystring values in the pager
189
189
  for (var i in b)
190
190
  {
191
- if (i == 'sort' || i == 'desc' || i == 'page')
192
- this.pager.options[i] = b[i];
191
+ if (i == 'sort' || i == 'desc' || i == 'page')
192
+ this.pager.options[i] = i == 'sort' ? b[i] : parseInt(b[i]);
193
193
  else
194
194
  this.pager.params[i] = b[i];
195
195
  }
@@ -770,12 +770,12 @@ IndexTable.prototype = {
770
770
  },
771
771
 
772
772
  pager_div: function(summary)
773
- {
773
+ {
774
774
  var that = this;
775
775
  var p = this.pager;
776
776
 
777
777
  // Set default parameter values if not present
778
- if (!p.options.items_per_page) p.options.items_per_page = 10
778
+ if (!p.options.items_per_page) p.options.items_per_page = 10
779
779
  if (!p.options.page) p.options.page = 1
780
780
 
781
781
  var page = parseInt(p.options.page);
@@ -783,8 +783,8 @@ IndexTable.prototype = {
783
783
  // Max links to show (must be odd)
784
784
  var total_links = 5;
785
785
  var prev_page = page - 1;
786
- var next_page = page + 1;
787
- var total_pages = Math.ceil(parseFloat(p.options.item_count)/parseFloat(p.options.items_per_page));
786
+ var next_page = page + 1;
787
+ var total_pages = Math.ceil(parseFloat(p.options.item_count)/parseFloat(p.options.items_per_page));
788
788
  var start = 1;
789
789
  var stop = 1;
790
790
 
@@ -806,18 +806,18 @@ IndexTable.prototype = {
806
806
  if (start < 1) start = 1;
807
807
  }
808
808
  }
809
-
809
+
810
810
  var div = $('<div/>').addClass('pager');
811
811
  if (summary)
812
812
  div.append($('<p/>').html("Results: showing page " + page + " of " + total_pages));
813
813
 
814
814
  if (total_pages > 1)
815
- {
815
+ {
816
816
  var div2 = $('<div/>').addClass('page_links');
817
817
  if (page > 1)
818
818
  div2.append($('<a/>').attr('href', this.pager_hash({ page: prev_page })).html('Previous').click(function(e) { that.hash_click(e, this); }));
819
819
  for (i=start; i<=stop; i++)
820
- {
820
+ {
821
821
  if (page != i)
822
822
  div2.append($('<a/>').attr('href', this.pager_hash({ page: i })).html(i).click(function(e) { that.hash_click(e, this); }));
823
823
  else
@@ -826,7 +826,7 @@ IndexTable.prototype = {
826
826
  if (page < total_pages)
827
827
  div2.append($('<a/>').attr('href', this.pager_hash({ page: next_page })).html('Next').click(function(e) { that.hash_click(e, this); }));
828
828
  div.append(div2);
829
- }
829
+ }
830
830
  return div;
831
831
  },
832
832
 
@@ -840,15 +840,12 @@ IndexTable.prototype = {
840
840
  pager_params: function(h)
841
841
  {
842
842
  var that = this;
843
- var skip = this.pager.options && this.pager.options.skip ? this.pager.options.skip : [];
843
+ var skip = this.pager.skip ? this.pager.skip : [];
844
844
  var p = {};
845
- for (var i in this.pager.params) if (skip.indexOf(i) == -1) p[i] = this.pager.params[i];
846
- if (this.pager.options)
847
- {
848
- if (this.pager.options.sort) p.sort = this.pager.options.sort;
849
- if (this.pager.options.desc) p.desc = this.pager.options.desc ? 1 : 0;
850
- if (this.pager.options.page) p.page = this.pager.options.page;
851
- }
845
+ for (var i in this.pager.params) if (skip.indexOf(i) == -1) p[i] = this.pager.params[i];
846
+ if (this.pager.options.sort) p.sort = this.pager.options.sort;
847
+ if (this.pager.options.desc) p.desc = this.pager.options.desc ? 1 : 0;
848
+ if (this.pager.options.page) p.page = this.pager.options.page;
852
849
  if (h)
853
850
  {
854
851
  for (var i in h)
@@ -441,14 +441,20 @@ module Caboose
441
441
 
442
442
  def to_json
443
443
  {
444
- :base_url => @options ? @options['base_url'] : nil,
445
- :sort => @options ? @options['sort'] : nil,
446
- :desc => @options ? @options['desc'] : nil,
447
- :item_count => @options ? @options['item_count'] : nil,
448
- :items_per_page => @options ? @options['items_per_page'] : nil,
449
- :page => @options ? @options['page'] : nil,
450
- :use_url_params => @use_url_params
444
+ :options => @options,
445
+ :params => @params,
446
+ :use_url_params => @use_url_params
447
+
448
+ #:base_url => @options ? @options['base_url'] : nil,
449
+ #:sort => @options ? @options['sort'] : nil,
450
+ #:desc => @options ? @options['desc'] : nil,
451
+ #:item_count => @options ? @options['item_count'] : nil,
452
+ #:items_per_page => @options ? @options['items_per_page'] : nil,
453
+ #:page => @options ? @options['page'] : nil,
454
+ #:params => @params,
455
+ #:use_url_params => @use_url_params
451
456
  }.to_json
452
457
  end
458
+
453
459
  end
454
460
  end
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.44'
2
+ VERSION = '0.9.45'
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.44
4
+ version: 0.9.45
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-01 00:00:00.000000000 Z
11
+ date: 2017-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg