caboose-cms 0.9.55 → 0.9.56

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.
@@ -309,7 +309,7 @@ var BlockModalController = ModalController.extend({
309
309
  that.set_clickable(b2);
310
310
  });
311
311
  }
312
- if (show_mouseover)
312
+ if (false && show_mouseover)
313
313
  {
314
314
  $('#the_modal #block_' + b.id).mouseover(function(el) { $('#the_modal #block_' + b.id).addClass( 'block_over'); });
315
315
  $('#the_modal #block_' + b.id).mouseout(function(el) { $('#the_modal #block_' + b.id).removeClass('block_over'); });
@@ -421,7 +421,7 @@ var BlockModalController = ModalController.extend({
421
421
  var that = this;
422
422
  if (!confirm)
423
423
  {
424
- var p = $('<p/>').addClass('note warning')
424
+ var p = $('<p/>').addClass('caboose_note delete')
425
425
  .append("Are you sure you want to delete the block? This can't be undone.<br />")
426
426
  .append($('<input/>').attr('type','button').val('Yes').click(function() { that.delete_block(true); })).append(' ')
427
427
  .append($('<input/>').attr('type','button').val('No').click(function() { $('#modal_message').empty(); that.autosize();
@@ -527,7 +527,7 @@ var BlockModalController = ModalController.extend({
527
527
  {
528
528
  var that = this;
529
529
  if (!b) return that.base_url() + '/' + that.block_id;
530
- return that.base_url(b) + '/' + b.id;
530
+ return that.base_url(b) + '/' + b.id;
531
531
  },
532
532
 
533
533
  child_block: function(name, b)
@@ -33,6 +33,21 @@ BoundText = BoundControl.extend({
33
33
  $('#'+that.el+'_container').append($('<div/>').attr('id', that.el + '_placeholder').addClass('mb_placeholder').append($('<span/>').html(that.attribute.nice_name + ': ')));
34
34
  $('#'+that.el).css('background', 'transparent');
35
35
  }
36
+
37
+ // if (this.attribute.width) $('#'+this.el).css('width' , this.attribute.width);
38
+ // if (this.attribute.fixed_placeholder && this.attribute.align != 'right')
39
+ // {
40
+ // that.set_placeholder_padding();
41
+ // //setTimeout(function() {
42
+ // // var w = $('#'+that.el+'_placeholder').outerWidth();
43
+ // // $('#'+that.el).attr('placeholder', 'empty').css('padding-left', '+=' + w);//.css('width', '-=' + w);
44
+ // // }, 200);
45
+ // }
46
+ // var this2 = this;
47
+ // $('#'+this.el).on('keyup', function(e) {
48
+ // if (e.keyCode == 27) this2.cancel(); // Escape
49
+ // if (e.keyCode == 13) this2.save(); // Enter
50
+
36
51
  if (that.attribute.width) $('#'+that.el).css('width', that.attribute.width);
37
52
  if (that.attribute.fixed_placeholder && that.attribute.align != 'right')
38
53
  that.set_placeholder_padding();
@@ -40,6 +55,7 @@ BoundText = BoundControl.extend({
40
55
  $('#'+that.el).on('keyup', function(e) {
41
56
  if (e.keyCode == 27) that.cancel(); // Escape
42
57
  if (e.keyCode == 13) that.save(); // Enter
58
+
43
59
 
44
60
  if ($('#'+that.el).val() != that.attribute.value_clean)
45
61
  $('#'+that.el).addClass('mb_dirty');
@@ -0,0 +1,66 @@
1
+ @import url('https://fonts.googleapis.com/css?family=Roboto:300,300i');
2
+ #tiny_header {
3
+ display: block;
4
+ color: #fff;
5
+ background-image: url(/assets/caboose/caboose_logo_small.png);
6
+ background-color: #000;
7
+ background-repeat: no-repeat;
8
+ background-position: right 0;
9
+ padding: 0 50px 0 10px;
10
+ position: absolute;
11
+ top: 0px;
12
+ right: 0px;
13
+ z-index: 100000;
14
+ border-left: #fff 1px solid;
15
+ border-bottom: #fff 1px solid;
16
+ }
17
+ #tiny_header a {
18
+ display: inline-block;
19
+ color: #fff;
20
+ padding: 16px 10px;
21
+ }
22
+ .block_over { background: #e3e3e3; }
23
+ .select_handle { display: none; }
24
+ .move_up_handle { display: none; }
25
+ .move_down_handle { display: none; }
26
+ .delete_handle { display: none; }
27
+ .duplicate_handle { display: none; }
28
+ .block_over > .select_handle { display: block; position: relative; z-index: 3; }
29
+ .block_over > .move_up_handle { display: block; position: relative; z-index: 3; }
30
+ .block_over > .move_down_handle { display: block; position: relative; z-index: 3; }
31
+ .block_over > .delete_handle { display: block; position: relative; z-index: 3; }
32
+ .block_over > .duplicate_handle { display: block; position: relative; z-index: 3; }
33
+ .block_over > .select_handle span { position: absolute; top: 0; right: 72px; width: 18px; height: 18px; background-color: #fff; border: #ccc 1px solid; }
34
+ .block_over > .move_up_handle span { position: absolute; top: 0; right: 36px; width: 18px; height: 18px; background-color: #fff; border: #ccc 1px solid; }
35
+ .block_over > .move_down_handle span { position: absolute; top: 0; right: 18px; width: 18px; height: 18px; background-color: #fff; border: #ccc 1px solid; }
36
+ .block_over > .delete_handle span { position: absolute; top: 0; right: 0px; width: 18px; height: 18px; background-color: #fff; border: #ccc 1px solid; }
37
+ .block_over > .duplicate_handle span { position: absolute; top: 0; right: 54px; width: 18px; height: 18px; background-color: #fff; border: #ccc 1px solid; }
38
+ .selected { background: #fff799; }
39
+ .new_block_link { position: relative; width: 100%; }
40
+ .new_block_link .line { position: absolute; top: -11px; width: 100%; height: 2px; background: transparent; }
41
+ .new_block_link a { position: absolute; top: -20px; left: 45%; background: transparent; color: transparent !important; display: block; padding: 4px 8px; }
42
+ .new_block_link_over { position: relative; width: 100%; }
43
+ .new_block_link_over .line { position: absolute; top: -11px; width: 100%; height: 2px; background: #ccc; }
44
+ .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; }
45
+ .caboose_note { padding: 10px 20px; background: #990000; color: #fff; font-size: 16px; }
46
+
47
+ #the_modal #modal_content .mb_container {
48
+ input {
49
+ border: #ccc 1px solid;
50
+ border-radius: 0 !important;
51
+ font-family: 'Roboto' !important;
52
+ font-weight: 300 !important;
53
+ font-size: 15px !important;
54
+ padding: 8px 6px 6px 6px;
55
+ }
56
+ .mb_placeholder {
57
+ top: 9px;
58
+ left: 8px;
59
+ span {
60
+ font-size: 15px;
61
+ font-family: Roboto !important;
62
+ font-weight: 300 !important;
63
+ color: #5f5f5f;
64
+ }
65
+ }
66
+ }
@@ -0,0 +1,288 @@
1
+ @import url('https://fonts.googleapis.com/css?family=Roboto:300,300i');
2
+
3
+ #block_sidebar {
4
+ position: fixed;
5
+ top: 0;
6
+ left: 0;
7
+ width: 200px;
8
+ height: 800px;
9
+ height: 100vh;
10
+ z-index: 999;
11
+ background: #ecebe8;
12
+ border-right: 1px solid #d4d4d4;
13
+ overflow-y: scroll;
14
+ #new_blocks_container2 {
15
+ h4 {
16
+ font-family: 'Roboto';
17
+ font-weight: 300;
18
+ font-size: 1.2em;
19
+ padding: 10px;
20
+ text-align: center;
21
+ height: 52px;
22
+ margin-bottom: 10px;
23
+ }
24
+ }
25
+ #new_blocks {
26
+ list-style-type: none;
27
+ text-align: center;
28
+ li.title {
29
+ width: 100%;
30
+ clear: both;
31
+ margin: 5px 0;
32
+ span {
33
+ font-size: 15px;
34
+ display: block;
35
+ text-transform: uppercase;
36
+ }
37
+ }
38
+ li.blocktype {
39
+ display: inline-block;
40
+ border: 1px solid #d4d4d4;
41
+ width: 90px;
42
+ height: 70px;
43
+ cursor: move;
44
+ text-align: center;
45
+ border-radius: 2px;
46
+ overflow: hidden;
47
+ margin-bottom: 5px;
48
+ padding: 6px;
49
+ background-color: #f9f8f6;
50
+ span[class*=" icon-"] {
51
+
52
+ }
53
+ span.bname {
54
+ margin-top: 3px;
55
+ display: block;
56
+ font-family: 'Roboto';
57
+ font-weight: 300;
58
+ font-size: 12px;
59
+ border: 0;
60
+ }
61
+ &.divider {
62
+
63
+ }
64
+ &:hover {
65
+ background: #ffffde;
66
+ }
67
+ }
68
+ }
69
+ }
70
+
71
+ #the_modal #modal_content .mb_container {
72
+ input {
73
+ border: #ccc 1px solid;
74
+ border-radius: 0 !important;
75
+ font-family: 'Roboto' !important;
76
+ font-weight: 300 !important;
77
+ font-size: 15px !important;
78
+ padding: 8px 6px 6px 6px;
79
+ }
80
+ .mb_placeholder {
81
+ top: 9px;
82
+ left: 8px;
83
+ span {
84
+ font-size: 15px;
85
+ font-family: Roboto !important;
86
+ font-weight: 300 !important;
87
+ color: #5f5f5f;
88
+ }
89
+ }
90
+ }
91
+
92
+ body > .ui-draggable-dragging {
93
+ width: 95px;
94
+ height: auto;
95
+ overflow: hidden;
96
+ padding: 6px;
97
+ list-style-type: none;
98
+ font-size: 12px;
99
+ padding: 6px;
100
+ text-align: center;
101
+ background: #ecebe8;
102
+ border: 1px solid #d4d4d4;
103
+ margin-bottom: 0;
104
+ border-radius: 8px;
105
+ }
106
+
107
+ p.caboose_note.delete {
108
+ background: #d24949;
109
+ color: white;
110
+ font-size: 14px;
111
+ line-height: 18px;
112
+ padding: 20px;
113
+ text-align: center;
114
+ position: relative;
115
+ z-index: 5;
116
+ font-family: 'Roboto';
117
+ font-weight: 300;
118
+ input[type="button"] {
119
+ display: inline-block;
120
+ -webkit-appearance: none;
121
+ background-color: #fff;
122
+ border: 0;
123
+ padding: 8px 10px;
124
+ font-family: 'Roboto';
125
+ font-weight: 300;
126
+ font-size: 14px;
127
+ margin: 10px 5px 0 5px;
128
+ color: #111;
129
+ width: auto;
130
+ cursor: pointer;
131
+ &:hover {
132
+ background-color: #111;
133
+ color: #fff;
134
+ }
135
+ &:focus {
136
+ outline-width: 0;
137
+ }
138
+ }
139
+ }
140
+
141
+ #caboose-loading {
142
+ display: none;
143
+ position: fixed;
144
+ background: white;
145
+ width: 100%;
146
+ height: 100%;
147
+ top: 0;
148
+ left: 0;
149
+ z-index: 100000000;
150
+ text-align: center;
151
+ opacity: 0.95;
152
+ svg#loader {
153
+ display: block;
154
+ width: 60px;
155
+ height: 60px;
156
+ margin: 0 auto 10px auto;
157
+ }
158
+ h4 {
159
+ text-transform: uppercase;
160
+ font-family: 'Roboto';
161
+ font-weight: 300;
162
+ font-size: 1.2em;
163
+ margin-bottom: 0;
164
+ }
165
+ // opacity: 0;
166
+ // transition: opacity 300ms ease;
167
+ // &.show {
168
+ // opacity: 0.9;
169
+ // }
170
+ }
171
+
172
+ .ui-draggable.ui-draggable-dragging.block_over {
173
+ opacity: 0.2;
174
+ background-color: transparent;
175
+ }
176
+
177
+ body > .container, body > .mm-page > .container {
178
+ width: 95%;
179
+ width: calc(100vw - 200px);
180
+ float: right;
181
+ }
182
+ #colorbox:focus {
183
+ outline-width: 0 !important;
184
+ }
185
+ #colorbox {
186
+ #cboxWrapper {
187
+ border-radius: 0 !important;
188
+ }
189
+ }
190
+
191
+ #tiny_header {
192
+ display: block;
193
+ color: #fff;
194
+ // background-image: url(/assets/caboose/caboose_logo_small.png);
195
+ background-color: #353535;
196
+ // background-repeat: no-repeat;
197
+ // background-position: right 0;
198
+ position: absolute;
199
+ top: 0;
200
+ right: 0;
201
+ z-index: 100000;
202
+ box-shadow: 0px 2px 3px rgba(10,10,10,0.3);
203
+ padding: 8px 10px 9px 10px;
204
+ a {
205
+ display: inline-block;
206
+ color: #fff;
207
+ padding: 0 10px;
208
+ font-family: 'Roboto';
209
+ font-weight: 300;
210
+ font-size: 15px;
211
+ text-decoration: none;
212
+ &:hover {
213
+ color: #dbc553;
214
+ }
215
+ &:focus {
216
+ outline-width: 0;
217
+ }
218
+ }
219
+ }
220
+
221
+ .block_over { background: #e3e3e3; }
222
+ .select_handle { display: none; }
223
+ // .move_up_handle { display: none; }
224
+ // .move_down_handle { display: none; }
225
+ .delete_handle { display: none; }
226
+ .duplicate_handle { display: none; }
227
+ .drag_handle { display: none; }
228
+ .block_over > .drag_handle { display: block; position: relative; z-index: 3; }
229
+ .block_over > .select_handle { display: block; position: relative; z-index: 3; }
230
+ // .block_over > .move_up_handle { display: block; position: relative; z-index: 3; }
231
+ // .block_over > .move_down_handle { display: block; position: relative; z-index: 3; }
232
+ .block_over > .delete_handle { display: block; position: relative; z-index: 3; }
233
+ .block_over > .duplicate_handle { display: block; position: relative; z-index: 3; }
234
+ .block_over > .drag_handle span { position: absolute; top: 0; right: 54px; width: 18px; height: 18px; background-color: #fff; border: #ccc 1px solid; }
235
+ .block_over > .select_handle span { position: absolute; top: 0; right: 18px; width: 18px; height: 18px; background-color: #fff; border: #ccc 1px solid; }
236
+ // .block_over > .move_up_handle span { position: absolute; top: 0; right: 36px; width: 18px; height: 18px; background-color: #fff; border: #ccc 1px solid; }
237
+ // .block_over > .move_down_handle span { position: absolute; top: 0; right: 18px; width: 18px; height: 18px; background-color: #fff; border: #ccc 1px solid; }
238
+ .block_over > .delete_handle span { position: absolute; top: 0; right: 0px; width: 18px; height: 18px; background-color: #fff; border: #ccc 1px solid; }
239
+ .block_over > .duplicate_handle span { position: absolute; top: 0; right: 36px; width: 18px; height: 18px; background-color: #fff; border: #ccc 1px solid; }
240
+
241
+ .selected { background: #fff799 !important;
242
+ img {
243
+ opacity: 0.6;
244
+ }
245
+ }
246
+
247
+ .new_block_link {
248
+ position: relative;
249
+ width: 100%;
250
+ height: 0;
251
+ background-color: transparent;
252
+ transition: all 300ms ease;
253
+ &.np {
254
+ height: auto;
255
+ }
256
+ .line {
257
+ position: absolute;
258
+ height: 16px;
259
+ left: 0;
260
+ bottom: -8px;
261
+ width: 100%;
262
+ transition: all 300ms ease;
263
+ z-index: 5;
264
+ &.dropzone {
265
+ background: #dbeff7;
266
+ }
267
+ &.highlight {
268
+ background: #b0d5e4;
269
+ }
270
+ &.new-page {
271
+ text-align: center;
272
+ height: auto;
273
+ bottom: initial;
274
+ top: 0;
275
+ font-family: 'Roboto';
276
+ font-weight: 300;
277
+ padding: 15px 8px;
278
+ background: #ecebe8;
279
+ border: 1px dashed gray;
280
+ position: relative;
281
+ font-size: 14px;
282
+ &.highlight {
283
+ background: #9cb9fb;
284
+ color: transparent;
285
+ }
286
+ }
287
+ }
288
+ }
@@ -9,8 +9,9 @@
9
9
  font-style: normal;
10
10
  }
11
11
 
12
- #the_modal div.icons [class^="icon-"]:before,
13
- #the_modal div.icons [class*=" icon-"]:before
12
+ #the_modal div.icons [class^="icon-"]::before,
13
+ #the_modal div.icons [class*=" icon-"]::before,
14
+ #new_blocks_container2 [class*=" icon-"]::before
14
15
  {
15
16
  font-family: 'icomoon' !important;
16
17
  }
@@ -21,7 +22,8 @@
21
22
 
22
23
  #the_modal div.icons [class^="icon-"],
23
24
  #the_modal div.icons [class*=" icon-"],
24
- #modal_content div.icons [class*="icon-"] {
25
+ #modal_content div.icons [class*="icon-"],
26
+ #new_blocks_container2 [class*=" icon-"] {
25
27
  font-family: 'icomoon' !important;
26
28
  speak: none;
27
29
  font-style: normal;
@@ -18,5 +18,7 @@
18
18
  #the_modal div.mb_container input[type=checkbox] { top: 12px; }
19
19
  #the_modal #modal_crumbtrail,
20
20
  #the_modal #modal_crumbtrail h2,
21
- #the_modal #modal_crumbtrail h2 a { font-size: 16pt !important; }
22
-
21
+ #the_modal #modal_crumbtrail h2 a { font-family: 'Roboto'; font-weight: 300; font-size: 15px !important; color: #0975a7; text-decoration: none; }
22
+ #the_modal #modal_crumbtrail h2 a:hover {
23
+ color: #09a710;
24
+ }
@@ -64,7 +64,7 @@ module Caboose
64
64
  @block = params[:id] ? Block.find(params[:id]) : (params[:page_id] ? Block.new(:page_id => params[:page_id]) : Block.new(:post_id => params[:post_id]))
65
65
  @after_id = params[:after_id] ? params[:after_id] : nil
66
66
  @before_id = params[:before_id] ? params[:before_id] : nil
67
- render :layout => 'caboose/modal'
67
+ render :layout => 'caboose/modal'
68
68
  end
69
69
 
70
70
  # @route GET /admin/pages/:page_id/blocks/tree
@@ -128,7 +128,8 @@ module Caboose
128
128
  bt = b.block_type
129
129
  crumbs << {
130
130
  :block_id => b.id,
131
- :text => b.name && b.name.downcase != bt.description.downcase ? "#{bt.description} (#{b.name})" : bt.description
131
+ :text => bt.description
132
+ # :text => b.name && b.name.downcase != bt.description.downcase ? "#{bt.description} (#{b.name})" : bt.description
132
133
  }
133
134
  b = b.parent
134
135
  end
@@ -137,7 +138,7 @@ module Caboose
137
138
 
138
139
  def admin_tree_helper(b)
139
140
  arr = []
140
- b.children.each do |b2|
141
+ b.children.order(:block_type_id).each do |b2|
141
142
  bt = b2.block_type
142
143
  arr << {
143
144
  'id' => b2.id,
@@ -328,7 +329,7 @@ module Caboose
328
329
  i = i + 1
329
330
  end
330
331
 
331
- elsif params[:before_id]
332
+ elsif params[:before_id] && !params[:before_id].blank?
332
333
  b2 = Block.find(params[:before_id].to_i)
333
334
  b.sort_order = b2.sort_order
334
335
 
@@ -339,7 +340,7 @@ module Caboose
339
340
  i = i + 1
340
341
  end
341
342
 
342
- elsif params[:after_id]
343
+ elsif params[:after_id] && !params[:after_id].blank?
343
344
  b2 = Block.find(params[:after_id].to_i)
344
345
  b.sort_order = b2.sort_order + 1
345
346
 
@@ -359,7 +360,27 @@ module Caboose
359
360
 
360
361
  # Ensure that all the children are created for the block
361
362
  b.create_children
362
-
363
+
364
+ # Default child block count
365
+ if !params[:child_count].blank? && params[:child_count].to_i > 0
366
+ (1..params[:child_count].to_i).each_with_index do |cc, ind|
367
+ b1 = Block.new
368
+ if params[:page_id]
369
+ b1.page_id = params[:page_id].to_i
370
+ else
371
+ b1.post_id = params[:post_id].to_i
372
+ end
373
+ b1.parent_id = b.id
374
+ b1.sort_order = ind
375
+ b1.block_type_id = b.block_type.default_child_block_type_id
376
+ b1.save
377
+ b1.create_children
378
+ bw = b1.child('width')
379
+ bw.value = (100.0 / params[:child_count].to_f).to_i.to_s + '%'
380
+ bw.save
381
+ end
382
+ end
383
+
363
384
  # Set the global values if necessary
364
385
  if b.block_type.is_global
365
386
  b.get_global_value(@site.id)
@@ -519,6 +540,39 @@ module Caboose
519
540
  resp.success = true
520
541
  render :json => resp
521
542
  end
543
+
544
+ # @route POST /admin/pages/:page_id/blocks/:id/move
545
+ # @route POST /admin/posts/:post_id/blocks/:id/move
546
+ def admin_move
547
+ return unless user_is_allowed('pages', 'edit')
548
+ resp = StdClass.new
549
+ b = Block.find(params[:id])
550
+ if params[:before_id] && !params[:before_id].blank?
551
+ b2 = Block.find(params[:before_id].to_i)
552
+ b.sort_order = b2.sort_order
553
+ i = 1
554
+ b2.parent.children.where('sort_order >= ?', b.sort_order).reorder(:sort_order).all.each do |b3|
555
+ b3.sort_order = b.sort_order + i
556
+ b3.save
557
+ i = i + 1
558
+ end
559
+ elsif params[:after_id] && !params[:after_id].blank?
560
+ b2 = Block.find(params[:after_id].to_i)
561
+ b.sort_order = b2.sort_order + 1
562
+ i = 1
563
+ b2.parent.children.where('sort_order >= ?', b.sort_order).reorder(:sort_order).all.each do |b3|
564
+ b3.sort_order = b.sort_order + i
565
+ b3.save
566
+ i = i + 1
567
+ end
568
+ elsif params[:parent_id]
569
+ b.sort_order = Block.where(:parent_id => params[:parent_id]).count
570
+ end
571
+ b.parent_id = params[:parent_id]
572
+ resp.success = true
573
+ b.save
574
+ render :json => resp
575
+ end
522
576
 
523
577
  # @route PUT /admin/pages/:page_id/blocks/:id/move-up
524
578
  # @route PUT /admin/posts/:post_id/blocks/:id/move-up