caboose-cms 0.9.134 → 0.9.135

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: fcfbf246d2536f0c9e4403a909f7555bc07c6cd7
4
- data.tar.gz: 9c92cffdf2508586d117a4c9e7d3030739c81f77
3
+ metadata.gz: 2390d0194741e14fcbe3c793fe4e1d3efce280e3
4
+ data.tar.gz: 381c777c54b1c76192d6e68ab14857784d3931ee
5
5
  SHA512:
6
- metadata.gz: ef97678358c46a955e4e1fe41dee59189ec855db8d84be5b3d56b32893a3515988583358c7d18a18e063087a3538c4abfd6fdb1b2e9e46ddbda7d76c2a569e6f
7
- data.tar.gz: cbb48655938c647fbc0495d64ef73ef95e1570448d3359523c0753222cb22279b1ae30c3baca83516b73ac1f96fb3a7b42be776f4c82a56b7f7ce032549c4064
6
+ metadata.gz: 68afb4b1b1a2eb61c3d571047f8c882bde110b014d4509f084560650081975706966f08c4d5dbff94af9d58a4956a5526acdcb7d6b90b984ef721c41599e5fbe
7
+ data.tar.gz: 5d4df4df76087c9c0b77a36a71a54bdeb677e0880afd9dc53846975a2ea32c394efc48ec8edcb29441129d1c3d62239a8c35a032f1297320292d9fcf54e7f370
@@ -53,16 +53,24 @@ BlockContentController.prototype = {
53
53
  var target_id = $(b).data('rtid');
54
54
  // var block_id = $(b).attr('id').replace('block_','');
55
55
  var editor = CKEDITOR.inline( $(b).attr('id') );
56
+
56
57
  editor.on('change', function(ev) {
57
58
  that.is_modified();
59
+ $(b).css('background-color','#ffffd0').css('color','black');
60
+ });
61
+
62
+ editor.on('blur', function(ev) {
58
63
  var html = $(b).html();
59
64
  $.ajax({
60
65
  url: that.base_url() + '/' + target_id + '/value',
61
66
  type: 'put',
62
67
  data: { value: html },
63
- success: function(resp) { }
68
+ success: function(resp) {
69
+ $(b).css('background-color','').css('color','');
70
+ }
64
71
  });
65
72
  });
73
+
66
74
  }
67
75
  });
68
76
  });
@@ -82,7 +82,6 @@ module Caboose
82
82
  @editmode = !params['edit'].nil? && user.is_allowed('pages', 'edit') ? true : false
83
83
  # @crumb_trail = Caboose::Page.crumb_trail(@page)
84
84
  # @subnav = Caboose::Page.subnav(@page, session['use_redirect_urls'], @user)
85
-
86
85
  #@subnav.links = @tasks.collect {|href, task| {'href' => href, 'text' => task, 'is_current' => uri == href}}
87
86
 
88
87
  end
@@ -221,9 +220,8 @@ module Caboose
221
220
  redirect_to "/admin/pages/#{@page.id}/layout"
222
221
  return
223
222
  end
224
- Caboose::Block.where(:page_id => @page.id, :new_sort_order => nil).update_all('new_sort_order = sort_order')
225
- Caboose::Block.where(:page_id => @page.id, :status => nil).update_all(:status => 'published')
226
- # Caboose::Block.where(:page_id => @page.id, :new_parent_id => nil).update_all('new_parent_id = parent_id')
223
+ Caboose::Block.where(:page_id => @page.id, :new_sort_order => nil).update_all('new_sort_order = sort_order') if @page && !@page.id.nil?
224
+ Caboose::Block.where(:page_id => @page.id, :status => nil).update_all(:status => 'published') if @page && !@page.id.nil?
227
225
  @editing = true
228
226
  @preview = false
229
227
  end
@@ -105,8 +105,8 @@ module Caboose
105
105
  redirect_to "/admin/posts/#{@post.id}/layout"
106
106
  return
107
107
  end
108
- Caboose::Block.where(:post_id => @post.id, :new_sort_order => nil).update_all('new_sort_order = sort_order')
109
- Caboose::Block.where(:post_id => @post.id, :status => nil).update_all(:status => 'published')
108
+ Caboose::Block.where(:post_id => @post.id, :new_sort_order => nil).update_all('new_sort_order = sort_order') if @post && !@post.id.nil?
109
+ Caboose::Block.where(:post_id => @post.id, :status => nil).update_all(:status => 'published') if @post && !@post.id.nil?
110
110
  @editing = true
111
111
  @preview = false
112
112
  end
@@ -71,43 +71,47 @@ class Caboose::Page < ActiveRecord::Base
71
71
  end
72
72
 
73
73
  def is_published
74
- Caboose::Block.where(:page_id => self.id).where('status != ?','published').count == 0
74
+ Caboose::Block.where(:page_id => self.id).where('status != ?','published').count == 0 if !self.id.nil?
75
75
  end
76
76
 
77
77
  def publish
78
- Caboose::Block.where(:page_id => self.id).where('status = ? OR status = ?','edited','added').all.each do |b|
79
- if b.new_value == 'EMPTY'
80
- b.value = nil
81
- elsif !b.new_value.blank?
82
- b.value = b.new_value
78
+ if !self.id.nil?
79
+ Caboose::Block.where(:page_id => self.id).where('status = ? OR status = ?','edited','added').all.each do |b|
80
+ if b.new_value == 'EMPTY'
81
+ b.value = nil
82
+ elsif !b.new_value.blank?
83
+ b.value = b.new_value
84
+ end
85
+ if b.new_media_id == 0
86
+ b.media_id = nil
87
+ elsif !b.new_media_id.blank?
88
+ b.media_id = b.new_media_id
89
+ end
90
+ b.sort_order = b.new_sort_order if !b.new_sort_order.blank?
91
+ b.parent_id = b.new_parent_id if !b.new_parent_id.blank?
92
+ b.status = 'published'
93
+ b.new_value = nil
94
+ b.new_media_id = nil
95
+ b.new_sort_order = nil
96
+ b.new_parent_id = nil
97
+ b.save
83
98
  end
84
- if b.new_media_id == 0
85
- b.media_id = nil
86
- elsif !b.new_media_id.blank?
87
- b.media_id = b.new_media_id
88
- end
89
- b.sort_order = b.new_sort_order if !b.new_sort_order.blank?
90
- b.parent_id = b.new_parent_id if !b.new_parent_id.blank?
91
- b.status = 'published'
92
- b.new_value = nil
93
- b.new_media_id = nil
94
- b.new_sort_order = nil
95
- b.new_parent_id = nil
96
- b.save
99
+ deleted_blocks = Caboose::Block.where(:page_id => self.id, :status => 'deleted').pluck(:id)
100
+ dids = deleted_blocks.blank? ? 0 : deleted_blocks
101
+ Caboose::Block.where("id in (?) or parent_id in (?)",dids,dids).destroy_all
102
+ Caboose::Block.where(:page_id => self.id, :status => nil).update_all(:status => 'published')
103
+ self.status = 'published'
104
+ self.save
97
105
  end
98
- deleted_blocks = Caboose::Block.where(:page_id => self.id, :status => 'deleted').pluck(:id)
99
- dids = deleted_blocks.blank? ? 0 : deleted_blocks
100
- Caboose::Block.where("id in (?) or parent_id in (?)",dids,dids).destroy_all
101
- Caboose::Block.where(:page_id => self.id, :status => nil).update_all(:status => 'published')
102
- self.status = 'published'
103
- self.save
104
106
  end
105
107
 
106
108
  def revert
107
- Caboose::Block.where(:page_id => self.id).where(:status => 'added').destroy_all
108
- Caboose::Block.where(:page_id => self.id).update_all("status = 'published', new_value = null, new_media_id = null, new_sort_order = sort_order, new_parent_id = null")
109
- self.status = 'published'
110
- self.save
109
+ if !self.id.nil?
110
+ Caboose::Block.where(:page_id => self.id).where(:status => 'added').destroy_all
111
+ Caboose::Block.where(:page_id => self.id).update_all("status = 'published', new_value = null, new_media_id = null, new_sort_order = sort_order, new_parent_id = null")
112
+ self.status = 'published'
113
+ self.save
114
+ end
111
115
  end
112
116
 
113
117
  def self.page_with_uri(host_with_port, uri, get_closest_parent = true)
@@ -46,43 +46,47 @@ class Caboose::Post < ActiveRecord::Base
46
46
  end
47
47
 
48
48
  def is_published
49
- Caboose::Block.where(:post_id => self.id).where('status != ?','published').count == 0
49
+ Caboose::Block.where(:post_id => self.id).where('status != ?','published').count == 0 if !self.id.nil?
50
50
  end
51
51
 
52
52
  def publish
53
- Caboose::Block.where(:post_id => self.id).where('status = ? OR status = ?','edited','added').all.each do |b|
54
- if b.new_value == 'EMPTY'
55
- b.value = nil
56
- elsif !b.new_value.blank?
57
- b.value = b.new_value
53
+ if !self.id.nil?
54
+ Caboose::Block.where(:post_id => self.id).where('status = ? OR status = ?','edited','added').all.each do |b|
55
+ if b.new_value == 'EMPTY'
56
+ b.value = nil
57
+ elsif !b.new_value.blank?
58
+ b.value = b.new_value
59
+ end
60
+ if b.new_media_id == 0
61
+ b.media_id = nil
62
+ elsif !b.new_media_id.blank?
63
+ b.media_id = b.new_media_id
64
+ end
65
+ b.sort_order = b.new_sort_order if !b.new_sort_order.blank?
66
+ b.parent_id = b.new_parent_id if !b.new_parent_id.blank?
67
+ b.status = 'published'
68
+ b.new_value = nil
69
+ b.new_media_id = nil
70
+ b.new_sort_order = nil
71
+ b.new_parent_id = nil
72
+ b.save
58
73
  end
59
- if b.new_media_id == 0
60
- b.media_id = nil
61
- elsif !b.new_media_id.blank?
62
- b.media_id = b.new_media_id
63
- end
64
- b.sort_order = b.new_sort_order if !b.new_sort_order.blank?
65
- b.parent_id = b.new_parent_id if !b.new_parent_id.blank?
66
- b.status = 'published'
67
- b.new_value = nil
68
- b.new_media_id = nil
69
- b.new_sort_order = nil
70
- b.new_parent_id = nil
71
- b.save
74
+ deleted_blocks = Caboose::Block.where(:post_id => self.id, :status => 'deleted').pluck(:id)
75
+ dids = deleted_blocks.blank? ? 0 : deleted_blocks
76
+ Caboose::Block.where("id in (?) or parent_id in (?)",dids,dids).destroy_all
77
+ Caboose::Block.where(:post_id => self.id, :status => nil).update_all(:status => 'published')
78
+ self.status = 'published'
79
+ self.save
72
80
  end
73
- deleted_blocks = Caboose::Block.where(:post_id => self.id, :status => 'deleted').pluck(:id)
74
- dids = deleted_blocks.blank? ? 0 : deleted_blocks
75
- Caboose::Block.where("id in (?) or parent_id in (?)",dids,dids).destroy_all
76
- Caboose::Block.where(:post_id => self.id, :status => nil).update_all(:status => 'published')
77
- self.status = 'published'
78
- self.save
79
81
  end
80
82
 
81
83
  def revert
82
- Caboose::Block.where(:post_id => self.id).where(:status => 'added').destroy_all
83
- Caboose::Block.where(:post_id => self.id).update_all("status = 'published', new_value = null, new_media_id = null, new_sort_order = sort_order, new_parent_id = null")
84
- self.status = 'published'
85
- self.save
84
+ if !self.id.nil?
85
+ Caboose::Block.where(:post_id => self.id).where(:status => 'added').destroy_all
86
+ Caboose::Block.where(:post_id => self.id).update_all("status = 'published', new_value = null, new_media_id = null, new_sort_order = sort_order, new_parent_id = null")
87
+ self.status = 'published'
88
+ self.save
89
+ end
86
90
  end
87
91
 
88
92
  def self.uri(post)
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.134'
2
+ VERSION = '0.9.135'
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.134
4
+ version: 0.9.135
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-21 00:00:00.000000000 Z
11
+ date: 2018-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg