caboose-cms 0.9.172 → 0.9.173

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e94f6b70e7405d620738735f3988354796aff2b
4
- data.tar.gz: 7b04c7c819bd1e4dc982386a3fc3dc5c75440f9d
3
+ metadata.gz: b280a399c0fe0c9481f1047fb86e5c3d71b51fd1
4
+ data.tar.gz: 15b6a9ffa8951c7711fe3b512ac637c5ad02daf9
5
5
  SHA512:
6
- metadata.gz: 5631f4acdbbe4a3bf46243ab1e9fda542abc05fa6c1dbc8026265044e9972a3f83bffab7d3b953a430ffb3f9d7ef4ab8b3241bfe9eddc148725ed6af69ef7b30
7
- data.tar.gz: 44604487593826996692a81dc5cf324184e1d269debefeb895584cfc5cc89a9796fc8eb3b484f4385caece005354137b26d862368cef6f88667aa18fb1e7873c
6
+ metadata.gz: e66eea6f8d026e9fa62396ba72b9be702f3269e1357b189b40c6f77bbb3c49d553755fdf11a3435dd73fa261e32020ca8b87cd6391e98a9f6c3a2086620b3901
7
+ data.tar.gz: 2d9620d712cf82a6e7e202718c01eccd9011fa1265075b6e618707864068c12e8f43fca4a5809fe71c0f6c265ace4377598d702796fa50134fbd14200a744fbd
@@ -285,7 +285,7 @@ var BlockModalController = ModalController.extend({
285
285
  url: that.block_url(block) + '/remove-media',
286
286
  type: 'put',
287
287
  success: function(html) {
288
- $('#the_modal img#block_' + block.id).attr('src','//d9hjv462jiw15.cloudfront.net/assets/blank.png').css('width','200px').css('height','120px');
288
+ $('#the_modal .img-holder#block_' + block.id).find("img").attr('src','https://cabooseit.s3.amazonaws.com/assets/select_image.png');
289
289
  $('#the_modal div#block_' + block.id + ' p').html('Empty file.');
290
290
  $('#the_modal #block_' + block.id).parent().find('.caboose-btn').remove();
291
291
  that.parent_controller.render_blocks();
@@ -312,14 +312,14 @@ var BlockModalController = ModalController.extend({
312
312
  that.parent_controller.edit_block(b.id);
313
313
  });
314
314
 
315
- if ( b.block_type && b.block_type.field_type == 'image' && b.rendered_value.indexOf('placehold') < 0 ) {
315
+ if ( b.block_type && b.block_type.field_type == 'image' && b.rendered_value.indexOf('select_image.png') < 0 ) {
316
316
  btn = $('<a href="#" class="caboose-btn">Remove</a>');
317
- btn.css('position','relative').css('left','10px').css('bottom','10px').css('font-size','13px');
317
+ btn.css('position','absolute').css('left','100%').css('left','calc(100% + 10px)').css('bottom','0').css('font-size','13px');
318
318
  btn.on('click', function(e) {
319
319
  e.preventDefault();
320
320
  that.remove_media(b);
321
321
  });
322
- $('#the_modal #block_' + b.id).after(btn);
322
+ $('#the_modal #block_' + b.id).closest(".img-wrap").append(btn);
323
323
  }
324
324
 
325
325
  if ( b.block_type && b.block_type.field_type == 'file' && b.rendered_value.indexOf('Click to select a file') < 0 ) {
@@ -236,31 +236,31 @@ var MediaModalController = BlockModalController.extend({
236
236
  var that = this;
237
237
  var m = that.media_with_id(media_id);
238
238
 
239
- var image_urls = $('<div/>').attr('id', 'image_urls').css('margin-bottom', '20px');
240
- if (m.image_urls)
241
- {
242
- image_urls.append($('<h2/>').append('Image URLs'));
243
- for (var size in m.image_urls)
244
- {
245
- var s = size.replace('_url', '');
246
- s = s[0].toUpperCase() + s.slice(1);
247
- var url = m.image_urls[size];
248
- image_urls.append($('<div/>')
249
- .append($('<span/>').addClass('size').append(s))
250
- .append($('<input/>').attr('type', 'text').attr('id', 'size_' + s).addClass('url').val(url))
251
- .append($('<button/>').addClass('clippy').data('clipboard-target', '#size_' + s).append('Copy'))
252
- );
253
- }
254
- }
239
+ // var image_urls = $('<div/>').attr('id', 'image_urls').css('margin-bottom', '20px');
240
+ // if (m.image_urls)
241
+ // {
242
+ // image_urls.append($('<h2/>').append('Image URLs'));
243
+ // for (var size in m.image_urls)
244
+ // {
245
+ // var s = size.replace('_url', '');
246
+ // s = s[0].toUpperCase() + s.slice(1);
247
+ // var url = m.image_urls[size];
248
+ // image_urls.append($('<div/>')
249
+ // .append($('<span/>').addClass('size').append(s))
250
+ // .append($('<input/>').attr('type', 'text').attr('id', 'size_' + s).addClass('url').val(url))
251
+ // .append($('<button/>').addClass('clippy').data('clipboard-target', '#size_' + s).append('Copy'))
252
+ // );
253
+ // }
254
+ // }
255
255
 
256
256
  $('#top_controls').empty();
257
- var img_tag = m.media_type == 'image' ? ($('<img/>').attr('id', 'detail_image').attr('src', m.image_urls ? m.image_urls.thumb_url : '//placehold.it/250x250')) : ( $('<p/>').text(m.original_name) );
257
+ var img_tag = m.media_type == 'image' ? ($('<img/>').attr('id', 'detail_image').attr('src', m.image_urls ? m.image_urls.thumb_url : 'https://cabooseit.s3.amazonaws.com/assets/select_image.png')) : ( $('<p/>').text(m.original_name) );
258
258
  $('#the_modal #media').empty()
259
- .append(img_tag)
260
- .append($('<p/>').append($('<div/>').attr('id', 'media_' + media_id + '_media_category_id' )))
261
- .append($('<p/>').append($('<div/>').attr('id', 'media_' + media_id + '_name' )))
262
- .append($('<p/>').append($('<div/>').attr('id', 'media_' + media_id + '_description' )))
263
- .append(image_urls);
259
+ .append( $("<div />").addClass("img-wrap").append(img_tag) );
260
+ // .append($('<p/>').append($('<div/>').attr('id', 'media_' + media_id + '_media_category_id' )))
261
+ // .append($('<p/>').append($('<div/>').attr('id', 'media_' + media_id + '_name' )))
262
+ // .append($('<p/>').append($('<div/>').attr('id', 'media_' + media_id + '_description' )))
263
+ // .append(image_urls);
264
264
  var select_text = m.media_type == 'image' ? 'Select this Image' : 'Select this File';
265
265
  $('#modal_controls').empty()
266
266
  .append($('<p/>').css('clear', 'both')
@@ -273,24 +273,24 @@ var MediaModalController = BlockModalController.extend({
273
273
  .append($('<input/>').attr('type', 'button').addClass('caboose-btn').val('Close' ).click(function(e) { that.parent_controller.render_blocks(); that.close(); }))
274
274
  );
275
275
 
276
- var m = new ModelBinder({
277
- name: 'Media',
278
- id: m.id,
279
- update_url: '/admin/media/' + m.id,
280
- authenticity_token: that.authenticity_token,
281
- attributes: [
282
- { name: 'media_category_id' , nice_name: 'Category' , type: 'select' , value: m.media_category_id , fixed_placeholder: true, width: 400, after_update: function() { m.media_category_id = this.value; }, on_load: function() { that.autosize(); }, options_url: '/admin/media-categories/options' },
283
- { name: 'name' , nice_name: 'Name' , type: 'text' , value: m.name , fixed_placeholder: true, width: 400, after_update: function() { m.name = this.value; }, on_load: function() { that.autosize(); }},
284
- { name: 'description' , nice_name: 'Description' , type: 'text' , value: m.description , fixed_placeholder: true, width: 400, after_update: function() { m.description = this.value; }, on_load: function() { that.autosize(); }},
285
- ]
286
- });
287
- $('#media_' + media_id + '_media_category_id' + '_container').css('width', '400px');
288
- $('#media_' + media_id + '_name' + '_container').css('width', '400px');
289
- $('#media_' + media_id + '_description' + '_container').css('width', '400px');
276
+ // var m = new ModelBinder({
277
+ // name: 'Media',
278
+ // id: m.id,
279
+ // update_url: '/admin/media/' + m.id,
280
+ // authenticity_token: that.authenticity_token,
281
+ // attributes: [
282
+ // { name: 'media_category_id' , nice_name: 'Category' , type: 'select' , value: m.media_category_id , fixed_placeholder: true, width: 400, after_update: function() { m.media_category_id = this.value; }, on_load: function() { that.autosize(); }, options_url: '/admin/media-categories/options' },
283
+ // { name: 'name' , nice_name: 'Name' , type: 'text' , value: m.name , fixed_placeholder: true, width: 400, after_update: function() { m.name = this.value; }, on_load: function() { that.autosize(); }},
284
+ // { name: 'description' , nice_name: 'Description' , type: 'text' , value: m.description , fixed_placeholder: true, width: 400, after_update: function() { m.description = this.value; }, on_load: function() { that.autosize(); }},
285
+ // ]
286
+ // });
287
+ // $('#media_' + media_id + '_media_category_id' + '_container').css('width', '400px');
288
+ // $('#media_' + media_id + '_name' + '_container').css('width', '400px');
289
+ // $('#media_' + media_id + '_description' + '_container').css('width', '400px');
290
290
 
291
- $('#image_urls span.size' ).css('width', '70px').css('display', 'inline-block');
292
- $('#image_urls input.url' ).css('width', '270px').css('border', '#ccc 1px solid');
293
- $('#image_urls button' ).css('width', '60px');
291
+ // $('#image_urls span.size' ).css('width', '70px').css('display', 'inline-block');
292
+ // $('#image_urls input.url' ).css('width', '270px').css('border', '#ccc 1px solid');
293
+ // $('#image_urls button' ).css('width', '60px');
294
294
 
295
295
  //c = new Clipboard('.clippy');
296
296
  //c.on('success', function(e) {
@@ -18,21 +18,20 @@ BoundImage = BoundControl.extend({
18
18
 
19
19
  if (!this.attribute.update_url)
20
20
  this.attribute.update_url = this.model.update_url;
21
+
22
+ var awidth = this.attribute.width ? this.attribute.width : this.width;
21
23
 
22
24
  var this2 = this;
23
25
  $('#'+this.el).wrap($('<div/>')
24
26
  .attr('id', this.el + '_container')
25
- .addClass('mb_container')
27
+ .addClass('mb_container model-image')
26
28
  .css('position', 'relative')
27
29
  );
28
30
  $('#'+this.el+'_container').empty();
29
31
 
30
- $('#'+this.el+'_container').append($('<img/>')
31
- .attr('src', this.attribute.value)
32
- .css('width', this.width)
33
- .css('float', 'left')
34
- .css('margin-right', 10)
35
- );
32
+ $('#'+this.el+'_container').append( $("<div/>").addClass('img-holder').css('float','left').css('width',awidth).css('margin-right',10).append($('<img/>')
33
+ .attr('src', this.attribute.value).css('display','block').css('max-width','100%')
34
+ ));
36
35
  $('#'+this.el+'_container')
37
36
  .append($('<form target="' + this.el + '_iframe"></form>')
38
37
  .attr('id', this.el + '_form')
@@ -1,8 +1,13 @@
1
+ #media .img-wrap {
2
+ background-image:url('/assets/caboose/grid.png');
3
+ background-size: 15px;
4
+ display: inline-block;
5
+ }
1
6
 
2
7
  #detail_image {
3
- float: right;
4
- margin: 0;
5
- width: 370px;
8
+ display: block;
9
+ max-height: 300px;
10
+ max-width: 100%;
6
11
  }
7
12
 
8
13
  // #left_content {
@@ -579,6 +579,11 @@ Page Bar Generator
579
579
  max-width: 912px;
580
580
  margin: 0 auto;
581
581
  padding: 0 20px;
582
+ .copy-options {
583
+ border-top: 1px solid #d6d6d6;
584
+ padding-top: 20px;
585
+ margin-top: 10px;
586
+ }
582
587
  .category {
583
588
  border-top: 1px solid #d6d6d6;
584
589
  padding-top: 20px;
@@ -16,9 +16,7 @@ Message boxes
16
16
  .note {
17
17
  padding: 15px;
18
18
  background: #fff3ac;
19
- //color: #fff;
20
19
  font-size: 15px;
21
- //text-align: center;
22
20
  h2 { margin: 0 0 10px 0; padding: 0; }
23
21
  a {
24
22
  color: #fff;
@@ -28,9 +26,11 @@ Message boxes
28
26
  }
29
27
  &.error {
30
28
  background: #bf4448;
29
+ color: #fff;
31
30
  }
32
31
  &.success {
33
32
  background: #26ae88;
33
+ color: #fff;
34
34
  }
35
35
  &.loading {
36
36
  background-image: url('https://cabooseit.s3.amazonaws.com/assets/shared/loading_blue.gif');
@@ -38,6 +38,8 @@ Message boxes
38
38
  background-position: 0 center;
39
39
  background-repeat: no-repeat;
40
40
  padding-left: 40px;
41
+ background-color: #1a5aac;
42
+ color: white;
41
43
  }
42
44
  }
43
45
 
@@ -17,6 +17,11 @@ require caboose/spectrum
17
17
  color: #000;
18
18
  }
19
19
 
20
+ .mb_container.model-image .img-holder {
21
+ background-image: url('/assets/caboose/grid.png');
22
+ background-size: 15px;
23
+ }
24
+
20
25
  .mb_container input[type=text],
21
26
  .mb_container select,
22
27
  .mb_container .mb_fake option,
@@ -437,7 +437,7 @@ module Caboose
437
437
  elsif site_id.nil? then resp.error = "Invalid site"
438
438
  elsif parent_id.nil? then resp.error = "Invalid parent"
439
439
  else
440
- resp.new_id = p.delay(:priority => 20).duplicate(site_id, parent_id, duplicate_children, block_type_id, child_block_type_id)
440
+ resp.new_id = Rails.env.production? ? p.delay(:priority => 20).duplicate(site_id, parent_id, duplicate_children, block_type_id, child_block_type_id) : p.duplicate(site_id, parent_id, duplicate_children, block_type_id, child_block_type_id)
441
441
  resp.success = true
442
442
  end
443
443
 
@@ -512,65 +512,81 @@ module Caboose
512
512
  return
513
513
  end
514
514
 
515
- if params[:template_id].blank?
516
-
517
-
518
- page = Caboose::Page.new
519
-
515
+ # Blank page
516
+ if params[:template_id].blank? && params[:copy_from_id].blank?
517
+ page = Caboose::Page.new
520
518
  if parent.nil?
521
519
  d = Domain.where(:domain => request.host_with_port).first.site_id
522
520
  page.site_id = d.site_id
523
521
  else
524
522
  page.site_id = parent.site_id
525
523
  end
526
-
527
524
  page.title = title
528
525
  page.parent_id = parent_id
529
526
  page.hide = true
530
527
  page.content_format = Caboose::Page::CONTENT_FORMAT_HTML
531
528
  page.save
532
-
533
529
  i = 0
534
530
  begin
535
531
  page.slug = Page.slug(page.title + (i > 0 ? " #{i}" : ""))
536
532
  page.uri = parent.parent_id == -1 ? page.slug : "#{parent.uri}/#{page.slug}"
537
533
  i = i+1
538
534
  end while (Page.where(:uri => page.uri, :site_id => page.site_id).count > 0 && i < 10)
539
-
540
535
  page.save
541
-
542
536
  # Create the top level block for the page
543
537
  bt = BlockType.find(params[:layout_id])
544
538
  Block.create(:page_id => page.id, :block_type_id => bt.id, :name => bt.name)
545
-
546
539
  # Set the new page's permissions
547
540
  viewers = Caboose::PagePermission.where({ :page_id => parent.id, :action => 'view' }).pluck(:role_id)
548
541
  editors = Caboose::PagePermission.where({ :page_id => parent.id, :action => 'edit' }).pluck(:role_id)
549
542
  Caboose::Page.update_authorized_for_action(page.id, 'view', viewers)
550
543
  Caboose::Page.update_authorized_for_action(page.id, 'edit', editors)
551
544
  resp.redirect = "/admin/pages/#{page.id}/content"
545
+
546
+ # Copy from an existing page
547
+ elsif !params[:copy_from_id].blank?
548
+ source = Caboose::Page.find(params[:copy_from_id])
549
+ if source
550
+ Caboose.log("copying from source page: #{source.id}")
551
+ new_page = source.duplicate(@site.id, parent_id, false, layout_id, nil)
552
+ new_page.title = params[:title]
553
+ new_page.hide = true
554
+ i = 0
555
+ begin
556
+ new_page.slug = Page.slug(new_page.title + (i > 0 ? " #{i}" : ""))
557
+ new_page.uri = parent.parent_id == -1 ? new_page.slug : "#{parent.uri}/#{new_page.slug}"
558
+ i = i+1
559
+ end while (Page.where(:uri => new_page.uri, :site_id => @site.id).count > 0 && i < 10)
560
+ new_page.save
561
+ # Set the new page's permissions
562
+ viewers = Caboose::PagePermission.where({ :page_id => parent.id, :action => 'view' }).pluck(:role_id)
563
+ editors = Caboose::PagePermission.where({ :page_id => parent.id, :action => 'edit' }).pluck(:role_id)
564
+ Caboose::Page.update_authorized_for_action(new_page.id, 'view', viewers)
565
+ Caboose::Page.update_authorized_for_action(new_page.id, 'edit', editors)
566
+ resp.redirect = "/admin/pages/#{new_page.id}/content"
567
+ else
568
+ resp.redirect = "/admin/pages/new"
569
+ end
570
+
571
+ # Use a page template
552
572
  else
553
573
  template = Caboose::PageTemplate.find(params[:template_id])
554
574
  if template && template.page
555
575
  new_page = template.page.duplicate(@site.id, parent_id, false, layout_id, nil)
556
576
  new_page.title = params[:title]
557
577
  new_page.hide = true
558
-
559
578
  i = 0
560
579
  begin
561
580
  new_page.slug = Page.slug(new_page.title + (i > 0 ? " #{i}" : ""))
562
581
  new_page.uri = parent.parent_id == -1 ? new_page.slug : "#{parent.uri}/#{new_page.slug}"
563
582
  i = i+1
564
583
  end while (Page.where(:uri => new_page.uri, :site_id => @site.id).count > 0 && i < 10)
565
-
566
584
  new_page.save
567
-
568
585
  # Set the new page's permissions
569
586
  viewers = Caboose::PagePermission.where({ :page_id => parent.id, :action => 'view' }).pluck(:role_id)
570
587
  editors = Caboose::PagePermission.where({ :page_id => parent.id, :action => 'edit' }).pluck(:role_id)
571
588
  Caboose::Page.update_authorized_for_action(new_page.id, 'view', viewers)
572
589
  Caboose::Page.update_authorized_for_action(new_page.id, 'edit', editors)
573
-
574
590
  resp.redirect = "/admin/pages/#{new_page.id}/content"
575
591
  else
576
592
  resp.redirect = "/admin/pages/new"
@@ -30,7 +30,6 @@ module Caboose
30
30
  @error = "You are not allowed to manage sites."
31
31
  render :file => 'caboose/extras/error' and return
32
32
  end
33
-
34
33
  @pager = PageBarGenerator.new(params, {
35
34
  'name_like' => '',
36
35
  },{
@@ -76,52 +75,48 @@ module Caboose
76
75
  # @route GET /admin/sites/new
77
76
  def admin_new
78
77
  return if !user_is_allowed('sites', 'add')
79
- if !@site.is_master
80
- @error = "You are not allowed to manage sites."
78
+ if (@site.id.to_s != params[:id] && !@site.is_master)
79
+ @error = "You are not allowed to edit this site."
81
80
  render :file => 'caboose/extras/error' and return
82
81
  end
83
-
84
82
  @site = Site.new
85
83
  end
86
-
87
-
88
84
 
89
85
  # @route GET /admin/sites/:id/block-types
90
86
  def admin_edit_block_types
91
87
  return if !user_is_allowed('sites', 'edit')
92
- if !@site.is_master
93
- @error = "You are not allowed to manage sites."
88
+ if (@site.id.to_s != params[:id] && !@site.is_master)
89
+ @error = "You are not allowed to edit this site."
94
90
  render :file => 'caboose/extras/error' and return
95
91
  end
96
-
97
92
  @site = Site.find(params[:id])
98
93
  end
99
94
 
100
95
  # @route GET /admin/sites/:id/css
101
96
  def admin_edit_css
102
97
  return if !user_is_allowed('sites', 'edit')
103
- if !@site.is_master
104
- @error = "You are not allowed to manage sites."
98
+ if (@site.id.to_s != params[:id] && !@site.is_master)
99
+ @error = "You are not allowed to edit this site."
105
100
  render :file => 'caboose/extras/error' and return
106
- end
101
+ end
107
102
  @site = Site.find(params[:id])
108
103
  end
109
104
 
110
105
  # @route GET /admin/sites/:id/js
111
106
  def admin_edit_js
112
107
  return if !user_is_allowed('sites', 'edit')
113
- if !@site.is_master
114
- @error = "You are not allowed to manage sites."
108
+ if (@site.id.to_s != params[:id] && !@site.is_master)
109
+ @error = "You are not allowed to edit this site."
115
110
  render :file => 'caboose/extras/error' and return
116
- end
111
+ end
117
112
  @site = Site.find(params[:id])
118
113
  end
119
114
 
120
115
  # @route GET /admin/sites/:id/delete
121
116
  def admin_delete_form
122
117
  return if !user_is_allowed('sites', 'edit')
123
- if !@site.is_master
124
- @error = "You are not allowed to manage sites."
118
+ if (@site.id.to_s != params[:id] && !@site.is_master)
119
+ @error = "You are not allowed to edit this site."
125
120
  render :file => 'caboose/extras/error' and return
126
121
  end
127
122
  @site = Site.find(params[:id])
@@ -130,14 +125,11 @@ module Caboose
130
125
  # @route GET /admin/sites/:id
131
126
  def admin_edit
132
127
  return if !user_is_allowed('sites', 'edit')
133
- if !@site.is_master
134
- @error = "You are not allowed to manage sites."
128
+ if (@site.id.to_s != params[:id] && !@site.is_master)
129
+ @error = "You are not allowed to edit this site."
135
130
  render :file => 'caboose/extras/error' and return
136
131
  end
137
-
138
132
  @site = Site.find(params[:id])
139
- @site.init_users_and_roles
140
-
141
133
  end
142
134
 
143
135
  # @route POST /admin/sites
@@ -173,11 +165,11 @@ module Caboose
173
165
  # @route PUT /admin/sites/:id
174
166
  def admin_update
175
167
  return if !user_is_allowed('sites', 'edit')
176
- render :json => { :error => "You are not allowed to manage sites." } and return if !@site.is_master
177
-
168
+ if (@site.id.to_s != params[:id] && !@site.is_master)
169
+ render :json => { :error => "You are not allowed to manage sites." } and return
170
+ end
178
171
  resp = StdClass.new
179
172
  site = Site.find(params[:id])
180
-
181
173
  save = true
182
174
  params.each do |name,value|
183
175
  case name
@@ -196,7 +188,6 @@ module Caboose
196
188
  when 'assets_url' then site.assets_url = value
197
189
  end
198
190
  end
199
-
200
191
  resp.success = save && site.save
201
192
  render :json => resp
202
193
  end
@@ -204,15 +195,38 @@ module Caboose
204
195
  # @route POST /admin/sites/:id/logo
205
196
  def admin_update_logo
206
197
  return if !user_is_allowed('sites', 'edit')
207
- render :json => { :error => "You are not allowed to manage sites." } and return if !@site.is_master
208
-
198
+ if (@site.id.to_s != params[:id] && !@site.is_master)
199
+ render :json => { :error => "You are not allowed to manage sites." } and return
200
+ end
209
201
  site = Site.find(params[:id])
210
202
  site.logo = params[:logo]
211
203
  site.save
212
-
213
204
  resp = StdClass.new
214
205
  resp.success = true
215
- resp.attributes = { :image => { :value => site.logo.url(:thumb) }}
206
+ resp.attributes = { :logo => { :value => site.logo.url(:thumb) }}
207
+ if Caboose::use_cloudinary
208
+ site.update_cloudinary_logo if Rails.env.development?
209
+ site.delay(:queue => 'general', :priority => 12).update_cloudinary_logo if Rails.env.production?
210
+ end
211
+ render :json => resp
212
+ end
213
+
214
+ # @route POST /admin/sites/:id/favicon
215
+ def admin_update_favicon
216
+ return if !user_is_allowed('sites', 'edit')
217
+ if (@site.id.to_s != params[:id] && !@site.is_master)
218
+ render :json => { :error => "You are not allowed to manage sites." } and return
219
+ end
220
+ site = Site.find(params[:id])
221
+ site.favicon = params[:favicon]
222
+ site.save
223
+ resp = StdClass.new
224
+ resp.success = true
225
+ resp.attributes = { :favicon => { :value => site.favicon.url(:tiny) }}
226
+ if Caboose::use_cloudinary
227
+ site.update_cloudinary_favicon if Rails.env.development?
228
+ site.delay(:queue => 'general', :priority => 12).update_cloudinary_favicon if Rails.env.production?
229
+ end
216
230
  render :json => resp
217
231
  end
218
232
 
@@ -220,10 +234,8 @@ module Caboose
220
234
  def admin_delete
221
235
  return if !user_is_allowed('sites', 'delete')
222
236
  render :json => { :error => "You are not allowed to manage sites." } and return if !@site.is_master
223
-
224
237
  site = Site.find(params[:id])
225
238
  site.destroy
226
-
227
239
  resp = StdClass.new({
228
240
  'redirect' => '/admin/sites'
229
241
  })
@@ -234,7 +246,6 @@ module Caboose
234
246
  def admin_add_member
235
247
  return if !user_is_allowed('sites', 'edit')
236
248
  render :json => { :error => "You are not allowed to manage sites." } and return if !@site.is_master
237
-
238
249
  sm = SiteMembership.where(:site_id => params[:id], :user_id => params[:user_id]).first
239
250
  sm = SiteMembership.create(:site_id => params[:id], :user_id => params[:user_id]) if sm.nil?
240
251
  sm.role = params[:role]
@@ -246,7 +257,6 @@ module Caboose
246
257
  def admin_remove_member
247
258
  return if !user_is_allowed('sites', 'edit')
248
259
  render :json => { :error => "You are not allowed to manage sites." } and return if !@site.is_master
249
-
250
260
  SiteMembership.where(:site_id => params[:id], :user_id => params[:user_id]).destroy_all
251
261
  render :json => true
252
262
  end
@@ -257,7 +267,6 @@ module Caboose
257
267
  # @route GET /admin/sites/:id/:field-options
258
268
  def options
259
269
  return if !user_is_allowed('sites', 'view')
260
-
261
270
  case params[:field]
262
271
  when nil
263
272
  options = logged_in_user.is_super_admin? ? Site.reorder('name').all.collect { |s| { 'value' => s.id, 'text' => s.name }} : []
@@ -75,6 +75,12 @@ module Caboose
75
75
  when 'sidebar_width' then theme.sidebar_width = value
76
76
  when 'sidebar_bg_color' then theme.sidebar_bg_color = value
77
77
 
78
+ when 'banner_font_size' then theme.banner_font_size = value
79
+ when 'footer_hover_color' then theme.footer_hover_color = value
80
+ when 'actual_footer_height' then theme.actual_footer_height = value
81
+ when 'actual_banner_height' then theme.actual_banner_height = value
82
+ when 'dropdown_nav_padding' then theme.dropdown_nav_padding = value
83
+
78
84
  end
79
85
  end
80
86
  resp.success = save && theme.save
@@ -14,8 +14,8 @@ class Caboose::CorePlugin < Caboose::CaboosePlugin
14
14
  item['children'] << { 'icon' => 'box', 'id' => 'inbox' , 'text' => 'Inbox' , 'href' => '/admin/inbox' , 'modal' => false } if user.is_allowed('contacts' , 'view') && has_inbox && Contact.where(:site_id => site.id).count > 0
15
15
  nav << item if item['children'].count > 0
16
16
 
17
- item = { 'id' => 'core', 'text' => 'Settings', 'children' => [] }
18
- # item['children'] << { 'id' => 'blocktypes' , 'text' => 'AB Test Variants' , 'href' => '/admin/ab-variants' , 'modal' => false } if user.is_allowed('abvariants' , 'view')
17
+ item = { 'id' => 'core', 'text' => 'Settings', 'children' => [] }
18
+ item['children'] << { 'id' => 'settings' , 'icon' => 'settings', 'text' => 'Site Settings' , 'href' => "/admin/sites/#{site.id}" , 'modal' => false } if user.is_super_admin?
19
19
  item['children'] << { 'id' => 'blocktypes' , 'text' => 'Block Types' , 'href' => '/admin/block-types' , 'modal' => false } if user.is_allowed('blocktypes' , 'view') && site.is_master == true
20
20
  item['children'] << { 'icon' => 'star', 'id' => 'fonts' , 'text' => 'Fonts' , 'href' => '/admin/fonts' , 'modal' => false } if user.is_allowed('fonts' , 'view') && site.use_fonts == true
21
21
  item['children'] << { 'id' => 'redirects' , 'text' => 'Permanent Redirects' , 'href' => '/admin/redirects' , 'modal' => false } if user.is_allowed('redirects' , 'view')
@@ -460,9 +460,7 @@ class Caboose::Page < ActiveRecord::Base
460
460
 
461
461
  p.title = "Copy of " + self.title
462
462
  p.menu_title = self.menu_title
463
- p.slug = self.slug
464
- p.alias = self.alias
465
- p.uri = self.uri
463
+ p.alias = self.alias
466
464
  p.redirect_url = self.redirect_url
467
465
  p.hide = self.hide
468
466
  p.content_format = self.content_format
@@ -478,7 +476,16 @@ class Caboose::Page < ActiveRecord::Base
478
476
  p.meta_robots = self.meta_robots
479
477
  p.canonical_url = self.canonical_url
480
478
  p.fb_description = self.fb_description
481
- p.gp_description = self.gp_description
479
+ p.gp_description = self.gp_description
480
+
481
+ i = 0
482
+ begin
483
+ par = Caboose::Page.where(:id => parent_id).first
484
+ p.slug = Caboose::Page.slug(p.title + (i > 0 ? " #{i}" : ""))
485
+ p.uri = par.parent_id == -1 ? p.slug : "#{par.uri}/#{p.slug}"
486
+ i = i+1
487
+ end while (Caboose::Page.where(:uri => p.uri, :site_id => site_id).count > 0 && i < 10)
488
+
482
489
  p.save
483
490
 
484
491
  self.page_tags.each{ |tag| Caboose::PageTag.create(:page_id => p.id, :tag => tag.tag) }
@@ -807,11 +807,10 @@ class Caboose::Schema < Caboose::Utilities::Schema
807
807
  [ :theme_color , :string ],
808
808
  [ :assets_url , :string ],
809
809
  [ :rets_office_id, :string ],
810
- [ :theme_id, :integer ]
811
- #[ :custom_css , :text ],
812
- #[ :custom_css_files , :text ],
813
- #[ :custom_js , :text ],
814
- #[ :custom_js_files , :text ]
810
+ [ :theme_id, :integer ],
811
+ [ :favicon, :attachment ],
812
+ [ :cl_logo_version , :string ],
813
+ [ :cl_favicon_version , :string ]
815
814
  ],
816
815
  Caboose::SiteMembership => [
817
816
  [ :site_id , :integer ],
@@ -924,7 +923,6 @@ class Caboose::Schema < Caboose::Utilities::Schema
924
923
  [ :status , :string ]
925
924
  ],
926
925
  Caboose::Theme => [
927
- # [ :site_id , :integer ],
928
926
  [ :color_main , :string ],
929
927
  [ :color_alt , :string ],
930
928
  [ :color_light, :string ],
@@ -960,29 +958,41 @@ class Caboose::Schema < Caboose::Utilities::Schema
960
958
  [ :input_font_size, :string ],
961
959
  [ :input_padding, :string ],
962
960
  [ :digest, :text ],
963
- [ :body_line_height, :text ],
964
- [ :body_font_color, :text ],
965
- [ :button_padding, :text ],
966
- [ :button_line_height, :text ],
967
- [ :footer_padding, :text ],
968
- [ :footer_font_size, :text ],
969
- [ :header_font_size, :text ],
970
- [ :note_padding, :text ],
971
- [ :header_nav_spacing, :text ],
972
- [ :logo_width, :text ],
973
- [ :logo_height, :text ],
974
- [ :logo_top_padding, :text ],
975
- [ :heading_line_height, :text ],
976
- [ :mobile_menu_nav_padding, :text ],
977
- [ :mobile_menu_font_size, :text ],
978
- [ :banner_padding, :text ],
979
- [ :banner_overlay_color, :text ],
980
- [ :banner_overlay_opacity, :text ],
981
- [ :default_header_style, :text ],
982
- [ :default_header_position, :text ],
983
- [ :sidebar_width, :text ],
984
- [ :sidebar_bg_color, :text ],
985
- [ :default_banner_image, :attachment ]
961
+ [ :body_line_height, :string ],
962
+ [ :body_font_color, :string ],
963
+ [ :button_padding, :string ],
964
+ [ :button_line_height, :string ],
965
+ [ :footer_padding, :string ],
966
+ [ :footer_font_size, :string ],
967
+ [ :header_font_size, :string ],
968
+ [ :note_padding, :string ],
969
+ [ :header_nav_spacing, :string ],
970
+ [ :logo_width, :string ],
971
+ [ :logo_height, :string ],
972
+ [ :logo_top_padding, :string ],
973
+ [ :heading_line_height, :string ],
974
+ [ :mobile_menu_nav_padding, :string ],
975
+ [ :mobile_menu_font_size, :string ],
976
+ [ :banner_padding, :string ],
977
+ [ :banner_overlay_color, :string ],
978
+ [ :banner_overlay_opacity, :string ],
979
+ [ :default_header_style, :string ],
980
+ [ :default_header_position, :string ],
981
+ [ :sidebar_width, :string ],
982
+ [ :sidebar_bg_color, :string ],
983
+ [ :default_banner_image, :attachment ],
984
+ [ :banner_font_size, :string ],
985
+ [ :footer_hover_color, :string ],
986
+ [ :actual_footer_height, :string ],
987
+ [ :actual_banner_height, :string ],
988
+ [ :dropdown_nav_padding, :string ]
989
+ ],
990
+ Caboose::ThemeFile => [
991
+ [ :filename, :string ]
992
+ ],
993
+ Caboose::ThemeFileMembership => [
994
+ [ :theme_file_id , :integer ],
995
+ [ :theme_id , :integer ]
986
996
  ],
987
997
  Caboose::User => [
988
998
  [ :site_id , :integer ],
@@ -10,6 +10,7 @@ class Caboose::Site < ActiveRecord::Base
10
10
  has_many :fonts, :class_name => 'Caboose::Font', :dependent => :delete_all
11
11
  has_many :post_categories, :class_name => 'Caboose::PostCategory'
12
12
  has_one :store_config
13
+
13
14
  has_attached_file :logo,
14
15
  :path => ':caboose_prefixsite_logos/:id_:style.:extension',
15
16
  :default_url => 'http://placehold.it/300x300',
@@ -19,6 +20,16 @@ class Caboose::Site < ActiveRecord::Base
19
20
  :large => '600x800>'
20
21
  }
21
22
  do_not_validate_attachment_file_type :logo
23
+
24
+ has_attached_file :favicon,
25
+ :path => ':caboose_prefixfavicons/:id_:style.:extension',
26
+ :default_url => 'https://assets.caboosecms.com/site_logos/ninefavicon.png',
27
+ :styles => {
28
+ :tiny => '100x100>',
29
+ :thumb => '300x300>'
30
+ }
31
+ do_not_validate_attachment_file_type :favicon
32
+
22
33
  attr_accessible :id ,
23
34
  :name ,
24
35
  :description ,
@@ -39,7 +50,9 @@ class Caboose::Site < ActiveRecord::Base
39
50
  :robots_txt ,
40
51
  :theme_color ,
41
52
  :assets_url ,
42
- :theme_id
53
+ :theme_id ,
54
+ :cl_logo_version ,
55
+ :cl_favicon_version
43
56
 
44
57
  before_save :validate_presence_of_store_config
45
58
 
@@ -47,6 +60,22 @@ class Caboose::Site < ActiveRecord::Base
47
60
  Caboose::Theme.where(:id => self.theme_id).first
48
61
  end
49
62
 
63
+ def update_cloudinary_logo
64
+ if Caboose::use_cloudinary
65
+ result = Cloudinary::Uploader.upload("https:#{self.logo.url(:large)}" , :public_id => "caboose/site_logos/#{self.id}_large", :overwrite => true)
66
+ self.cl_logo_version = result['version'] if result && result['version']
67
+ self.save
68
+ end
69
+ end
70
+
71
+ def update_cloudinary_favicon
72
+ if Caboose::use_cloudinary
73
+ result = Cloudinary::Uploader.upload("https:#{self.favicon.url(:thumb)}" , :public_id => "caboose/favicons/#{self.id}_thumb", :overwrite => true)
74
+ self.cl_favicon_version = result['version'] if result && result['version']
75
+ self.save
76
+ end
77
+ end
78
+
50
79
  def build_new_site
51
80
  # if defined?(SuiteBuilder) == 'constant' && SuiteBuilder.class == Class
52
81
  helper = Caboose::SiteBuilder.new(self.name)
@@ -2,6 +2,9 @@ class Caboose::Theme < ActiveRecord::Base
2
2
 
3
3
  self.table_name = "themes"
4
4
 
5
+ has_many :theme_file_memberships
6
+ has_many :theme_files, :through => :theme_file_memberships
7
+
5
8
  has_attached_file :default_banner_image,
6
9
  :path => 'banner_images/:id_:style.:extension',
7
10
  :default_url => 'https://res.cloudinary.com/caboose/image/upload/c_scale,f_auto,q_auto:good,w_1800/v1539265856/default_banner.jpg',
@@ -70,6 +73,12 @@ class Caboose::Theme < ActiveRecord::Base
70
73
  :sidebar_width,
71
74
  :sidebar_bg_color,
72
75
 
76
+ :banner_font_size,
77
+ :footer_hover_color,
78
+ :actual_footer_height,
79
+ :actual_banner_height,
80
+ :dropdown_nav_padding,
81
+
73
82
  :digest
74
83
 
75
84
  def compile(for_site_id = 0)
@@ -82,7 +91,7 @@ class Caboose::Theme < ActiveRecord::Base
82
91
  tmp_asset_name = "theme_#{self.id}_site_#{for_site_id}"
83
92
  FileUtils.mkdir_p(tmp_themes_path) unless File.directory?(tmp_themes_path)
84
93
  File.open(File.join(tmp_themes_path, "#{tmp_asset_name}.scss"), 'w') { |f| f.write(body) }
85
- # begin
94
+ begin
86
95
  env = if Rails.application.assets.is_a?(Sprockets::Index)
87
96
  Rails.application.assets.instance_variable_get('@environment')
88
97
  else
@@ -107,9 +116,12 @@ class Caboose::Theme < ActiveRecord::Base
107
116
  File.open(File.join(Rails.root, 'public', theme.asset_path(asset.digest, for_site_id)), 'w') { |f| f.write(compressed_body) }
108
117
  end
109
118
  self.update_digest(asset.digest)
110
- # rescue Sass::SyntaxError => error
111
- # theme.revert
112
- # end
119
+ rescue Sass::SyntaxError => error
120
+ if Rails.env.development?
121
+ raise error
122
+ end
123
+ theme.revert
124
+ end
113
125
  end
114
126
 
115
127
  def revert
@@ -133,8 +145,16 @@ class Caboose::Theme < ActiveRecord::Base
133
145
  end
134
146
 
135
147
  def asset_url(site_id = 0)
136
- pre = Rails.env.production? ? "https://" : ""
137
- "#{pre}#{ActionController::Base.asset_host}/#{asset_path(self.digest,site_id)}"
148
+ if Rails.env.production?
149
+ return "https://#{ActionController::Base.asset_host}/#{asset_path(self.digest,site_id)}"
150
+ else
151
+ path = File.join(Rails.root, 'public', "#{asset_path(self.digest,site_id)}")
152
+ if File.file?(path)
153
+ return "#{ActionController::Base.asset_host}/#{asset_path(self.digest,site_id)}"
154
+ else
155
+ return "https://#{Caboose::cdn_domain}/#{asset_path(self.digest,site_id)}"
156
+ end
157
+ end
138
158
  end
139
159
 
140
160
  def js_url
@@ -0,0 +1,6 @@
1
+ class Caboose::ThemeFile < ActiveRecord::Base
2
+ self.table_name = "theme_files"
3
+
4
+ attr_accessible :filename
5
+
6
+ end
@@ -0,0 +1,8 @@
1
+ class Caboose::ThemeFileMembership < ActiveRecord::Base
2
+ self.table_name = "theme_file_memberships"
3
+
4
+ belongs_to :theme
5
+ belongs_to :theme_file
6
+ attr_accessible :theme_id, :theme_file_id
7
+
8
+ end
@@ -5,10 +5,18 @@ if block.media
5
5
  elsif block.image
6
6
  url = block.image.url(:tiny)
7
7
  end
8
-
9
- if editing && url.nil?
10
- %><p id='block_<%= block.id %>'>Please upload an image.</p><%
11
- else
12
- %><img src='<%= raw url %>' id='block_<%= block.id %>' /><%
13
- end
14
- %>
8
+ if editing && url.include?('placehold') %>
9
+ <div class="img-wrap" style="position:relative;display:inline-block;">
10
+ <div class="img-holder" style="background-image:url(https://cabooseit.s3.amazonaws.com/assets/caboose/grid.png);background-size:15px;display:inline-block;position:relative;" id='block_<%= block.id %>'>
11
+ <img src='https://cabooseit.s3.amazonaws.com/assets/select_image.png' width="150" style="max-width:100%;display:block;" />
12
+ </div>
13
+ </div>
14
+ <% elsif editing %>
15
+ <div class="img-wrap" style="position:relative;display:inline-block;">
16
+ <div class="img-holder" style="background-image:url(https://cabooseit.s3.amazonaws.com/assets/caboose/grid.png);background-size:15px;display:inline-block;position:relative;" id='block_<%= block.id %>'>
17
+ <img src='<%== url %>' width="200" style="max-width:100%;display:block;" />
18
+ </div>
19
+ </div>
20
+ <% else %>
21
+ <img src='<%== url %>' width="200" id='block_<%= block.id %>' />
22
+ <% end %>
@@ -1,6 +1,6 @@
1
1
  <form action="/login" method="post" id="login-form">
2
2
  <div class="header">
3
- <% if @site.logo %>
3
+ <% if @site.logo && !@site.logo.url.include?('placehold') %>
4
4
  <img src='<%= @site.logo.url(:thumb) %>' alt="<%= @site.description %>" />
5
5
  <% else %>
6
6
  <img src="/assets/caboose/caboose_logo.png" alt="Caboose">
@@ -1,3 +1,8 @@
1
+ <%
2
+ temp = Caboose::PageTemplate.where('screenshot_file_name is not null').first
3
+ tempimg = temp ? temp.screenshot.url(:small) : '//cabooseit.s3.amazonaws.com/assets/shared/template.png'
4
+ %>
5
+
1
6
  <h1>New Page</h1>
2
7
 
3
8
  <div class="new-page-form-wrapper">
@@ -28,11 +33,11 @@
28
33
  <option <% if bt.description == 'Subpage' || bt.description == 'Standard' %>selected<% end %> value="<%= bt.id %>"><%= bt.description %></option>
29
34
  <% end %>
30
35
  </select>
31
- <p class="meta">The page layout defines the overall page structure, such as header, footer, and sidebar. Most of the time, this is 'Subpage'.</p>
36
+ <p class="meta">The page layout defines the overall page structure, such as header, footer, and sidebar.</p>
32
37
  </div>
33
38
  </section>
34
39
  <%# temporarily only super admins can do templates %>
35
- <% if @logged_in_user && @logged_in_user.is_super_admin? %>
40
+
36
41
  <section class="page-templates-wrapper">
37
42
  <h4>Page Template</h4>
38
43
  <div class="field">
@@ -42,19 +47,28 @@
42
47
  <div class="category">
43
48
  <div class="cat-templates">
44
49
  <a href="#" id="template-blank" class="template selected opt">
45
- <img src="//cabooseit.s3.amazonaws.com/assets/shared/template.png" width="200" alt="Blank" />
50
+ <img src="https://cabooseit.s3.amazonaws.com/assets/blank_template.png" width="200" alt="Blank" />
46
51
  <div class="text">
47
52
  <span class="title">Blank</span>
48
53
  <span class="desc">A completely blank page.</span>
49
54
  </div>
50
55
  </a>
56
+ <% if @logged_in_user && @logged_in_user.is_super_admin? %>
51
57
  <a href="#" id="template-choose" class="template opt">
52
- <img src="//cabooseit.s3.amazonaws.com/assets/shared/template.png" width="200" alt="Blank" />
58
+ <img src="<%= tempimg %>" width="200" alt="Blank" />
53
59
  <div class="text">
54
60
  <span class="title">Use a Template</span>
55
61
  <span class="desc">Choose a page template.</span>
56
62
  </div>
57
63
  </a>
64
+ <% end %>
65
+ <a href="#" id="template-copy" class="template opt">
66
+ <img src="https://cabooseit.s3.amazonaws.com/assets/copy_page.png" width="200" alt="Blank" />
67
+ <div class="text">
68
+ <span class="title">Existing page</span>
69
+ <span class="desc">Copy an existing page.</span>
70
+ </div>
71
+ </a>
58
72
  </div>
59
73
  </div>
60
74
  <% @categories.each do |cat| %>
@@ -75,14 +89,25 @@
75
89
  </div>
76
90
  </div>
77
91
  <% end %>
92
+ <div class="copy-options" style="display:none;">
93
+ <div class="field">
94
+ <label for="copy_from_id">Choose a page to copy</label>
95
+ <select name="copy_from_id" id="copy_from_id">
96
+ <% @sitemap.each do |sm| %>
97
+ <option value="<%= sm['value'] %>"><%= sm['text'] %></option>
98
+ <% end %>
99
+ </select>
100
+ </div>
101
+ </div>
78
102
  </section>
79
- <% end %>
103
+
80
104
  <div id="page-message"></div>
81
105
  <section class="buttons clearfix">
82
106
  <a href="/admin/pages" class="caboose-btn-white">Cancel</a>
83
107
  <a href="#" id="create_page" class="caboose-btn">Create Page</a>
84
108
  </section>
85
109
  <input type="hidden" id="use_template" name="use_template" value="no" />
110
+ <input type="hidden" id="use_copy" name="use_copy" value="no" />
86
111
  <input type="hidden" id="template_id" name="template_id" value="" />
87
112
  </form>
88
113
  </div>
@@ -107,11 +132,21 @@
107
132
  $(this).addClass("selected");
108
133
  if ( $(this).attr("id") == "template-choose") {
109
134
  $(".category.more").slideDown();
135
+ $(".copy-options").slideUp();
110
136
  $("#use_template").attr("value","yes");
137
+ $("#use_copy").attr("value","no");
111
138
  }
112
139
  else if ( $(this).attr("id") == "template-blank") {
113
140
  $(".category.more").slideUp();
141
+ $(".copy-options").slideUp();
142
+ $("#use_template").attr("value","no");
143
+ $("#use_copy").attr("value","no");
144
+ }
145
+ else if ( $(this).attr("id") == "template-copy") {
146
+ $(".category.more").slideUp();
147
+ $(".copy-options").slideDown();
114
148
  $("#use_template").attr("value","no");
149
+ $("#use_copy").attr("value","yes");
115
150
  }
116
151
  });
117
152
  $(".template.tem").click(function(e) {
@@ -28,7 +28,7 @@ tabs = {
28
28
  'Block Types' => "/admin/sites/#{@site.id}/block-types",
29
29
  'Custom CSS' => "/admin/sites/#{@site.id}/css",
30
30
  'Custom JS' => "/admin/sites/#{@site.id}/js",
31
- 'Retargeting' => "/admin/sites/#{@site.id}/retargeting",
31
+ # 'Retargeting' => "/admin/sites/#{@site.id}/retargeting",
32
32
  'Delete Site' => "/admin/sites/#{@site.id}/delete"
33
33
  }
34
34
 
@@ -17,9 +17,12 @@ user_ids = [] if user_ids.nil?
17
17
  <p><div id='site_<%= @site.id %>_use_fonts' ></div></p>
18
18
  <p><div id='site_<%= @site.id %>_use_dragdrop' ></div></p>
19
19
  <p><div id='site_<%= @site.id %>_allow_self_registration' ></div></p>
20
+ <% if @site.theme.nil? %>
20
21
  <p><div id='site_<%= @site.id %>_theme_color' ></div></p>
22
+ <% end %>
21
23
  <p><div id='site_<%= @site.id %>_assets_url' ></div></p>
22
24
  <p><div id='site_<%= @site.id %>_default_layout_id' ></div></p>
25
+ <p><div id='site_<%= @site.id %>_favicon' ></div></p>
23
26
 
24
27
  <h2>Domains</h2>
25
28
  <p><a href='#' onclick="add_domain(<%= @site.id %>);">New Domain</a></p>
@@ -93,7 +96,8 @@ $(document).ready(function() {
93
96
  update_url: '/admin/sites/<%= @site.id %>',
94
97
  authenticity_token: '<%= form_authenticity_token %>',
95
98
  attributes: [
96
- { name: 'logo' , nice_name: 'Logo' , type: 'image' , value: <%= raw Caboose.json(@site.logo ? @site.logo.url(:thumb) : '') %>, width: 400, update_url: '/admin/sites/<%= @site.id %>/logo' },
99
+ { name: 'logo' , nice_name: 'Logo' , type: 'image' , value: <%= raw Caboose.json(@site.logo ? @site.logo.url(:thumb) : '') %>, width: 300, update_url: '/admin/sites/<%= @site.id %>/logo' },
100
+ { name: 'favicon' , nice_name: 'Favicon' , type: 'image' , value: <%= raw Caboose.json(@site.favicon ? @site.favicon.url(:tiny) : '') %>, width: 80, update_url: '/admin/sites/<%= @site.id %>/favicon' },
97
101
  { name: 'description' , nice_name: 'Description' , type: 'text' , value: <%= raw Caboose.json(@site.description) %>, width: 600 },
98
102
  { name: 'theme_color' , nice_name: 'Theme Color' , type: 'text' , value: <%= raw Caboose.json(@site.theme_color) %>, width: 600 },
99
103
  { name: 'assets_url' , nice_name: 'Assets URL' , type: 'text' , value: <%= raw Caboose.json(@site.assets_url) %>, width: 600 },
@@ -36,6 +36,7 @@ position = header.child('position') if header
36
36
  <div id="theme_<%= @theme.id %>_header_bg_color"></div>
37
37
  <div id="theme_<%= @theme.id %>_header_font_color"></div>
38
38
  <div id="theme_<%= @theme.id %>_dropdown_color"></div>
39
+ <div id="theme_<%= @theme.id %>_dropdown_nav_padding"></div>
39
40
  <div id="theme_<%= @theme.id %>_mobile_menu_icon_color"></div>
40
41
  <div id="theme_<%= @theme.id %>_mobile_menu_icon_top"></div>
41
42
  <div id="theme_<%= @theme.id %>_header_font_size"></div>
@@ -50,9 +51,11 @@ position = header.child('position') if header
50
51
  <h5>Footer</h5>
51
52
  <div id="theme_<%= @theme.id %>_footer_height"></div>
52
53
  <div id="theme_<%= @theme.id %>_footer_bg_color"></div>
54
+ <div id="theme_<%= @theme.id %>_footer_hover_color"></div>
53
55
  <div id="theme_<%= @theme.id %>_footer_font_color"></div>
54
56
  <div id="theme_<%= @theme.id %>_footer_padding"></div>
55
57
  <div id="theme_<%= @theme.id %>_footer_font_size"></div>
58
+ <div id="theme_<%= @theme.id %>_actual_footer_height"></div>
56
59
  </section>
57
60
  </div>
58
61
  <div class="unit1of2 right">
@@ -85,8 +88,10 @@ position = header.child('position') if header
85
88
  <section>
86
89
  <h5>Subpage Banner</h5>
87
90
  <div id="theme_<%= @theme.id %>_banner_padding"></div>
91
+ <div id="theme_<%= @theme.id %>_banner_font_size"></div>
88
92
  <div id="theme_<%= @theme.id %>_banner_overlay_color"></div>
89
93
  <div id="theme_<%= @theme.id %>_banner_overlay_opacity"></div>
94
+ <div id="theme_<%= @theme.id %>_actual_banner_height"></div>
90
95
  <div id="theme_<%= @theme.id %>_default_banner_image"></div>
91
96
  </section>
92
97
  <section>
@@ -134,12 +139,6 @@ position = header.child('position') if header
134
139
  section > div {
135
140
  margin-bottom: 10px;
136
141
  }
137
- #message .note {
138
- font-size: 16px !important;
139
- }
140
- #message p.note.loading {
141
- background-color: #b7b7ff !important;
142
- }
143
142
  </style>
144
143
  <% end %>
145
144
 
@@ -233,7 +232,12 @@ $(document).ready(function() {
233
232
  <% end %>
234
233
  { name: 'sidebar_width', nice_name: "<%= 'width'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.sidebar_width) %>, width: 400 },
235
234
  { name: 'sidebar_bg_color', nice_name: "<%= 'background_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.sidebar_bg_color) %>, width: 400 },
236
- { name: 'default_banner_image' , nice_name: 'Default Banner Image' , type: 'image' , value: <%= raw Caboose.json(@theme.default_banner_image ? @theme.default_banner_image.url(:huge) : 'https://res.cloudinary.com/caboose/image/upload/c_scale,f_auto,q_auto:good,w_300/v1539265856/default_banner.jpg') %>, width: 800, update_url: '/admin/themes/<%= @theme.id %>/default-banner-image' }
235
+ { name: 'default_banner_image' , nice_name: 'Default Banner Image' , type: 'image' , value: <%= raw Caboose.json(@theme.default_banner_image ? @theme.default_banner_image.url(:huge) : 'https://res.cloudinary.com/caboose/image/upload/c_scale,f_auto,q_auto:good,w_300/v1539265856/default_banner.jpg') %>, width: 800, update_url: '/admin/themes/<%= @theme.id %>/default-banner-image' },
236
+ { name: 'banner_font_size', nice_name: "<%= 'banner_font_size'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.banner_font_size) %>, width: 400 },
237
+ { name: 'footer_hover_color', nice_name: "<%= 'footer_hover_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.footer_hover_color) %>, width: 400 },
238
+ { name: 'actual_footer_height', nice_name: "<%= 'actual_footer_height'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.actual_footer_height) %>, width: 400 },
239
+ { name: 'actual_banner_height', nice_name: "<%= 'actual_banner_height'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.actual_banner_height) %>, width: 400 },
240
+ { name: 'dropdown_nav_padding', nice_name: "<%= 'dropdown_nav_padding'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.dropdown_nav_padding) %>, width: 400 }
237
241
  ]
238
242
  });
239
243
  });
data/lib/caboose.rb CHANGED
@@ -43,6 +43,10 @@ module Caboose
43
43
  # Whether or not to use AB Testing
44
44
  mattr_accessor :use_ab_testing
45
45
  @@use_ab_testing = true
46
+
47
+ # Whether or not to use Cloudinary for site logo and favicon
48
+ mattr_accessor :use_cloudinary
49
+ @@use_cloudinary = false
46
50
 
47
51
  # Website name
48
52
  mattr_accessor :website_name
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.172'
2
+ VERSION = '0.9.173'
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.172
4
+ version: 0.9.173
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-17 00:00:00.000000000 Z
11
+ date: 2018-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -879,6 +879,8 @@ files:
879
879
  - app/models/caboose/tax_calculator.rb
880
880
  - app/models/caboose/tax_line.rb
881
881
  - app/models/caboose/theme.rb
882
+ - app/models/caboose/theme_file.rb
883
+ - app/models/caboose/theme_file_membership.rb
882
884
  - app/models/caboose/user.rb
883
885
  - app/models/caboose/utilities/schema.rb
884
886
  - app/models/caboose/variant.rb