caboose-cms 0.8.58 → 0.8.59
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/admin_post_edit_content.js +95 -108
- data/app/assets/javascripts/caboose/{admin_page_edit_content.js → block_content_controller.js} +67 -73
- data/app/assets/javascripts/caboose/block_modal_controllers/block_modal_controller.js +28 -33
- data/app/assets/javascripts/caboose/block_modal_controllers/button_modal_controller.js +2 -0
- data/app/assets/javascripts/caboose/block_modal_controllers/media_modal_controller.js +22 -17
- data/app/assets/javascripts/caboose/block_modal_controllers/richtext_modal_controller.js +2 -0
- data/app/assets/javascripts/caboose/modal_controller.js +40 -4
- data/app/views/caboose/pages/admin_edit_content.html.erb +8 -8
- data/app/views/caboose/pages/show.html.erb +3 -1
- data/app/views/caboose/posts/admin_edit_content.html.erb +70 -5
- data/lib/caboose/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8854c5eb4ae1dee3f1374f0fb4d2a62068aa9760
|
4
|
+
data.tar.gz: b2d414cfa6f72c0fd78cafcea2de5cd26345031e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31d8ad0c0727e6e7fac55698f42936be2edc61195ffc7cff9697578a754a283b32029db0cf10d7ad47ce5b2b817ea84230876306dc0a605d8fd6d25012e38917
|
7
|
+
data.tar.gz: 4b643e9870a550a767c6878e396204cb09e1414b4b25c821364c820cabf2573b9d0bdb6fbb29eb033548a13b54c356373087ba589b114124e70950b64031ad80
|
@@ -6,80 +6,68 @@ PostContentController.prototype = {
|
|
6
6
|
post_id: false,
|
7
7
|
new_block_type_id: false,
|
8
8
|
selected_block_ids: [],
|
9
|
+
blocks: false,
|
10
|
+
assets_path: false,
|
11
|
+
included_assets: false,
|
9
12
|
|
10
|
-
init: function(
|
13
|
+
init: function(params)
|
11
14
|
{
|
12
|
-
this.post_id = post_id;
|
13
15
|
var that = this;
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
for (var i in params)
|
17
|
+
that[i] = params[i];
|
18
|
+
that.refresh_blocks(function() {
|
19
|
+
that.set_clickable();
|
20
|
+
});
|
18
21
|
},
|
19
22
|
|
20
|
-
|
21
|
-
{
|
22
|
-
//var that = this;
|
23
|
-
//$('.sortable').sortable({
|
24
|
-
// //hoverClass: "ui-state-active",
|
25
|
-
// placeholder: 'sortable-placeholder',
|
26
|
-
// forcePlaceholderSize: true,
|
27
|
-
// handle: '.sort_handle',
|
28
|
-
// receive: function(e, ui) {
|
29
|
-
// that.new_block_type_id = ui.item.attr('id').replace('new_block_', '');
|
30
|
-
// },
|
31
|
-
// update: function(e, ui) {
|
32
|
-
// if (that.new_block_type_id)
|
33
|
-
// {
|
34
|
-
// $.ajax({
|
35
|
-
// url: '/admin/posts/' + that.post_id + '/blocks',
|
36
|
-
// type: 'post',
|
37
|
-
// data: { block_type_id: that.new_block_type_id, index: ui.item.index() },
|
38
|
-
// success: function(resp) { that.render_blocks(function() { that.edit_block(resp.block.id); }); }
|
39
|
-
// });
|
40
|
-
// that.new_block_type_id = false;
|
41
|
-
// }
|
42
|
-
// else
|
43
|
-
// {
|
44
|
-
// var ids = [];
|
45
|
-
// $.each($(e.target).children(), function(i, el) {
|
46
|
-
// var id = $(el).attr('id');
|
47
|
-
// if (id && id.substr(0, 6) == 'block_') ids.push(id.substr(6));
|
48
|
-
// });
|
49
|
-
//
|
50
|
-
// $.ajax({
|
51
|
-
// url: '/admin/posts/' + that.post_id + '/block-order',
|
52
|
-
// type: 'put',
|
53
|
-
// data: {
|
54
|
-
// block_ids: ids,
|
55
|
-
// },
|
56
|
-
// success: function(resp) {}
|
57
|
-
// });
|
58
|
-
// }
|
59
|
-
// }
|
60
|
-
//});
|
61
|
-
},
|
62
|
-
|
63
|
-
draggable_blocks: function()
|
23
|
+
refresh_blocks: function(callback)
|
64
24
|
{
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
25
|
+
var that = this;
|
26
|
+
$.ajax({
|
27
|
+
url: '/admin/posts/' + that.page_id + '/blocks/tree',
|
28
|
+
type: 'get',
|
29
|
+
success: function(resp) {
|
30
|
+
that.blocks = resp;
|
31
|
+
if (callback) callback();
|
32
|
+
}
|
70
33
|
});
|
71
34
|
},
|
72
35
|
|
73
36
|
edit_block: function(block_id)
|
74
37
|
{
|
75
|
-
|
38
|
+
var that = this;
|
39
|
+
var b = that.block_with_id(block_id);
|
40
|
+
var modal_controller = '';
|
41
|
+
if (b.block_type.use_js_for_modal == true) {
|
42
|
+
if (b.name)
|
43
|
+
$.each(b.name.split('_'), function(j, word) { modal_controller += word.charAt(0).toUpperCase() + word.toLowerCase().slice(1); });
|
44
|
+
else
|
45
|
+
$.each(b.block_type.name.split('_'), function(j, word) { modal_controller += word.charAt(0).toUpperCase() + word.toLowerCase().slice(1); });
|
46
|
+
}
|
47
|
+
else if (b.block_type.field_type == 'image') { modal_controller = 'Media'; }
|
48
|
+
else if (b.block_type.field_type == 'richtext') { modal_controller = 'Richtext'; }
|
49
|
+
else { modal_controller = 'Block'; }
|
50
|
+
that.modal = eval("new " + modal_controller + "ModalController({ " +
|
51
|
+
" post_id: " + that.post_id + ", " +
|
52
|
+
" block_id: " + block_id + ", " +
|
53
|
+
" authenticity_token: '" + that.authenticity_token + "', " +
|
54
|
+
" parent_controller: this, " +
|
55
|
+
" assets_path: '" + that.assets_path + "'" +
|
56
|
+
"})"
|
57
|
+
);
|
76
58
|
},
|
77
59
|
|
78
60
|
new_block: function(block_id)
|
79
61
|
{
|
80
|
-
|
81
|
-
|
82
|
-
|
62
|
+
var that = this;
|
63
|
+
that.modal = new BlockModalController({
|
64
|
+
post_id: that.post_id,
|
65
|
+
block_id: parent_id,
|
66
|
+
authenticity_token: that.authenticity_token,
|
67
|
+
parent_controller: this,
|
68
|
+
assets_path: that.assets_path,
|
69
|
+
new_block_on_init: true
|
70
|
+
})
|
83
71
|
},
|
84
72
|
|
85
73
|
select_block: function(block_id)
|
@@ -187,35 +175,31 @@ PostContentController.prototype = {
|
|
187
175
|
Block Rendering
|
188
176
|
*****************************************************************************/
|
189
177
|
|
190
|
-
render_blocks: function(before_render)
|
178
|
+
render_blocks: function(before_render)
|
179
|
+
{
|
180
|
+
var that = this;
|
191
181
|
$('.sortable').sortable('destroy');
|
192
182
|
var that = this;
|
193
183
|
$.ajax({
|
194
|
-
url: '/admin/
|
195
|
-
success: function(blocks) {
|
184
|
+
url: '/admin/pages/' + this.page_id + '/blocks/render-second-level',
|
185
|
+
success: function(blocks) {
|
196
186
|
if (before_render) before_render();
|
197
187
|
$(blocks).each(function(i, b) {
|
198
188
|
$('#block_' + b.id).replaceWith(b.html);
|
199
189
|
});
|
200
|
-
that.set_clickable();
|
201
|
-
that.sortable_blocks();
|
190
|
+
that.refresh_blocks(function() { that.set_clickable(); });
|
202
191
|
that.selected_block_ids = [];
|
203
192
|
}
|
204
193
|
});
|
205
|
-
},
|
206
|
-
|
194
|
+
},
|
195
|
+
|
207
196
|
set_clickable: function()
|
208
|
-
{
|
209
|
-
var that = this;
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
$(blocks).each(function(i,b) {
|
215
|
-
that.set_clickable_helper(b, false, false, (i == count-1));
|
216
|
-
});
|
217
|
-
}
|
218
|
-
});
|
197
|
+
{
|
198
|
+
var that = this;
|
199
|
+
var count = that.blocks.length;
|
200
|
+
$(that.blocks).each(function(i,b) {
|
201
|
+
that.set_clickable_helper(b, false, false, (i == count-1));
|
202
|
+
});
|
219
203
|
},
|
220
204
|
|
221
205
|
set_clickable_helper: function(b, parent_id, parent_allows_child_blocks, is_last_child)
|
@@ -230,15 +214,15 @@ PostContentController.prototype = {
|
|
230
214
|
|
231
215
|
if (parent_allows_child_blocks && (!b.name || b.name.length == 0))
|
232
216
|
{
|
233
|
-
$('#block_' + b.id).
|
217
|
+
$('#block_' + b.id).before($('<div/>')
|
234
218
|
.addClass('new_block_link')
|
235
219
|
.append($('<div/>').addClass('line'))
|
236
220
|
.append($('<a/>')
|
237
221
|
.attr('href', '#')
|
238
222
|
.html("New Block")
|
239
223
|
.click(function(e) {
|
240
|
-
e.preventDefault(); e.stopPropagation();
|
241
|
-
|
224
|
+
e.preventDefault(); e.stopPropagation();
|
225
|
+
that.new_block(parent_id, b.id);
|
242
226
|
})
|
243
227
|
)
|
244
228
|
.mouseover(function(e) { $(this).removeClass('new_block_link').addClass('new_block_link_over'); e.stopPropagation(); })
|
@@ -246,15 +230,15 @@ PostContentController.prototype = {
|
|
246
230
|
);
|
247
231
|
if (is_last_child && is_last_child == true)
|
248
232
|
{
|
249
|
-
$('#block_' + b.id).
|
233
|
+
$('#block_' + b.id).after($('<div/>')
|
250
234
|
.addClass('new_block_link')
|
251
235
|
.append($('<div/>').addClass('line'))
|
252
236
|
.append($('<a/>')
|
253
237
|
.attr('href', '#')
|
254
238
|
.html("New Block")
|
255
239
|
.click(function(e) {
|
256
|
-
e.preventDefault(); e.stopPropagation();
|
257
|
-
|
240
|
+
e.preventDefault(); e.stopPropagation();
|
241
|
+
that.new_block(parent_id, null, b.id);
|
258
242
|
})
|
259
243
|
)
|
260
244
|
.mouseover(function(e) { $(this).removeClass('new_block_link').addClass('new_block_link_over'); e.stopPropagation(); })
|
@@ -262,9 +246,11 @@ PostContentController.prototype = {
|
|
262
246
|
);
|
263
247
|
}
|
264
248
|
}
|
265
|
-
|
266
|
-
$('#block_' + b.id).attr('onclick','').unbind('click');
|
249
|
+
|
250
|
+
$('#block_' + b.id + ' *').attr('onclick', '').unbind('click');
|
251
|
+
$('#block_' + b.id).attr('onclick','').unbind('click');
|
267
252
|
$('#block_' + b.id).click(function(e) {
|
253
|
+
e.preventDefault();
|
268
254
|
e.stopPropagation();
|
269
255
|
that.edit_block(b.id);
|
270
256
|
});
|
@@ -274,40 +260,41 @@ PostContentController.prototype = {
|
|
274
260
|
{
|
275
261
|
var count = b.children.length;
|
276
262
|
$.each(b.children, function(i, b2) {
|
277
|
-
if (b2.field_type == 'block')
|
263
|
+
if (b2.block_type.field_type == 'block')
|
278
264
|
show_mouseover = false;
|
279
|
-
that.set_clickable_helper(b2, b.id, b.allow_child_blocks, i == (count-1));
|
265
|
+
that.set_clickable_helper(b2, b.id, b.block_type.allow_child_blocks, i == (count-1));
|
280
266
|
});
|
281
|
-
}
|
282
|
-
//if (b.allow_child_blocks)
|
283
|
-
//{
|
284
|
-
// $('#block_' + b.id).after($('<div/>')
|
285
|
-
// .addClass('new_block_link')
|
286
|
-
// .append($('<div/>').addClass('line'))
|
287
|
-
// .append($('<a/>')
|
288
|
-
// .attr('href', '#')
|
289
|
-
// .html("New Block")
|
290
|
-
// .click(function(e) {
|
291
|
-
// e.preventDefault(); e.stopPropagation();
|
292
|
-
// caboose_modal_url('/admin/posts/' + that.post_id + '/blocks/' + b.id + '/new?after_id=' + b.id);
|
293
|
-
// })
|
294
|
-
// )
|
295
|
-
// .mouseover(function(e) { $(this).removeClass('new_block_link').addClass('new_block_link_over'); e.stopPropagation(); })
|
296
|
-
// .mouseout(function(e) { $(this).removeClass('new_block_link_over').addClass('new_block_link'); e.stopPropagation(); })
|
297
|
-
// );
|
298
|
-
//}
|
267
|
+
}
|
299
268
|
if (show_mouseover)
|
300
269
|
{
|
301
270
|
$('#block_' + b.id).mouseover(function(el) { $('#block_' + b.id).addClass( 'block_over'); });
|
302
271
|
$('#block_' + b.id).mouseout(function(el) { $('#block_' + b.id).removeClass('block_over'); });
|
303
272
|
}
|
304
|
-
}
|
273
|
+
},
|
274
|
+
|
275
|
+
/*****************************************************************************
|
276
|
+
Helper methods
|
277
|
+
*****************************************************************************/
|
305
278
|
|
279
|
+
block_with_id: function(block_id, b)
|
280
|
+
{
|
281
|
+
var that = this;
|
282
|
+
if (b && b.id == block_id)
|
283
|
+
return b;
|
284
|
+
var the_block = false;
|
285
|
+
if ((!b && that.blocks) || (b && b.children))
|
286
|
+
{
|
287
|
+
$.each(b ? b.children : that.blocks, function(i, b2) {
|
288
|
+
the_block = that.block_with_id(block_id, b2);
|
289
|
+
if (the_block)
|
290
|
+
return false;
|
291
|
+
});
|
292
|
+
}
|
293
|
+
return the_block;
|
294
|
+
}
|
306
295
|
};
|
307
296
|
|
308
297
|
function toggle_blocks()
|
309
298
|
{
|
310
299
|
$('#new_blocks_container2').slideToggle();
|
311
300
|
}
|
312
|
-
|
313
|
-
|
data/app/assets/javascripts/caboose/{admin_page_edit_content.js → block_content_controller.js}
RENAMED
@@ -1,14 +1,16 @@
|
|
1
1
|
|
2
|
-
var
|
2
|
+
var BlockContentController = function(params) { this.init(params); };
|
3
3
|
|
4
|
-
|
4
|
+
BlockContentController.prototype = {
|
5
5
|
|
6
|
+
post_id: false,
|
6
7
|
page_id: false,
|
7
8
|
new_block_type_id: false,
|
8
9
|
selected_block_ids: [],
|
9
10
|
blocks: false,
|
10
11
|
assets_path: false,
|
11
12
|
included_assets: false,
|
13
|
+
mc: false,
|
12
14
|
|
13
15
|
init: function(params)
|
14
16
|
{
|
@@ -16,15 +18,16 @@ PageContentController.prototype = {
|
|
16
18
|
for (var i in params)
|
17
19
|
that[i] = params[i];
|
18
20
|
that.refresh_blocks(function() {
|
19
|
-
that.set_clickable();
|
20
|
-
});
|
21
|
+
that.set_clickable();
|
22
|
+
});
|
23
|
+
that.mc = new ModalController({ parent_controller: this, assets_path: that.assets_path });
|
21
24
|
},
|
22
25
|
|
23
26
|
refresh_blocks: function(callback)
|
24
27
|
{
|
25
28
|
var that = this;
|
26
29
|
$.ajax({
|
27
|
-
url:
|
30
|
+
url: that.base_url() + '/tree',
|
28
31
|
type: 'get',
|
29
32
|
success: function(resp) {
|
30
33
|
that.blocks = resp;
|
@@ -32,55 +35,62 @@ PageContentController.prototype = {
|
|
32
35
|
}
|
33
36
|
});
|
34
37
|
},
|
35
|
-
|
36
|
-
draggable_blocks: function()
|
37
|
-
{
|
38
|
-
$('#new_blocks li').draggable({
|
39
|
-
dropOnEmpty: true,
|
40
|
-
connectToSortable: "#blocks",
|
41
|
-
helper: "clone",
|
42
|
-
revert: "invalid"
|
43
|
-
});
|
44
|
-
},
|
45
38
|
|
46
39
|
edit_block: function(block_id)
|
47
|
-
{
|
48
|
-
console.log('PageContentController.edit_block');
|
40
|
+
{
|
49
41
|
var that = this;
|
50
42
|
var b = that.block_with_id(block_id);
|
43
|
+
var bt = b.block_type;
|
44
|
+
var ft = bt.field_type; // == 'image' || bt.field_type == 'file' ? 'media' : bt.field_type;
|
45
|
+
|
51
46
|
var modal_controller = '';
|
52
|
-
if (
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
else { modal_controller = 'Block'; }
|
61
|
-
that.modal = eval("new " + modal_controller + "ModalController({ " +
|
62
|
-
" page_id: " + that.page_id + ", " +
|
47
|
+
if (bt.use_js_for_modal == true) { modal_controller = b.name ? b.name : bt.name; }
|
48
|
+
else if (ft == 'image') { modal_controller = 'media'; }
|
49
|
+
else if (ft == 'file') { modal_controller = 'media'; }
|
50
|
+
else if (ft == 'richtext') { modal_controller = 'richtext'; }
|
51
|
+
else { modal_controller = 'block'; }
|
52
|
+
|
53
|
+
var new_modal_eval_string = "new " + that.underscores_to_camelcase(modal_controller) + "ModalController({ " +
|
54
|
+
" " + (that.page_id && that.page_id != null ? "page_id: " + that.page_id : "post_id: " + that.post_id) + ", " +
|
63
55
|
" block_id: " + block_id + ", " +
|
64
56
|
" authenticity_token: '" + that.authenticity_token + "', " +
|
65
|
-
" parent_controller:
|
57
|
+
" parent_controller: that, " +
|
66
58
|
" assets_path: '" + that.assets_path + "'" +
|
67
|
-
"})"
|
68
|
-
|
59
|
+
"})";
|
60
|
+
|
61
|
+
var js_file = 'caboose/block_modal_controllers/' + modal_controller + '_modal_controller.js';
|
62
|
+
if (!that.mc.asset_included(js_file))
|
63
|
+
{
|
64
|
+
// Include the file before instantiating the controller
|
65
|
+
$(document).on(modal_controller + '_modal_controller_loaded', function() { that.modal = eval(new_modal_eval_string); });
|
66
|
+
that.mc.include_assets(js_file);
|
67
|
+
}
|
68
|
+
else // We're good, go ahead and instantiate
|
69
|
+
{
|
70
|
+
that.modal = eval(new_modal_eval_string);
|
71
|
+
}
|
69
72
|
},
|
70
73
|
|
71
|
-
|
74
|
+
underscores_to_camelcase: function(str)
|
72
75
|
{
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
76
|
+
var str2 = '';
|
77
|
+
$.each(str.split('_'), function(j, word) { str2 += word.charAt(0).toUpperCase() + word.toLowerCase().slice(1); });
|
78
|
+
return str2;
|
79
|
+
},
|
80
|
+
|
81
|
+
new_block: function(parent_id, before_block_id, after_block_id)
|
82
|
+
{
|
83
|
+
var that = this;
|
84
|
+
var options = {
|
78
85
|
block_id: parent_id,
|
79
86
|
authenticity_token: that.authenticity_token,
|
80
87
|
parent_controller: this,
|
81
88
|
assets_path: that.assets_path,
|
82
89
|
new_block_on_init: true
|
83
|
-
}
|
90
|
+
}
|
91
|
+
if (that.page_id && that.page_id != null) options['page_id'] = that.page_id;
|
92
|
+
else options['post_id'] = that.post_id;
|
93
|
+
that.modal = new BlockModalController(options)
|
84
94
|
},
|
85
95
|
|
86
96
|
select_block: function(block_id)
|
@@ -124,7 +134,7 @@ PageContentController.prototype = {
|
|
124
134
|
for (var i in this.selected_block_ids)
|
125
135
|
{
|
126
136
|
$.ajax({
|
127
|
-
url:
|
137
|
+
url: that.base_url() + '/' + this.selected_block_ids[i],
|
128
138
|
type: 'delete',
|
129
139
|
async: false,
|
130
140
|
success: function(resp) {}
|
@@ -138,7 +148,7 @@ PageContentController.prototype = {
|
|
138
148
|
var that = this;
|
139
149
|
this.loadify($('#block_' + block_id + '_move_up_handle span'));
|
140
150
|
$.ajax({
|
141
|
-
url:
|
151
|
+
url: that.base_url() + '/' + block_id + '/move-up',
|
142
152
|
type: 'put',
|
143
153
|
success: function(resp) {
|
144
154
|
if (resp.success) that.render_blocks(function() { that.stop_loadify(); });
|
@@ -151,7 +161,7 @@ PageContentController.prototype = {
|
|
151
161
|
var that = this;
|
152
162
|
this.loadify($('#block_' + block_id + '_move_down_handle span'));
|
153
163
|
$.ajax({
|
154
|
-
url:
|
164
|
+
url: that.base_url() + '/' + block_id + '/move-down',
|
155
165
|
type: 'put',
|
156
166
|
success: function(resp) {
|
157
167
|
if (resp.success) that.render_blocks(function() { that.stop_loadify(); });
|
@@ -194,7 +204,7 @@ PageContentController.prototype = {
|
|
194
204
|
$('.sortable').sortable('destroy');
|
195
205
|
var that = this;
|
196
206
|
$.ajax({
|
197
|
-
url:
|
207
|
+
url: that.base_url() + '/render-second-level',
|
198
208
|
success: function(blocks) {
|
199
209
|
if (before_render) before_render();
|
200
210
|
$(blocks).each(function(i, b) {
|
@@ -207,7 +217,7 @@ PageContentController.prototype = {
|
|
207
217
|
},
|
208
218
|
|
209
219
|
set_clickable: function()
|
210
|
-
{
|
220
|
+
{
|
211
221
|
var that = this;
|
212
222
|
var count = that.blocks.length;
|
213
223
|
$(that.blocks).each(function(i,b) {
|
@@ -216,9 +226,8 @@ PageContentController.prototype = {
|
|
216
226
|
},
|
217
227
|
|
218
228
|
set_clickable_helper: function(b, parent_id, parent_allows_child_blocks, is_last_child)
|
219
|
-
{
|
220
|
-
var that = this;
|
221
|
-
|
229
|
+
{
|
230
|
+
var that = this;
|
222
231
|
$('#block_' + b.id)
|
223
232
|
.prepend($('<a/>').attr('id', 'block_' + b.id + '_select_handle' ).addClass('select_handle' ).append($('<span/>').addClass('ui-icon ui-icon-check' )).click(function(e) { e.preventDefault(); e.stopPropagation(); that.select_block(b.id); }))
|
224
233
|
.prepend($('<a/>').attr('id', 'block_' + b.id + '_move_up_handle' ).addClass('move_up_handle' ).append($('<span/>').addClass('ui-icon ui-icon-arrow-1-n' )).click(function(e) { e.preventDefault(); e.stopPropagation(); that.move_block_up(b.id); }))
|
@@ -234,8 +243,7 @@ PageContentController.prototype = {
|
|
234
243
|
.attr('href', '#')
|
235
244
|
.html("New Block")
|
236
245
|
.click(function(e) {
|
237
|
-
e.preventDefault(); e.stopPropagation();
|
238
|
-
console.log('Adding new block...');
|
246
|
+
e.preventDefault(); e.stopPropagation();
|
239
247
|
that.new_block(parent_id, b.id);
|
240
248
|
})
|
241
249
|
)
|
@@ -251,8 +259,7 @@ PageContentController.prototype = {
|
|
251
259
|
.attr('href', '#')
|
252
260
|
.html("New Block")
|
253
261
|
.click(function(e) {
|
254
|
-
e.preventDefault(); e.stopPropagation();
|
255
|
-
console.log('Adding new block...');
|
262
|
+
e.preventDefault(); e.stopPropagation();
|
256
263
|
that.new_block(parent_id, null, b.id);
|
257
264
|
})
|
258
265
|
)
|
@@ -264,9 +271,9 @@ PageContentController.prototype = {
|
|
264
271
|
|
265
272
|
$('#block_' + b.id + ' *').attr('onclick', '').unbind('click');
|
266
273
|
$('#block_' + b.id).attr('onclick','').unbind('click');
|
267
|
-
$('#block_' + b.id).click(function(e) {
|
274
|
+
$('#block_' + b.id).click(function(e) {
|
268
275
|
e.preventDefault();
|
269
|
-
e.stopPropagation();
|
276
|
+
e.stopPropagation();
|
270
277
|
that.edit_block(b.id);
|
271
278
|
});
|
272
279
|
|
@@ -279,24 +286,7 @@ PageContentController.prototype = {
|
|
279
286
|
show_mouseover = false;
|
280
287
|
that.set_clickable_helper(b2, b.id, b.block_type.allow_child_blocks, i == (count-1));
|
281
288
|
});
|
282
|
-
}
|
283
|
-
//if (b.allow_child_blocks)
|
284
|
-
//{
|
285
|
-
// $('#block_' + b.id).after($('<div/>')
|
286
|
-
// .addClass('new_block_link')
|
287
|
-
// .append($('<div/>').addClass('line'))
|
288
|
-
// .append($('<a/>')
|
289
|
-
// .attr('href', '#')
|
290
|
-
// .html("New Block")
|
291
|
-
// .click(function(e) {
|
292
|
-
// e.preventDefault(); e.stopPropagation();
|
293
|
-
// caboose_modal_url('/admin/pages/' + that.page_id + '/blocks/' + b.id + '/new?after_id=' + b.id);
|
294
|
-
// })
|
295
|
-
// )
|
296
|
-
// .mouseover(function(e) { $(this).removeClass('new_block_link').addClass('new_block_link_over'); e.stopPropagation(); })
|
297
|
-
// .mouseout(function(e) { $(this).removeClass('new_block_link_over').addClass('new_block_link'); e.stopPropagation(); })
|
298
|
-
// );
|
299
|
-
//}
|
289
|
+
}
|
300
290
|
if (show_mouseover)
|
301
291
|
{
|
302
292
|
$('#block_' + b.id).mouseover(function(el) { $('#block_' + b.id).addClass( 'block_over'); });
|
@@ -323,12 +313,16 @@ PageContentController.prototype = {
|
|
323
313
|
});
|
324
314
|
}
|
325
315
|
return the_block;
|
326
|
-
}
|
316
|
+
},
|
317
|
+
|
318
|
+
base_url: function()
|
319
|
+
{
|
320
|
+
var that = this;
|
321
|
+
return '/admin/' + (that.page_id && that.page_id != null ? 'pages/' + that.page_id : 'posts/' + that.post_id) + '/blocks';
|
322
|
+
}
|
327
323
|
};
|
328
324
|
|
329
325
|
function toggle_blocks()
|
330
326
|
{
|
331
327
|
$('#new_blocks_container2').slideToggle();
|
332
328
|
}
|
333
|
-
|
334
|
-
|
@@ -2,6 +2,7 @@
|
|
2
2
|
var BlockModalController = ModalController.extend({
|
3
3
|
|
4
4
|
page_id: false,
|
5
|
+
post_id: false,
|
5
6
|
block_id: false,
|
6
7
|
block: false,
|
7
8
|
block_types: false,
|
@@ -33,12 +34,12 @@ var BlockModalController = ModalController.extend({
|
|
33
34
|
|
34
35
|
refresh_block: function(callback)
|
35
36
|
{
|
36
|
-
var that = this
|
37
|
+
var that = this;
|
37
38
|
$.ajax({
|
38
|
-
url:
|
39
|
+
url: that.block_url() + '/tree',
|
39
40
|
type: 'get',
|
40
41
|
success: function(arr) {
|
41
|
-
that.block = arr[0];
|
42
|
+
that.block = arr[0];
|
42
43
|
if (callback) callback();
|
43
44
|
}
|
44
45
|
});
|
@@ -180,10 +181,10 @@ var BlockModalController = ModalController.extend({
|
|
180
181
|
update_url: that.block_url(b),
|
181
182
|
authenticity_token: that.authenticity_token,
|
182
183
|
attributes: [
|
183
|
-
{ name: 'block_type_id' , nice_name: 'Block type' , type: 'select' , value: b.block_type.id , text: b.block_type.name , width: 400, fixed_placeholder: true,
|
184
|
-
{ name: 'parent_id' , nice_name: 'Parent ID' , type: 'select' , value: b.parent_id , text: b.parent ? b.parent.title : '' , width: 400, fixed_placeholder: true,
|
185
|
-
{ name: 'constrain' , nice_name: 'Constrain' , type: 'checkbox' , value: b.constrain ? 1 : 0 , width: 400, fixed_placeholder: true,
|
186
|
-
{ name: 'full_width' , nice_name: 'Full Width' , type: 'checkbox' , value: b.full_width ? 1 : 0 , width: 400, fixed_placeholder: true,
|
184
|
+
{ name: 'block_type_id' , nice_name: 'Block type' , type: 'select' , value: b.block_type.id , text: b.block_type.name , width: 400, fixed_placeholder: true, after_update: function() { that.parent_controller.render_blocks(); that.block.block_type.id = this.value; }, after_cancel: function() { that.parent_controller.render_blocks(); }, on_load: function() { that.modal.autosize(); }, options_url: '/admin/block-types/options' },
|
185
|
+
{ name: 'parent_id' , nice_name: 'Parent ID' , type: 'select' , value: b.parent_id , text: b.parent ? b.parent.title : '' , width: 400, fixed_placeholder: true, after_update: function() { that.parent_controller.render_blocks(); that.block.parent_id = this.value; }, after_cancel: function() { that.parent_controller.render_blocks(); }, on_load: function() { that.modal.autosize(); }, options_url: '/admin/' + (that.page_id ? 'pages/' + that.page_id : 'posts/' + that.post_id) + '/block-options' },
|
186
|
+
{ name: 'constrain' , nice_name: 'Constrain' , type: 'checkbox' , value: b.constrain ? 1 : 0 , width: 400, fixed_placeholder: true, after_update: function() { that.parent_controller.render_blocks(); that.block.constrain = this.value; }, after_cancel: function() { that.parent_controller.render_blocks(); }, on_load: function() { that.modal.autosize(); }},
|
187
|
+
{ name: 'full_width' , nice_name: 'Full Width' , type: 'checkbox' , value: b.full_width ? 1 : 0 , width: 400, fixed_placeholder: true, after_update: function() { that.parent_controller.render_blocks(); that.block.full_width = this.value; }, after_cancel: function() { that.parent_controller.render_blocks(); }, on_load: function() { that.modal.autosize(); }}
|
187
188
|
]
|
188
189
|
});
|
189
190
|
that.autosize();
|
@@ -209,14 +210,13 @@ var BlockModalController = ModalController.extend({
|
|
209
210
|
{
|
210
211
|
if (!b.rendered_value)
|
211
212
|
{
|
212
|
-
$.ajax({
|
213
|
-
block_id: b.id, // Used in the success function
|
213
|
+
$.ajax({
|
214
214
|
url: that.block_url(b) + '/render',
|
215
215
|
type: 'get',
|
216
216
|
success: function(html) {
|
217
|
-
$('#the_modal #block_' +
|
217
|
+
$('#the_modal #block_' + b.id).replaceWith(html);
|
218
218
|
|
219
|
-
var b2 = that.block_with_id(
|
219
|
+
var b2 = that.block_with_id(b.id);
|
220
220
|
b2.rendered_value = html;
|
221
221
|
that.set_clickable(b2);
|
222
222
|
that.autosize();
|
@@ -282,8 +282,8 @@ var BlockModalController = ModalController.extend({
|
|
282
282
|
|
283
283
|
set_clickable: function(b)
|
284
284
|
{
|
285
|
-
var that = this;
|
286
|
-
|
285
|
+
var that = this;
|
286
|
+
|
287
287
|
if (!b)
|
288
288
|
{
|
289
289
|
$.each(that.block.children, function(i,b) {
|
@@ -292,19 +292,10 @@ var BlockModalController = ModalController.extend({
|
|
292
292
|
}
|
293
293
|
|
294
294
|
$('#the_modal #block_' + b.id).attr('onclick','').unbind('click');
|
295
|
-
$('#the_modal #block_' + b.id).click(function(e) {
|
295
|
+
$('#the_modal #block_' + b.id).click(function(e) {
|
296
296
|
e.stopPropagation();
|
297
297
|
that.parent_controller.edit_block(b.id);
|
298
|
-
});
|
299
|
-
//if (b.allow_child_blocks == true)
|
300
|
-
//{
|
301
|
-
// $('#new_block_' + b.id).replaceWith($('<input/>')
|
302
|
-
// .attr('type', 'button')
|
303
|
-
// .val('New Block')
|
304
|
-
// .click(function(e) { e.stopPropagation(); that.new_block(b.id);
|
305
|
-
// })
|
306
|
-
// );
|
307
|
-
//}
|
298
|
+
});
|
308
299
|
var show_mouseover = true;
|
309
300
|
if (b.children && b.children.length > 0)
|
310
301
|
{
|
@@ -394,8 +385,9 @@ var BlockModalController = ModalController.extend({
|
|
394
385
|
type: 'get',
|
395
386
|
success: function(resp) { bt = resp; },
|
396
387
|
async: false
|
397
|
-
});
|
398
|
-
|
388
|
+
});
|
389
|
+
if (bt.use_js_for_modal)
|
390
|
+
that.include_assets('caboose/block_modal_controllers/' + bt.name + '_modal_controller.js');
|
399
391
|
|
400
392
|
var h = {
|
401
393
|
authenticity_token: that.authenticity_token,
|
@@ -404,7 +396,7 @@ var BlockModalController = ModalController.extend({
|
|
404
396
|
if (that.before_id ) h['before_id'] = that.before_id;
|
405
397
|
if (that.after_id ) h['after_id' ] = that.after_id;
|
406
398
|
$.ajax({
|
407
|
-
url:
|
399
|
+
url: that.block_url(),
|
408
400
|
type: 'post',
|
409
401
|
data: h,
|
410
402
|
success: function(resp) {
|
@@ -505,16 +497,17 @@ var BlockModalController = ModalController.extend({
|
|
505
497
|
|
506
498
|
base_url: function(b)
|
507
499
|
{
|
508
|
-
var that = this;
|
509
|
-
if (!b)
|
510
|
-
|
500
|
+
var that = this;
|
501
|
+
if (!b)
|
502
|
+
return '/admin/' + (that.page_id && that.page_id != null ? 'pages/' + that.page_id : 'posts/' + that.post_id) + '/blocks';
|
503
|
+
return '/admin/' + (b.page_id && b.page_id != null ? 'pages/' + b.page_id : 'posts/' + b.post_id) + '/blocks';
|
511
504
|
},
|
512
505
|
|
513
506
|
block_url: function(b)
|
514
507
|
{
|
515
|
-
var that = this;
|
516
|
-
if (!b)
|
517
|
-
return
|
508
|
+
var that = this;
|
509
|
+
if (!b) return that.base_url() + '/' + that.block_id;
|
510
|
+
return that.base_url(b) + '/' + b.id;
|
518
511
|
},
|
519
512
|
|
520
513
|
child_block: function(name, b)
|
@@ -541,3 +534,5 @@ var BlockModalController = ModalController.extend({
|
|
541
534
|
},
|
542
535
|
|
543
536
|
});
|
537
|
+
|
538
|
+
$(document).trigger('block_modal_controller_loaded');
|
@@ -171,7 +171,7 @@ var MediaModalController = BlockModalController.extend({
|
|
171
171
|
.data('media_id', m.id)
|
172
172
|
.click(function(e) { that.print_media_detail($(this).data('media_id')); })
|
173
173
|
.append($('<span/>').addClass('name').html(m.original_name));
|
174
|
-
if (m.image_urls)
|
174
|
+
if (m.image_urls && m.image_urls != undefined)
|
175
175
|
li.append($('<img/>').attr('src', m.image_urls.tiny_url + '?' + d));
|
176
176
|
//if (that.selected_media.indexOf(m.id) > -1)
|
177
177
|
// li.addClass('selected ui-selected');
|
@@ -202,25 +202,28 @@ var MediaModalController = BlockModalController.extend({
|
|
202
202
|
var m = that.media_with_id(media_id);
|
203
203
|
|
204
204
|
var image_urls = $('<div/>').attr('id', 'image_urls').css('margin-bottom', '20px');
|
205
|
-
|
205
|
+
if (m.image_urls)
|
206
206
|
{
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
.
|
212
|
-
|
213
|
-
.append($('<
|
214
|
-
|
215
|
-
|
207
|
+
image_urls.append($('<h2/>').append('Image URLs'));
|
208
|
+
for (var size in m.image_urls)
|
209
|
+
{
|
210
|
+
var s = size.replace('_url', '');
|
211
|
+
s = s[0].toUpperCase() + s.slice(1);
|
212
|
+
var url = m.image_urls[size];
|
213
|
+
image_urls.append($('<div/>')
|
214
|
+
.append($('<span/>').addClass('size').append(s))
|
215
|
+
.append($('<input/>').attr('type', 'text').attr('id', 'size_' + s).addClass('url').val(url))
|
216
|
+
.append($('<button/>').addClass('clippy').data('clipboard-target', '#size_' + s).append('Copy'))
|
217
|
+
);
|
218
|
+
}
|
219
|
+
}
|
216
220
|
|
217
221
|
$('#top_controls').empty();
|
218
222
|
$('#media').empty()
|
219
|
-
.append($('<img/>').attr('id', 'detail_image').attr('src', m.image_urls.thumb_url))
|
223
|
+
.append($('<img/>').attr('id', 'detail_image').attr('src', m.image_urls ? m.image_urls.thumb_url : '//placehold.it/250x250'))
|
220
224
|
.append($('<p/>').append($('<div/>').attr('id', 'media_' + media_id + '_media_category_id' )))
|
221
225
|
.append($('<p/>').append($('<div/>').attr('id', 'media_' + media_id + '_name' )))
|
222
|
-
.append($('<p/>').append($('<div/>').attr('id', 'media_' + media_id + '_description' )))
|
223
|
-
.append($('<h2/>').append('Image URLs'))
|
226
|
+
.append($('<p/>').append($('<div/>').attr('id', 'media_' + media_id + '_description' )))
|
224
227
|
.append(image_urls);
|
225
228
|
$('#modal_controls').empty()
|
226
229
|
.append($('<p/>').css('clear', 'both')
|
@@ -248,9 +251,9 @@ var MediaModalController = BlockModalController.extend({
|
|
248
251
|
$('#media_' + media_id + '_name' + '_container').css('width', '400px');
|
249
252
|
$('#media_' + media_id + '_description' + '_container').css('width', '400px');
|
250
253
|
|
251
|
-
$('#image_urls span.size'
|
252
|
-
$('#image_urls input.url'
|
253
|
-
$('#image_urls button').css('width', '60px');
|
254
|
+
$('#image_urls span.size' ).css('width', '70px').css('display', 'inline-block');
|
255
|
+
$('#image_urls input.url' ).css('width', '270px').css('border', '#ccc 1px solid');
|
256
|
+
$('#image_urls button' ).css('width', '60px');
|
254
257
|
|
255
258
|
//c = new Clipboard('.clippy');
|
256
259
|
//c.on('success', function(e) {
|
@@ -429,3 +432,5 @@ var MediaModalController = BlockModalController.extend({
|
|
429
432
|
},
|
430
433
|
|
431
434
|
});
|
435
|
+
|
436
|
+
$(document).trigger('media_modal_controller_loaded');
|
@@ -6,6 +6,13 @@ var ModalController = Class.extend({
|
|
6
6
|
modal_element: false,
|
7
7
|
parent_controller: false,
|
8
8
|
|
9
|
+
init: function(params)
|
10
|
+
{
|
11
|
+
var that = this;
|
12
|
+
for (var i in params)
|
13
|
+
that[i] = params[i];
|
14
|
+
},
|
15
|
+
|
9
16
|
modal: function(el, width, height, callback)
|
10
17
|
{
|
11
18
|
var that = this;
|
@@ -68,7 +75,7 @@ var ModalController = Class.extend({
|
|
68
75
|
|
69
76
|
// Called at the beginning of init to include modal assets,
|
70
77
|
// and can be called at anytime with more assets
|
71
|
-
include_assets: function(arr)
|
78
|
+
include_assets: function(arr, after)
|
72
79
|
{
|
73
80
|
var that = this;
|
74
81
|
if (!arr) arr = that.assets_to_include();
|
@@ -77,15 +84,36 @@ var ModalController = Class.extend({
|
|
77
84
|
if (!that.parent_controller.included_assets || that.parent_controller.included_assets == undefined)
|
78
85
|
that.parent_controller.included_assets = [];
|
79
86
|
if (typeof arr == 'string') arr = [arr];
|
80
|
-
$.each(arr, function(i, url) {
|
81
|
-
if (that.
|
87
|
+
$.each(arr, function(i, url) {
|
88
|
+
if (that.asset_included(url)) return;
|
82
89
|
var full_url = url.match(/^http:.*?/) || url.match(/^https:.*?$/) || url.match(/^\/\/.*?$/) ? url : that.assets_path + url;
|
83
90
|
if (url.match(/\.js/))
|
84
|
-
{
|
91
|
+
{
|
85
92
|
var el = document.createElement('script');
|
86
93
|
el.setAttribute('type', 'text/javascript');
|
87
94
|
el.setAttribute('src', full_url);
|
88
95
|
document.getElementsByTagName('head')[0].appendChild(el)
|
96
|
+
|
97
|
+
//$.getScript(full_url, function() {
|
98
|
+
// if (after) after();
|
99
|
+
//});
|
100
|
+
//
|
101
|
+
//var trigger = 'script_' + Math.floor((Math.random() * 1000) + 1) + '_loaded'
|
102
|
+
//$(document).on(trigger, function() {
|
103
|
+
// if (after) after();
|
104
|
+
// $(document).unbind(trigger);
|
105
|
+
//});
|
106
|
+
//$.ajax({
|
107
|
+
// trigger: trigger,
|
108
|
+
// url: full_url,
|
109
|
+
// type: 'get',
|
110
|
+
// success: function(js) {
|
111
|
+
// var el = document.createElement('script');
|
112
|
+
// el.setAttribute('type', 'text/javascript');
|
113
|
+
// el.innerHTML = js + "\n$(document).trigger('" + this.trigger + "');\n",
|
114
|
+
// document.getElementsByTagName('head')[0].appendChild(el);
|
115
|
+
// }
|
116
|
+
//});
|
89
117
|
}
|
90
118
|
else if (url.match(/\.css/))
|
91
119
|
{
|
@@ -99,6 +127,14 @@ var ModalController = Class.extend({
|
|
99
127
|
});
|
100
128
|
},
|
101
129
|
|
130
|
+
asset_included: function(url)
|
131
|
+
{
|
132
|
+
var that = this;
|
133
|
+
if (!that.parent_controller.included_assets || that.parent_controller.included_assets == undefined)
|
134
|
+
that.parent_controller.included_assets = [];
|
135
|
+
return that.parent_controller.included_assets.indexOf(url) > -1;
|
136
|
+
},
|
137
|
+
|
102
138
|
include_inline_css: function(str)
|
103
139
|
{
|
104
140
|
var that = this;
|
@@ -1,7 +1,11 @@
|
|
1
|
+
<%
|
2
|
+
# app/views/caboose/pages/admin_edit_content.html.erb
|
3
|
+
%>
|
1
4
|
|
2
5
|
<% content_for :caboose_css do %>
|
3
6
|
<%= stylesheet_link_tag 'jquery-ui' %>
|
4
7
|
<%= stylesheet_link_tag 'caboose/admin_block_edit_image' %>
|
8
|
+
|
5
9
|
<%= stylesheet_link_tag "caboose/modal_inline" %>
|
6
10
|
<style type='text/css'>
|
7
11
|
|
@@ -59,22 +63,18 @@
|
|
59
63
|
<%= javascript_include_tag 'caboose/model/all' %>
|
60
64
|
<%= javascript_include_tag 'caboose/jquery-ui.drag-multiple.min.js' %>
|
61
65
|
<%= javascript_include_tag "caboose/clipboard" %>
|
62
|
-
<%= javascript_include_tag 'caboose/
|
66
|
+
<%= javascript_include_tag 'caboose/block_content_controller' %>
|
63
67
|
<%= javascript_include_tag "caboose/class" %>
|
64
68
|
<%= javascript_include_tag "caboose/modal_controller" %>
|
65
69
|
<%= javascript_include_tag "caboose/block_modal_controllers/block_modal_controller" %>
|
66
|
-
<%= javascript_include_tag "caboose/block_modal_controllers/media_modal_controller" %>
|
67
|
-
<%= javascript_include_tag "caboose/block_modal_controllers/richtext_modal_controller" %>
|
68
|
-
<% @page.block.modal_js_block_names.each do |s| %>
|
69
|
-
<%= javascript_include_tag "caboose/block_modal_controllers/#{s}_modal_controller" %>
|
70
|
-
<% end %>
|
71
70
|
<script type='text/javascript'>
|
72
71
|
|
73
72
|
var controller = false;
|
74
73
|
$(document).ready(function() {
|
75
|
-
controller = new
|
74
|
+
controller = new BlockContentController({
|
76
75
|
page_id: <%= @page.id %>,
|
77
|
-
assets_path: <%= raw Caboose.json(asset_path('loading.gif').gsub('loading.gif', ''))
|
76
|
+
assets_path: <%= raw Caboose.json(asset_path('loading.gif').gsub('loading.gif', '')) %>,
|
77
|
+
included_assets: ['caboose/block_modal_controllers/block_modal_controller.js']
|
78
78
|
});
|
79
79
|
|
80
80
|
$('body').append($('<div/>')
|
@@ -3,7 +3,9 @@
|
|
3
3
|
<% content_for :caboose_js do %>
|
4
4
|
<%= javascript_include_tag "caboose/admin" %>
|
5
5
|
<%= javascript_include_tag "caboose/model/all" %>
|
6
|
-
|
6
|
+
<%
|
7
|
+
#= javascript_include_tag 'caboose/admin_page_edit_content'
|
8
|
+
%>
|
7
9
|
<script type='text/javascript'>
|
8
10
|
|
9
11
|
var controller = false;
|
@@ -1,23 +1,88 @@
|
|
1
|
+
<%
|
2
|
+
# app/views/caboose/posts/admin_edit_content.html.erb
|
3
|
+
%>
|
1
4
|
|
2
5
|
<% content_for :caboose_css do %>
|
3
6
|
<%= stylesheet_link_tag 'jquery-ui' %>
|
7
|
+
<%= stylesheet_link_tag 'caboose/admin_block_edit_image' %>
|
4
8
|
<%= stylesheet_link_tag 'caboose/admin_post_edit_content' %>
|
9
|
+
<%= stylesheet_link_tag "caboose/modal_inline" %>
|
10
|
+
<style type='text/css'>
|
11
|
+
|
12
|
+
#tiny_header {
|
13
|
+
display: block;
|
14
|
+
color: #fff;
|
15
|
+
background-image: url(/assets/caboose/caboose_logo_small.png);
|
16
|
+
background-color: #000;
|
17
|
+
background-repeat: no-repeat;
|
18
|
+
background-position: right 0;
|
19
|
+
padding: 0 50px 0 10px;
|
20
|
+
position: absolute;
|
21
|
+
top: 0px;
|
22
|
+
right: 0px;
|
23
|
+
z-index: 100000;
|
24
|
+
border-left: #fff 1px solid;
|
25
|
+
border-bottom: #fff 1px solid;
|
26
|
+
}
|
27
|
+
#tiny_header a {
|
28
|
+
display: inline-block;
|
29
|
+
color: #fff;
|
30
|
+
padding: 16px 10px;
|
31
|
+
}
|
32
|
+
.block_over { background: #e3e3e3; }
|
33
|
+
.select_handle { display: none; }
|
34
|
+
.move_up_handle { display: none; }
|
35
|
+
.move_down_handle { display: none; }
|
36
|
+
.delete_handle { display: none; }
|
37
|
+
.block_over > .select_handle { display: block; position: relative; }
|
38
|
+
.block_over > .move_up_handle { display: block; position: relative; }
|
39
|
+
.block_over > .move_down_handle { display: block; position: relative; }
|
40
|
+
.block_over > .delete_handle { display: block; position: relative; }
|
41
|
+
.block_over > .select_handle span { position: absolute; top: 0; right: 54px; width: 18px; height: 18px; background-color: #fff; border: #ccc 1px solid; }
|
42
|
+
.block_over > .move_up_handle span { position: absolute; top: 0; right: 36px; width: 18px; height: 18px; background-color: #fff; border: #ccc 1px solid; }
|
43
|
+
.block_over > .move_down_handle span { position: absolute; top: 0; right: 18px; width: 18px; height: 18px; background-color: #fff; border: #ccc 1px solid; }
|
44
|
+
.block_over > .delete_handle span { position: absolute; top: 0; right: 0px; width: 18px; height: 18px; background-color: #fff; border: #ccc 1px solid; }
|
45
|
+
|
46
|
+
.selected { background: #fff799; }
|
47
|
+
|
48
|
+
.new_block_link { position: relative; width: 100%; }
|
49
|
+
.new_block_link .line { position: absolute; top: -11px; width: 100%; height: 2px; background: transparent; }
|
50
|
+
.new_block_link a { position: absolute; top: -20px; left: 45%; background: transparent; color: transparent !important; display: block; padding: 4px 8px; }
|
51
|
+
|
52
|
+
.new_block_link_over { position: relative; width: 100%; }
|
53
|
+
.new_block_link_over .line { position: absolute; top: -11px; width: 100%; height: 2px; background: #ccc; }
|
54
|
+
.new_block_link_over a { position: absolute; top: -22px; left: 45%; color: #fff; background: #666; display: block; padding: 2px 4px; text-decoration: none; font-size: 12px; }
|
55
|
+
|
56
|
+
.caboose_note { padding: 10px 20px; background: #990000; color: #fff; font-size: 16px; }
|
57
|
+
|
58
|
+
</style>
|
5
59
|
<% end %>
|
6
60
|
|
7
61
|
<% content_for :caboose_js do %>
|
8
62
|
<%= javascript_include_tag 'jquery-ui' %>
|
9
|
-
<%= javascript_include_tag 'caboose/
|
63
|
+
<%= javascript_include_tag 'caboose/model/all' %>
|
64
|
+
<%= javascript_include_tag 'caboose/jquery-ui.drag-multiple.min.js' %>
|
65
|
+
<%= javascript_include_tag "caboose/clipboard" %>
|
66
|
+
<%= javascript_include_tag 'caboose/block_content_controller' %>
|
67
|
+
<%= javascript_include_tag "caboose/class" %>
|
68
|
+
<%= javascript_include_tag "caboose/modal_controller" %>
|
69
|
+
<%= javascript_include_tag "caboose/block_modal_controllers/block_modal_controller" %>
|
10
70
|
<script type='text/javascript'>
|
11
71
|
|
12
72
|
var controller = false;
|
13
|
-
$(document).ready(function() {
|
14
|
-
controller = new
|
73
|
+
$(document).ready(function() {
|
74
|
+
controller = new BlockContentController({
|
75
|
+
post_id: <%= @post.id %>,
|
76
|
+
assets_path: <%= raw Caboose.json(asset_path('loading.gif').gsub('loading.gif', '')) %>,
|
77
|
+
included_assets: ['caboose/block_modal_controllers/block_modal_controller.js']
|
78
|
+
});
|
15
79
|
|
16
80
|
$('body').append($('<div/>')
|
17
81
|
.attr('id', 'tiny_header')
|
18
82
|
.append($('<a/>').attr('href', '/admin/posts').html("< Back"))
|
19
|
-
.append($('<a/>').attr('href', '/admin/posts/<%= @post.id %>/
|
20
|
-
.append($('<a/>').attr('href', '/admin/posts/<%= @post.id
|
83
|
+
.append($('<a/>').attr('href', '#').html('Post Options').click(function(e) { e.preventDefault(); caboose_modal_url('/admin/posts/<%= @post.id %>/custom-fields'); }))
|
84
|
+
.append($('<a/>').attr('href', '/admin/posts/<%= @post.id %>/layout').html("Layout"))
|
85
|
+
.append($('<a/>').attr('href', '/admin/posts/<%= @post.id %>').html("Settings"))
|
21
86
|
);
|
22
87
|
});
|
23
88
|
|
data/lib/caboose/version.rb
CHANGED
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.8.
|
4
|
+
version: 0.8.59
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -517,13 +517,13 @@ files:
|
|
517
517
|
- app/assets/javascripts/caboose/admin_main.js
|
518
518
|
- app/assets/javascripts/caboose/admin_media_index.js
|
519
519
|
- app/assets/javascripts/caboose/admin_media_index_new.js
|
520
|
-
- app/assets/javascripts/caboose/admin_page_edit_content.js
|
521
520
|
- app/assets/javascripts/caboose/admin_page_new_blocks.js
|
522
521
|
- app/assets/javascripts/caboose/admin_post_edit_content.js
|
523
522
|
- app/assets/javascripts/caboose/admin_products.js
|
524
523
|
- app/assets/javascripts/caboose/application.js
|
525
524
|
- app/assets/javascripts/caboose/assets_controller.js
|
526
525
|
- app/assets/javascripts/caboose/authorize.net.js
|
526
|
+
- app/assets/javascripts/caboose/block_content_controller.js
|
527
527
|
- app/assets/javascripts/caboose/block_media_controller.js
|
528
528
|
- app/assets/javascripts/caboose/block_modal_controllers/block_modal_controller.js
|
529
529
|
- app/assets/javascripts/caboose/block_modal_controllers/button_modal_controller.js
|