caboose-cms 0.9.138 → 0.9.139
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/caboose/block_modal_controllers/block_dd_modal_controller.js +17 -13
- data/app/assets/javascripts/caboose/model/bound_text.js +7 -6
- data/app/assets/javascripts/caboose/model/bound_textarea.js +2 -2
- data/app/assets/stylesheets/caboose/admin_block_edit_image.css.scss +6 -2
- data/app/assets/stylesheets/caboose/admin_edit_page_content_dragdrop.scss +9 -3
- data/app/controllers/caboose/blocks_controller.rb +28 -28
- data/app/controllers/caboose/pages_controller.rb +9 -2
- data/app/models/caboose/block.rb +1 -1
- data/app/views/caboose/pages/admin_edit_content.html.erb +1 -1
- data/app/views/caboose/pages/preview.html.erb +1 -0
- data/lib/caboose/version.rb +1 -1
- metadata +3 -3
- data/app/views/caboose/pages/admin_preview.html.erb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa2fe345ebd7b72fe8cc102bb36a8024b8adfc1c
|
4
|
+
data.tar.gz: 245f02764732266fab06044cdff4e8e37a4066ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e9527274edb975954ddbb4124c596bdcfb08484ad7f2008ad18ee9f766d9e78d14467396a6a6ea7e78e9d644b8c4144cd9f43348e00dea534b18f6f32bb3952
|
7
|
+
data.tar.gz: 48510782255453a40040dad5ebdeff9557d2e663b3b4f57f4ffccba10b3f36e35e84e1fffe8409142a97e91f0fda7b8d9e2e30d933ae0c76b32b77df4a43db2e
|
@@ -127,15 +127,15 @@ var BlockModalController = ModalController.extend({
|
|
127
127
|
{
|
128
128
|
var that = this;
|
129
129
|
var p = $('<p/>').css('clear', 'both')
|
130
|
-
.append($('<input/>').attr('type', 'button').addClass('btn').val('Close').click(function() { that.close(); that.parent_controller.render_blocks(); })).append(' ');
|
130
|
+
.append($('<input/>').attr('type', 'button').addClass('caboose-btn').val('Close').click(function() { that.close(); that.parent_controller.render_blocks(); })).append(' ');
|
131
131
|
if (!that.block.name)
|
132
132
|
{
|
133
|
-
p.append($('<input/>').attr('type', 'button').addClass('btn').val('Delete Block').click(function() { that.delete_block(); })).append(' ');
|
134
|
-
p.append($('<input/>').attr('type', 'button').addClass('btn').val('Duplicate Block').click(function() { that.duplicate_block(); })).append(' ');
|
133
|
+
p.append($('<input/>').attr('type', 'button').addClass('caboose-btn').val('Delete Block').click(function() { that.delete_block(); })).append(' ');
|
134
|
+
p.append($('<input/>').attr('type', 'button').addClass('caboose-btn').val('Duplicate Block').click(function() { that.duplicate_block(); })).append(' ');
|
135
135
|
}
|
136
|
-
p.append($('<input/>').attr('type', 'button').addClass('btn').val('Move Up' ).click(function() { that.move_up(); })).append(' ');
|
137
|
-
p.append($('<input/>').attr('type', 'button').addClass('btn').val('Move Down' ).click(function() { that.move_down(); })).append(' ');
|
138
|
-
p.append($('<input/>').attr('type', 'button').addClass('btn').val('Advanced' ).attr('id', 'btn_advanced').click(function() { that.print_advanced(); }));
|
136
|
+
p.append($('<input/>').attr('type', 'button').addClass('caboose-btn').val('Move Up' ).click(function() { that.move_up(); })).append(' ');
|
137
|
+
p.append($('<input/>').attr('type', 'button').addClass('caboose-btn').val('Move Down' ).click(function() { that.move_down(); })).append(' ');
|
138
|
+
p.append($('<input/>').attr('type', 'button').addClass('caboose-btn').val('Advanced' ).attr('id', 'btn_advanced').click(function() { that.print_advanced(); }));
|
139
139
|
$('#modal_controls').empty().append(p);
|
140
140
|
},
|
141
141
|
|
@@ -146,11 +146,16 @@ var BlockModalController = ModalController.extend({
|
|
146
146
|
var crumbs = $('<h2/>').css('margin-top', '0').css('padding-top', '0');
|
147
147
|
$.each(that.block.crumbtrail, function(i, h) {
|
148
148
|
if (i > 0) crumbs.append(' > ');
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
149
|
+
if ( i == 0 || h['text'] == "Content" ) {
|
150
|
+
crumbs.append($('<span/>').html(h['text']).data('block_id', h['block_id']));
|
151
|
+
}
|
152
|
+
else {
|
153
|
+
crumbs.append($('<a/>').attr('href', '#').html(h['text']).data('block_id', h['block_id']).click(function(e) {
|
154
|
+
e.preventDefault();
|
155
|
+
if (that.before_crumbtrail_click) that.before_crumbtrail_click();
|
156
|
+
that.parent_controller.edit_block(parseInt($(this).data('block_id')));
|
157
|
+
}));
|
158
|
+
}
|
154
159
|
});
|
155
160
|
$('#modal_crumbtrail').empty().append(crumbs);
|
156
161
|
},
|
@@ -203,8 +208,7 @@ var BlockModalController = ModalController.extend({
|
|
203
208
|
var that = this;
|
204
209
|
if (that.block.block_type.field_type != 'block' && that.block.children.length == 0)
|
205
210
|
return;
|
206
|
-
|
207
|
-
$.each(that.block.children, function(i, b) { that.render_child_block(b); });
|
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); } });
|
208
212
|
},
|
209
213
|
|
210
214
|
render_child_block: function(b)
|
@@ -46,7 +46,7 @@ BoundText = BoundControl.extend({
|
|
46
46
|
// var this2 = this;
|
47
47
|
// $('#'+this.el).on('keyup', function(e) {
|
48
48
|
// if (e.keyCode == 27) this2.cancel(); // Escape
|
49
|
-
// if (e.keyCode == 13) this2.save(); //
|
49
|
+
// if (e.keyCode == 13) this2.save(); // E
|
50
50
|
|
51
51
|
if (that.attribute.width) $('#'+that.el).css('width', that.attribute.width);
|
52
52
|
if (that.attribute.fixed_placeholder && that.attribute.align != 'right')
|
@@ -68,11 +68,12 @@ BoundText = BoundControl.extend({
|
|
68
68
|
|
69
69
|
set_placeholder_padding: function() {
|
70
70
|
var that = this;
|
71
|
-
var w = $('#'+that.el+'_placeholder').outerWidth();
|
72
|
-
if (w >
|
73
|
-
$('#'+that.el).css('padding-left',
|
74
|
-
else
|
75
|
-
setTimeout(function() { that.set_placeholder_padding(); },
|
71
|
+
var w = $('#'+that.el+'_placeholder').outerWidth() + 10;
|
72
|
+
if (w > 10)
|
73
|
+
$('#'+that.el).css('padding-left', + w);
|
74
|
+
else {
|
75
|
+
setTimeout(function() { that.set_placeholder_padding(); }, 500);
|
76
|
+
}
|
76
77
|
},
|
77
78
|
|
78
79
|
save: function()
|
@@ -25,8 +25,8 @@ BoundTextarea = BoundControl.extend({
|
|
25
25
|
$('#'+this.el+'_container').append($('<div/>').attr('id', this.el + '_placeholder').addClass('mb_placeholder').append($('<span/>').html(this.attribute.nice_name + ': ')));
|
26
26
|
if (this.attribute.width) $('#'+this.el).css('width' , this.attribute.width);
|
27
27
|
if (this.attribute.height) $('#'+this.el).css('height' , this.attribute.height);
|
28
|
-
var h = $('#'+this.el+'_placeholder').outerHeight() +
|
29
|
-
$('#'+this.el).attr('placeholder', 'empty').css('padding-top',
|
28
|
+
var h = $('#'+this.el+'_placeholder').outerHeight() + 8;
|
29
|
+
$('#'+this.el).attr('placeholder', 'empty').css('padding-top',h).css('height', '-=' + h);
|
30
30
|
|
31
31
|
var this2 = this;
|
32
32
|
$('#'+this.el).on('keyup', function(e) {
|
@@ -216,12 +216,12 @@
|
|
216
216
|
background: #141516;
|
217
217
|
color: #f7f7f7 !important;
|
218
218
|
text-align: center;
|
219
|
-
padding: 0 15px;
|
219
|
+
padding: 1px 15px 0 15px;
|
220
220
|
height: auto;
|
221
221
|
display: inline-block;
|
222
222
|
margin: 0 auto;
|
223
223
|
font-family: "Roboto", Arial;
|
224
|
-
font-weight:
|
224
|
+
font-weight: 300;
|
225
225
|
font-size: 15px;
|
226
226
|
line-height: 32px;
|
227
227
|
cursor: pointer;
|
@@ -241,6 +241,10 @@
|
|
241
241
|
background: #4f4448;
|
242
242
|
}
|
243
243
|
|
244
|
+
#modal_controls p .caboose-btn {
|
245
|
+
margin-right: 3px;
|
246
|
+
}
|
247
|
+
|
244
248
|
|
245
249
|
#media {
|
246
250
|
ul.thumbnail_view {
|
@@ -82,7 +82,7 @@
|
|
82
82
|
}
|
83
83
|
#the_modal {
|
84
84
|
#modal_controls {
|
85
|
-
margin-top:
|
85
|
+
margin-top: 20px;
|
86
86
|
}
|
87
87
|
}
|
88
88
|
|
@@ -91,7 +91,7 @@
|
|
91
91
|
}
|
92
92
|
|
93
93
|
#the_modal #modal_content .mb_container {
|
94
|
-
input {
|
94
|
+
input, textarea {
|
95
95
|
border: #ccc 1px solid;
|
96
96
|
border-radius: 0 !important;
|
97
97
|
font-family: 'Roboto' !important;
|
@@ -235,6 +235,12 @@ body > .container, body > .mm-page > .container {
|
|
235
235
|
}
|
236
236
|
}
|
237
237
|
|
238
|
+
// #modal_content .mb_container textarea {
|
239
|
+
// font-family: 'Roboto';
|
240
|
+
// font-weight: 300;
|
241
|
+
// font-size: 15px;
|
242
|
+
// }
|
243
|
+
|
238
244
|
#tiny_header {
|
239
245
|
display: block;
|
240
246
|
color: #fff;
|
@@ -242,7 +248,7 @@ body > .container, body > .mm-page > .container {
|
|
242
248
|
position: fixed;
|
243
249
|
top: 0;
|
244
250
|
right: 0;
|
245
|
-
z-index:
|
251
|
+
z-index: 999;
|
246
252
|
width: calc(100% - 200px);
|
247
253
|
height: 40px;
|
248
254
|
padding: 0 2%;
|
@@ -82,7 +82,6 @@ module Caboose
|
|
82
82
|
# @route GET /admin/posts/:post_id/blocks/:id/tree
|
83
83
|
def admin_tree
|
84
84
|
return unless user_is_allowed("#{page_or_post}s", 'edit')
|
85
|
-
|
86
85
|
blocks = []
|
87
86
|
if params[:id]
|
88
87
|
b = Block.find(params[:id])
|
@@ -98,7 +97,7 @@ module Caboose
|
|
98
97
|
'constrain' => b.constrain,
|
99
98
|
'full_width' => b.full_width,
|
100
99
|
'block_type' => bt,
|
101
|
-
'children' => admin_tree_helper(b),
|
100
|
+
'children' => admin_tree_helper(b,1),
|
102
101
|
'crumbtrail' => self.crumbtrail(b)
|
103
102
|
#'block_type_id' => bt.id,
|
104
103
|
#'field_type' => bt.field_type,
|
@@ -106,7 +105,7 @@ module Caboose
|
|
106
105
|
#'use_js_for_modal' => bt.use_js_for_modal,
|
107
106
|
}
|
108
107
|
else
|
109
|
-
q = params[:page_id] ? ["parent_id is null and page_id = ?", params[:page_id]] : ["parent_id is null and post_id = ?", params[:post_id]]
|
108
|
+
q = !params[:page_id].blank? ? ["parent_id is null and page_id = ?", params[:page_id]] : ["parent_id is null and post_id = ?", params[:post_id]]
|
110
109
|
Block.where(q).reorder(:new_sort_order).all.each do |b|
|
111
110
|
bt = b.block_type
|
112
111
|
blocks << {
|
@@ -119,7 +118,7 @@ module Caboose
|
|
119
118
|
'constrain' => b.constrain,
|
120
119
|
'full_width' => b.full_width,
|
121
120
|
'block_type' => bt,
|
122
|
-
'children' => admin_tree_helper(b)
|
121
|
+
'children' => admin_tree_helper(b,1)
|
123
122
|
#'block_type_id' => bt.id,
|
124
123
|
#'field_type' => bt.field_type,
|
125
124
|
#'allow_child_blocks' => bt.allow_child_blocks,
|
@@ -127,7 +126,6 @@ module Caboose
|
|
127
126
|
}
|
128
127
|
end
|
129
128
|
end
|
130
|
-
# Caboose.log(blocks)
|
131
129
|
render :json => blocks
|
132
130
|
end
|
133
131
|
|
@@ -139,33 +137,34 @@ module Caboose
|
|
139
137
|
crumbs << {
|
140
138
|
:block_id => b.id,
|
141
139
|
:text => bt.description
|
142
|
-
# :text => b.name && b.name.downcase != bt.description.downcase ? "#{bt.description} (#{b.name})" : bt.description
|
143
140
|
}
|
144
141
|
b = b.parent
|
145
142
|
end
|
146
143
|
return crumbs.reverse
|
147
144
|
end
|
148
145
|
|
149
|
-
def admin_tree_helper(b)
|
146
|
+
def admin_tree_helper(b,level)
|
150
147
|
arr = []
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
148
|
+
if level < 3
|
149
|
+
b.filtered_children(true,true).each do |b2|
|
150
|
+
bt = b2.block_type
|
151
|
+
arr << {
|
152
|
+
'id' => b2.id,
|
153
|
+
'parent_id' => (b2.new_parent_id.blank? ? b2.parent_id : b2.new_parent_id),
|
154
|
+
'page_id' => b2.page_id,
|
155
|
+
'post_id' => b2.post_id,
|
156
|
+
'name' => b2.name,
|
157
|
+
'value' => (b2.new_value.blank? ? b2.value : (b2.new_value == 'EMPTY' ? nil : b2.new_value)),
|
158
|
+
'constrain' => b2.constrain,
|
159
|
+
'full_width' => b2.full_width,
|
160
|
+
'block_type' => bt,
|
161
|
+
'children' => admin_tree_helper(b2,level+1)
|
162
|
+
#'block_type_id' => bt.id,
|
163
|
+
#'field_type' => bt.field_type,
|
164
|
+
#'allow_child_blocks' => bt.allow_child_blocks,
|
165
|
+
#'use_js_for_modal' => bt.use_js_for_modal,
|
166
|
+
}
|
167
|
+
end
|
169
168
|
end
|
170
169
|
return arr
|
171
170
|
end
|
@@ -585,7 +584,7 @@ module Caboose
|
|
585
584
|
resp = StdClass.new
|
586
585
|
b = Block.find(params[:id])
|
587
586
|
# sibs = b.siblings
|
588
|
-
parent_id = b.parent_id
|
587
|
+
parent_id = b.new_parent_id.blank? ? b.parent_id : b.new_parent_id
|
589
588
|
if b.parent_id
|
590
589
|
if params[:page_id]
|
591
590
|
resp.redirect = "/admin/pages/#{b.page_id}/blocks/#{b.parent_id}/edit"
|
@@ -618,6 +617,7 @@ module Caboose
|
|
618
617
|
|
619
618
|
|
620
619
|
if parent_id
|
620
|
+
# Caboose.log("reorganizing blocks under #{parent_id}")
|
621
621
|
# i = 0
|
622
622
|
# Block.where(:parent_id => parent_id).where('status != ?', 'deleted').order(:new_sort_order).all.each do |b2|
|
623
623
|
# b2.new_sort_order = i
|
@@ -707,7 +707,7 @@ module Caboose
|
|
707
707
|
b.new_sort_order = (b2.new_sort_order.blank? ? b2.sort_order : b2.new_sort_order)
|
708
708
|
i = 1
|
709
709
|
sibs = b2.siblings(b.new_sort_order)
|
710
|
-
|
710
|
+
Caboose.log("updating #{sibs.count} siblings")
|
711
711
|
sibs.each do |b3|
|
712
712
|
b3.new_sort_order = b.new_sort_order + i
|
713
713
|
b3.status = 'edited' if b3.status == 'published'
|
@@ -719,7 +719,7 @@ module Caboose
|
|
719
719
|
b.new_sort_order = (b2.new_sort_order.blank? ? (b2.sort_order + 1) : (b2.new_sort_order + 1))
|
720
720
|
i = 1
|
721
721
|
sibs = b2.siblings(b.new_sort_order)
|
722
|
-
|
722
|
+
Caboose.log("updating #{sibs.count} siblings")
|
723
723
|
sibs.each do |b3|
|
724
724
|
b3.new_sort_order = b.new_sort_order + i
|
725
725
|
b3.status = 'edited' if b3.status == 'published'
|
@@ -226,9 +226,11 @@ module Caboose
|
|
226
226
|
@preview = false
|
227
227
|
end
|
228
228
|
|
229
|
-
# @route GET /
|
230
|
-
def
|
229
|
+
# @route GET /pages/preview/:id
|
230
|
+
def preview
|
231
231
|
@page = Page.find(params[:id])
|
232
|
+
<<<<<<< HEAD
|
233
|
+
=======
|
232
234
|
# redirect_to "/login?return_url=/admin/pages/#{@page.id}/preview" and return if @logged_in_user.nil?
|
233
235
|
# condition = @logged_in_user && (@logged_in_user.is_super_admin? || (@logged_in_user.site_id == @page.site_id && ( @logged_in_user.is_allowed('all','all') || @logged_in_user.is_allowed('pages','edit') && Page.permissible_actions(@logged_in_user, @page.id).include?('edit'))))
|
234
236
|
condition = @page.site_id == @site.id
|
@@ -237,8 +239,13 @@ module Caboose
|
|
237
239
|
# redirect_to "/admin/pages/#{@page.id}/layout"
|
238
240
|
# return
|
239
241
|
# end
|
242
|
+
>>>>>>> 97f4d33f3f6719b2f17156cf09d0883ee55a5c65
|
240
243
|
@editing = true
|
241
244
|
@preview = true
|
245
|
+
if @page.nil? || @page.site_id != @site.id
|
246
|
+
redirect_to "/"
|
247
|
+
return
|
248
|
+
end
|
242
249
|
end
|
243
250
|
|
244
251
|
# @route GET /admin/pages/:id/layout
|
data/app/models/caboose/block.rb
CHANGED
@@ -539,7 +539,7 @@ class Caboose::Block < ActiveRecord::Base
|
|
539
539
|
|
540
540
|
# block siblings (in editing mode)
|
541
541
|
def siblings(min_sort_order=0)
|
542
|
-
Caboose::Block.where(:name => nil).where('new_sort_order >= ?',min_sort_order).where("(new_parent_id is null and parent_id = ? and status != ?) OR (new_parent_id = ? and status != ?)",self.parent_id,'deleted',self.parent_id,'deleted').order(:new_sort_order, :id).all
|
542
|
+
Caboose::Block.where(:name => nil).where('new_sort_order >= ?',min_sort_order).where("(new_parent_id is null and parent_id = ? and status != ?) OR (new_parent_id = ? and status != ?)",(self.new_parent_id.blank? ? self.parent_id : self.new_parent_id),'deleted',(self.new_parent_id.blank? ? self.parent_id : self.new_parent_id),'deleted').order(:new_sort_order, :id).all
|
543
543
|
end
|
544
544
|
|
545
545
|
# Move a block up
|
@@ -50,7 +50,7 @@ $(document).ready(function() {
|
|
50
50
|
.append("<span id='m-unpub'>unpublished changes</span>")
|
51
51
|
.append($('<a/>').attr('href', '/admin/pages').html("< Back"))
|
52
52
|
.append($('<a/>').attr('href', '/admin/pages/<%= @page.id %>/revert').html("Revert"))
|
53
|
-
.append($('<a/>').attr('href', '/
|
53
|
+
.append($('<a/>').attr('href', '/pages/preview/<%= @page.id %>').attr('target','_blank').html("Preview"))
|
54
54
|
.append($('<a/>').attr('href', '/admin/pages/<%= @page.id %>/publish').html("Publish"))
|
55
55
|
<% if @page.page_custom_field_values.count > 0 %>
|
56
56
|
.append($('<a/>').attr('href', '#').html('Custom Fields').click(function(e) { e.preventDefault(); caboose_modal_url('/admin/pages/<%= @page.id %>/custom-fields'); }))
|
@@ -0,0 +1 @@
|
|
1
|
+
|
data/lib/caboose/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caboose-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.139
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
@@ -1072,8 +1072,8 @@ files:
|
|
1072
1072
|
- app/views/caboose/pages/admin_edit_seo.html.erb
|
1073
1073
|
- app/views/caboose/pages/admin_index.html.erb
|
1074
1074
|
- app/views/caboose/pages/admin_new.html.erb
|
1075
|
-
- app/views/caboose/pages/admin_preview.html.erb
|
1076
1075
|
- app/views/caboose/pages/admin_sitemap.html.erb
|
1076
|
+
- app/views/caboose/pages/preview.html.erb
|
1077
1077
|
- app/views/caboose/pages/show.html.erb
|
1078
1078
|
- app/views/caboose/pages/test.html.erb
|
1079
1079
|
- app/views/caboose/pages/update_pic.html.erb
|
@@ -1252,7 +1252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1252
1252
|
version: '0'
|
1253
1253
|
requirements: []
|
1254
1254
|
rubyforge_project:
|
1255
|
-
rubygems_version: 2.
|
1255
|
+
rubygems_version: 2.2.0
|
1256
1256
|
signing_key:
|
1257
1257
|
specification_version: 4
|
1258
1258
|
summary: CMS built on rails.
|
@@ -1 +0,0 @@
|
|
1
|
-
|