diff options
-rw-r--r-- | app/helpers/users_helper.rb | 8 | ||||
-rw-r--r-- | app/models/user.rb | 2 | ||||
-rw-r--r-- | config/color_themes.yml | 12 | ||||
-rw-r--r-- | config/initializers/color_themes.rb | 8 | ||||
-rw-r--r-- | config/locales/diaspora/en.yml | 8 |
5 files changed, 22 insertions, 16 deletions
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index d79b6b059..5d181ea9c 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -31,13 +31,13 @@ module UsersHelper # specified from AVAILABLE_COLOR_THEMES in # config/initializers/color_themes.rb. # - # @example if AVAILABLE_COLOR_THEMES = {"original"=>"Original dark", "dark_green" => "Dark green"} + # @example if AVAILABLE_COLOR_THEMES = ["original", "dark_green"] # available_color_themes - # #=> [["Original dark", "original"], ["Dark green", "dark_green"]] + # #=> [["Original gray", "original"], ["Dark green", "dark_green"]] def available_color_themes opts = [] - AVAILABLE_COLOR_THEMES.map do |theme_code, theme_name| - opts << [theme_name, theme_code] + AVAILABLE_COLOR_THEMES.map do |theme_code| + opts << [I18n.t("color_themes.#{theme_code}"), theme_code] end opts end diff --git a/app/models/user.rb b/app/models/user.rb index 85ea59cb6..9969203ba 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -30,7 +30,7 @@ class User < ActiveRecord::Base validates_length_of :username, :maximum => 32 validates_exclusion_of :username, :in => AppConfig.settings.username_blacklist validates_inclusion_of :language, :in => AVAILABLE_LANGUAGE_CODES - validates :color_theme, inclusion: {in: AVAILABLE_COLOR_THEME_CODES}, allow_blank: true + validates :color_theme, inclusion: {in: AVAILABLE_COLOR_THEMES}, allow_blank: true validates_format_of :unconfirmed_email, :with => Devise.email_regexp, :allow_blank => true validate :unconfirmed_email_quasiuniqueness diff --git a/config/color_themes.yml b/config/color_themes.yml index 9f33b152f..45dfd5106 100644 --- a/config/color_themes.yml +++ b/config/color_themes.yml @@ -1,7 +1,7 @@ available: - original: "Original gray" - original_white: "Original white background" - dark_green: "Dark green" - magenta: "Magenta" - egyptian_blue: "Egyptian blue" - dark: "Dark" + - original + - original_white + - dark_green + - magenta + - egyptian_blue + - dark diff --git a/config/initializers/color_themes.rb b/config/initializers/color_themes.rb index 4d172789c..ae4757610 100644 --- a/config/initializers/color_themes.rb +++ b/config/initializers/color_themes.rb @@ -8,12 +8,10 @@ if color_themes_file.exist? # else include the original theme. AVAILABLE_COLOR_THEMES = if color_themes["available"].length > 0 - color_themes["available"] + color_themes["available"].freeze else - {"original" => "Original gray"} + ["original"].freeze end else - AVAILABLE_COLOR_THEMES = {"original" => "Original gray"}.freeze + AVAILABLE_COLOR_THEMES = ["original"].freeze end -# Get all codes from available themes into a separate variable, so that they can be called easier. -AVAILABLE_COLOR_THEME_CODES = AVAILABLE_COLOR_THEMES.keys diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index f280e4c69..b90dd4950 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -240,6 +240,14 @@ en: post_something: "Post to diaspora*" explanation: "Post to diaspora* from anywhere by bookmarking this link => %{link}." + color_themes: + dark: "Dark" + dark_green: "Dark green" + egyptian_blue: "Egyptian blue" + magenta: "Magenta" + original: "Original gray" + original_white: "Original white background" + comments: create: error: "Failed to comment." |