caboose-cms 0.9.173 → 0.9.174

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: b280a399c0fe0c9481f1047fb86e5c3d71b51fd1
4
- data.tar.gz: 15b6a9ffa8951c7711fe3b512ac637c5ad02daf9
3
+ metadata.gz: 2a5f146158d05cdcba0981301de5c3a2fccd86fd
4
+ data.tar.gz: 409a559e70e8b54e566f4da4aae8856bd73fe463
5
5
  SHA512:
6
- metadata.gz: e66eea6f8d026e9fa62396ba72b9be702f3269e1357b189b40c6f77bbb3c49d553755fdf11a3435dd73fa261e32020ca8b87cd6391e98a9f6c3a2086620b3901
7
- data.tar.gz: 2d9620d712cf82a6e7e202718c01eccd9011fa1265075b6e618707864068c12e8f43fca4a5809fe71c0f6c265ace4377598d702796fa50134fbd14200a744fbd
6
+ metadata.gz: 03206cafed754a35295390a14c683f34bde884efc581caa7665887416bd6d8a14920f2500161559d0294a61c66d2ddb5ee3a8c9bb8aacc28a9049ddf532a92ed
7
+ data.tar.gz: 2981f58cc12e869b43f2a8c95b20ae6cd654dd80444897bce1b84066fee01ae2ca90d11218deda4a75ef014237dd3f8757e468efd996471fcaa47ea76b0101ca
@@ -16,7 +16,7 @@ BoundColor = BoundControl.extend({
16
16
  this.el = this.el ? this.el : this.model.name.toLowerCase() + '_' + this.model.id + '_' + this.attribute.name;
17
17
  $('#'+this.el).wrap($('<div/>')
18
18
  .attr('id', this.el + '_container')
19
- .addClass('mb_container')
19
+ .addClass('mb_container').addClass('color')
20
20
  .css('position', 'relative')
21
21
  );
22
22
  $('#'+this.el+'_container').empty().append(
@@ -24,7 +24,7 @@ BoundColor = BoundControl.extend({
24
24
  .attr('id', this.el)
25
25
  .attr('type', 'text')
26
26
  .attr('placeholder', this.attribute.fixed_placeholder ? 'empty' : this.attribute.nice_name)
27
- .val(this.attribute.value)
27
+ .val(this.attribute.value)
28
28
  );
29
29
  $('#'+this.el+'_container').css('text-align', 'right');
30
30
 
@@ -35,10 +35,26 @@ BoundColor = BoundControl.extend({
35
35
  if (this.attribute.fixed_placeholder && this.attribute.align != 'left')
36
36
  {
37
37
  var w = $('#'+this.el+'_placeholder').outerWidth(true);
38
- $('#'+this.el).attr('placeholder', 'empty').css('padding-left', '+=' + w).css('width', '-=' + w);
38
+ $('#'+this.el).attr('placeholder', 'empty'); //.css('padding-left', '+=' + w); //.css('width', '-=' + w);
39
39
  }
40
40
 
41
41
  var this2 = this;
42
+
43
+ $('#'+this.el).css('z-index', 21);
44
+ $('#'+this.el).css('position', 'relative');
45
+ $('#'+this.el).css('background', 'transparent');
46
+ $('#'+this.el).spectrum({
47
+ color: this2.attribute.value,
48
+ showPalette: true,
49
+ showInput: true,
50
+ preferredFormat: 'hex',
51
+ replacerClassName: this2.el + '_bound_color',
52
+ change: function(color) {
53
+ this2.attribute.value = color.toHexString();
54
+ this2.save();
55
+ }
56
+ });
57
+
42
58
  $('#'+this.el).on('keyup', function(e) {
43
59
  if (e.keyCode == 27) this2.cancel(); // Escape
44
60
  if (e.keyCode == 13) this2.save(); // Enter
@@ -55,27 +71,13 @@ BoundColor = BoundControl.extend({
55
71
  this2.save();
56
72
  }
57
73
  });
58
- $('#'+this.el).css('z-index', 21);
59
- $('#'+this.el).css('position', 'relative');
60
- $('#'+this.el).css('background', 'transparent');
61
- $('#'+this.el).spectrum({
62
- color: this2.attribute.value,
63
- showPalette: true,
64
- showInput: true,
65
- preferredFormat: 'hex',
66
- replacerClassName: this2.el + '_bound_color',
67
- change: function(color) {
68
- this2.attribute.value = color.toHexString();
69
- this2.save();
70
- }
71
- });
72
74
 
73
75
  $('.' + this.el + '_bound_color').css('text-align', this.attribute.align);
74
- //if (this.attribute.width) $('.' + this.el + '_bound_color').css('width', this.attribute.width);
76
+ //if (this.attribute.width) $('.' + this.el + '_bound_color').css('width', this.attribute.width)
75
77
  if (this.attribute.fixed_placeholder && this.attribute.align != 'right')
76
78
  {
77
79
  var w = $('#'+this.el+'_placeholder').outerWidth(true);
78
- $('.' + this2.el + '_bound_color').css('padding-left', '+=' + w).css('width', '-=' + w);
80
+ $('.' + this2.el + '_bound_color'); //.css('padding-left', '+=' + w); //.css('width', '-=' + w);
79
81
  }
80
82
  if (this.attribute.align == 'right')
81
83
  $('.' + this.el + '_bound_color').css('margin', '0 0 0 auto');
@@ -83,22 +85,28 @@ BoundColor = BoundControl.extend({
83
85
 
84
86
  save: function() {
85
87
  //this.attribute.value = $('#'+this.el).val();
88
+
89
+ var vl = $('#'+this.el).val();
90
+ if ( !vl )
91
+ vl = this.attribute.value;
92
+ this.attribute.value = vl;
93
+
86
94
  if (this.attribute.value == this.attribute.value_clean)
87
95
  return;
88
96
 
89
- //this.show_loader();
97
+ this.show_loader();
90
98
  var this2 = this;
91
99
 
92
100
  this.binder.save(this.attribute, function(resp) {
93
101
  this2.save_attempts = 0;
94
102
  if (resp.error)
95
103
  {
96
- //this2.hide_loader();
104
+ this2.hide_loader();
97
105
  this2.error(resp.error);
98
106
  }
99
107
  else
100
108
  {
101
- //this2.show_check(500);
109
+ this2.show_check(500);
102
110
  $('#'+this2.el).val(this2.attribute.value);
103
111
  $('#'+this2.el).removeClass('mb_dirty');
104
112
 
@@ -17,6 +17,27 @@ require caboose/spectrum
17
17
  color: #000;
18
18
  }
19
19
 
20
+ .mb_container.color {
21
+ border: 1px solid #ccc;
22
+ height: 36px;
23
+ }
24
+
25
+ .mb_container.color .sp-replacer {
26
+ background-color: transparent;
27
+ border: 0;
28
+ position: relative;
29
+ bottom: 1px;
30
+ }
31
+ .admin-theme .mb_container.color input[type="text"] {
32
+ display: inline-block !important;
33
+ width: 80px;
34
+ border: 0;
35
+ padding-top: 0px;
36
+ }
37
+ div.mb_container.color div.mb_placeholder {
38
+ top: 7px;
39
+ }
40
+
20
41
  .mb_container.model-image .img-holder {
21
42
  background-image: url('/assets/caboose/grid.png');
22
43
  background-size: 15px;
@@ -478,6 +478,7 @@ module Caboose
478
478
  return if !user_is_allowed('pages', 'edit')
479
479
  #return if !Page.is_allowed(logged_in_user, params[:id], 'edit')
480
480
  @page = Page.find(params[:id])
481
+ @can_edit_home = user_is_allowed_to('edit', Caboose::Page.index_page(@site.id))
481
482
  if @page.site_id != @logged_in_user.site_id && !@logged_in_user.is_super_admin?
482
483
  redirect_to '/admin/pages'
483
484
  else
@@ -544,7 +545,7 @@ module Caboose
544
545
  resp.redirect = "/admin/pages/#{page.id}/content"
545
546
 
546
547
  # Copy from an existing page
547
- elsif !params[:copy_from_id].blank?
548
+ elsif !params[:copy_from_id].blank? && params[:use_copy] == 'yes'
548
549
  source = Caboose::Page.find(params[:copy_from_id])
549
550
  if source
550
551
  Caboose.log("copying from source page: #{source.id}")
@@ -728,6 +729,53 @@ module Caboose
728
729
  })
729
730
  render json: resp
730
731
  end
732
+
733
+ # @route PUT /admin/pages/:id/promote
734
+ def admin_promote
735
+ resp = StdClass.new
736
+ return unless user_is_allowed('pages', 'edit')
737
+ old_home = Caboose::Page.index_page(@site.id)
738
+ return unless user_is_allowed_to('edit', old_home)
739
+ new_home = Caboose::Page.find(params[:id])
740
+ if new_home && (old_home.site_id == new_home.site_id && new_home.site_id == @site.id) && (@site.id == @logged_in_user.site_id || @logged_in_user.is_super_admin?)
741
+ old_layout = Caboose::Block.where(:parent_id => nil, :page_id => old_home.id).first
742
+ old_footer = old_layout.child('footer') if old_layout
743
+ new_home.parent_id = -1
744
+ new_home.title = 'Home'
745
+ new_home.slug = nil
746
+ new_home.alias = nil
747
+ new_home.uri = nil
748
+ new_home.redirect_url = nil
749
+ new_home.hide = false
750
+ new_home.save
751
+ new_layout = Caboose::Block.where(:parent_id => nil, :page_id => new_home.id).first
752
+ new_footer = new_layout.child('footer') if new_layout
753
+ if new_footer && new_footer.children.count > 0
754
+ new_footer.children.each do |nc|
755
+ nc.destroy
756
+ end
757
+ end
758
+ if old_footer && old_footer.children.count > 0
759
+ old_footer.children.each do |oc|
760
+ oc.parent_id = new_footer.id
761
+ oc.page_id = new_home.id
762
+ oc.save
763
+ end
764
+ end
765
+ old_home.title = 'OLD Home'
766
+ old_home.parent_id = new_home.id
767
+ old_home.slug = "old-home-#{old_home.id}"
768
+ old_home.uri = "old-home-#{old_home.id}"
769
+ old_home.hide = true
770
+ old_home.save
771
+ resp.success = true
772
+ resp.redirect = "/admin/pages/#{new_home.id}"
773
+ else
774
+ resp.success = false
775
+ resp.error = "You don't have permission to do this."
776
+ end
777
+ render json: resp
778
+ end
731
779
 
732
780
  # @route_priority 1
733
781
  # @route GET /admin/pages/:field-options
@@ -109,6 +109,25 @@ module Caboose
109
109
  resp.attributes = { 'default_banner_image' => { 'value' => theme.default_banner_image.url(:huge) }}
110
110
  render :text => resp.to_json
111
111
  end
112
+
113
+ # @route PUT /admin/themes/:id/files/:file_id/toggle
114
+ def admin_toggle_file
115
+ resp = Caboose::StdClass.new
116
+ checked = params[:checked]
117
+ theme_id = params[:id]
118
+ file_id = params[:file_id]
119
+ if checked && checked != false && checked != 'false'
120
+ am = Caboose::ThemeFileMembership.where(:theme_id => theme_id, :theme_file_id => file_id).first
121
+ am = am ? am : Caboose::ThemeFileMembership.new
122
+ am.theme_id = theme_id
123
+ am.theme_file_id = file_id
124
+ am.save
125
+ else
126
+ Caboose::ThemeFileMembership.delete_all(:theme_id => theme_id, :theme_file_id => file_id)
127
+ end
128
+ resp.success = "Success"
129
+ render :json => resp
130
+ end
112
131
 
113
132
  end
114
133
  end
@@ -56,7 +56,8 @@ class Caboose::MediaCategory < ActiveRecord::Base
56
56
 
57
57
  def self.tree_hash(site_id)
58
58
  top_cat = self.where(:parent_id => nil, :site_id => site_id).first
59
- return self.tree_hash_helper(top_cat)
59
+ top_cat = Caboose::MediaCategory.create(:parent_id => nil, :site_id => site_id, :name => 'Media') if top_cat.nil?
60
+ return self.tree_hash_helper(top_cat)
60
61
  end
61
62
 
62
63
  def self.tree_hash_helper(cat)
@@ -461,8 +461,8 @@ class Caboose::Page < ActiveRecord::Base
461
461
  p.title = "Copy of " + self.title
462
462
  p.menu_title = self.menu_title
463
463
  p.alias = self.alias
464
- p.redirect_url = self.redirect_url
465
- p.hide = self.hide
464
+ p.redirect_url = self.redirect_url
465
+ p.hide = true
466
466
  p.content_format = self.content_format
467
467
  p.custom_css = self.custom_css
468
468
  p.custom_js = self.custom_js
@@ -988,7 +988,9 @@ class Caboose::Schema < Caboose::Utilities::Schema
988
988
  [ :dropdown_nav_padding, :string ]
989
989
  ],
990
990
  Caboose::ThemeFile => [
991
- [ :filename, :string ]
991
+ [ :filename, :string ],
992
+ [ :nice_name, :string ],
993
+ [ :default_included, :boolean , { :default => false }]
992
994
  ],
993
995
  Caboose::ThemeFileMembership => [
994
996
  [ :theme_file_id , :integer ],
@@ -82,7 +82,6 @@ class Caboose::Theme < ActiveRecord::Base
82
82
  :digest
83
83
 
84
84
  def compile(for_site_id = 0)
85
- Caboose.log("compiling theme for site #{for_site_id}")
86
85
  theme = self
87
86
  theme_name = 'default'
88
87
  path = Rails.root.join('themes', "#{theme_name}.scss.erb")
@@ -1,6 +1,6 @@
1
1
  class Caboose::ThemeFile < ActiveRecord::Base
2
2
  self.table_name = "theme_files"
3
3
 
4
- attr_accessible :filename
4
+ attr_accessible :filename, :nice_name, :default_included
5
5
 
6
6
  end
@@ -15,8 +15,29 @@
15
15
  <% end %>
16
16
  <div class='field_with_explanation'><div id='page_<%= @page.id %>_tags' ></div><span class='explanation'>Tags to help categorize your page. Use as many as you want, just separate by commas.</span></div>
17
17
 
18
+ <% if @can_edit_home %>
19
+ <div class='field_with_explanation'>
20
+ <a href="#" onclick="promote_page(<%= @page.id %>, false);return false;" id="promote">Make this page my homepage</a>
21
+ <div id="pmessage"></div>
22
+ </div>
23
+ <% end %>
24
+
18
25
  <%= render :partial => 'caboose/pages/admin_footer' %>
19
26
 
27
+ <% content_for :caboose_css do %>
28
+ <style>
29
+ a#promote {
30
+ color: #565daa;
31
+ font-size: 13px;
32
+ text-decoration: none;
33
+ display: inline-block;
34
+ margin-bottom: 7px;
35
+ }
36
+ a#promote:hover {
37
+ text-decoration: underline;
38
+ }
39
+ </style>
40
+ <% end %>
20
41
 
21
42
  <% content_for :caboose_js do %>
22
43
  <script type='text/javascript'>
@@ -60,5 +81,27 @@ function update_uri(page_id)
60
81
  });
61
82
  }
62
83
 
84
+ function promote_page(page_id, confirm)
85
+ {
86
+ if (!confirm)
87
+ {
88
+ var p = $('<p/>').addClass('note warning')
89
+ .append("Are you sure you want to do this? This page will replace the existing homepage. The existing homepage will be hidden but not deleted.")
90
+ .append($('<input/>').attr('type','button').val('Yes').click(function() { promote_page(page_id, true); })).append(' ')
91
+ .append($('<input/>').attr('type','button').val('No').click(function() { $('#pmessage').empty(); }));
92
+ $('#pmessage').empty().append(p);
93
+ return;
94
+ }
95
+ $('#pmessage').empty().html($('<p/>').addClass('loading').html("Promoting page..."));
96
+ $.ajax({
97
+ url: '/admin/pages/' + page_id + '/promote',
98
+ type: 'put',
99
+ success: function(resp) {
100
+ if (resp.error) $('#pmessage').html("<p class='note error'>" + resp.error + "</p>");
101
+ if (resp.redirect) window.location = resp.redirect;
102
+ }
103
+ });
104
+ }
105
+
63
106
  </script>
64
107
  <% end %>
@@ -34,7 +34,7 @@ $(document).ready(function() {
34
34
  { name: 'author' , nice_name: 'Author' , type: 'text' , value: <%= raw Caboose.json(@post.author ) %>, width: 600 },
35
35
  { name: 'created_at' , nice_name: 'Date Published' , type: 'date' , value: <%= raw Caboose.json(@post.created_at.strftime('%m/%d/%Y') ) %>, width: 600 },
36
36
  { name: 'published' , nice_name: 'Published' , type: 'checkbox' , value: <%= raw @post.published ? true : false %>, width: 600 },
37
- { name: 'image' , nice_name: 'Image' , type: 'image' , value: <%= raw Caboose.json(@post.image.url(:thumb)) %>, width: 600, update_url: '/admin/posts/<%= @post.id %>/image' }
37
+ { name: 'image' , nice_name: 'Image' , type: 'image' , value: <%= raw Caboose.json(@post.image.url(:thumb)) %>, width: 200, update_url: '/admin/posts/<%= @post.id %>/image' }
38
38
  ]
39
39
  });
40
40
  <% @post.post_custom_field_values.each do |fv| %>
@@ -135,7 +135,7 @@ $(document).ready(function() {
135
135
  { name: 'google_analytics_id' , nice_name: 'Primary Google Analytics Tracking ID' , type: 'text' , value: <%= raw Caboose.json(sc.google_analytics_id) %>, width: 500 },
136
136
  { name: 'google_analytics_id2' , nice_name: 'Secondary Google Analytics Tracking ID' , type: 'text' , value: <%= raw Caboose.json(sc.google_analytics_id2) %>, width: 500 },
137
137
  { name: 'auto_ga_js' , nice_name: 'Auto Embed Google Analytics JS' , type: 'checkbox' , value: <%= sc.auto_ga_js ? 1 : 0 %>, width: 500 },
138
- { name: 'share_image' , nice_name: 'Share Image' , type: 'image' , value: <%= raw Caboose.json(sc.share_image ? sc.share_image.url(:large) : 'http://placehold.it?300x300') %>, width: 800, update_url: '/admin/social/image' }
138
+ { name: 'share_image' , nice_name: 'Share Image' , type: 'image' , value: <%= raw Caboose.json(sc.share_image ? sc.share_image.url(:large) : 'http://placehold.it?300x300') %>, width: 300, update_url: '/admin/social/image' }
139
139
  ]
140
140
  });
141
141
 
@@ -7,7 +7,7 @@ position = header.child('position') if header
7
7
 
8
8
  <h1>Theme</h1>
9
9
 
10
- <div class="grid-row">
10
+ <div class="admin-theme grid-row">
11
11
  <div class="unit1of2 left">
12
12
  <section>
13
13
  <h5>Compile</h5>
@@ -57,6 +57,18 @@ position = header.child('position') if header
57
57
  <div id="theme_<%= @theme.id %>_footer_font_size"></div>
58
58
  <div id="theme_<%= @theme.id %>_actual_footer_height"></div>
59
59
  </section>
60
+
61
+ <section>
62
+ <h5>Theme Files</h5>
63
+ <% Caboose::ThemeFile.order(:nice_name).all.each do |tf| %>
64
+ <% tfm = Caboose::ThemeFileMembership.where(:theme_file_id => tf.id, :theme_id => @theme.id).exists? %>
65
+ <div class="field cb">
66
+ <input class="file-toggle" <% if tfm %>checked<% end %> type="checkbox" value="<%= tf.id %>" name="tf_<%= tf.id %>" id="<%= tf.id %>" />
67
+ <label for="<%= tf.id %>"><%= tf.nice_name %></label>
68
+ </div>
69
+ <% end %>
70
+ </section>
71
+
60
72
  </div>
61
73
  <div class="unit1of2 right">
62
74
  <section>
@@ -116,6 +128,7 @@ position = header.child('position') if header
116
128
 
117
129
 
118
130
  <% content_for :caboose_css do %>
131
+ <%= stylesheet_link_tag "caboose/spectrum" %>
119
132
  <style>
120
133
  .grid-row::after {
121
134
  content: ".";
@@ -139,13 +152,47 @@ position = header.child('position') if header
139
152
  section > div {
140
153
  margin-bottom: 10px;
141
154
  }
155
+ input[type="text"]:disabled {
156
+ color: #969696;
157
+ }
158
+ .field.cb {
159
+ height: 26px;
160
+ }
161
+ .field.cb input {
162
+ height: auto;
163
+ }
164
+ .field.cb label {
165
+ font-size: 14px;
166
+ position: relative;
167
+ top: 1px;
168
+ }
142
169
  </style>
143
170
  <% end %>
144
171
 
145
172
  <% content_for :caboose_js do %>
173
+ <%= javascript_include_tag "caboose/spectrum" %>
146
174
  <%= javascript_include_tag "caboose/model/all" %>
147
175
  <script type="text/javascript">
148
176
 
177
+ function toggle_file(file_id, checked) {
178
+ var status = checked;
179
+ $.ajax({
180
+ url: '/admin/themes/<%= @theme.id %>/files/' + file_id + '/toggle',
181
+ type: 'put',
182
+ data: {
183
+ checked: status
184
+ },
185
+ success: function(resp) {
186
+
187
+ }
188
+ });
189
+ }
190
+ $(window).load(function() {
191
+ $(".file-toggle").change(function() {
192
+ toggle_file($(this).attr("id"), $(this).is(':checked'));
193
+ });
194
+ });
195
+
149
196
  $("#compile-btn").click(function(e) {
150
197
  $('#message').html("<p class='note loading'>Compiling theme...</p>").fadeIn();
151
198
  e.preventDefault();
@@ -168,42 +215,42 @@ $(document).ready(function() {
168
215
  update_url: '/admin/theme',
169
216
  authenticity_token: '<%= form_authenticity_token %>',
170
217
  attributes: [
171
- { name: 'color_main' , nice_name: 'Main' , type: 'text' , value: <%= raw Caboose.json(@theme.color_main ) %>, width: 400 },
172
- { name: 'color_alt' , nice_name: 'Alternate' , type: 'text' , value: <%= raw Caboose.json(@theme.color_alt ) %>, width: 400 },
173
- { name: 'color_dark', nice_name: "<%= 'dark'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.color_dark) %>, width: 400 },
174
- { name: 'color_light', nice_name: "<%= 'light'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.color_light) %>, width: 400 },
218
+ { name: 'color_main' , nice_name: 'Main' , type: 'color' , value: <%= raw Caboose.json(@theme.color_main ) %>, width: 400 },
219
+ { name: 'color_alt' , nice_name: 'Alternate' , type: 'color' , value: <%= raw Caboose.json(@theme.color_alt ) %>, width: 400 },
220
+ { name: 'color_dark', nice_name: "<%= 'dark'.titleize %>", type: 'color', value: <%== Caboose.json(@theme.color_dark) %>, width: 400 },
221
+ { name: 'color_light', nice_name: "<%= 'light'.titleize %>", type: 'color', value: <%== Caboose.json(@theme.color_light) %>, width: 400 },
175
222
  { name: 'max_width', nice_name: "<%= 'max_width'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.max_width) %>, width: 400 },
176
- { name: 'body_bg_color', nice_name: "<%= 'background_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.body_bg_color) %>, width: 400 },
223
+ { name: 'body_bg_color', nice_name: "<%= 'background_color'.titleize %>", type: 'color', value: <%== Caboose.json(@theme.body_bg_color) %>, width: 400 },
177
224
  { name: 'font_size', nice_name: "<%= 'font_size'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.font_size) %>, width: 400 },
178
225
  { name: 'header_height', nice_name: "<%= 'height'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.header_height) %>, width: 400 },
179
- { name: 'header_bg_color', nice_name: "<%= 'background_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.header_bg_color) %>, width: 400 },
180
- { name: 'header_font_color', nice_name: "<%= 'font_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.header_font_color) %>, width: 400 },
181
- { name: 'dropdown_color', nice_name: "<%= 'dropdown_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.dropdown_color) %>, width: 400 },
182
- { name: 'mobile_menu_bg_color', nice_name: "<%= 'background_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.mobile_menu_bg_color) %>, width: 400 },
183
- { name: 'mobile_menu_font_color', nice_name: "<%= 'font_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.mobile_menu_font_color) %>, width: 400 },
184
- { name: 'mobile_menu_border_color', nice_name: "<%= 'border_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.mobile_menu_border_color) %>, width: 400 },
185
- { name: 'mobile_menu_icon_color', nice_name: "<%= 'icon_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.mobile_menu_icon_color) %>, width: 400 },
226
+ { name: 'header_bg_color', nice_name: "<%= 'background_color'.titleize %>", type: 'color', value: <%== Caboose.json(@theme.header_bg_color) %>, width: 400 },
227
+ { name: 'header_font_color', nice_name: "<%= 'font_color'.titleize %>", type: 'color', value: <%== Caboose.json(@theme.header_font_color) %>, width: 400 },
228
+ { name: 'dropdown_color', nice_name: "<%= 'dropdown_color'.titleize %>", type: 'color', value: <%== Caboose.json(@theme.dropdown_color) %>, width: 400 },
229
+ { name: 'mobile_menu_bg_color', nice_name: "<%= 'background_color'.titleize %>", type: 'color', value: <%== Caboose.json(@theme.mobile_menu_bg_color) %>, width: 400 },
230
+ { name: 'mobile_menu_font_color', nice_name: "<%= 'font_color'.titleize %>", type: 'color', value: <%== Caboose.json(@theme.mobile_menu_font_color) %>, width: 400 },
231
+ { name: 'mobile_menu_border_color', nice_name: "<%= 'border_color'.titleize %>", type: 'color', value: <%== Caboose.json(@theme.mobile_menu_border_color) %>, width: 400 },
232
+ { name: 'mobile_menu_icon_color', nice_name: "<%= 'icon_color'.titleize %>", type: 'color', value: <%== Caboose.json(@theme.mobile_menu_icon_color) %>, width: 400 },
186
233
  { name: 'mobile_menu_icon_top', nice_name: "<%= 'icon_top'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.mobile_menu_icon_top) %>, width: 400 },
187
234
  { name: 'footer_height', nice_name: "<%= 'height'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.footer_height) %>, width: 400 },
188
- { name: 'footer_bg_color', nice_name: "<%= 'background_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.footer_bg_color) %>, width: 400 },
189
- { name: 'footer_font_color', nice_name: "<%= 'font_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.footer_font_color) %>, width: 400 },
235
+ { name: 'footer_bg_color', nice_name: "<%= 'background_color'.titleize %>", type: 'color', value: <%== Caboose.json(@theme.footer_bg_color) %>, width: 400 },
236
+ { name: 'footer_font_color', nice_name: "<%= 'font_color'.titleize %>", type: 'color', value: <%== Caboose.json(@theme.footer_font_color) %>, width: 400 },
190
237
  { name: 'btn_border_radius', nice_name: "<%= 'border_radius'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.btn_border_radius) %>, width: 400 },
191
238
  { name: 'btn_border_width', nice_name: "<%= 'border_width'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.btn_border_width) %>, width: 400 },
192
- { name: 'btn_border_color', nice_name: "<%= 'border_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.btn_border_color) %>, width: 400 },
193
- { name: 'btn_font_color', nice_name: "<%= 'font_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.btn_font_color) %>, width: 400 },
239
+ { name: 'btn_border_color', nice_name: "<%= 'border_color'.titleize %>", type: 'color', value: <%== Caboose.json(@theme.btn_border_color) %>, width: 400 },
240
+ { name: 'btn_font_color', nice_name: "<%= 'font_color'.titleize %>", type: 'color', value: <%== Caboose.json(@theme.btn_font_color) %>, width: 400 },
194
241
  { name: 'btn_font_size', nice_name: "<%= 'font_size'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.btn_font_size) %>, width: 400 },
195
242
  { name: 'btn_font_weight', nice_name: "<%= 'font_weight'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.btn_font_weight) %>, width: 400 },
196
243
  { name: 'btn_font_case', nice_name: "<%= 'font_case'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.btn_font_case) %>, width: 400 },
197
244
  { name: 'btn_border_side', nice_name: "<%= 'border_side'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.btn_border_side) %>, width: 400 },
198
245
  { name: 'input_border_radius', nice_name: "<%= 'border_radius'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.input_border_radius) %>, width: 400 },
199
- { name: 'input_bg_color', nice_name: "<%= 'background_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.input_bg_color) %>, width: 400 },
200
- { name: 'input_border_color', nice_name: "<%= 'border_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.input_border_color) %>, width: 400 },
246
+ { name: 'input_bg_color', nice_name: "<%= 'background_color'.titleize %>", type: 'color', value: <%== Caboose.json(@theme.input_bg_color) %>, width: 400 },
247
+ { name: 'input_border_color', nice_name: "<%= 'border_color'.titleize %>", type: 'color', value: <%== Caboose.json(@theme.input_border_color) %>, width: 400 },
201
248
  { name: 'input_border_width', nice_name: "<%= 'border_width'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.input_border_width) %>, width: 400 },
202
- { name: 'input_font_color', nice_name: "<%= 'font_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.input_font_color) %>, width: 400 },
249
+ { name: 'input_font_color', nice_name: "<%= 'font_color'.titleize %>", type: 'color', value: <%== Caboose.json(@theme.input_font_color) %>, width: 400 },
203
250
  { name: 'input_font_size', nice_name: "<%= 'font_size'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.input_font_size) %>, width: 400 },
204
251
  { name: 'input_padding', nice_name: "<%= 'padding'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.input_padding) %>, width: 400 },
205
252
  { name: 'body_line_height', nice_name: "<%= 'line_height'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.body_line_height) %>, width: 400 },
206
- { name: 'body_font_color', nice_name: "<%= 'font_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.body_font_color) %>, width: 400 },
253
+ { name: 'body_font_color', nice_name: "<%= 'font_color'.titleize %>", type: 'color', value: <%== Caboose.json(@theme.body_font_color) %>, width: 400 },
207
254
  { name: 'button_padding', nice_name: "<%= 'padding'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.button_padding) %>, width: 400 },
208
255
  { name: 'button_line_height', nice_name: "<%= 'line_height'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.button_line_height) %>, width: 400 },
209
256
  { name: 'footer_padding', nice_name: "<%= 'padding'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.footer_padding) %>, width: 400 },
@@ -218,7 +265,7 @@ $(document).ready(function() {
218
265
  { name: 'mobile_menu_nav_padding', nice_name: "<%= 'nav_padding'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.mobile_menu_nav_padding) %>, width: 400 },
219
266
  { name: 'mobile_menu_font_size', nice_name: "<%= 'font_size'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.mobile_menu_font_size) %>, width: 400 },
220
267
  { name: 'banner_padding', nice_name: "<%= 'banner_padding'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.banner_padding) %>, width: 400 },
221
- { name: 'banner_overlay_color', nice_name: "<%= 'banner_overlay_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.banner_overlay_color) %>, width: 400 },
268
+ { name: 'banner_overlay_color', nice_name: "<%= 'banner_overlay_color'.titleize %>", type: 'color', value: <%== Caboose.json(@theme.banner_overlay_color) %>, width: 400 },
222
269
  { name: 'banner_overlay_opacity', nice_name: "<%= 'banner_overlay_opacity'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.banner_overlay_opacity) %>, width: 400 },
223
270
  <% if style %>
224
271
  { name: 'default_header_style', nice_name: "<%= 'default_style'.titleize %>", type: 'select', value: <%== Caboose.json(@theme.default_header_style) %>, options_url: '/admin/block-types/<%= style.id %>/options', width: 400 },
@@ -231,10 +278,10 @@ $(document).ready(function() {
231
278
  { name: 'default_header_position', nice_name: "<%= 'default_position'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.default_header_position) %>, width: 400 },
232
279
  <% end %>
233
280
  { name: 'sidebar_width', nice_name: "<%= 'width'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.sidebar_width) %>, width: 400 },
234
- { name: 'sidebar_bg_color', nice_name: "<%= 'background_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.sidebar_bg_color) %>, width: 400 },
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' },
281
+ { name: 'sidebar_bg_color', nice_name: "<%= 'background_color'.titleize %>", type: 'color', value: <%== Caboose.json(@theme.sidebar_bg_color) %>, width: 400 },
282
+ { 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: 150, update_url: '/admin/themes/<%= @theme.id %>/default-banner-image' },
236
283
  { 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 },
284
+ { name: 'footer_hover_color', nice_name: "<%= 'footer_hover_color'.titleize %>", type: 'color', value: <%== Caboose.json(@theme.footer_hover_color) %>, width: 400 },
238
285
  { name: 'actual_footer_height', nice_name: "<%= 'actual_footer_height'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.actual_footer_height) %>, width: 400 },
239
286
  { name: 'actual_banner_height', nice_name: "<%= 'actual_banner_height'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.actual_banner_height) %>, width: 400 },
240
287
  { name: 'dropdown_nav_padding', nice_name: "<%= 'dropdown_nav_padding'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.dropdown_nav_padding) %>, width: 400 }
@@ -242,5 +289,101 @@ $(document).ready(function() {
242
289
  });
243
290
  });
244
291
 
292
+ $(window).load(function() {
293
+ var color_main = "<%= @theme.color_main %>";
294
+ var color_alt = "<%= @theme.color_alt %>";
295
+ var color_dark = "<%= @theme.color_dark %>";
296
+ var color_light = "<%= @theme.color_light %>";
297
+ $("#theme_<%= @theme.id %>_color_main").prop('disabled',true);
298
+ $("#theme_<%= @theme.id %>_color_alt").prop('disabled',true);
299
+ $("#theme_<%= @theme.id %>_color_light").prop('disabled',true);
300
+ $("#theme_<%= @theme.id %>_color_dark").prop('disabled',true);
301
+ $.each($(".mb_container.color"), function(k,v) {
302
+ var inp = $(v).find("input[type='text']").first();
303
+ inp.spectrum("option","showPalette",false);
304
+ inp.spectrum("option","showSelectionPalette",false);
305
+ if ( inp.val() == 'main' ) {
306
+ inp.spectrum("set",color_main);
307
+ inp.val('main');
308
+ }
309
+ else if ( inp.val() == 'alt' || inp.val() == 'alternate' ) {
310
+ inp.spectrum("set",color_alt);
311
+ inp.val('alt');
312
+ }
313
+ else if ( inp.val() == 'light' ) {
314
+ inp.spectrum("set",color_light);
315
+ inp.val('light');
316
+ }
317
+ else if ( inp.val() == 'dark' ) {
318
+ inp.spectrum("set",color_dark);
319
+ inp.val('dark');
320
+ }
321
+ inp.on("change.spectrum", function(e, color) {
322
+ console.log("input changed to " + color);
323
+ console.log("input v: " + inp.val());
324
+ if ( inp.val() == 'main' ) {
325
+ inp.spectrum("set",color_main);
326
+ inp.val('main');
327
+ }
328
+ else if ( inp.val() == 'alt' || inp.val() == 'alternate' ) {
329
+ inp.spectrum("set",color_alt);
330
+ inp.val('alt');
331
+ }
332
+ else if ( inp.val() == 'light' ) {
333
+ inp.spectrum("set",color_light);
334
+ inp.val('light');
335
+ }
336
+ else if ( inp.val() == 'dark' ) {
337
+ inp.spectrum("set",color_dark);
338
+ inp.val('dark');
339
+ }
340
+ else {
341
+ inp.spectrum("set", inp.val());
342
+ // inp.val(color);
343
+ }
344
+ });
345
+ });
346
+ $("#theme_<%= @theme.id %>_color_main").on("change.spectrum", function(e, color) {
347
+ $.each($(".mb_container.color"), function(k,v) {
348
+ var inp = $(v).find("input[type='text']").first();
349
+ if ( inp.val() == 'main' ) {
350
+ inp.spectrum("set",color);
351
+ inp.val('main');
352
+ }
353
+ });
354
+ color_main = color;
355
+ });
356
+ $("#theme_<%= @theme.id %>_color_alt").on("change.spectrum", function(e, color) {
357
+ $.each($(".mb_container.color"), function(k,v) {
358
+ var inp = $(v).find("input[type='text']").first();
359
+ if ( inp.val() == 'alt' ) {
360
+ inp.spectrum("set",color);
361
+ inp.val('alt');
362
+ }
363
+ });
364
+ color_alt = color;
365
+ });
366
+ $("#theme_<%= @theme.id %>_color_dark").on("change.spectrum", function(e, color) {
367
+ $.each($(".mb_container.color"), function(k,v) {
368
+ var inp = $(v).find("input[type='text']").first();
369
+ if ( inp.val() == 'dark' ) {
370
+ inp.spectrum("set",color);
371
+ inp.val('dark');
372
+ }
373
+ });
374
+ color_dark = color;
375
+ });
376
+ $("#theme_<%= @theme.id %>_color_light").on("change.spectrum", function(e, color) {
377
+ $.each($(".mb_container.color"), function(k,v) {
378
+ var inp = $(v).find("input[type='text']").first();
379
+ if ( inp.val() == 'light' ) {
380
+ inp.spectrum("set",color);
381
+ inp.val('light');
382
+ }
383
+ });
384
+ color_light = color;
385
+ });
386
+ });
387
+
245
388
  </script>
246
389
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.173'
2
+ VERSION = '0.9.174'
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.173
4
+ version: 0.9.174
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-18 00:00:00.000000000 Z
11
+ date: 2018-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg