caboose-cms 0.7.25 → 0.7.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a50bc705322c621bfae1116e28e9b4ce8bf6e971
4
- data.tar.gz: 287158bedbcca2a553ad2831bdc4d94b21a0a52c
3
+ metadata.gz: 5cbedc8eb22cdc7fe35035da2e8a2115b21242af
4
+ data.tar.gz: 32d51d39f8312a4a9a46e994c485efbf4c531fa4
5
5
  SHA512:
6
- metadata.gz: edbd6b8c76a106e41b43e200b6e836de91095f4c7a9a064295ddcde5e8b808669c9e13738d282307fa0d8288bcf4eb387e1c6af42ed4f20ed32063822dddf872
7
- data.tar.gz: 48acb5c5c35c0bc443c928c653c001aa0a0cb87aaa4a1353c29eeb187c8af2a20b49a077643978da19781872e805b386e2e728b6c20733e05c8bba6ae316f142
6
+ metadata.gz: 236bd5322624a04ea7b2cc4b6c06e1c3216b556b24f5f62cc07a5f6c8d7ca4159622498d8acc53dd2427442afd538ac6bd24d1afe690dfa120949af803b76ee4
7
+ data.tar.gz: 05916a5469fdc4c67e88df67179a4977184efa71dbfeaaec8b9839a11164b87fcfe04118687454b3e6074d76eaa5850907d181292397e8a89fdca3a3286eab04
@@ -51,10 +51,9 @@ body {
51
51
  #top_nav ul li a {
52
52
  display: block;
53
53
  margin: 8px 4px;
54
- padding: 8px 16px;
54
+ padding: 0 16px;
55
55
  border: #333 1px solid;
56
56
  text-decoration: none;
57
- height: 16px;
58
57
  }
59
58
 
60
59
  #top_nav ul li a { color: #ccc; border: #333 1px solid; background: #000; }
@@ -489,12 +488,12 @@ Page Bar Generator
489
488
  background: #141516;
490
489
  color: #f7f7f7;
491
490
  text-align: center;
492
- padding: 8px 15px 6px 15px;
491
+ padding: 0 15px;
493
492
  height: auto;
494
493
  display: inline-block;
495
494
  margin: 0 auto;
496
495
  font-size: 15px;
497
- line-height: 18px;
496
+ line-height: 32px;
498
497
  cursor: pointer;
499
498
  border: 1px solid #fff;
500
499
  -webkit-border-radius: 5px;
@@ -510,7 +509,7 @@ Page Bar Generator
510
509
  border: 1px solid #fff;
511
510
  color: #141516;
512
511
  text-align: center;
513
- padding: 8px 15px 6px 15px;
512
+ padding: 0 15px;
514
513
  height: auto;
515
514
  display: inline-block;
516
515
  margin: 0 auto;
@@ -521,7 +520,7 @@ Page Bar Generator
521
520
  -webkit-appearance: none;
522
521
  -moz-border-radius: 5px;
523
522
  border-radius: 5px;
524
- line-height: 18px;
523
+ line-height: 32px;
525
524
  text-decoration: none;
526
525
  }
527
526
 
@@ -0,0 +1,5 @@
1
+ class Caboose::FontFamily < ActiveRecord::Base
2
+ self.table_name = "font_families"
3
+ has_many :font_variants, :class_name => 'Caboose::FontVariant', :dependent => :delete_all
4
+ attr_accessible :id, :name
5
+ end
@@ -0,0 +1,5 @@
1
+ class Caboose::FontVariant < ActiveRecord::Base
2
+ self.table_name = "font_variants"
3
+ belongs_to :font_family, :class_name => 'Caboose::FontFamily'
4
+ attr_accessible :id, :ttf_url, :font_family_id, :variant, :weight, :style, :sort_order
5
+ end
@@ -290,6 +290,17 @@ class Caboose::Schema < Caboose::Utilities::Schema
290
290
  [ :variant , :string ],
291
291
  [ :url , :string ]
292
292
  ],
293
+ Caboose::FontFamily => [
294
+ [ :name , :string ]
295
+ ],
296
+ Caboose::FontVariant => [
297
+ [ :font_family_id , :integer ],
298
+ [ :variant , :string ],
299
+ [ :ttf_url , :string ],
300
+ [ :weight , :string ],
301
+ [ :style , :string ],
302
+ [ :sort_order , :integer ]
303
+ ],
293
304
  Caboose::GiftCard => [
294
305
  [ :site_id , :integer ],
295
306
  [ :name , :string ],
@@ -107,7 +107,7 @@
107
107
  font-weight: normal;
108
108
  }
109
109
  .caboose-btn {
110
- padding: 8px 15px;
110
+ padding: 0 15px;
111
111
  }
112
112
  .final-box p .bold-italic {
113
113
  font-family: "body-font-bold-italic";
@@ -303,7 +303,13 @@
303
303
  $(".body-variant-selector").html("");
304
304
  if ( font && font.variants ) {
305
305
  $.each(font.variants, function(key, variant) {
306
- $("#variant-selector").append("<option value='" + variant + "'>" + variant + "</option>");
306
+ if (font.variant_names && font.variant_names[key]) {
307
+ $("#variant-selector").append("<option value='" + variant + "'>" + font.variant_names[key] + "</option>");
308
+ }
309
+ else {
310
+ $("#variant-selector").append("<option value='" + variant + "'>" + variant + "</option>");
311
+ }
312
+
307
313
  $(".body-variant-selector").append("<option value='" + variant + "'>" + variant + "</option>");
308
314
  });
309
315
  }
@@ -311,33 +317,49 @@
311
317
 
312
318
  function load_css(font_id, variant) {
313
319
  var font = window.google_fonts[font_id];
314
- // console.dir(font);
315
- // console.log("family: " + font.family);
316
- // console.log("variant: " + variant);
317
- var apiUrl = [];
318
- apiUrl.push('//fonts.googleapis.com/css?family=');
319
- apiUrl.push(font.family.replace(/ /g, '+'));
320
- if ( variant && variant != "" ) {
321
- apiUrl.push(':');
322
- apiUrl.push(variant);
320
+ if ( font.version == "custom" ) {
321
+ var head = document.getElementsByTagName('head')[0];
322
+ var cssId = font_id + "_" + variant;
323
+ if (!document.getElementById(cssId)) {
324
+ // console.dir(font);
325
+ var weight = variant.replace("italic","").replace("regular","normal");
326
+ var style = variant.indexOf("italic") >= 0 ? "italic" : "normal";
327
+ weight = weight == "" ? "normal" : weight;
328
+ var css = document.createTextNode("@font-face {font-family:'" + font.family + "';src:url('" + font.files[variant] + "') format('truetype');font-weight:" + weight + ";font-style:" + style + ";}");
329
+ var style = document.createElement('style');
330
+ style.appendChild(css);
331
+ style.id = cssId;
332
+ head.appendChild(style);
333
+ }
323
334
  }
324
- var url = apiUrl.join('');
325
- var cssId = font_id + "_" + variant;
326
- if (!document.getElementById(cssId)) {
327
- var head = document.getElementsByTagName('head')[0];
328
- var link = document.createElement('link');
329
- link.id = cssId;
330
- link.rel = 'stylesheet';
331
- link.type = 'text/css';
332
- link.href = url;
333
- link.media = 'all';
334
- head.appendChild(link);
335
+ else {
336
+ var apiUrl = [];
337
+ apiUrl.push('//fonts.googleapis.com/css?family=');
338
+ apiUrl.push(font.family.replace(/ /g, '+'));
339
+ if ( variant && variant != "" ) {
340
+ apiUrl.push(':');
341
+ apiUrl.push(variant);
342
+ }
343
+ var url = apiUrl.join('');
344
+ var cssId = font_id + "_" + variant;
345
+ if (!document.getElementById(cssId)) {
346
+ var head = document.getElementsByTagName('head')[0];
347
+ var link = document.createElement('link');
348
+ link.id = cssId;
349
+ link.rel = 'stylesheet';
350
+ link.type = 'text/css';
351
+ link.href = url;
352
+ link.media = 'all';
353
+ head.appendChild(link);
354
+ }
335
355
  }
336
356
  }
337
357
 
338
358
  function change_preview(font_id, variant) {
339
359
  var font = window.google_fonts[font_id];
360
+ // console.dir(font);
340
361
  $(".font-preview").css("font-family",font.family);
362
+ $(".font-preview .family").text(font.family);
341
363
  if ( variant.indexOf("italic") >= 0 ) {
342
364
  $(".font-preview").css("font-style","italic");
343
365
  }
@@ -382,6 +404,26 @@
382
404
  type: 'get',
383
405
  success: function(resp) {
384
406
  if ( resp.items ) {
407
+ // console.dir(resp.items);
408
+ <% fonts = Caboose::FontFamily.all %>
409
+ <% fonts.each do |f| %>
410
+ <% variants = f.font_variants.order(:sort_order).all %>
411
+ resp.items.unshift({
412
+ category: "sans-serif",
413
+ family: "<%= f.name %>",
414
+ files: { <% variants.each do |v| %>
415
+ <%= v.style ? (v.weight == 'regular' && v.style == 'italic' ? 'italic' : (v.style + v.weight)) : v.weight %>: "<%= v.ttf_url %>",
416
+ <% end %> },
417
+ variants: [ <% variants.each_with_index do |v,i| %>
418
+ "<%= v.style ? (v.weight == 'regular' && v.style == 'italic' ? 'italic' : (v.style + v.weight)) : v.weight %>",
419
+ <% end %> ],
420
+ variant_names: [ <% variants.each_with_index do |v,i| %>
421
+ "<%= v.variant %>",
422
+ <% end %> ],
423
+ version: "custom"
424
+ });
425
+ <% end %>
426
+ console.dir(resp.items);
385
427
  window.google_fonts = resp.items;
386
428
  update_fonts(0, 10);
387
429
  var first_font = $(".font-li.selected").data("index");
@@ -408,6 +450,7 @@
408
450
  event.preventDefault();
409
451
  var font_id = $(".font-li.selected").data("index");
410
452
  var variant = $("#variant-selector").val();
453
+ var variant_name = $("#variant-selector option:selected").first().text();
411
454
  var font = window.google_fonts[font_id];
412
455
  var preview = $("#font" + $(this).attr("id") + "-preview");
413
456
  preview.css("font-family",font.family);
@@ -425,7 +468,7 @@
425
468
  preview.css("font-weight","normal");
426
469
  }
427
470
  preview.find(".family").html(font.family);
428
- preview.find(".variant").html(variant);
471
+ preview.find(".variant").html(variant_name);
429
472
  save_font(font.family, variant, font.files[variant], $(this).data("name"));
430
473
  });
431
474
 
@@ -34,9 +34,9 @@ $(document).ready(function() {
34
34
  { name: 'facebook_page_id' , nice_name: 'Facebook Page ID' , type: 'text' , value: <%= raw Caboose.json(sc.facebook_page_id) %>, width: 500 },
35
35
  { name: 'twitter_username' , nice_name: 'Twitter Username' , type: 'text' , value: <%= raw Caboose.json(sc.twitter_username) %>, width: 500 },
36
36
  { name: 'instagram_username' , nice_name: 'Instagram Username' , type: 'text' , value: <%= raw Caboose.json(sc.instagram_username) %>, width: 500 },
37
- { name: 'youtube_url' , nice_name: 'YouTube Channel ID' , type: 'text' , value: <%= raw Caboose.json(sc.youtube_url) %>, width: 500 },
37
+ { name: 'youtube_url' , nice_name: 'YouTube Channel URL' , type: 'text' , value: <%= raw Caboose.json(sc.youtube_url) %>, width: 500 },
38
38
  { name: 'pinterest_url' , nice_name: 'Pinterest URL' , type: 'text' , value: <%= raw Caboose.json(sc.pinterest_url) %>, width: 500 },
39
- { name: 'vimeo_url' , nice_name: 'Vimeo URL' , type: 'text' , value: <%= raw Caboose.json(sc.vimeo_url) %>, width: 500 },
39
+ { name: 'vimeo_url' , nice_name: 'Vimeo Username' , type: 'text' , value: <%= raw Caboose.json(sc.vimeo_url) %>, width: 500 },
40
40
  { name: 'rss_url' , nice_name: 'RSS Feed URL' , type: 'text' , value: <%= raw Caboose.json(sc.rss_url) %>, width: 500 },
41
41
  { name: 'google_plus_url' , nice_name: 'Google Plus URL' , type: 'text' , value: <%= raw Caboose.json(sc.google_plus_url) %>, width: 500 },
42
42
  { name: 'linkedin_url' , nice_name: 'LinkedIn URL' , type: 'text' , value: <%= raw Caboose.json(sc.linkedin_url) %>, width: 500 },
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.7.25'
2
+ VERSION = '0.7.26'
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.7.25
4
+ version: 0.7.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-17 00:00:00.000000000 Z
11
+ date: 2015-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -792,6 +792,8 @@ files:
792
792
  - app/models/caboose/discount.rb
793
793
  - app/models/caboose/domain.rb
794
794
  - app/models/caboose/font.rb
795
+ - app/models/caboose/font_family.rb
796
+ - app/models/caboose/font_variant.rb
795
797
  - app/models/caboose/ga.rb
796
798
  - app/models/caboose/gift_card.rb
797
799
  - app/models/caboose/line_item.rb