From f613518ea80a763532905658fcda04a6f5f55254 Mon Sep 17 00:00:00 2001 From: bistline Date: Mon, 12 Mar 2018 17:08:46 -0400 Subject: [PATCH] updates to branding group form --- app/helpers/branding_groups_helper.rb | 27 +++++++++++++++++++++++ app/models/branding_group.rb | 2 +- app/views/branding_groups/_form.html.erb | 28 +++++++++++------------- app/views/branding_groups/show.html.erb | 4 ++-- 4 files changed, 43 insertions(+), 18 deletions(-) diff --git a/app/helpers/branding_groups_helper.rb b/app/helpers/branding_groups_helper.rb index d887a73808..3993518551 100644 --- a/app/helpers/branding_groups_helper.rb +++ b/app/helpers/branding_groups_helper.rb @@ -1,2 +1,29 @@ module BrandingGroupsHelper + + def web_safe_fonts + [ + ['Sans-serif', + [ + ['Arial', 'Arial, sans-serif'], ['Arial Narrow', 'Arial Narrow, sans-serif'], ['Arial Rounded MT Bold','Arial Rounded MT Bold, sans-serif'], + ['Calibri', 'Calibri, sans-serif'], ['Candara','Candara, sans-serif'], ['Century Gothic','Century Gothic, sans-serif'], + ['Gill Sans','Gill Sans, sans-serif'], ['Helvetica','Helvetica, sans-serif'], ['Helvetica Neue','Helvetica Neue, sans-serif'], + ['Tahoma','Tahoma, sans-serif'], ['Trebuchet MS','Trebuchet MS, sans-serif'], ['Verdana','Verdana, sans-serif'] + ] + ], + ['Serif', + [ + ['Baskerville','Baskerville, serif'], ['Book Antiqua','Book Antiqua, serif'], ['Calisto MT','Calisto MT, serif'], + ['Cambria','Cambria, serif'], ['Garamond','Garamond, serif'], ['Georgia','Georgia, serif'], ['Goudy Old Style','Goudy Old Style, serif'], + ['Lucida Bright','Lucida Bright, serif'], ['Palatino','Palatino, serif'], ['Times New Roman','Times New Roman, serif'] + ] + ], + ['Monospace', + [ + ['Andale Mono','Andale Mono, monospace'], ['Consolas','Consolas, monospace'], ['Courier New','Courier New, monospace'], + ['Lucida Console','Lucida Console, monospace'], ['Lucida Sans Typewriter','Lucida Sans Typewriter, monospace'], + ['Monaco','Monaco, monospace'] + ] + ] + ] + end end diff --git a/app/models/branding_group.rb b/app/models/branding_group.rb index 1e636cc845..bbfca3547b 100644 --- a/app/models/branding_group.rb +++ b/app/models/branding_group.rb @@ -7,7 +7,7 @@ class BrandingGroup field :name_as_id, type: String field :tag_line, type: String field :background_color, type: String - field :font_family, type: String, default: 'Helvetica Neue' + field :font_family, type: String, default: 'Helvetica Neue, sans-serif' field :font_color, type: String, default: '#333333' has_many :studies diff --git a/app/views/branding_groups/_form.html.erb b/app/views/branding_groups/_form.html.erb index d74689fd09..d3d66045ca 100644 --- a/app/views/branding_groups/_form.html.erb +++ b/app/views/branding_groups/_form.html.erb @@ -17,21 +17,21 @@ <%= f.text_field :name, class: 'form-control' %>
- <%= f.label :tag_line %>
+ <%= f.label :tag_line, 'Tag Line' %>
<%= f.text_field :tag_line, class: 'form-control' %>
- <%= f.label :background_color %>
+ <%= f.label :background_color, 'Background Color' %>
<%= f.color_field :background_color, class: 'form-control' %>
- <%= f.label :font_family %>
- <%= f.text_field :font_family, class: 'form-control' %> + <%= f.label :font_family, "Font Family #{link_to "".html_safe, 'https://www.cssfontstack.com', title: 'View Options', data: {toggle: 'tooltip'}, target: :_blank}".html_safe %>
+ <%= f.select :font_family, grouped_options_for_select(web_safe_fonts, @branding_group.font_family), {}, class: 'form-control' %>
- <%= f.label :font_color %>
+ <%= f.label :font_color, 'Font Color' %>
<%= f.color_field :font_color, class: 'form-control' %>
@@ -41,16 +41,14 @@
-
-
- <%= f.label :splash_image, 'Splash Image' %>
- <%= f.file_field :splash_image, class: 'btn btn-default fileinput-button' %> - <% if @branding_group.splash_image.present? %> -

Current file: <%= link_to " #{@branding_group.splash_image_file_name} (#{ number_to_human_size @branding_group.splash_image_file_size})".html_safe, - @branding_group.splash_image.url, download: @branding_group.splash_image_file_name, - class: 'btn btn-xs btn-primary' %>

- <% end %> -
+
+ <%= f.label :splash_image, 'Splash Image' %>
+ <%= f.file_field :splash_image, class: 'btn btn-default fileinput-button' %> + <% if @branding_group.splash_image.present? %> +

Current file: <%= link_to " #{@branding_group.splash_image_file_name} (#{ number_to_human_size @branding_group.splash_image_file_size})".html_safe, + @branding_group.splash_image.url, download: @branding_group.splash_image_file_name, + class: 'btn btn-xs btn-primary' %>

+ <% end %>
diff --git a/app/views/branding_groups/show.html.erb b/app/views/branding_groups/show.html.erb index 339deb5f0d..9bb4158daa 100644 --- a/app/views/branding_groups/show.html.erb +++ b/app/views/branding_groups/show.html.erb @@ -1,6 +1,6 @@
-

<%= @branding_group.name %> <%= link_to " View Live".html_safe, site_path(brand: @branding_group.name_as_id), class: 'btn btn-default' %>

+

<%= @branding_group.name %> <%= link_to " View Live".html_safe, site_path(scpbr: @branding_group.name_as_id), class: 'btn btn-default' %>

<%= @branding_group.tag_line %>

@@ -9,7 +9,7 @@

Background color: <%= @branding_group.background_color %>

-

Splash Image <%= @branding_group.splash_image_file_name %>

+

Splash Image: <%= @branding_group.splash_image_file_name %>

<%= image_tag @branding_group.splash_image.url, class: 'img-thumbnail' %>