caboose-cms 0.9.166 → 0.9.167

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/caboose/block_content_controller_dragdrop.js +1 -1
  3. data/app/assets/javascripts/caboose/model/index_table.js +3 -3
  4. data/app/assets/stylesheets/caboose/admin_edit_page_content_dragdrop.scss +20 -1
  5. data/app/assets/stylesheets/caboose/admin_main.css.scss +142 -9
  6. data/app/assets/stylesheets/caboose/message_boxes.css.scss +45 -29
  7. data/app/assets/stylesheets/caboose/modal_inline.css +10 -2
  8. data/app/controllers/caboose/block_type_store_controller.rb +1 -2
  9. data/app/controllers/caboose/login_controller.rb +1 -1
  10. data/app/controllers/caboose/login_logs_controller.rb +9 -1
  11. data/app/controllers/caboose/page_templates_controller.rb +76 -0
  12. data/app/controllers/caboose/pages_controller.rb +76 -42
  13. data/app/controllers/caboose/sites_controller.rb +20 -11
  14. data/app/controllers/caboose/themes_controller.rb +108 -0
  15. data/app/models/caboose/block.rb +7 -3
  16. data/app/models/caboose/block_type.rb +2 -0
  17. data/app/models/caboose/core_plugin.rb +2 -0
  18. data/app/models/caboose/page.rb +1 -0
  19. data/app/models/caboose/page_template.rb +17 -0
  20. data/app/models/caboose/page_template_category.rb +20 -0
  21. data/app/models/caboose/schema.rb +80 -1
  22. data/app/models/caboose/site.rb +15 -2
  23. data/app/models/caboose/theme.rb +146 -0
  24. data/app/models/caboose/user.rb +14 -16
  25. data/app/views/caboose/block_type_sources/admin_edit.html.erb +1 -1
  26. data/app/views/caboose/block_type_sources/admin_index.html.erb +1 -1
  27. data/app/views/caboose/block_type_store/admin_details.html.erb +2 -2
  28. data/app/views/caboose/block_type_store/admin_index.html.erb +3 -3
  29. data/app/views/caboose/fonts/admin_index.html.erb +23 -0
  30. data/app/views/caboose/login_logs/admin_index.html.erb +6 -1
  31. data/app/views/caboose/login_logs/admin_index_for_user.html.erb +36 -0
  32. data/app/views/caboose/page_templates/admin_edit.html.erb +68 -0
  33. data/app/views/caboose/page_templates/admin_index.html.erb +24 -0
  34. data/app/views/caboose/page_templates/admin_new.html.erb +38 -0
  35. data/app/views/caboose/pages/admin_delete_form.html.erb +5 -4
  36. data/app/views/caboose/pages/admin_edit_content.html.erb +0 -9
  37. data/app/views/caboose/pages/admin_new.html.erb +139 -41
  38. data/app/views/caboose/pages/admin_new_old.html.erb +46 -0
  39. data/app/views/caboose/posts/admin_edit_content.html.erb +0 -8
  40. data/app/views/caboose/sites/admin_index.html.erb +2 -1
  41. data/app/views/caboose/themes/admin_edit.html.erb +242 -0
  42. data/app/views/caboose/users/_admin_header.html.erb +2 -2
  43. data/app/views/caboose/users/admin_delete_form.html.erb +0 -2
  44. data/app/views/caboose/users/admin_edit.html.erb +24 -7
  45. data/app/views/caboose/users/admin_edit_password.html.erb +1 -1
  46. data/app/views/caboose/users/admin_edit_roles.html.erb +2 -0
  47. data/app/views/layouts/caboose/application.html.erb +8 -0
  48. data/lib/caboose/version.rb +1 -1
  49. metadata +13 -2
@@ -0,0 +1,38 @@
1
+ <h1>New Page Template</h1>
2
+
3
+ <form action='/admin/templates' method='post' id='new_template_form' onsubmit="add_template();return false;">
4
+ <input type='hidden' name='authenticity_token' value='<%= form_authenticity_token %>' />
5
+ <p><input type='text' name='title' placeholder='Title' style="width: 400px;" /></p>
6
+ <p><select name='category_id'>
7
+ <option value=''>-- Select a category --</option>
8
+ <% cats = Caboose::PageTemplateCategory.order(:title).all.each do |cat| %>
9
+ <option <% if params[:category] == cat.id.to_s %>selected<% end %> value="<%= cat.id %>"><%= cat.title %></option>
10
+ <% end %>
11
+ </select></p>
12
+ <div id='message'></div>
13
+ <p>
14
+ <input type='button' value='< Back' onclick="window.location='/admin/templates';" />
15
+ <input type='submit' value='Add Page Template' />
16
+ </p>
17
+ </form>
18
+
19
+ <% content_for :caboose_js do %>
20
+ <%= javascript_include_tag "caboose/model/all" %>
21
+ <script type='text/javascript'>
22
+
23
+ function add_template()
24
+ {
25
+ $("#message").html("<p class='loading'>Adding page template...</p>");
26
+ $.ajax({
27
+ url: '/admin/templates',
28
+ type: 'post',
29
+ data: $('#new_template_form').serialize(),
30
+ success: function(resp) {
31
+ if (resp.error) $("#message").html("<p class='note error'>" + resp.error + "</p>");
32
+ if (resp.redirect) window.location = resp.redirect;
33
+ }
34
+ });
35
+ }
36
+
37
+ </script>
38
+ <% end %>
@@ -2,9 +2,10 @@
2
2
  <%= render :partial => 'caboose/pages/admin_header' %>
3
3
 
4
4
  <div id='message'>
5
- <p class='note error'>Are you sure you want to delete the page? This can't be undone.<br /><br />
6
- <input type='button' value='Yes' onclick='delete_page(<%= @page.id %>, true);' />
7
- <input type='button' value='No' onclick="window.location='/admin/pages/<%= @page.id %>/edit';" />
5
+ <p class='note error'>
6
+ <span style="display:block;margin-bottom:10px;">Are you sure you want to delete the page? This can't be undone.</span>
7
+ <input style="margin-right:8px;" type='button' value='Yes' onclick='delete_page(<%= @page.id %>, true);' />
8
+ <input type='button' value='No' onclick="window.location='/admin/pages/<%= @page.id %>';" />
8
9
  </p>
9
10
  </div>
10
11
 
@@ -15,7 +16,7 @@
15
16
 
16
17
  function delete_page(page_id, confirm)
17
18
  {
18
- $('#message').html("<p class='loading'>Deleting page...</p>");
19
+ $('#message').html("<p class='note loading'>Deleting page...</p>");
19
20
  $.ajax({
20
21
  url: '/admin/pages/' + page_id,
21
22
  type: 'delete',
@@ -27,11 +27,6 @@
27
27
  <% end %>
28
28
  <script type='text/javascript'>
29
29
 
30
- function hide_caboose_notice() {
31
- $("#caboose-notice").hide();
32
- document.cookie = "caboose_page_publish=true; expires=Thu, 18 Dec 2030 12:00:00 UTC; path=/";
33
- }
34
-
35
30
  var controller = false;
36
31
  $(document).ready(function() {
37
32
  controller = new BlockContentController({
@@ -59,10 +54,6 @@ $(document).ready(function() {
59
54
  .append($('<a/>').attr('href', '/<%= @page.uri %>').attr('target','_blank').text("View Page"))
60
55
  );
61
56
 
62
- <% if cookies[:caboose_page_publish].blank? %>
63
- $('body').append($('<div/>').attr('id','caboose-notice').html("<a href='#' onclick='hide_caboose_notice();return false;'>x</a><p>NEW: Changes aren't saved until you click Publish. Click Preview to preview the edited page, or Revert to discard your changes.</p>"));
64
- <% end %>
65
-
66
57
  <% if @site && @site.use_dragdrop %>
67
58
  var html = "<%== (render :partial => 'caboose/pages/new_block_header').gsub( / *\n+/, '' ) %> ";
68
59
  $('body').append($('<div/>')
@@ -1,46 +1,144 @@
1
1
  <h1>New Page</h1>
2
- <p>Parent: <%= @parent ? @parent.title : "Home" %></p>
3
2
 
4
- <form action='/admin/pages' method='post' id='new_page_form' onsubmit="add_page(); return false;">
5
- <input type='hidden' name='authenticity_token' value='<%= form_authenticity_token %>' />
6
- <input type='hidden' name='parent_id' value='<%= @parent_id %>' />
7
- <p><input type='text' name='title' placeholder='Title' style="width: 400px;" /></p>
8
- <p><select name='block_type_id'>
9
- <option value=''>-- Select a layout --</option>
10
- <% cat_ids = Caboose::BlockTypeCategory.layouts.collect{ |cat| cat.id } %>
11
- <% Caboose::BlockType.includes(:block_type_site_memberships).where("block_type_category_id in (?) and block_type_site_memberships.site_id = ?", cat_ids, @site.id).reorder(:description).all.each do |bt| %>
12
- <option value="<%= bt.id %>"><%= bt.description %></option>
13
- <% end %>
14
- </select></p>
15
- <div id='message'></div>
16
- <p>
17
- <input type='button' value='< Back' onclick="window.location='/admin/pages';" />
18
- <input type='submit' value='Add Page' />
19
- </p>
20
- </form>
3
+ <div class="new-page-form-wrapper">
4
+ <form action="/admin/pages" id="new_page_form" method="POST">
5
+ <section>
6
+ <div class="field">
7
+ <label for="title">Page Title</label>
8
+ <input type="text" name="title" id="title" />
9
+ <p class="meta">The page title will display in the main menu and in the browser title bar.</p>
10
+ </div>
11
+ <div class="field">
12
+ <label for="title">Parent Page</label>
13
+ <select name="parent_id" id="parent_id">
14
+ <% @sitemap.each do |sm| %>
15
+ <option value="<%= sm['value'] %>"><%= sm['text'] %></option>
16
+ <% end %>
17
+ </select>
18
+ <p class="meta">The parent page determines where this page will appear in the main menu.</p>
19
+ </div>
20
+ </section>
21
+ <section>
22
+ <h4>Page Layout</h4>
23
+ <div class="field">
24
+ <label for="layout_id">Choose a Layout</label>
25
+ <select name="layout_id" id="layout_id">
26
+ <% cat_ids = Caboose::BlockTypeCategory.layouts.collect{ |cat| cat.id } %>
27
+ <% Caboose::BlockType.includes(:block_type_site_memberships).where("block_type_category_id in (?) and block_type_site_memberships.site_id = ?", cat_ids, @site.id).reorder(:description).all.each do |bt| %>
28
+ <option <% if bt.description == 'Subpage' || bt.description == 'Standard' %>selected<% end %> value="<%= bt.id %>"><%= bt.description %></option>
29
+ <% end %>
30
+ </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>
32
+ </div>
33
+ </section>
34
+ <%# temporarily only super admins can do templates %>
35
+ <% if @logged_in_user && @logged_in_user.is_super_admin? %>
36
+ <section class="page-templates-wrapper">
37
+ <h4>Page Template</h4>
38
+ <div class="field">
39
+ <label for="#">Choose a Template</label>
40
+ <p class="meta">Start from scratch with a blank page, or choose a page template as a starting point.</p>
41
+ </div>
42
+ <div class="category">
43
+ <div class="cat-templates">
44
+ <a href="#" id="template-blank" class="template selected opt">
45
+ <img src="//cabooseit.s3.amazonaws.com/assets/shared/template.png" width="200" alt="Blank" />
46
+ <div class="text">
47
+ <span class="title">Blank</span>
48
+ <span class="desc">A completely blank page.</span>
49
+ </div>
50
+ </a>
51
+ <a href="#" id="template-choose" class="template opt">
52
+ <img src="//cabooseit.s3.amazonaws.com/assets/shared/template.png" width="200" alt="Blank" />
53
+ <div class="text">
54
+ <span class="title">Use a Template</span>
55
+ <span class="desc">Choose a page template.</span>
56
+ </div>
57
+ </a>
58
+ </div>
59
+ </div>
60
+ <% @categories.each do |cat| %>
61
+ <% next if cat.superadmin_only && !@logged_in_user.is_super_admin? %>
62
+ <div style="display:none;" class="category more">
63
+ <h3><%= cat.title %></h3>
64
+ <p class="description"><%= cat.description %></p>
65
+ <div class="cat-templates">
66
+ <% cat.page_templates.order(:sort_order).each do |tem| %>
67
+ <a href="#" data-id="<%= tem.id %>" class="template tem">
68
+ <img src="<%= tem.screenshot.url(:small) %>" width="200" alt="<%= tem.title %>" srcset="<%= tem.screenshot.url(:medium) %> 2x" />
69
+ <div class="text">
70
+ <span class="title"><%= tem.title.blank? ? 'New Template' : tem.title %></span>
71
+ <% if !tem.description.blank? %><span class="desc"><%= tem.description %></span><% end %>
72
+ </div>
73
+ </a>
74
+ <% end %>
75
+ </div>
76
+ </div>
77
+ <% end %>
78
+ </section>
79
+ <% end %>
80
+ <div id="page-message"></div>
81
+ <section class="buttons clearfix">
82
+ <a href="/admin/pages" class="caboose-btn-white">Cancel</a>
83
+ <a href="#" id="create_page" class="caboose-btn">Create Page</a>
84
+ </section>
85
+ <input type="hidden" id="use_template" name="use_template" value="no" />
86
+ <input type="hidden" id="template_id" name="template_id" value="" />
87
+ </form>
88
+ </div>
21
89
 
22
90
  <% content_for :caboose_js do %>
23
- <%= javascript_include_tag "caboose/model/all" %>
24
- <script type='text/javascript'>
25
-
26
- var modal = false;
27
- $(document).ready(function() {
28
- modal = new CabooseModal(420);
29
- });
30
-
31
- function add_page()
32
- {
33
- modal.autosize("<p class='loading'>Adding page...</p>");
34
- $.ajax({
35
- url: '/admin/pages',
36
- type: 'post',
37
- data: $('#new_page_form').serialize(),
38
- success: function(resp) {
39
- if (resp.error) modal.autosize("<p class='note error'>" + resp.error + "</p>");
40
- if (resp.redirect) parent.window.location = resp.redirect
41
- }
42
- });
43
- }
44
-
91
+ <script>
92
+ function add_page() {
93
+ $("#page-message").html("<p class='note loading'>Creating page...</p>");
94
+ $.ajax({
95
+ url: '/admin/pages',
96
+ type: 'post',
97
+ data: $('#new_page_form').serialize(),
98
+ success: function(resp) {
99
+ if (resp.error) $("#page-message").html("<p class='note error'>" + resp.error + "</p>");
100
+ if (resp.redirect) window.location = resp.redirect;
101
+ }
102
+ });
103
+ }
104
+ $(".template.opt").click(function(e) {
105
+ e.preventDefault();
106
+ $(".template.opt").removeClass("selected");
107
+ $(this).addClass("selected");
108
+ if ( $(this).attr("id") == "template-choose") {
109
+ $(".category.more").slideDown();
110
+ $("#use_template").attr("value","yes");
111
+ }
112
+ else if ( $(this).attr("id") == "template-blank") {
113
+ $(".category.more").slideUp();
114
+ $("#use_template").attr("value","no");
115
+ }
116
+ });
117
+ $(".template.tem").click(function(e) {
118
+ e.preventDefault();
119
+ $(".template.tem").removeClass("selected");
120
+ $(this).addClass("selected");
121
+ $("#template_id").attr("value", $(this).data("id"));
122
+ });
123
+ $("#create_page").click(function(e) {
124
+ e.preventDefault();
125
+ var mess = $("#page-message");
126
+ mess.html('');
127
+ if ( $("#title").val() == '' ) {
128
+ mess.html("<p class='note error'>Page Title is required.</p>");
129
+ }
130
+ else if ( $("#parent_id").val() == '' ) {
131
+ mess.html("<p class='note error'>Parent Page is required.</p>");
132
+ }
133
+ else if ( $("#layout_id").val() == '' ) {
134
+ mess.html("<p class='note error'>Page Layout is required.</p>");
135
+ }
136
+ else if ( $("#use_template").attr("value") == "yes" && $("#template_id").attr("value") == '' ) {
137
+ mess.html("<p class='note error'>Please select a template or choose 'Blank'.</p>");
138
+ }
139
+ else {
140
+ add_page();
141
+ }
142
+ });
45
143
  </script>
46
- <% end %>
144
+ <% end %>
@@ -0,0 +1,46 @@
1
+ <h1>New Page</h1>
2
+ <p>Parent: <%= @parent ? @parent.title : "Home" %></p>
3
+
4
+ <form action='/admin/pages' method='post' id='new_page_form' onsubmit="add_page(); return false;">
5
+ <input type='hidden' name='authenticity_token' value='<%= form_authenticity_token %>' />
6
+ <input type='hidden' name='parent_id' value='<%= @parent_id %>' />
7
+ <p><input type='text' name='title' placeholder='Title' style="width: 400px;" /></p>
8
+ <p><select name='block_type_id'>
9
+ <option value=''>-- Select a layout --</option>
10
+ <% cat_ids = Caboose::BlockTypeCategory.layouts.collect{ |cat| cat.id } %>
11
+ <% Caboose::BlockType.includes(:block_type_site_memberships).where("block_type_category_id in (?) and block_type_site_memberships.site_id = ?", cat_ids, @site.id).reorder(:description).all.each do |bt| %>
12
+ <option value="<%= bt.id %>"><%= bt.description %></option>
13
+ <% end %>
14
+ </select></p>
15
+ <div id='message'></div>
16
+ <p>
17
+ <input type='button' value='< Back' onclick="window.location='/admin/pages';" />
18
+ <input type='submit' value='Add Page' />
19
+ </p>
20
+ </form>
21
+
22
+ <% content_for :caboose_js do %>
23
+ <%= javascript_include_tag "caboose/model/all" %>
24
+ <script type='text/javascript'>
25
+
26
+ var modal = false;
27
+ $(document).ready(function() {
28
+ modal = new CabooseModal(420);
29
+ });
30
+
31
+ function add_page()
32
+ {
33
+ modal.autosize("<p class='loading'>Adding page...</p>");
34
+ $.ajax({
35
+ url: '/admin/pages',
36
+ type: 'post',
37
+ data: $('#new_page_form').serialize(),
38
+ success: function(resp) {
39
+ if (resp.error) modal.autosize("<p class='note error'>" + resp.error + "</p>");
40
+ if (resp.redirect) parent.window.location = resp.redirect
41
+ }
42
+ });
43
+ }
44
+
45
+ </script>
46
+ <% end %>
@@ -27,10 +27,6 @@
27
27
  <% end %>
28
28
  <script type='text/javascript'>
29
29
 
30
- function hide_caboose_notice() {
31
- $("#caboose-notice").hide();
32
- document.cookie = "caboose_post_publish=true; expires=Thu, 18 Dec 2030 12:00:00 UTC; path=/";
33
- }
34
30
  var controller = false;
35
31
  $(document).ready(function() {
36
32
  controller = new BlockContentController({
@@ -55,10 +51,6 @@ $(document).ready(function() {
55
51
  .append($('<a/>').attr('href', '<%= @post.uri %>').attr('target','_blank').text("View Post"))
56
52
  );
57
53
 
58
- <% if cookies[:caboose_post_publish].blank? %>
59
- $('body').append($('<div/>').attr('id','caboose-notice').html("<a href='#' onclick='hide_caboose_notice();return false;'>x</a><p>NEW: Changes aren't saved until you click Publish. Click Preview to preview the edited post, or Revert to discard your changes.</p>"));
60
- <% end %>
61
-
62
54
  <% if @site && @site.use_dragdrop %>
63
55
  var html = "<%== (render :partial => 'caboose/pages/new_block_header').gsub( / *\n+/, '' ) %> ";
64
56
  $('body').append($('<div/>')
@@ -19,7 +19,8 @@ $(document).ready(function() {
19
19
  var table = new IndexTable({
20
20
  form_authenticity_token: '<%= form_authenticity_token %>',
21
21
  container: 'sites',
22
- base_url: '/admin/sites',
22
+ base_url: '/admin/sites',
23
+ after_add: 'redirect',
23
24
  fields: [
24
25
  { name: 'name' , sort: 'name' , show: true , editable: false, bulk_edit: false, nice_name: 'Name' , type: 'text' , value: function(site) { return site.name; }, width: 400 },
25
26
  { name: 'description' , sort: 'description' , show: true , bulk_edit: false, nice_name: 'Description' , type: 'text' , value: function(site) { return site.description; }, width: 400 },
@@ -0,0 +1,242 @@
1
+ <%
2
+ dt = Caboose::BlockType.where(:name => 'layout_default_theme_standard').first
3
+ header = dt.child('header') if dt
4
+ style = header.child('style') if header
5
+ position = header.child('position') if header
6
+ %>
7
+
8
+ <h1>Theme</h1>
9
+
10
+ <div class="grid-row">
11
+ <div class="unit1of2 left">
12
+ <section>
13
+ <h5>Compile</h5>
14
+ <a href="#" id="compile-btn" class="caboose-btn">Compile Theme</a>
15
+ <div style="margin-top:20px;" id='message'></div>
16
+ </section>
17
+ <section>
18
+ <h5>Colors</h5>
19
+ <div id='theme_<%= @theme.id %>_color_main'></div>
20
+ <div id='theme_<%= @theme.id %>_color_alt'></div>
21
+ <div id="theme_<%= @theme.id %>_color_dark"></div>
22
+ <div id="theme_<%= @theme.id %>_color_light"></div>
23
+ </section>
24
+ <section>
25
+ <h5>Body</h5>
26
+ <div id="theme_<%= @theme.id %>_max_width"></div>
27
+ <div id="theme_<%= @theme.id %>_body_bg_color"></div>
28
+ <div id="theme_<%= @theme.id %>_font_size"></div>
29
+ <div id="theme_<%= @theme.id %>_body_line_height"></div>
30
+ <div id="theme_<%= @theme.id %>_body_font_color"></div>
31
+ <div id="theme_<%= @theme.id %>_heading_line_height"></div>
32
+ </section>
33
+ <section>
34
+ <h5>Header</h5>
35
+ <div id="theme_<%= @theme.id %>_header_height"></div>
36
+ <div id="theme_<%= @theme.id %>_header_bg_color"></div>
37
+ <div id="theme_<%= @theme.id %>_header_font_color"></div>
38
+ <div id="theme_<%= @theme.id %>_dropdown_color"></div>
39
+ <div id="theme_<%= @theme.id %>_mobile_menu_icon_color"></div>
40
+ <div id="theme_<%= @theme.id %>_mobile_menu_icon_top"></div>
41
+ <div id="theme_<%= @theme.id %>_header_font_size"></div>
42
+ <div id="theme_<%= @theme.id %>_header_nav_spacing"></div>
43
+ <div id="theme_<%= @theme.id %>_logo_width"></div>
44
+ <div id="theme_<%= @theme.id %>_logo_height"></div>
45
+ <div id="theme_<%= @theme.id %>_logo_top_padding"></div>
46
+ <div id="theme_<%= @theme.id %>_default_header_style"></div>
47
+ <div id="theme_<%= @theme.id %>_default_header_position"></div>
48
+ </section>
49
+ <section>
50
+ <h5>Footer</h5>
51
+ <div id="theme_<%= @theme.id %>_footer_height"></div>
52
+ <div id="theme_<%= @theme.id %>_footer_bg_color"></div>
53
+ <div id="theme_<%= @theme.id %>_footer_font_color"></div>
54
+ <div id="theme_<%= @theme.id %>_footer_padding"></div>
55
+ <div id="theme_<%= @theme.id %>_footer_font_size"></div>
56
+ </section>
57
+ </div>
58
+ <div class="unit1of2 right">
59
+ <section>
60
+ <h5>Buttons</h5>
61
+ <div id="theme_<%= @theme.id %>_btn_border_radius"></div>
62
+ <div id="theme_<%= @theme.id %>_btn_border_width"></div>
63
+ <div id="theme_<%= @theme.id %>_btn_border_color"></div>
64
+ <div id="theme_<%= @theme.id %>_btn_font_color"></div>
65
+ <div id="theme_<%= @theme.id %>_btn_font_size"></div>
66
+ <div id="theme_<%= @theme.id %>_btn_font_weight"></div>
67
+ <div id="theme_<%= @theme.id %>_btn_font_case"></div>
68
+ <div id="theme_<%= @theme.id %>_btn_border_side"></div>
69
+ <div id="theme_<%= @theme.id %>_button_padding"></div>
70
+ <div id="theme_<%= @theme.id %>_button_line_height"></div>
71
+ </section>
72
+
73
+ <section>
74
+ <h5>Inputs</h5>
75
+ <div id="theme_<%= @theme.id %>_input_border_radius"></div>
76
+ <div id="theme_<%= @theme.id %>_input_bg_color"></div>
77
+ <div id="theme_<%= @theme.id %>_input_border_color"></div>
78
+ <div id="theme_<%= @theme.id %>_input_border_width"></div>
79
+ <div id="theme_<%= @theme.id %>_input_font_color"></div>
80
+ <div id="theme_<%= @theme.id %>_input_font_size"></div>
81
+ <div id="theme_<%= @theme.id %>_input_padding"></div>
82
+ <div id="theme_<%= @theme.id %>_note_padding"></div>
83
+ </section>
84
+
85
+ <section>
86
+ <h5>Subpage Banner</h5>
87
+ <div id="theme_<%= @theme.id %>_banner_padding"></div>
88
+ <div id="theme_<%= @theme.id %>_banner_overlay_color"></div>
89
+ <div id="theme_<%= @theme.id %>_banner_overlay_opacity"></div>
90
+ <div id="theme_<%= @theme.id %>_default_banner_image"></div>
91
+ </section>
92
+ <section>
93
+ <h5>Mobile Menu</h5>
94
+ <div id="theme_<%= @theme.id %>_mobile_menu_bg_color"></div>
95
+ <div id="theme_<%= @theme.id %>_mobile_menu_font_color"></div>
96
+ <div id="theme_<%= @theme.id %>_mobile_menu_border_color"></div>
97
+ <div id="theme_<%= @theme.id %>_mobile_menu_nav_padding"></div>
98
+ <div id="theme_<%= @theme.id %>_mobile_menu_font_size"></div>
99
+ </section>
100
+
101
+ <section>
102
+ <h5>Sidebar</h5>
103
+ <div id="theme_<%= @theme.id %>_sidebar_width"></div>
104
+ <div id="theme_<%= @theme.id %>_sidebar_bg_color"></div>
105
+ </section>
106
+
107
+ </div>
108
+ </div>
109
+
110
+
111
+
112
+
113
+ <% content_for :caboose_css do %>
114
+ <style>
115
+ .grid-row::after {
116
+ content: ".";
117
+ visibility: hidden;
118
+ display: block;
119
+ height: 0;
120
+ clear: both;
121
+ }
122
+ section {
123
+ margin-bottom: 20px;
124
+ }
125
+ section h5 {
126
+ margin: 0 0 10px 0;
127
+ font-size: 18px;
128
+ }
129
+ .unit1of2 {
130
+ width: 48%;
131
+ float: left;
132
+ padding: 0 2% 0 0;
133
+ }
134
+ section > div {
135
+ margin-bottom: 10px;
136
+ }
137
+ #message .note {
138
+ font-size: 16px !important;
139
+ }
140
+ #message p.note.loading {
141
+ background-color: #b7b7ff !important;
142
+ }
143
+ </style>
144
+ <% end %>
145
+
146
+ <% content_for :caboose_js do %>
147
+ <%= javascript_include_tag "caboose/model/all" %>
148
+ <script type="text/javascript">
149
+
150
+ $("#compile-btn").click(function(e) {
151
+ $('#message').html("<p class='note loading'>Compiling theme...</p>").fadeIn();
152
+ e.preventDefault();
153
+ $.ajax({
154
+ url: '/admin/themes/<%= @theme.id %>/compile',
155
+ type: 'get',
156
+ success: function(resp) {
157
+ if (resp.error) $('#message').html("<p class='note error'>" + resp.error + "</p>").fadeIn();
158
+ if (resp.success && resp.message) {
159
+ $('#message').html("<p class='note success'>" + resp.message + "</p>").fadeIn().delay(2000).fadeOut();
160
+ }
161
+ }
162
+ });
163
+ });
164
+
165
+ $(document).ready(function() {
166
+ new ModelBinder({
167
+ name: 'Theme',
168
+ id: <%= @theme.id %>,
169
+ update_url: '/admin/theme',
170
+ authenticity_token: '<%= form_authenticity_token %>',
171
+ attributes: [
172
+ { name: 'color_main' , nice_name: 'Main' , type: 'text' , value: <%= raw Caboose.json(@theme.color_main ) %>, width: 400 },
173
+ { name: 'color_alt' , nice_name: 'Alternate' , type: 'text' , value: <%= raw Caboose.json(@theme.color_alt ) %>, width: 400 },
174
+ { name: 'color_dark', nice_name: "<%= 'dark'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.color_dark) %>, width: 400 },
175
+ { name: 'color_light', nice_name: "<%= 'light'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.color_light) %>, width: 400 },
176
+ { name: 'max_width', nice_name: "<%= 'max_width'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.max_width) %>, width: 400 },
177
+ { name: 'body_bg_color', nice_name: "<%= 'background_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.body_bg_color) %>, width: 400 },
178
+ { name: 'font_size', nice_name: "<%= 'font_size'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.font_size) %>, width: 400 },
179
+ { name: 'header_height', nice_name: "<%= 'height'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.header_height) %>, width: 400 },
180
+ { name: 'header_bg_color', nice_name: "<%= 'background_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.header_bg_color) %>, width: 400 },
181
+ { name: 'header_font_color', nice_name: "<%= 'font_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.header_font_color) %>, width: 400 },
182
+ { name: 'dropdown_color', nice_name: "<%= 'dropdown_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.dropdown_color) %>, width: 400 },
183
+ { name: 'mobile_menu_bg_color', nice_name: "<%= 'background_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.mobile_menu_bg_color) %>, width: 400 },
184
+ { name: 'mobile_menu_font_color', nice_name: "<%= 'font_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.mobile_menu_font_color) %>, width: 400 },
185
+ { name: 'mobile_menu_border_color', nice_name: "<%= 'border_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.mobile_menu_border_color) %>, width: 400 },
186
+ { name: 'mobile_menu_icon_color', nice_name: "<%= 'icon_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.mobile_menu_icon_color) %>, width: 400 },
187
+ { name: 'mobile_menu_icon_top', nice_name: "<%= 'icon_top'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.mobile_menu_icon_top) %>, width: 400 },
188
+ { name: 'footer_height', nice_name: "<%= 'height'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.footer_height) %>, width: 400 },
189
+ { name: 'footer_bg_color', nice_name: "<%= 'background_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.footer_bg_color) %>, width: 400 },
190
+ { name: 'footer_font_color', nice_name: "<%= 'font_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.footer_font_color) %>, width: 400 },
191
+ { name: 'btn_border_radius', nice_name: "<%= 'border_radius'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.btn_border_radius) %>, width: 400 },
192
+ { name: 'btn_border_width', nice_name: "<%= 'border_width'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.btn_border_width) %>, width: 400 },
193
+ { name: 'btn_border_color', nice_name: "<%= 'border_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.btn_border_color) %>, width: 400 },
194
+ { name: 'btn_font_color', nice_name: "<%= 'font_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.btn_font_color) %>, width: 400 },
195
+ { name: 'btn_font_size', nice_name: "<%= 'font_size'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.btn_font_size) %>, width: 400 },
196
+ { name: 'btn_font_weight', nice_name: "<%= 'font_weight'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.btn_font_weight) %>, width: 400 },
197
+ { name: 'btn_font_case', nice_name: "<%= 'font_case'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.btn_font_case) %>, width: 400 },
198
+ { name: 'btn_border_side', nice_name: "<%= 'border_side'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.btn_border_side) %>, width: 400 },
199
+ { name: 'input_border_radius', nice_name: "<%= 'border_radius'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.input_border_radius) %>, width: 400 },
200
+ { name: 'input_bg_color', nice_name: "<%= 'background_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.input_bg_color) %>, width: 400 },
201
+ { name: 'input_border_color', nice_name: "<%= 'border_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.input_border_color) %>, width: 400 },
202
+ { name: 'input_border_width', nice_name: "<%= 'border_width'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.input_border_width) %>, width: 400 },
203
+ { name: 'input_font_color', nice_name: "<%= 'font_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.input_font_color) %>, width: 400 },
204
+ { name: 'input_font_size', nice_name: "<%= 'font_size'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.input_font_size) %>, width: 400 },
205
+ { name: 'input_padding', nice_name: "<%= 'padding'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.input_padding) %>, width: 400 },
206
+ { name: 'body_line_height', nice_name: "<%= 'line_height'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.body_line_height) %>, width: 400 },
207
+ { name: 'body_font_color', nice_name: "<%= 'font_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.body_font_color) %>, width: 400 },
208
+ { name: 'button_padding', nice_name: "<%= 'padding'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.button_padding) %>, width: 400 },
209
+ { name: 'button_line_height', nice_name: "<%= 'line_height'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.button_line_height) %>, width: 400 },
210
+ { name: 'footer_padding', nice_name: "<%= 'padding'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.footer_padding) %>, width: 400 },
211
+ { name: 'footer_font_size', nice_name: "<%= 'font_size'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.footer_font_size) %>, width: 400 },
212
+ { name: 'header_font_size', nice_name: "<%= 'font_size'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.header_font_size) %>, width: 400 },
213
+ { name: 'note_padding', nice_name: "<%= 'note_padding'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.note_padding) %>, width: 400 },
214
+ { name: 'header_nav_spacing', nice_name: "<%= 'nav_spacing'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.header_nav_spacing) %>, width: 400 },
215
+ { name: 'logo_width', nice_name: "<%= 'logo_width'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.logo_width) %>, width: 400 },
216
+ { name: 'logo_height', nice_name: "<%= 'logo_height'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.logo_height) %>, width: 400 },
217
+ { name: 'logo_top_padding', nice_name: "<%= 'logo_top_padding'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.logo_top_padding) %>, width: 400 },
218
+ { name: 'heading_line_height', nice_name: "<%= 'heading_line_height'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.heading_line_height) %>, width: 400 },
219
+ { name: 'mobile_menu_nav_padding', nice_name: "<%= 'nav_padding'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.mobile_menu_nav_padding) %>, width: 400 },
220
+ { name: 'mobile_menu_font_size', nice_name: "<%= 'font_size'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.mobile_menu_font_size) %>, width: 400 },
221
+ { name: 'banner_padding', nice_name: "<%= 'banner_padding'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.banner_padding) %>, width: 400 },
222
+ { name: 'banner_overlay_color', nice_name: "<%= 'banner_overlay_color'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.banner_overlay_color) %>, width: 400 },
223
+ { name: 'banner_overlay_opacity', nice_name: "<%= 'banner_overlay_opacity'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.banner_overlay_opacity) %>, width: 400 },
224
+ <% if style %>
225
+ { 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 },
226
+ <% else %>
227
+ { name: 'default_header_style', nice_name: "<%= 'default_style'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.default_header_style) %>, width: 400 },
228
+ <% end %>
229
+ <% if position %>
230
+ { name: 'default_header_position', nice_name: "<%= 'default_position'.titleize %>", type: 'select', value: <%== Caboose.json(@theme.default_header_position) %>, options_url: '/admin/block-types/<%= position.id %>/options', width: 400 },
231
+ <% else %>
232
+ { name: 'default_header_position', nice_name: "<%= 'default_position'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.default_header_position) %>, width: 400 },
233
+ <% end %>
234
+ { name: 'sidebar_width', nice_name: "<%= 'width'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.sidebar_width) %>, width: 400 },
235
+ { 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' }
237
+ ]
238
+ });
239
+ });
240
+
241
+ </script>
242
+ <% end %>