Commit 15d54b29649652226dc62044680913640be6e407
1 parent
336750c9
Exists in
master
and in
4 other branches
design pages now uses the COLOR_SCHEMES
This unifies the code color-scheme code and makes adding new schemes a little easier.
Showing
12 changed files
with
20 additions
and
23 deletions
Show diff stats
16.5 KB
app/assets/images/dark.png
16.5 KB
6.5 KB
app/assets/images/monokai.png
6.5 KB
15.9 KB
app/assets/images/solarized_dark.png
15.9 KB
16.8 KB
app/assets/images/white.png
16.8 KB
app/assets/stylesheets/highlight/dark.scss
app/helpers/application_helper.rb
| @@ -4,12 +4,23 @@ require 'uri' | @@ -4,12 +4,23 @@ require 'uri' | ||
| 4 | module ApplicationHelper | 4 | module ApplicationHelper |
| 5 | COLOR_SCHEMES = { | 5 | COLOR_SCHEMES = { |
| 6 | 1 => 'white', | 6 | 1 => 'white', |
| 7 | - 2 => 'black', | 7 | + 2 => 'dark', |
| 8 | 3 => 'solarized-dark', | 8 | 3 => 'solarized-dark', |
| 9 | 4 => 'monokai', | 9 | 4 => 'monokai', |
| 10 | } | 10 | } |
| 11 | COLOR_SCHEMES.default = 'white' | 11 | COLOR_SCHEMES.default = 'white' |
| 12 | 12 | ||
| 13 | + # Helper method to access the COLOR_SCHEMES | ||
| 14 | + # | ||
| 15 | + # The keys are the `color_scheme_ids` | ||
| 16 | + # The values are the `name` of the scheme. | ||
| 17 | + # | ||
| 18 | + # The preview images are `name-scheme-preview.png` | ||
| 19 | + # The stylesheets should use the css class `.name` | ||
| 20 | + def color_schemes | ||
| 21 | + COLOR_SCHEMES.freeze | ||
| 22 | + end | ||
| 23 | + | ||
| 13 | # Check if a particular controller is the current one | 24 | # Check if a particular controller is the current one |
| 14 | # | 25 | # |
| 15 | # args - One or more controller names to check | 26 | # args - One or more controller names to check |
app/views/profiles/design.html.haml
| @@ -40,23 +40,9 @@ | @@ -40,23 +40,9 @@ | ||
| 40 | %i.icon-ok | 40 | %i.icon-ok |
| 41 | Saved | 41 | Saved |
| 42 | .code_highlight_opts | 42 | .code_highlight_opts |
| 43 | - = label_tag do | ||
| 44 | - .prev | ||
| 45 | - = image_tag "white.png" | ||
| 46 | - = f.radio_button :color_scheme_id, 1 | ||
| 47 | - White | ||
| 48 | - = label_tag do | ||
| 49 | - .prev | ||
| 50 | - = image_tag "dark.png" | ||
| 51 | - = f.radio_button :color_scheme_id, 2 | ||
| 52 | - Dark | ||
| 53 | - = label_tag do | ||
| 54 | - .prev | ||
| 55 | - = image_tag "solarized_dark.png" | ||
| 56 | - = f.radio_button :color_scheme_id, 3 | ||
| 57 | - Solarized Dark | ||
| 58 | - = label_tag do | ||
| 59 | - .prev | ||
| 60 | - = image_tag "monokai.png" | ||
| 61 | - = f.radio_button :color_scheme_id, 4 | ||
| 62 | - Monokai | 43 | + - color_schemes.each do |color_scheme_id, color_scheme| |
| 44 | + = label_tag do | ||
| 45 | + .prev | ||
| 46 | + = image_tag "#{color_scheme}-scheme-preview.png" | ||
| 47 | + = f.radio_button :color_scheme_id, color_scheme_id | ||
| 48 | + = color_scheme.gsub(/[-_]+/, ' ').humanize |
features/steps/profile/profile.rb
| @@ -74,7 +74,7 @@ class Profile < Spinach::FeatureSteps | @@ -74,7 +74,7 @@ class Profile < Spinach::FeatureSteps | ||
| 74 | 74 | ||
| 75 | When "I change my code preview theme" do | 75 | When "I change my code preview theme" do |
| 76 | within '.code-preview-theme' do | 76 | within '.code-preview-theme' do |
| 77 | - choose "Solarized Dark" | 77 | + choose "Solarized dark" |
| 78 | end | 78 | end |
| 79 | end | 79 | end |
| 80 | 80 |