Commit 8da7c3bfbc975d03d997edddb2dd83d0af5fb187
Exists in
master
and in
4 other branches
Merge pull request #4178 from docwhat/use-COLOR_SCHEMES
design pages now uses the COLOR_SCHEMES
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 | 4 | module ApplicationHelper |
| 5 | 5 | COLOR_SCHEMES = { |
| 6 | 6 | 1 => 'white', |
| 7 | - 2 => 'black', | |
| 7 | + 2 => 'dark', | |
| 8 | 8 | 3 => 'solarized-dark', |
| 9 | 9 | 4 => 'monokai', |
| 10 | 10 | } |
| 11 | 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 | 24 | # Check if a particular controller is the current one |
| 14 | 25 | # |
| 15 | 26 | # args - One or more controller names to check | ... | ... |
app/views/profiles/design.html.haml
| ... | ... | @@ -40,23 +40,9 @@ |
| 40 | 40 | %i.icon-ok |
| 41 | 41 | Saved |
| 42 | 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