caboose-cms 0.9.228 → 0.9.229
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/caboose/admin.js +1 -1
- data/app/assets/javascripts/caboose/admin_main.js +1 -13
- data/app/assets/javascripts/caboose/admin_media_index.js +161 -158
- data/app/assets/javascripts/caboose/application.js +8 -7
- data/app/assets/javascripts/caboose/block_content_controller_dragdrop.js +60 -4
- data/app/assets/javascripts/caboose/block_modal_controllers/block_dd_modal_controller.js +3 -2
- data/app/assets/javascripts/caboose/block_modal_controllers/media_modal_controller.js +17 -6
- data/app/assets/javascripts/caboose/model/all.js +5 -1
- data/app/assets/stylesheets/caboose/admin_block_edit_image.css.scss +2 -1
- data/app/assets/stylesheets/caboose/admin_edit_page_content_dragdrop.scss +71 -15
- data/app/assets/stylesheets/caboose/admin_main.css.scss +25 -29
- data/app/assets/stylesheets/caboose/admin_media_index.css.scss +26 -5
- data/app/assets/stylesheets/caboose/application.css +11 -5
- data/app/assets/stylesheets/caboose/login.scss +1 -0
- data/app/assets/stylesheets/caboose/model_binder.css +13 -4
- data/app/assets/stylesheets/caboose/page_bar_generator.css +2 -1
- data/app/controllers/caboose/admin_controller.rb +3 -4
- data/app/controllers/caboose/application_controller.rb +16 -19
- data/app/controllers/caboose/block_types_controller.rb +8 -6
- data/app/controllers/caboose/cart_controller.rb +2 -2
- data/app/controllers/caboose/change_logs_controller.rb +13 -0
- data/app/controllers/caboose/fonts_controller.rb +139 -2
- data/app/controllers/caboose/invoices_controller.rb +5 -4
- data/app/controllers/caboose/login_logs_controller.rb +5 -7
- data/app/controllers/caboose/media_categories_controller.rb +16 -2
- data/app/controllers/caboose/media_controller.rb +14 -11
- data/app/controllers/caboose/pages_controller.rb +104 -42
- data/app/controllers/caboose/posts_controller.rb +53 -7
- data/app/controllers/caboose/products_controller.rb +1 -1
- data/app/controllers/caboose/sites_controller.rb +25 -6
- data/app/controllers/caboose/sns_controller.rb +3 -3
- data/app/controllers/caboose/themes_controller.rb +30 -0
- data/app/controllers/caboose/users_controller.rb +17 -10
- data/app/controllers/caboose/variants_controller.rb +9 -9
- data/app/models/caboose/block.rb +98 -22
- data/app/models/caboose/block_type.rb +2 -1
- data/app/models/caboose/block_type_parser.rb +1 -1
- data/app/models/caboose/calendar_event_group.rb +2 -2
- data/app/models/caboose/change_log.rb +97 -0
- data/app/models/caboose/core_plugin.rb +4 -3
- data/app/models/caboose/font.rb +7 -2
- data/app/models/caboose/font_variant.rb +12 -0
- data/app/models/caboose/media.rb +15 -4
- data/app/models/caboose/media_category.rb +2 -4
- data/app/models/caboose/page.rb +316 -45
- data/app/models/caboose/page_bar_generator.rb +20 -10
- data/app/models/caboose/post.rb +108 -8
- data/app/models/caboose/product.rb +1 -1
- data/app/models/caboose/role.rb +2 -2
- data/app/models/caboose/schema.rb +73 -72
- data/app/models/caboose/site.rb +203 -1
- data/app/models/caboose/theme.rb +70 -5
- data/app/views/caboose/block_types/admin_edit.html.erb +6 -8
- data/app/views/caboose/blocks/_cached_block.html.erb +28 -0
- data/app/views/caboose/blocks/_file.html.erb +2 -2
- data/app/views/caboose/blocks/_ga.html.erb +1 -2
- data/app/views/caboose/blocks/_image.html.erb +4 -0
- data/app/views/caboose/blocks/_render_function.html.erb +9 -4
- data/app/views/caboose/change_logs/admin_index.html.erb +65 -0
- data/app/views/caboose/fonts/admin_family_edit.html.erb +63 -0
- data/app/views/caboose/fonts/admin_family_index.html.erb +42 -0
- data/app/views/caboose/fonts/admin_index.html.erb +55 -10
- data/app/views/caboose/fonts/admin_variant_edit.html.erb +84 -0
- data/app/views/caboose/invoices_mailer/customer_status_updated.html.erb +5 -14
- data/app/views/caboose/login_logs/admin_index_for_user.html.erb +1 -1
- data/app/views/caboose/media/admin_index.html.erb +14 -24
- data/app/views/caboose/my_account/index.html.erb +1 -0
- data/app/views/caboose/pages/_admin_header.html.erb +5 -0
- data/app/views/caboose/pages/admin_change_logs.html.erb +56 -0
- data/app/views/caboose/pages/admin_edit_content.html.erb +6 -2
- data/app/views/caboose/pages/admin_edit_general.html.erb +32 -4
- data/app/views/caboose/pages/compiled_asset.css.erb +0 -0
- data/app/views/caboose/pages/compiled_asset.js.erb +0 -0
- data/app/views/caboose/posts/_admin_header.html.erb +5 -0
- data/app/views/caboose/posts/admin_change_logs.html.erb +56 -0
- data/app/views/caboose/posts/admin_delete_form.html.erb +1 -1
- data/app/views/caboose/posts/admin_edit_content.html.erb +6 -2
- data/app/views/caboose/products/admin_group_variants.html.erb +1 -1
- data/app/views/caboose/products/admin_sort.html copy.erb +1 -1
- data/app/views/caboose/sites/admin_edit.html.erb +21 -0
- data/app/views/caboose/sites/compiled_asset.css.erb +0 -0
- data/app/views/caboose/sites/compiled_asset.js.erb +0 -0
- data/app/views/caboose/themes/admin_edit.html.erb +7 -3
- data/app/views/caboose/themes/admin_error_log.html.erb +9 -0
- data/app/views/caboose/themes/admin_js.html.erb +131 -0
- data/app/views/caboose/users/_admin_header.html.erb +4 -0
- data/app/views/caboose/users/admin_change_logs.html.erb +63 -0
- data/app/views/caboose/users/admin_edit_roles.html.erb +1 -0
- data/app/views/caboose/variants/admin_group.html.erb +1 -1
- data/app/views/layouts/caboose/admin.html.erb +9 -2
- data/app/views/layouts/caboose/application.html.erb +62 -92
- data/app/views/layouts/caboose/css.css.erb +44 -0
- data/app/views/layouts/caboose/footer_css.css.erb +41 -0
- data/app/views/layouts/caboose/footer_js.js.erb +31 -0
- data/app/views/layouts/caboose/js.js.erb +34 -0
- data/lib/caboose/version.rb +1 -1
- data/lib/tasks/caboose.rake +3 -14
- metadata +23 -27
- data/app/controllers/caboose/assets_controller.rb +0 -65
- data/app/models/caboose/asset.rb +0 -23
- data/app/models/caboose/asset_manifest.rb +0 -91
- data/app/models/caboose/block_cache.rb +0 -105
- data/app/models/caboose/block_cache_file.rb +0 -22
- data/app/models/caboose/block_cache_image.rb +0 -53
- data/app/models/caboose/page_cache.rb +0 -12
- data/app/models/caboose/page_cacher.rb +0 -137
- data/app/views/caboose/pages/admin_new_old.html.erb +0 -46
- data/app/views/caboose/pages/test.html.erb +0 -64
@@ -1,9 +1,10 @@
|
|
1
|
+
<% is_cache = defined?(is_cache) ? is_cache : false %>
|
1
2
|
<%== ERB.new(render_function).result(self.instance_eval { binding }) %>
|
2
|
-
|
3
3
|
<% if caboose_js && caboose_js.length > 1 %>
|
4
4
|
<% caboose_js.to_a.each_with_index do |js, ind| %>
|
5
5
|
<% next if ind == 0 %>
|
6
|
-
<%
|
6
|
+
<% js_yield = is_cache ? "js_#{block.id}".to_sym : :js %>
|
7
|
+
<% content_for js_yield do %>
|
7
8
|
<% begin %>
|
8
9
|
<% erb = ERB.new(js).result(self.instance_eval { binding }) %>
|
9
10
|
<%== erb %>
|
@@ -16,7 +17,8 @@
|
|
16
17
|
<% if caboose_css && caboose_css.length > 1 %>
|
17
18
|
<% caboose_css.to_a.each_with_index do |css, ind| %>
|
18
19
|
<% next if ind == 0 %>
|
19
|
-
<%
|
20
|
+
<% css_yield = is_cache ? "css_#{block.id}".to_sym : :css %>
|
21
|
+
<% content_for css_yield do %>
|
20
22
|
<% begin %>
|
21
23
|
<% erb = ERB.new(css).result(self.instance_eval { binding }) %>
|
22
24
|
<%== erb %>
|
@@ -25,4 +27,7 @@
|
|
25
27
|
<% end %>
|
26
28
|
<% end %>
|
27
29
|
<% end %>
|
28
|
-
<% end %>
|
30
|
+
<% end %>
|
31
|
+
<% block.cached_js = yield( "js_#{block.id}".to_sym ) if is_cache %>
|
32
|
+
<% block.cached_css = yield( "css_#{block.id}".to_sym ) if is_cache %>
|
33
|
+
<% block.save if is_cache %>
|
@@ -0,0 +1,65 @@
|
|
1
|
+
<h1>Recent Changes</h1>
|
2
|
+
|
3
|
+
<div style="padding-right:30px;">
|
4
|
+
<table cellpadding="0" cellspacing="0">
|
5
|
+
<thead>
|
6
|
+
<tr>
|
7
|
+
<th>User</th>
|
8
|
+
<th>Resource</th>
|
9
|
+
<th>Title</th>
|
10
|
+
<th>Date</th>
|
11
|
+
<th>Action</th>
|
12
|
+
<th>Field</th>
|
13
|
+
<th>Old Value</th>
|
14
|
+
<th>New Value</th>
|
15
|
+
</tr>
|
16
|
+
</thead>
|
17
|
+
<% @logs.each do |log| %>
|
18
|
+
<%
|
19
|
+
res = log.page_id ? Caboose::Page.where(:id => log.page_id).first : (log.post_id ? Caboose::Post.where(:id => log.post_id).first : (log.media_id ? Caboose::Media.where(:id => log.media_id).first : nil))
|
20
|
+
res_type = log.page_id ? "Page" : (log.post_id ? "Post" : (log.description.include?('Media Category') && log.media_id ? ('Media Category') : (log.media_id ? "Media" : nil)))
|
21
|
+
res_title = res ? (log.page_id ? res.title : (log.post_id ? res.title : (log.description.include?('Media Category') && log.media_id ? (log.description.gsub('Media Category: ','')) : (log.media_id ? Caboose::Media.title_for_id(res.id) : "N/A")))) : log.description.gsub("Media Category: ","")
|
22
|
+
%>
|
23
|
+
<tr>
|
24
|
+
<td><%= log.user ? log.user.username : "N/A" %></td>
|
25
|
+
<td><%= res_type %></td>
|
26
|
+
<td><%= res_title %></td>
|
27
|
+
<td><%= log.timestamp.in_time_zone('Central Time (US & Canada)').strftime('%-m/%-d/%y, %l:%M%P') %></td>
|
28
|
+
<td><%= log.describe_action %></td>
|
29
|
+
<td><%= log.description.blank? ? '' : log.description.gsub("Media Category: ",'') %></td>
|
30
|
+
<td><%== (!log.description.blank? && log.description.include?('Custom Css') || log.description.include?('Custom Js')) || (!log.describe_old.blank? && log.describe_old.include?('</')) ? "<pre>" : "" %><%= log.describe_old %><%== (!log.description.blank? && log.description.include?('Custom Css') || log.description.include?('Custom Js')) || (!log.describe_old.blank? && log.describe_old.include?('</')) ? "</pre>" : "" %></td>
|
31
|
+
<td><%== (!log.description.blank? && log.description.include?('Custom Css') || log.description.include?('Custom Js')) || (!log.describe_new.blank? && log.describe_new.include?('</')) ? "<pre>" : "" %><%= log.describe_new %><%== (!log.description.blank? && log.description.include?('Custom Css') || log.description.include?('Custom Js')) || (!log.describe_new.blank? && log.describe_new.include?('</')) ? "</pre>" : "" %></td>
|
32
|
+
</tr>
|
33
|
+
<% end %>
|
34
|
+
</table>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
|
38
|
+
<% content_for :caboose_css do %>
|
39
|
+
<style>
|
40
|
+
table {
|
41
|
+
width: 100%;
|
42
|
+
}
|
43
|
+
table tr {
|
44
|
+
|
45
|
+
}
|
46
|
+
table td, table th {
|
47
|
+
font-family: "Roboto";
|
48
|
+
font-weight: 300;
|
49
|
+
font-size: 13px;
|
50
|
+
padding: 6px 8px 6px 4px;
|
51
|
+
text-align: left;
|
52
|
+
max-width: 200px;
|
53
|
+
border-bottom: 1px solid #eaeaea;
|
54
|
+
}
|
55
|
+
td pre {
|
56
|
+
overflow: hidden;
|
57
|
+
white-space: pre-line;
|
58
|
+
font-size: 12px;
|
59
|
+
font-family: monospace;
|
60
|
+
}
|
61
|
+
table th {
|
62
|
+
font-weight: bold;
|
63
|
+
}
|
64
|
+
</style>
|
65
|
+
<% end %>
|
@@ -0,0 +1,63 @@
|
|
1
|
+
<h1>Edit Font Family</h1>
|
2
|
+
|
3
|
+
<h2><%= @ff.name %></h2>
|
4
|
+
<h4>Variants</h4>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @ff.font_variants.order(:sort_order).each do |var| %>
|
8
|
+
<li><a href="/admin/font-variants/<%= var.id %>"><%= var.variant %></a></li>
|
9
|
+
<% end %>
|
10
|
+
<li style="margin-top:15px;"><a href="#" onclick="new_variant();return false;">New Variant</a></li>
|
11
|
+
</ul>
|
12
|
+
|
13
|
+
<div id="new-variant">
|
14
|
+
<h5>Add New Font Variant</h5>
|
15
|
+
<form method="POST" action="/admin/font-variants">
|
16
|
+
<input type="hidden" name="family_id" value="<%= @ff.id %>" />
|
17
|
+
<input style="width:200px;" id="var" type="text" name="variant" placeholder="Variant Name" />
|
18
|
+
<a href="#" id="submit-variant" class="caboose-btn">Add</a>
|
19
|
+
<div style="margin-top:5px;" id="message"></div>
|
20
|
+
</form>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
|
24
|
+
<br /><br />
|
25
|
+
<a href="/admin/font-families" class="caboose-btn">Back</a>
|
26
|
+
|
27
|
+
<% content_for :caboose_js do %>
|
28
|
+
<script>
|
29
|
+
function new_variant() {
|
30
|
+
$("#new-variant").slideToggle();
|
31
|
+
}
|
32
|
+
$("#submit-variant").click(function(e) {
|
33
|
+
e.preventDefault();
|
34
|
+
$.ajax({
|
35
|
+
url: '/admin/font-variants',
|
36
|
+
type: 'post',
|
37
|
+
data: {
|
38
|
+
family_id: <%= @ff.id %>,
|
39
|
+
variant: $("#var").val()
|
40
|
+
},
|
41
|
+
success: function(resp) {
|
42
|
+
if (resp.error) $('#message').html("<p class='note error'>" + resp.error + "</p>");
|
43
|
+
if (resp.redirect) window.location = resp.redirect;
|
44
|
+
}
|
45
|
+
});
|
46
|
+
});
|
47
|
+
</script>
|
48
|
+
<% end %>
|
49
|
+
|
50
|
+
<% content_for :caboose_css do %>
|
51
|
+
<style>
|
52
|
+
#new-variant {
|
53
|
+
padding: 15px;
|
54
|
+
border: 1px solid gray;
|
55
|
+
width: 400px;
|
56
|
+
background: #dfffd2;
|
57
|
+
display: none;
|
58
|
+
}
|
59
|
+
#new-variant h5 {
|
60
|
+
margin: 0 0 8px 0;
|
61
|
+
}
|
62
|
+
</style>
|
63
|
+
<% end %>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<h1>Font Families</h1>
|
2
|
+
|
3
|
+
<div id='fonts'></div>
|
4
|
+
|
5
|
+
<% content_for :caboose_css do %>
|
6
|
+
<style>
|
7
|
+
table.data {
|
8
|
+
margin-right: 20px;
|
9
|
+
}
|
10
|
+
</style>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<% content_for :caboose_js do %>
|
14
|
+
<%= javascript_include_tag 'caboose/model/all' %>
|
15
|
+
<script type='text/javascript'>
|
16
|
+
|
17
|
+
$(document).ready(function() {
|
18
|
+
var that = this;
|
19
|
+
var table = new IndexTable({
|
20
|
+
form_authenticity_token: '<%= form_authenticity_token %>',
|
21
|
+
container: 'fonts',
|
22
|
+
base_url: '/admin/font-families',
|
23
|
+
allow_bulk_edit: false,
|
24
|
+
allow_bulk_import: false,
|
25
|
+
allow_duplicate: false,
|
26
|
+
allow_bulk_delete: false,
|
27
|
+
after_add: 'redirect',
|
28
|
+
fields: [
|
29
|
+
{ name: 'name' , sort: 'name' , show: true , editable: false, bulk_edit: false, nice_name: 'Name' , type: 'text' , value: function(site) { return site.name; }, width: 400 }
|
30
|
+
],
|
31
|
+
search_fields: [
|
32
|
+
{ name: 'name_like', nice_name: 'Name', type: 'text', width: 400 }
|
33
|
+
],
|
34
|
+
new_model_text: 'New Font Familiy',
|
35
|
+
new_model_fields: [
|
36
|
+
{ name: 'name', nice_name: 'Name', type: 'text', width: 400 }
|
37
|
+
],
|
38
|
+
});
|
39
|
+
});
|
40
|
+
|
41
|
+
</script>
|
42
|
+
<% end %>
|
@@ -1,3 +1,5 @@
|
|
1
|
+
<h1>Fonts</h1>
|
2
|
+
|
1
3
|
<% if @site.use_fonts %>
|
2
4
|
|
3
5
|
<div class="constrain clearfix">
|
@@ -66,12 +68,23 @@
|
|
66
68
|
</div>
|
67
69
|
<div class="unit1of3">
|
68
70
|
<a href="#" class="set-font caboose-btn" id="3" data-name="button-font">Set as Button Font</a>
|
71
|
+
<% if @site.theme %>
|
72
|
+
<br />
|
73
|
+
<a href="#" class="set-font caboose-btn" id="7" data-name="custom1-font">Set as Custom1 Font</a>
|
74
|
+
<a href="#" class="set-font caboose-btn" id="8" data-name="custom2-font">Set as Custom2 Font</a>
|
75
|
+
<a href="#" class="set-font caboose-btn" id="9" data-name="custom3-font">Set as Custom3 Font</a>
|
76
|
+
<% end %>
|
69
77
|
</div>
|
70
78
|
</div>
|
71
79
|
<div class="final-box">
|
72
80
|
<h2 id="font1-preview">Your Selected Fonts - <span class="family"><%= @hf.family %></span> <span class="variant"><%= @hf.variant %></span></h2>
|
73
81
|
<p id="font2-preview"><span class="family"><%= @bf.family %></span> <span class="variant"><%= @bf.variant %></span> - Lorem ipsum dolor sit amet, consectetur <strong id="font4-preview">this is bold text</strong>. Dicta, at voluptates assumenda hic <span class="bold-italic" id="font6-preview">this is bold italic text</span> soluta. Beatae illo explicabo, atque deserunt, <em id="font5-preview">this is italic text</em> magni necessitatibus, a eveniet hic. Culpa debitis corporis saepe eum alias eius cum eaque ipsam ducimus sunt, nobis ab quia vitae hic laudantium unde pariatur sapiente numquam.</p>
|
74
|
-
<a id="font3-preview" class="caboose-btn" href="#" style="margin
|
82
|
+
<a id="font3-preview" class="caboose-btn" href="#" style="margin:20px 0;"><span class="family"><%= @btn.family %></span> <span class="variant"><%= @btn.variant %></span></a>
|
83
|
+
<% if @site.theme %>
|
84
|
+
<p id="font7-preview">This is the Custom1 Font you have selected. <span class="ff">font-family: "custom1-font";</span></p>
|
85
|
+
<p id="font8-preview">This is the Custom2 Font you have selected. <span class="ff">font-family: "custom2-font";</span></p>
|
86
|
+
<p style="margin-bottom:0;" id="font9-preview">This is the Custom3 Font you have selected. <span class="ff">font-family: "custom3-font";</span></p>
|
87
|
+
<% end %>
|
75
88
|
</div>
|
76
89
|
</div>
|
77
90
|
|
@@ -84,6 +97,9 @@
|
|
84
97
|
|
85
98
|
<% content_for :caboose_css do %>
|
86
99
|
<style>
|
100
|
+
.ff {
|
101
|
+
font-family:monospace;font-size:13px;display:inline-block;color:gray;float: right;
|
102
|
+
}
|
87
103
|
#font-form {
|
88
104
|
margin-top: 20px;
|
89
105
|
}
|
@@ -208,6 +224,18 @@
|
|
208
224
|
font-family: "button-font";
|
209
225
|
src: url('<%= @btn.url %>') format('truetype');
|
210
226
|
}
|
227
|
+
@font-face {
|
228
|
+
font-family: "custom1-font";
|
229
|
+
src: url('<%= @custom1.url %>') format('truetype');
|
230
|
+
}
|
231
|
+
@font-face {
|
232
|
+
font-family: "custom2-font";
|
233
|
+
src: url('<%= @custom2.url %>') format('truetype');
|
234
|
+
}
|
235
|
+
@font-face {
|
236
|
+
font-family: "custom3-font";
|
237
|
+
src: url('<%= @custom3.url %>') format('truetype');
|
238
|
+
}
|
211
239
|
#font1-preview {
|
212
240
|
font-family: "heading-font";
|
213
241
|
font-style: normal;
|
@@ -223,6 +251,21 @@
|
|
223
251
|
font-style: normal;
|
224
252
|
font-weight: normal;
|
225
253
|
}
|
254
|
+
#font7-preview {
|
255
|
+
font-family: "custom1-font";
|
256
|
+
font-style: normal;
|
257
|
+
font-weight: normal;
|
258
|
+
}
|
259
|
+
#font8-preview {
|
260
|
+
font-family: "custom2-font";
|
261
|
+
font-style: normal;
|
262
|
+
font-weight: normal;
|
263
|
+
}
|
264
|
+
#font9-preview {
|
265
|
+
font-family: "custom3-font";
|
266
|
+
font-style: normal;
|
267
|
+
font-weight: normal;
|
268
|
+
}
|
226
269
|
.clearfix::after {
|
227
270
|
content: ".";
|
228
271
|
visibility: hidden;
|
@@ -309,7 +352,7 @@
|
|
309
352
|
var variant;
|
310
353
|
for (i = min; i < max; i++) {
|
311
354
|
font = window.google_fonts[i];
|
312
|
-
variant = font.variants[0];
|
355
|
+
variant = font ? font.variants[0] : null;
|
313
356
|
load_css(i, variant);
|
314
357
|
var index = (i % 10) + 1;
|
315
358
|
// console.log("family: " + font.family, ", index: " + index);
|
@@ -345,8 +388,8 @@
|
|
345
388
|
var cssId = font_id + "_" + variant;
|
346
389
|
if (!document.getElementById(cssId)) {
|
347
390
|
// console.dir(font);
|
348
|
-
var weight = variant.replace("italic","").replace("regular","normal");
|
349
|
-
var style = variant.indexOf("italic") >= 0 ? "italic" : "normal";
|
391
|
+
var weight = variant ? variant.replace("italic","").replace("regular","normal") : "N/A";
|
392
|
+
var style = variant ? (variant.indexOf("italic") >= 0 ? "italic" : "normal") : "N/A";
|
350
393
|
weight = weight == "" ? "normal" : weight;
|
351
394
|
var css = document.createTextNode("@font-face {font-family:'" + font.family + "';src:url('" + font.files[variant] + "') format('truetype');font-weight:" + weight + ";font-style:" + style + ";}");
|
352
395
|
var style = document.createElement('style');
|
@@ -383,13 +426,13 @@
|
|
383
426
|
// console.dir(font);
|
384
427
|
$(".font-preview").css("font-family",font.family);
|
385
428
|
$(".font-preview .family").text(font.family);
|
386
|
-
if ( variant.indexOf("italic") >= 0 ) {
|
429
|
+
if ( variant && variant.indexOf("italic") >= 0 ) {
|
387
430
|
$(".font-preview").css("font-style","italic");
|
388
431
|
}
|
389
432
|
else {
|
390
433
|
$(".font-preview").css("font-style","normal");
|
391
434
|
}
|
392
|
-
var weight = variant.match(/\d+/);
|
435
|
+
var weight = variant ? variant.match(/\d+/) : 400;
|
393
436
|
if ( weight && weight != "" ) {
|
394
437
|
$(".font-preview").css("font-weight",weight);
|
395
438
|
}
|
@@ -406,6 +449,7 @@
|
|
406
449
|
data: {
|
407
450
|
family: family,
|
408
451
|
variant: variant,
|
452
|
+
// variant_id: variant_id,
|
409
453
|
url: url,
|
410
454
|
name: name
|
411
455
|
},
|
@@ -423,19 +467,20 @@
|
|
423
467
|
$(document).ready(function() {
|
424
468
|
|
425
469
|
$.ajax({
|
426
|
-
url: 'https://www.googleapis.com/webfonts/v1/webfonts?sort=popularity&key=
|
470
|
+
url: 'https://www.googleapis.com/webfonts/v1/webfonts?sort=popularity&key=AIzaSyAv6j9aPfc18FwIoTixYhvq1kr8vWT7H2g',
|
427
471
|
type: 'get',
|
428
472
|
success: function(resp) {
|
429
473
|
if ( resp.items ) {
|
430
|
-
|
474
|
+
// console.dir(resp.items);
|
431
475
|
<% fonts = Caboose::FontFamily.all %>
|
432
476
|
<% fonts.each do |f| %>
|
433
|
-
<%
|
477
|
+
<% next if f.font_variants.count == 0 %>
|
478
|
+
<% variants = f.font_variants.where("weight is not null").order(:sort_order).all %>
|
434
479
|
resp.items.unshift({
|
435
480
|
category: "sans-serif",
|
436
481
|
family: "<%= f.name %>",
|
437
482
|
files: { <% variants.each do |v| %>
|
438
|
-
<%= v.style ? (v.weight == 'regular' && v.style == 'italic' ? 'italic' : (v.style + v.weight)) : v.weight %>: "<%= v.ttf_url %>",
|
483
|
+
<%= v.style ? (v.weight == 'regular' && v.style == 'italic' ? 'italic' : (v.style + v.weight)) : v.weight %>: "<%= v.ttf_file && !v.ttf_file.url.include?('missing') ? v.ttf_file.url : v.ttf_url %>",
|
439
484
|
<% end %> },
|
440
485
|
variants: [ <% variants.each_with_index do |v,i| %>
|
441
486
|
"<%= v.style ? (v.weight == 'regular' && v.style == 'italic' ? 'italic' : (v.style + v.weight)) : v.weight %>",
|
@@ -0,0 +1,84 @@
|
|
1
|
+
|
2
|
+
<h1>Edit Font Variant</h1>
|
3
|
+
|
4
|
+
<h4><%= @variant.font_family.name %></h4>
|
5
|
+
<p><div id='fontvariant_<%= @variant.id %>_variant' ></div></p>
|
6
|
+
<p><div id='fontvariant_<%= @variant.id %>_style' ></div></p>
|
7
|
+
<p><div id='fontvariant_<%= @variant.id %>_weight' ></div></p>
|
8
|
+
<p><div id='fontvariant_<%= @variant.id %>_sort_order' ></div></p>
|
9
|
+
<p><div id='fontvariant_<%= @variant.id %>_ttf_url' ></div></p>
|
10
|
+
|
11
|
+
<div class="file-wrapper">
|
12
|
+
<div id='fontvariant_<%= @variant.id %>_ttf_file' ></div>
|
13
|
+
<p class="current">Current file: <%= @variant.ttf_file_file_name.blank? ? "None" : @variant.ttf_file_file_name %></p>
|
14
|
+
</div>
|
15
|
+
<div class="file-wrapper">
|
16
|
+
<div id='fontvariant_<%= @variant.id %>_woff_file' ></div>
|
17
|
+
<p class="current">Current file: <%= @variant.woff_file_file_name.blank? ? "None" : @variant.woff_file_file_name %></p>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
|
21
|
+
<div id='message'></div>
|
22
|
+
|
23
|
+
<a class="caboose-btn" href="/admin/font-families/<%= @variant.font_family_id %>">Back</a>
|
24
|
+
|
25
|
+
|
26
|
+
<% content_for :caboose_js do %>
|
27
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
28
|
+
<script type="text/javascript">
|
29
|
+
|
30
|
+
$(document).ready(function() {
|
31
|
+
m = new ModelBinder({
|
32
|
+
name: 'FontVariant',
|
33
|
+
id: <%= @variant.id %>,
|
34
|
+
update_url: '/admin/font-variants/<%= @variant.id %>',
|
35
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
36
|
+
attributes: [
|
37
|
+
{ name: 'variant' , nice_name: 'Name' , type: 'text' , value: <%= raw Caboose.json(@variant.variant ) %>, width: 500 },
|
38
|
+
{ name: 'style' , nice_name: 'Style' , type: 'text' , value: <%= raw Caboose.json(@variant.style ) %>, width: 500 },
|
39
|
+
{ name: 'weight' , nice_name: 'Weight' , type: 'text' , value: <%= raw Caboose.json(@variant.weight ) %>, width: 500 },
|
40
|
+
{ name: 'sort_order' , nice_name: 'Sort Order' , type: 'text' , value: <%= raw Caboose.json(@variant.sort_order ) %>, width: 500 },
|
41
|
+
{ name: 'ttf_url' , nice_name: 'TTF URL (deprecated)' , type: 'text' , value: <%= raw Caboose.json(@variant.ttf_url ) %>, width: 800 },
|
42
|
+
{ name: 'ttf_file' , nice_name: 'TTF File' , type: 'file' , value: <%= raw Caboose.json(@variant.ttf_file ? @variant.ttf_file.url : 'No File') %>, width: 800, update_url: '/admin/font-variants/<%= @variant.id %>/ttf-file' },
|
43
|
+
{ name: 'woff_file' , nice_name: 'WOFF File' , type: 'file' , value: <%= raw Caboose.json(@variant.woff_file ? @variant.woff_file.url : 'No File') %>, width: 800, update_url: '/admin/font-variants/<%= @variant.id %>/woff-file' }
|
44
|
+
]
|
45
|
+
});
|
46
|
+
});
|
47
|
+
|
48
|
+
</script>
|
49
|
+
<% end %>
|
50
|
+
|
51
|
+
|
52
|
+
<% content_for :caboose_css do %>
|
53
|
+
<style>
|
54
|
+
.file-wrapper {
|
55
|
+
position: relative;
|
56
|
+
right: 9px;
|
57
|
+
}
|
58
|
+
.file-wrapper::after {
|
59
|
+
content: ".";
|
60
|
+
visibility: hidden;
|
61
|
+
display: block;
|
62
|
+
height: 0;
|
63
|
+
clear: both;
|
64
|
+
}
|
65
|
+
.file-wrapper .mb_placeholder span {
|
66
|
+
font-size: 15px;
|
67
|
+
position: relative;
|
68
|
+
bottom: 7px;
|
69
|
+
}
|
70
|
+
.file-wrapper .mb_container {
|
71
|
+
display: inline-block;
|
72
|
+
width: auto;
|
73
|
+
}
|
74
|
+
.current {
|
75
|
+
color: #0357FF;
|
76
|
+
font-size: 13px;
|
77
|
+
padding-left: 10px;
|
78
|
+
position: relative;
|
79
|
+
bottom: 33px;
|
80
|
+
margin-top: 0;
|
81
|
+
display: inline-block;
|
82
|
+
}
|
83
|
+
</style>
|
84
|
+
<% end %>
|
@@ -5,16 +5,15 @@ logo = logo.gsub('//','https://') if !logo.nil?
|
|
5
5
|
|
6
6
|
<p><img src='<%= logo %>' /></p>
|
7
7
|
|
8
|
-
<h1>Your
|
8
|
+
<h1>Your order has been updated</h1>
|
9
9
|
|
10
|
-
<h2>
|
10
|
+
<h2>Order Details</h2>
|
11
11
|
|
12
12
|
<p>Invoice #<%= @invoice.invoice_number %></p>
|
13
13
|
<p>Status: <%= @invoice.status %></p>
|
14
14
|
|
15
15
|
<table border='1' style='border-collapse: collapse;'>
|
16
16
|
<tr>
|
17
|
-
<th>Package</th>
|
18
17
|
<th>Line Item</th>
|
19
18
|
<th>Unit Price</th>
|
20
19
|
<th>Quantity</th>
|
@@ -25,13 +24,6 @@ logo = logo.gsub('//','https://') if !logo.nil?
|
|
25
24
|
<% v = li.variant %>
|
26
25
|
<% p = v.product %>
|
27
26
|
<tr>
|
28
|
-
<% if i == 0 %>
|
29
|
-
<td rowspan="<%= op.line_items.count %>">
|
30
|
-
<div><%= op.shipping_method.service_name %></div>
|
31
|
-
<div><%= op.status %></div>
|
32
|
-
<% if op.tracking_number %><div><%= op.tracking_number %></div><% end %>
|
33
|
-
</td>
|
34
|
-
<% end %>
|
35
27
|
<td>
|
36
28
|
<%= p.title %>
|
37
29
|
<% if li.is_gift %>
|
@@ -53,8 +45,7 @@ logo = logo.gsub('//','https://') if !logo.nil?
|
|
53
45
|
<% next if li.invoice_package_id %>
|
54
46
|
<% v = li.variant %>
|
55
47
|
<% p = v.product %>
|
56
|
-
<tr>
|
57
|
-
<td>Not assigned to a package</td>
|
48
|
+
<tr>
|
58
49
|
<td><%= p.title %></td></td>
|
59
50
|
<td align='right'><%= number_to_currency(li.unit_price) %></td>
|
60
51
|
<td align='right'><%= li.quantity %></td>
|
@@ -78,7 +69,7 @@ logo = logo.gsub('//','https://') if !logo.nil?
|
|
78
69
|
<tr><td colspan="4" align='right'>Total: </td><td align='right'><%= number_to_currency(@invoice.total) %></td></tr>
|
79
70
|
</table>
|
80
71
|
|
81
|
-
<% if @invoice.shipping_address %>
|
72
|
+
<% if @invoice.shipping_address && !@invoice.shipping_address.address1.blank? %>
|
82
73
|
<% sa = @invoice.shipping_address %>
|
83
74
|
<h2>Shipping Address</h2>
|
84
75
|
<p>
|
@@ -89,7 +80,7 @@ logo = logo.gsub('//','https://') if !logo.nil?
|
|
89
80
|
</p>
|
90
81
|
<% end %>
|
91
82
|
|
92
|
-
<% if @invoice.billing_address %>
|
83
|
+
<% if @invoice.billing_address && !@invoice.billing_address.address1.blank? %>
|
93
84
|
<% ba = @invoice.billing_address %>
|
94
85
|
<h2>Billing Address</h2>
|
95
86
|
<p>
|