caboose-cms 0.9.82 → 0.9.83

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: 14e6a4beb61272ea82d1b19d6189398b2a41c76a
4
- data.tar.gz: a09557a901c823b7d12ce55d84d2640b34d6f625
3
+ metadata.gz: c2382d0cd7dca903db123294ab348c27cf479984
4
+ data.tar.gz: 69b9ff6480a2a4b4e4e5d8c78e5f5d27638678aa
5
5
  SHA512:
6
- metadata.gz: 7af096ca809b22c615b5b71080bbe8d7c91b302fee8c8de8c298c0a8c462bf900f31b114ac2a2846f597862b3976cf1013a72e7f927e719f0f72b63c63ed4726
7
- data.tar.gz: 0bb83c997ebde0c043438304c0c42c67400efee11f3e0daf10b5b136306dd216017ad8a3de9bf7e76a0b8e234009d86360c3aa49c33679555ccc8cb30297efc0
6
+ metadata.gz: f4836eb3d70e11c4a26fc6e3665584d531f56e68038d3c80f1a09afa7d47042fe0b63c638fc2709d7e9076ae08ca16d1d4e1594947883802f889a90cff0b3011
7
+ data.tar.gz: 822db3dcbf62ddb4e71affaf8fd4e1103eaaee2bfc4603c0abf76b58588fed42a0189e1e7aed18a0a65f579b28a11a9455d8b7cf22db1b717731369a812100aa
@@ -165,9 +165,6 @@ BlockContentController.prototype = {
165
165
  }
166
166
  that.move_block_save(block_id, parent_id, before_block_id, after_block_id);
167
167
  }
168
- else {
169
-
170
- }
171
168
  },
172
169
 
173
170
  move_block_save: function(block_id, parent_id, before_block_id, after_block_id) {
@@ -298,16 +295,23 @@ BlockContentController.prototype = {
298
295
  $('.new_block_link').remove();
299
296
  $("[id^='block_']").each(function(k,v) {
300
297
 
298
+ var is_unit = $(v).hasClass('flex-grid-unit');
299
+ var is_grid = $(v).hasClass('flex-grid-container');
301
300
  var bid = $(v).attr('id').replace('block_','');
301
+ var dropclass = (is_unit && is_unit == true ? 'column-dropper' : 'regular-dropper');
302
302
 
303
- // empty post, page, column, or text area
303
+ // empty post, page, column, grid, or text area
304
304
  if ( $(v).find('.content_body').length > 0 && $(v).find('.content_body').first().children().length == 0 ) {
305
+ var msg = (is_grid && is_grid == true ? '<p>Empty grid. Drag a column here.</p>' : '<p>Empty content area. Drag blocks here.</p>');
305
306
  var el = $(v).find('.content_body').first();
307
+ if ( $(v).find('.flexbox').length > 0 && $(v).find('.flexbox').first().children().length == 0 )
308
+ $(v).addClass('empty');
306
309
  var first_parent_block = el.parents("[id^='block_']").first();
307
310
  if ( first_parent_block.attr('id') == $(v).attr('id') ) {
308
311
  el.html($('<div/>')
309
- .addClass('new_block_link np')
310
- .append($('<div/>').addClass('new-page line').html('<p>Empty content area. Drag blocks here.</p>').droppable({
312
+ .addClass('new_block_link np ' + (is_grid && is_grid == true ? 'column-dropper' : 'regular-dropper'))
313
+ .append($('<div/>').addClass('new-page line').html(msg).droppable({
314
+ accept: (is_grid && is_grid == true ? '.flex-grid-unit' : ':not(.flex-grid-unit)'),
311
315
  hoverClass: "highlight",
312
316
  tolerance: "pointer",
313
317
  drop: function(event, ui) {
@@ -326,8 +330,9 @@ BlockContentController.prototype = {
326
330
  var parent_id = $(v).parents("[id^='block_']").first().attr('id').replace('block_','');
327
331
  var is_last_child = $(v).next("[id^='block_']").length == 0 ? true : false;
328
332
  $(v).before($('<div/>')
329
- .addClass('new_block_link')
333
+ .addClass('new_block_link ' + dropclass)
330
334
  .append($('<div/>').addClass('line').droppable({
335
+ accept: (is_unit && is_unit == true ? '.flex-grid-unit' : ':not(.flex-grid-unit)'),
331
336
  hoverClass: "highlight",
332
337
  tolerance: "pointer",
333
338
  drop: function(event, ui) {
@@ -340,8 +345,9 @@ BlockContentController.prototype = {
340
345
  );
341
346
  if (is_last_child && is_last_child == true) {
342
347
  $(v).after($('<div/>')
343
- .addClass('new_block_link')
348
+ .addClass('new_block_link ' + dropclass).addClass(dropclass)
344
349
  .append($('<div/>').addClass('line').droppable({
350
+ accept: (is_unit && is_unit == true ? ".flex-grid-unit" : ':not(.flex-grid-unit)'),
345
351
  hoverClass: "highlight",
346
352
  tolerance: "pointer",
347
353
  drop: function(event, ui) {
@@ -361,13 +367,18 @@ BlockContentController.prototype = {
361
367
  revert: "invalid",
362
368
  scroll: false,
363
369
  zIndex: 999,
364
- start: function(event, ui) { $(".line.ui-droppable").addClass('dropzone'); },
365
- stop: function(event, ui) { $(".line.ui-droppable").removeClass('dropzone'); }
370
+ start: function(event, ui) { $((is_unit && is_unit == true ? '.column-dropper' : '.regular-dropper') + " .line.ui-droppable").addClass('dropzone'); },
371
+ stop: function(event, ui) { $((is_unit && is_unit == true ? '.column-dropper' : '.regular-dropper') + " .line.ui-droppable").removeClass('dropzone'); }
366
372
  });
367
373
  }
368
374
 
369
375
  that.add_handles_to_block(bid);
370
376
 
377
+ $(".flex-grid-container").each(function(k, v) {
378
+ var h = $(v).outerHeight();
379
+ $(v).find(".flexbox > .new_block_link .line").css('height',h);
380
+ });
381
+
371
382
  });
372
383
 
373
384
  },
@@ -375,23 +386,25 @@ BlockContentController.prototype = {
375
386
  add_handles_to_block: function(block_id) {
376
387
  var that = this;
377
388
  var el = $('#block_' + block_id);
378
- if ( el.attr('id').indexOf('_value') >= 0 || el.children('.drag_handle').length > 0 )
379
- return true;
380
- if ( el.parents('.content_body').length > 0 ) {
381
- $('#block_' + block_id + ' *').attr('onclick', '').unbind('click');
382
- el.prepend($('<a/>').attr('id', 'handle_block_' + block_id + '_drag' ).addClass('drag_handle' ).append($('<span/>').addClass('ui-icon ui-icon-arrow-4' )).click(function(e) { e.preventDefault(); e.stopPropagation(); }))
383
- .prepend($('<a/>').attr('id', 'handle_block_' + block_id + '_select' ).addClass('select_handle' ).append($('<span/>').addClass('ui-icon ui-icon-check' )).click(function(e) { e.preventDefault(); e.stopPropagation(); that.select_block(block_id); }))
384
- .prepend($('<a/>').attr('id', 'handle_block_' + block_id + '_duplicate' ).addClass('duplicate_handle' ).append($('<span/>').addClass('ui-icon ui-icon-copy' )).click(function(e) { e.preventDefault(); e.stopPropagation(); that.duplicate_block(block_id); }))
385
- .prepend($('<a/>').attr('id', 'handle_block_' + block_id + '_delete' ).addClass('delete_handle' ).append($('<span/>').addClass('ui-icon ui-icon-close' )).click(function(e) { e.preventDefault(); e.stopPropagation(); that.delete_block(block_id); }));
386
- el.mouseover(function(el) { $('#block_' + block_id).addClass( 'block_over'); });
387
- el.mouseout(function(el) { $('#block_' + block_id).removeClass('block_over'); });
389
+ if (el.length > 0) {
390
+ if ( el.attr('id').indexOf('_value') >= 0 || el.children('.drag_handle').length > 0 )
391
+ return true;
392
+ if ( el.parents('.content_body').length > 0 ) {
393
+ $('#block_' + block_id + ' *').attr('onclick', '').unbind('click');
394
+ el.prepend($('<a/>').attr('id', 'handle_block_' + block_id + '_drag' ).addClass('drag_handle' ).append($('<span/>').addClass('ui-icon ui-icon-arrow-4' )).click(function(e) { e.preventDefault(); e.stopPropagation(); }))
395
+ .prepend($('<a/>').attr('id', 'handle_block_' + block_id + '_select' ).addClass('select_handle' ).append($('<span/>').addClass('ui-icon ui-icon-check' )).click(function(e) { e.preventDefault(); e.stopPropagation(); that.select_block(block_id); }))
396
+ .prepend($('<a/>').attr('id', 'handle_block_' + block_id + '_duplicate' ).addClass('duplicate_handle' ).append($('<span/>').addClass('ui-icon ui-icon-copy' )).click(function(e) { e.preventDefault(); e.stopPropagation(); that.duplicate_block(block_id); }))
397
+ .prepend($('<a/>').attr('id', 'handle_block_' + block_id + '_delete' ).addClass('delete_handle' ).append($('<span/>').addClass('ui-icon ui-icon-close' )).click(function(e) { e.preventDefault(); e.stopPropagation(); that.delete_block(block_id); }));
398
+ el.mouseover(function(el) { $('#block_' + block_id).addClass( 'block_over'); });
399
+ el.mouseout(function(el) { $('#block_' + block_id).removeClass('block_over'); });
400
+ }
401
+ el.attr('onclick','').unbind('click');
402
+ el.click(function(e) {
403
+ e.preventDefault();
404
+ e.stopPropagation();
405
+ that.edit_block(block_id);
406
+ });
388
407
  }
389
- el.attr('onclick','').unbind('click');
390
- el.click(function(e) {
391
- e.preventDefault();
392
- e.stopPropagation();
393
- that.edit_block(block_id);
394
- });
395
408
  },
396
409
 
397
410
  /*****************************************************************************
@@ -239,10 +239,10 @@ body > .container, body > .mm-page > .container {
239
239
  .block_over > .delete_handle span { position: absolute; top: 0; right: 0px; width: 18px; height: 18px; background-color: #fff; border: #ccc 1px solid; }
240
240
  .block_over > .duplicate_handle span { position: absolute; top: 0; right: 36px; width: 18px; height: 18px; background-color: #fff; border: #ccc 1px solid; }
241
241
 
242
- .flex-grid-unit.block_over > .delete_handle span { right: auto; left: 36px; background-color: #f1e9e9; }
243
- .flex-grid-unit.block_over > .duplicate_handle span { right: auto; left: 0; background-color: #f1e9e9; }
244
- .flex-grid-unit.block_over > .select_handle span { right: auto; left: 18px; background-color: #f1e9e9; }
245
- .flex-grid-unit.block_over > .drag_handle span { display: none; }
242
+ .flex-grid-unit.block_over > .delete_handle span { right: auto; left: 54px; background-color: #f1e9e9; }
243
+ .flex-grid-unit.block_over > .duplicate_handle span { right: auto; left: 18px; background-color: #f1e9e9; }
244
+ .flex-grid-unit.block_over > .select_handle span { right: auto; left: 36px; background-color: #f1e9e9; }
245
+ .flex-grid-unit.block_over > .drag_handle span { right: auto; left: 0; background-color: #f1e9e9; }
246
246
 
247
247
  .unslider-block-wrapper > .delete_handle,
248
248
  .unslider-block-wrapper > .drag_handle,
@@ -278,7 +278,7 @@ body > .container, body > .mm-page > .container {
278
278
  background: #dbeff7;
279
279
  }
280
280
  &.highlight {
281
- background: #b0d5e4;
281
+ background: shade(#dbeff7, 15%);
282
282
  }
283
283
  &.new-page {
284
284
  text-align: center;
@@ -295,10 +295,68 @@ body > .container, body > .mm-page > .container {
295
295
  p {
296
296
  color: #1d1d1d;
297
297
  }
298
+ &.dropzone {
299
+ background: #dbeff7;
300
+ }
298
301
  &.highlight {
299
- background: #9cb9fb;
302
+ background: shade(#dbeff7, 15%);
300
303
  color: transparent;
301
304
  }
302
305
  }
303
306
  }
304
- }
307
+ }
308
+
309
+ .flex-grid-container .flexbox > .new_block_link {
310
+ height: 0;
311
+ width: 0;
312
+ flex: 0 0 0;
313
+ .line {
314
+ background-color: transparent;
315
+ left: -8px;
316
+ bottom: auto;
317
+ top: 0;
318
+ width: 16px;
319
+ height: 70px;
320
+ &.dropzone {
321
+ background: #c8ffca;
322
+ }
323
+ &.highlight {
324
+ background: shade(#c8ffca, 15%);
325
+ }
326
+ }
327
+ }
328
+
329
+ .flex-grid-container.empty {
330
+ & > .flexbox > .new_block_link.np, & > .constrain > .flexbox > .new_block_link.np {
331
+ flex: 1 1 100%;
332
+ width: auto;
333
+ height: auto;
334
+ .new-page.line {
335
+ width: 100%;
336
+ bottom: auto;
337
+ top: auto;
338
+ background: #ecebe8;
339
+ left: 0;
340
+ height: auto;
341
+ z-index: 2;
342
+ &.dropzone {
343
+ background: #c8ffca;
344
+ }
345
+ &.highlight {
346
+ background: shade(#c8ffca, 15%);
347
+ }
348
+ }
349
+ }
350
+ }
351
+
352
+
353
+
354
+
355
+
356
+
357
+
358
+
359
+
360
+
361
+
362
+
@@ -393,7 +393,7 @@ module Caboose
393
393
  b1.create_children
394
394
  bw = b1.child('width')
395
395
  if bw
396
- bw.value = (100.0 / params[:child_count].to_f).to_i.to_s + '%'
396
+ bw.value = 'auto' # (100.0 / params[:child_count].to_f).to_i.to_s + '%'
397
397
  bw.save
398
398
  end
399
399
  end
@@ -324,7 +324,7 @@ module Caboose
324
324
  parent_id = params[:parent_id]
325
325
  block_type_id = params[:block_type_id]
326
326
  child_block_type_id = params[:child_block_type_id]
327
- duplicate_children = params[:duplicate_children] ? true : false
327
+ duplicate_children = params[:duplicate_children] == 'true' ? true : false
328
328
 
329
329
  if p.nil? then resp.error = "Invalid page"
330
330
  elsif site_id.nil? then resp.error = "Invalid site"
@@ -587,12 +587,11 @@ class Caboose::Block < ActiveRecord::Base
587
587
 
588
588
  # Assumes that we start the duplicate process at the top level block
589
589
  def duplicate_page_block(site_id, page_id, new_block_type_id = nil, new_parent_id = nil)
590
- m = self.media_id ? self.media.duplicate(site_id) : nil
591
590
  b = Caboose::Block.create(
592
591
  :page_id => page_id,
593
592
  :post_id => nil,
594
593
  :parent_id => new_parent_id,
595
- :media_id => self.media_id ? m.id : nil,
594
+ :media_id => self.media_id,
596
595
  :block_type_id => new_block_type_id,
597
596
  :sort_order => self.sort_order,
598
597
  :constrain => self.constrain,
@@ -413,7 +413,7 @@ class Caboose::Page < ActiveRecord::Base
413
413
  p = Caboose::Page.create(:site_id => site_id, :parent_id => parent_id)
414
414
  end
415
415
 
416
- p.title = self.title
416
+ p.title = "Copy of " + self.title
417
417
  p.menu_title = self.menu_title
418
418
  p.slug = self.slug
419
419
  p.alias = self.alias
@@ -7,25 +7,25 @@ btsm = Caboose::BlockTypeSiteMembership.where(:site_id => @site.id).pluq(:block_
7
7
  <h4>Drag a block<br />onto the page.</h4>
8
8
  <ul id='new_blocks'>
9
9
  <li class='title'><span>Structure</span></li>
10
- <li class='blocktype' id='new_block_3159_2' data-btid='3159' data-children='2'>
10
+ <li class='blocktype bt' id='new_block_3159_2' data-btid='3159' data-children='2'>
11
11
  <span class='icon icon-insert-template'></span>
12
12
  <span class='bname'>2 Column Row</span>
13
13
  </li>
14
- <li class='blocktype' id='new_block_3159_3' data-btid='3159' data-children='3'>
14
+ <li class='blocktype bt' id='new_block_3159_3' data-btid='3159' data-children='3'>
15
15
  <span class='icon icon-insert-template'></span>
16
16
  <span class='bname'>3 Column Row</span>
17
17
  </li>
18
- <li class='blocktype' id='new_block_3159_4' data-btid='3159' data-children='4'>
18
+ <li class='blocktype bt' id='new_block_3159_4' data-btid='3159' data-children='4'>
19
19
  <span class='icon icon-insert-template'></span>
20
20
  <span class='bname'>4 Column Row</span>
21
21
  </li>
22
- <li class='blocktype' id='new_block_3159_5' data-btid='3159' data-children='5'>
22
+ <li class='blocktype bt' id='new_block_3159_5' data-btid='3159' data-children='5'>
23
23
  <span class='icon icon-insert-template'></span>
24
24
  <span class='bname'>5 Column Row</span>
25
25
  </li>
26
26
  <li class='title'><span>Content</span></li>
27
27
  <% @block_types.each do |block_type| %>
28
- <li class='blocktype' id='new_block_<%= block_type.id %>' data-btid='<%= block_type.id %>'>
28
+ <li class='blocktype bt' id='new_block_<%= block_type.id %>' data-btid='<%= block_type.id %>'>
29
29
  <span class='icon icon-<%= block_type.icon %>'></span>
30
30
  <span class='bname'><%= block_type.description %></span>
31
31
  </li>
@@ -54,7 +54,7 @@ $(document).ready(function() {
54
54
  .append(html)
55
55
  );
56
56
  $("#new_blocks li.blocktype").draggable({ revert: true, helper: 'clone', appendTo: 'body', zIndex: 999999, scroll: false, start: function(event, ui) {
57
- $(".line.ui-droppable").addClass('dropzone'); }, stop: function(event, ui) { $(".line.ui-droppable").removeClass('dropzone'); } });
57
+ $(".regular-dropper .line.ui-droppable").addClass('dropzone'); }, stop: function(event, ui) { $(".regular-dropper .line.ui-droppable").removeClass('dropzone'); } });
58
58
  $('body').addClass('icons');
59
59
  $('body').append($('<div/>').attr('id','caboose-loading').append( $('<div/>').addClass('table').append($('<div/>').addClass('table-cell').append('<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg id="loader" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" width="60px" height="60px" viewBox="0 0 128 128" xml:space="preserve"><g><path d="M64 0L40.08 21.9a10.98 10.98 0 0 0-5.05 8.75C34.37 44.85 64 60.63 64 60.63V0z" fill="#ffb118"/><path d="M128 64l-21.88-23.9a10.97 10.97 0 0 0-8.75-5.05C83.17 34.4 67.4 64 67.4 64H128z" fill="#80c141"/><path d="M63.7 69.73a110.97 110.97 0 0 1-5.04-20.54c-1.16-8.7.68-14.17.68-14.17h38.03s-4.3-.86-14.47 10.1c-3.06 3.3-19.2 24.58-19.2 24.58z" fill="#cadc28"/><path d="M64 128l23.9-21.88a10.97 10.97 0 0 0 5.05-8.75C93.6 83.17 64 67.4 64 67.4V128z" fill="#cf171f"/><path d="M58.27 63.7a110.97 110.97 0 0 1 20.54-5.04c8.7-1.16 14.17.68 14.17.68v38.03s.86-4.3-10.1-14.47c-3.3-3.06-24.58-19.2-24.58-19.2z" fill="#ec1b21"/><path d="M0 64l21.88 23.9a10.97 10.97 0 0 0 8.75 5.05C44.83 93.6 60.6 64 60.6 64H0z" fill="#018ed5"/><path d="M64.3 58.27a110.97 110.97 0 0 1 5.04 20.54c1.16 8.7-.68 14.17-.68 14.17H30.63s4.3.86 14.47-10.1c3.06-3.3 19.2-24.58 19.2-24.58z" fill="#00bbf2"/><path d="M69.73 64.34a111.02 111.02 0 0 1-20.55 5.05c-8.7 1.14-14.15-.7-14.15-.7V30.65s-.86 4.3 10.1 14.5c3.3 3.05 24.6 19.2 24.6 19.2z" fill="#f8f400"/><circle cx="64" cy="64" r="2.03"/><animateTransform attributeName="transform" type="rotate" from="0 64 64" to="-360 64 64" dur="2100ms" repeatCount="indefinite"></animateTransform></g></svg>').append('<h4>Loading...</h4>') ) ));
60
60
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.82'
2
+ VERSION = '0.9.83'
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.82
4
+ version: 0.9.83
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-26 00:00:00.000000000 Z
11
+ date: 2017-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -1325,12 +1325,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1325
1325
  version: '0'
1326
1326
  requirements: []
1327
1327
  rubyforge_project:
1328
- rubygems_version: 2.6.12
1328
+ rubygems_version: 2.2.0
1329
1329
  signing_key:
1330
1330
  specification_version: 4
1331
1331
  summary: CMS built on rails.
1332
1332
  test_files:
1333
+ - spec/factories/caboose_blocks.rb
1334
+ - spec/factories/caboose_users.rb
1333
1335
  - spec/models/block_spec.rb
1334
1336
  - spec/models/user_spec.rb
1335
- - spec/factories/caboose_users.rb
1336
- - spec/factories/caboose_blocks.rb