Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Issue 1853 rename base em in skins wizard #639

Closed
wants to merge 3 commits into
from
Jump to file or symbol
Failed to load files and symbols.
+20 −11
Split
View
8 app/models/skin.rb 100755 → 100644
@@ -90,7 +90,7 @@ def valid_public_preview
validates_uniqueness_of :title, :message => ts('must be unique')
- validates_numericality_of :margin, :base_em, :allow_nil => true
+ validates_numericality_of :margin, :font_size, :allow_nil => true
validate :valid_font
def valid_font
return if self.font.blank?
@@ -315,12 +315,12 @@ def get_wizard_settings
style += "#workskin {margin: auto #{self.margin}%; padding: 0.5em #{self.margin}% 0;}\n"
end
- if self.background_color.present? || self.foreground_color.present? || self.font.present? || self.base_em.present?
+ if self.background_color.present? || self.foreground_color.present? || self.font.present? || self.font_size.present?
style += "body, #main {
#{self.background_color.present? ? "background: #{self.background_color};" : ''}
#{self.foreground_color.present? ? "color: #{self.foreground_color};" : ''}"
- if self.base_em.present?
- style += "font-size: #{self.base_em}%; line-height:1.125;"
+ if self.font_size.present?
+ style += "font-size: #{self.font_size}%; line-height:1.125;"
end
if self.font.present?
style += "\nfont-family: #{font};"
@@ -5,12 +5,12 @@
#chapters {margin: auto <%= skin.margin %>% 2.5em; padding: 0.5em <%= skin.margin %>% 0;}
<% end %>
- <% if skin.background_color || skin.foreground_color || skin.font || skin.base_em %>
+ <% if skin.background_color || skin.foreground_color || skin.font || skin.font_size %>
<% bgcolor = skin.background_color ? skin.background_color : "#FFFEF9" %>
body {
background: <%= bgcolor %>;
color: <%= skin.foreground_color ? skin.foreground_color : "#222" %>;
- font: <%= skin.base_em ? skin.base_em : "100" %>%/1.125 <%= skin.font ? skin.font : "'Lucida Grande', Verdana, Helvetica, Arial, sans-serif" %>;
+ font: <%= skin.font_size ? skin.font_size : "100" %>%/1.125 <%= skin.font ? skin.font : "'Lucida Grande', Verdana, Helvetica, Arial, sans-serif" %>;
}
<% end %>
<% if skin.paragraph_margin %>
@@ -30,10 +30,10 @@
</dd>
<dt>
- <%= f.label :base_em, ts('Percent of base font size (%)') %>
+ <%= f.label :font_size, ts('Percent of base font size (%)') %>
<%= link_to_help('skins-wizard-font-size') %>
</dt>
- <dd><%= f.text_field :base_em %></dd>
+ <dd><%= f.text_field :font_size %></dd>
<dt>
<%= f.label :paragraph_margin, ts('Vertical gap between paragraphs') %>
@@ -41,7 +41,7 @@
</div>
<% end %>
- <% if @skin.margin || !@skin.font.blank? || !@skin.background_color.blank? || !@skin.foreground_color.blank? || @skin.base_em || @skin.paragraph_margin || !@skin.headercolor.blank? || !@skin.accent_color.blank? %>
+ <% if @skin.margin || !@skin.font.blank? || !@skin.background_color.blank? || !@skin.foreground_color.blank? || @skin.font_size || @skin.paragraph_margin || !@skin.headercolor.blank? || !@skin.accent_color.blank? %>
<div class="wizard module">
<h3 class="heading">Wizard Settings</h3>
<p class="notes">(Can be overridden by custom <abbr title="cascading style sheets">CSS</abbr>)</p>
@@ -53,7 +53,7 @@
<% unless @skin.font.blank? %><dt>Font</dt><dd><%= @skin.font %><% end %>
<% unless @skin.background_color.blank? %><dt>Background color</dt><dd><%= @skin.background_color %><% end %>
<% unless @skin.foreground_color.blank? %><dt>Foreground color</dt><dd><%= @skin.foreground_color %><% end %>
- <% if @skin.base_em %><dt>Relative font size</dt><dd><%= @skin.base_em %><% end %>
+ <% if @skin.font_size %><dt>Relative font size</dt><dd><%= @skin.font_size %><% end %>
<% if @skin.paragraph_margin %><dt>Paragraph margin</dt><dd><%= @skin.paragraph_margin %><% end %>
<% unless @skin.headercolor.blank? %><dt>Header color</dt><dd><%= @skin.headercolor %><% end %>
<% unless @skin.accent_color.blank? %><dt>Accent color</dt><dd><%= @skin.accent_color %><% end %>
@@ -0,0 +1,9 @@
+class RenameBaseEm < ActiveRecord::Migration
+ def self.up
+ rename_column :skins, :base_em, :font_size
+ end
+
+ def self.down
+ rename_column :skins, :font_size, :base_em
+ end
+end
View
@@ -961,7 +961,7 @@
t.integer "margin"
t.integer "paragraph_gap"
t.string "font"
- t.integer "base_em"
+ t.integer "font_size"
t.string "background_color"
t.string "foreground_color"
t.text "description"