caboose-cms 0.9.141 → 0.9.142

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4a12ce0605a6ada50a69e1bd6acce2c85e2644d9
4
- data.tar.gz: 3884dd6153bd714da7819b86db0361f39061941f
3
+ metadata.gz: 4101ff715f3350bdf7f403582837404239a21b14
4
+ data.tar.gz: acdfda2009f0ea2c7f645638f1835d43d093f27c
5
5
  SHA512:
6
- metadata.gz: ddff9ac7a922f69933783d8c072d9839429d214a457d486f626ff30a76340343affd4c5f2a937c6239f9776ad52aaa2603cd95476b1299c080bf4e4fb7d5fea3
7
- data.tar.gz: faa9dc225784b397a2ae1e58d44456f2264fe6a573a31300a93904e45eb99e52084faf7193a59c2fd0c046ca92c7f23a0967eefef4a9cc2ce7dfd47fed4ab92f
6
+ metadata.gz: 46ee55cdbb2d71c15fe7cc6102aea19b78c19528ccdf4d948bcac9da2350a98182c9faefaedeeac5108ef64acc67667a2424225d01c2aac7f001b0cb7088a879
7
+ data.tar.gz: 4c945c4379334ab43ac7fc7cfa20dbed51f31da4439c39b2dc46694c56d7c9d33d37eef544b5ee0f7d98e8e763190bd6c8e478fe1b14e93b0e46ee916a8f702c
@@ -64,6 +64,7 @@ BlockContentController.prototype = {
64
64
 
65
65
  editor.on('blur', function(ev) {
66
66
  if ( !is_saved ) {
67
+ $(b).find("span > span[contenteditable='false']").remove();
67
68
  var html = $(b).html();
68
69
  $.ajax({
69
70
  url: that.base_url() + '/' + target_id + '/value',
@@ -79,6 +80,7 @@ BlockContentController.prototype = {
79
80
 
80
81
  $(b).on('mouseleave', function(ev) {
81
82
  if ( !is_saved ) {
83
+ $(b).find("span > span[contenteditable='false']").remove();
82
84
  var html = $(b).html();
83
85
  $.ajax({
84
86
  url: that.base_url() + '/' + target_id + '/value',
@@ -268,7 +270,7 @@ BlockContentController.prototype = {
268
270
 
269
271
  delete_block: function(block_id, confirm)
270
272
  {
271
- var that = this;
273
+ var that = this;
272
274
  if (this.selected_block_ids.indexOf(block_id) == -1)
273
275
  this.selected_block_ids.push(block_id);
274
276
  var other_count = this.selected_block_ids.length - 1;
@@ -288,11 +290,10 @@ BlockContentController.prototype = {
288
290
  return;
289
291
  }
290
292
  else {
291
- for (var i in this.selected_block_ids) {
292
- var bid = this.selected_block_ids[i];
293
- $('#block_' + bid).remove();
294
- that.delete_block_save(bid);
295
- }
293
+ $.each( this.selected_block_ids, function(k1,v1) {
294
+ $('#block_' + v1).remove();
295
+ that.delete_block_save(v1);
296
+ });
296
297
  that.selected_block_ids = [];
297
298
  that.add_dropzones();
298
299
  that.is_modified();
@@ -112,7 +112,7 @@ var BlockModalController = ModalController.extend({
112
112
  }
113
113
  if (that.block.block_type.allow_child_blocks)
114
114
  {
115
- div.append($('<p/>').css('clear', 'both').append($('<a/>').attr('href', '#').html(that.add_child_link_text ? that.add_child_link_text : "Add a child block!").click(function(e) {
115
+ div.append($('<p/>').css('clear', 'both').append($('<a/>').addClass('caboose-btn').attr('href', '#').html(that.add_child_link_text ? that.add_child_link_text : "Add a child block!").click(function(e) {
116
116
  e.preventDefault();
117
117
  that.add_block();
118
118
  })));
@@ -205,7 +205,7 @@ var BlockModalController = ModalController.extend({
205
205
 
206
206
  render_child_blocks: function()
207
207
  {
208
- var that = this;
208
+ var that = this;
209
209
  if (that.block.block_type.field_type != 'block' && that.block.children.length == 0)
210
210
  return;
211
211
  $.each(that.block.children, function(i, b) { if ( b.name != null || that.block.block_type.default_child_block_type_id == b.block_type.id ) { that.render_child_block(b); } });
@@ -213,7 +213,7 @@ var BlockModalController = ModalController.extend({
213
213
 
214
214
  render_child_block: function(b)
215
215
  {
216
- var that = this;
216
+ var that = this;
217
217
  if (that.complex_field_types.indexOf(b.block_type.field_type) > -1)
218
218
  {
219
219
  if (!b.rendered_value)
@@ -223,7 +223,6 @@ var BlockModalController = ModalController.extend({
223
223
  type: 'get',
224
224
  success: function(html) {
225
225
  $('#the_modal #block_' + b.id).replaceWith(html);
226
-
227
226
  var b2 = that.block_with_id(b.id);
228
227
  b2.rendered_value = html;
229
228
  that.set_clickable(b2);
@@ -112,7 +112,7 @@ var BlockModalController = ModalController.extend({
112
112
  }
113
113
  if (that.block.block_type.allow_child_blocks)
114
114
  {
115
- div.append($('<p/>').css('clear', 'both').append($('<a/>').attr('href', '#').html(that.add_child_link_text ? that.add_child_link_text : "Add a child block!").click(function(e) {
115
+ div.append($('<p/>').css('clear', 'both').append($('<a/>').addClass('caboose-btn').attr('href', '#').html(that.add_child_link_text ? that.add_child_link_text : "Add a child block!").click(function(e) {
116
116
  e.preventDefault();
117
117
  that.add_block();
118
118
  })));
@@ -30,8 +30,8 @@ var ModalController = Class.extend({
30
30
  closeButton: false,
31
31
  opacity: 0.50,
32
32
  onComplete: function() {
33
- var arr = ['TopLeft','TopCenter','TopRight','BottomLeft','BottomCenter','BottomRight','MiddleLeft','MiddleRight'];
34
- for (var i in arr) $('#cbox' + arr[i]).css('background-color', '#fff !important');
33
+ // var arr = ['TopLeft','TopCenter','TopRight','BottomLeft','BottomCenter','BottomRight','MiddleLeft','MiddleRight'];
34
+ // for (var i in arr) $('#cbox' + arr[i]).css('background-color', '#fff !important');
35
35
  $("#cboxClose").hide();
36
36
  if (callback) callback();
37
37
  }
@@ -20,6 +20,7 @@
20
20
  text-align: center;
21
21
  height: 52px;
22
22
  margin-bottom: 10px;
23
+ color: #252525;
23
24
  }
24
25
  }
25
26
  #new_blocks {
@@ -98,6 +99,7 @@
98
99
  font-weight: 300 !important;
99
100
  font-size: 15px !important;
100
101
  padding: 8px 6px 6px 6px;
102
+ color: #252525;
101
103
  &:focus {
102
104
  outline-width: 0;
103
105
  border-color: #28acc1;
@@ -8,7 +8,7 @@
8
8
  #the_modal div.icons a:hover span.icon { color: #000 !important; }
9
9
  #the_modal div.icons a:hover span.name { color: #000 !important; }
10
10
 
11
- #the_modal { box-sizing: border-box; }
11
+ #the_modal { box-sizing: border-box; color: #252525; }
12
12
  #the_modal p { margin-bottom: 10px; }
13
13
  #the_modal .mb_container input { border: #ccc 1px solid; }
14
14
  #the_modal div.mb_container div.mb_placeholder { top: 9px; }
@@ -85,7 +85,7 @@ module Caboose
85
85
  blocks = []
86
86
  if params[:id]
87
87
  b = Block.find(params[:id])
88
- b.create_children(status: 'added') if Caboose::Block.where(:parent_id => b.id).count == 0
88
+ b.create_children(status: 'added') # if Caboose::Block.where(:parent_id => b.id).count == 0
89
89
  bt = b.block_type
90
90
  blocks << {
91
91
  'id' => b.id,
@@ -138,7 +138,7 @@ module Caboose
138
138
  :block_id => b.id,
139
139
  :text => bt.description
140
140
  }
141
- b = b.parent
141
+ b = (b.new_parent_id.blank? ? b.parent : Caboose::Block.find(b.new_parent_id))
142
142
  end
143
143
  return crumbs.reverse
144
144
  end
@@ -146,7 +146,8 @@ module Caboose
146
146
  def admin_tree_helper(b,level)
147
147
  arr = []
148
148
  if level < 3
149
- b.filtered_children(true,true).each do |b2|
149
+ sort_by_id = b.block_type.default_child_block_type_id.nil? ? true : false
150
+ b.filtered_children(true,sort_by_id).each do |b2|
150
151
  bt = b2.block_type
151
152
  arr << {
152
153
  'id' => b2.id,
@@ -483,7 +484,9 @@ module Caboose
483
484
  b = RichTextBlockParser.parse(b, v, request.host_with_port)
484
485
  else
485
486
  if b.block_type.field_type == 'checkbox_multiple'
486
- b.new_value = Block.parse_checkbox_multiple_value(b, v)
487
+ pv = Block.parse_checkbox_multiple_value(b, v)
488
+ b.new_value = (pv.blank? ? 'EMPTY' : pv)
489
+ b.status = 'edited' if b.status == 'published'
487
490
  else
488
491
  b.new_value = (v.blank? ? 'EMPTY' : v)
489
492
  b.status = 'edited' if b.status == 'published'
@@ -689,9 +692,9 @@ module Caboose
689
692
  return unless user_is_allowed("#{page_or_post}s", 'edit')
690
693
  resp = StdClass.new
691
694
  b = Block.find(params[:id])
692
- par = Block.where(:name => nil).where(:id => (b.new_parent_id.blank? ? b.parent_id : b.new_parent_id)).first
695
+ par = Block.where("name is null or name like '%column%'").where(:id => (b.new_parent_id.blank? ? b.parent_id : b.new_parent_id)).first
693
696
  resp.parent_id = par ? par.id : nil
694
- gp = par ? Block.where(:name => nil).where(:id => (par.new_parent_id.blank? ? par.parent_id : par.new_parent_id)).first : nil
697
+ gp = par ? Block.where("name is null or name like '%column%'").where(:id => (par.new_parent_id.blank? ? par.parent_id : par.new_parent_id)).first : nil
695
698
  resp.grandparent_id = gp ? gp.id : nil
696
699
  render :json => resp
697
700
  end
@@ -707,7 +710,7 @@ module Caboose
707
710
  b.new_sort_order = (b2.new_sort_order.blank? ? b2.sort_order : b2.new_sort_order)
708
711
  i = 1
709
712
  sibs = b2.siblings(b.new_sort_order)
710
- Caboose.log("updating #{sibs.count} siblings")
713
+ # Caboose.log("updating #{sibs.count} siblings")
711
714
  sibs.each do |b3|
712
715
  b3.new_sort_order = b.new_sort_order + i
713
716
  b3.status = 'edited' if b3.status == 'published'
@@ -719,7 +722,7 @@ module Caboose
719
722
  b.new_sort_order = (b2.new_sort_order.blank? ? (b2.sort_order + 1) : (b2.new_sort_order + 1))
720
723
  i = 1
721
724
  sibs = b2.siblings(b.new_sort_order)
722
- Caboose.log("updating #{sibs.count} siblings")
725
+ # Caboose.log("updating #{sibs.count} siblings")
723
726
  sibs.each do |b3|
724
727
  b3.new_sort_order = b.new_sort_order + i
725
728
  b3.status = 'edited' if b3.status == 'published'
@@ -130,7 +130,7 @@ class Caboose::Block < ActiveRecord::Base
130
130
  blocks = []
131
131
  if editing
132
132
  sortby = sort_by_id ? 'block_type_id' : 'new_sort_order,id'
133
- blocks = Caboose::Block.where("new_parent_id = ? or (parent_id = ? and new_parent_id is null)", self.id, self.id).order(sortby)
133
+ blocks = Caboose::Block.where("status != ?","deleted").where("new_parent_id = ? or (parent_id = ? and new_parent_id is null)", self.id, self.id).order(sortby)
134
134
  else
135
135
  blocks = Caboose::Block.where(:parent_id => self.id).order('sort_order,id')
136
136
  end
@@ -526,15 +526,24 @@ class Caboose::Block < ActiveRecord::Base
526
526
 
527
527
  # Parses the value given for a checkbox multiple block
528
528
  def self.parse_checkbox_multiple_value(b, arr)
529
- current_value = b.value ? b.value.split('|') : []
529
+ current_value = b.new_value.blank? ? (b.value ? b.value.split('|') : []) : (b.new_value ? b.new_value.split('|') : [])
530
530
  v = arr[0]
531
531
  checked = arr[1].to_i == 1
532
- if checked && !current_value.include?(v)
533
- current_value << v
534
- elsif !checked && current_value.include?(v)
535
- current_value.delete(v)
532
+ if v == 'all'
533
+ if checked && b.block_type && !b.block_type.options.blank?
534
+ Caboose.log(b.block_type.options)
535
+ return b.block_type.options.split("\n").join('|')
536
+ else
537
+ return ''
538
+ end
539
+ else
540
+ if checked && !current_value.include?(v)
541
+ current_value << v
542
+ elsif !checked && current_value.include?(v)
543
+ current_value.delete(v)
544
+ end
545
+ return current_value.join('|')
536
546
  end
537
- return current_value.join('|')
538
547
  end
539
548
 
540
549
  # block siblings (in editing mode)
@@ -37,17 +37,21 @@ class Caboose::MediaCategory < ActiveRecord::Base
37
37
 
38
38
  def self.flat_tree_helper(cat, prefix, str)
39
39
  cat.name = "#{str}#{cat.name}"
40
- arr = [{
41
- :id => cat.id,
42
- :parent_id => cat.parent_id,
43
- :site_id => cat.site_id,
44
- :name => cat.name,
45
- :media_count => cat.media.count
46
- }]
47
- cat.children.each do |cat2|
48
- arr += self.flat_tree_helper(cat2, prefix, "#{str}#{prefix}")
40
+ if cat.name == "-&nbsp;&nbsp;Products"
41
+ return []
42
+ else
43
+ arr = [{
44
+ :id => cat.id,
45
+ :parent_id => cat.parent_id,
46
+ :site_id => cat.site_id,
47
+ :name => cat.name,
48
+ :media_count => cat.media.count
49
+ }]
50
+ cat.children.each do |cat2|
51
+ arr += self.flat_tree_helper(cat2, prefix, "#{str}#{prefix}")
52
+ end
53
+ return arr
49
54
  end
50
- return arr
51
55
  end
52
56
 
53
57
  def self.tree_hash(site_id)
@@ -60,7 +64,7 @@ class Caboose::MediaCategory < ActiveRecord::Base
60
64
  :id => cat.id,
61
65
  :name => cat.name,
62
66
  :media_count => cat.media.count,
63
- :children => cat.children.collect{ |kid| self.tree_hash_helper(kid) }
67
+ :children => (cat.name == 'Products' ? [] : cat.children.collect{ |kid| self.tree_hash_helper(kid) })
64
68
  }
65
69
  end
66
70
 
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.141'
2
+ VERSION = '0.9.142'
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.141
4
+ version: 0.9.142
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-05-25 00:00:00.000000000 Z
11
+ date: 2018-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg