Commit 8da7c3bfbc975d03d997edddb2dd83d0af5fb187

Authored by Dmitriy Zaporozhets
2 parents 36777f4a 15d54b29

Merge pull request #4178 from docwhat/use-COLOR_SCHEMES

design pages now uses the COLOR_SCHEMES
app/assets/images/dark-scheme-preview.png 0 → 100644

16.5 KB

app/assets/images/dark.png

16.5 KB

app/assets/images/monokai-scheme-preview.png 0 → 100644

6.5 KB

app/assets/images/monokai.png

6.5 KB

app/assets/images/solarized-dark-scheme-preview.png 0 → 100644

15.9 KB

app/assets/images/solarized_dark.png

15.9 KB

app/assets/images/white-scheme-preview.png 0 → 100644

16.8 KB

app/assets/images/white.png

16.8 KB

app/assets/stylesheets/highlight/dark.scss
1 -.black .highlight { 1 +.dark .highlight {
2 2
3 background-color: #333; 3 background-color: #333;
4 4
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