summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Höltje <docwhat@gerf.org>2013-06-03 12:34:07 -0400
committerChristian Höltje <docwhat@gerf.org>2013-06-05 11:17:13 -0400
commit15d54b29649652226dc62044680913640be6e407 (patch)
tree3d52c17fdc300e4cd9ccddb499fb6e4d2729f3b9
parent336750c916498e99505f593067d4eeadccb3c261 (diff)
downloadgitlab-ce-15d54b29649652226dc62044680913640be6e407.tar.gz
design pages now uses the COLOR_SCHEMES
This unifies the code color-scheme code and makes adding new schemes a little easier.
-rw-r--r--app/assets/images/dark-scheme-preview.png (renamed from app/assets/images/dark.png)bin16935 -> 16935 bytes
-rw-r--r--app/assets/images/monokai-scheme-preview.png (renamed from app/assets/images/monokai.png)bin6651 -> 6651 bytes
-rw-r--r--app/assets/images/solarized-dark-scheme-preview.png (renamed from app/assets/images/solarized_dark.png)bin16320 -> 16320 bytes
-rw-r--r--app/assets/images/white-scheme-preview.png (renamed from app/assets/images/white.png)bin17161 -> 17161 bytes
-rw-r--r--app/assets/stylesheets/highlight/dark.scss2
-rw-r--r--app/helpers/application_helper.rb13
-rw-r--r--app/views/profiles/design.html.haml26
-rw-r--r--features/steps/profile/profile.rb2
8 files changed, 20 insertions, 23 deletions
diff --git a/app/assets/images/dark.png b/app/assets/images/dark-scheme-preview.png
index 055a9069b63..055a9069b63 100644
--- a/app/assets/images/dark.png
+++ b/app/assets/images/dark-scheme-preview.png
Binary files differ
diff --git a/app/assets/images/monokai.png b/app/assets/images/monokai-scheme-preview.png
index 9477941778e..9477941778e 100644
--- a/app/assets/images/monokai.png
+++ b/app/assets/images/monokai-scheme-preview.png
Binary files differ
diff --git a/app/assets/images/solarized_dark.png b/app/assets/images/solarized-dark-scheme-preview.png
index 728964bc4c8..728964bc4c8 100644
--- a/app/assets/images/solarized_dark.png
+++ b/app/assets/images/solarized-dark-scheme-preview.png
Binary files differ
diff --git a/app/assets/images/white.png b/app/assets/images/white-scheme-preview.png
index 67eb8763044..67eb8763044 100644
--- a/app/assets/images/white.png
+++ b/app/assets/images/white-scheme-preview.png
Binary files differ
diff --git a/app/assets/stylesheets/highlight/dark.scss b/app/assets/stylesheets/highlight/dark.scss
index a56c98cc5f1..129d33dcac3 100644
--- a/app/assets/stylesheets/highlight/dark.scss
+++ b/app/assets/stylesheets/highlight/dark.scss
@@ -1,4 +1,4 @@
-.black .highlight {
+.dark .highlight {
background-color: #333;
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 488a55b2e6c..5287bb0b458 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -4,12 +4,23 @@ require 'uri'
module ApplicationHelper
COLOR_SCHEMES = {
1 => 'white',
- 2 => 'black',
+ 2 => 'dark',
3 => 'solarized-dark',
4 => 'monokai',
}
COLOR_SCHEMES.default = 'white'
+ # Helper method to access the COLOR_SCHEMES
+ #
+ # The keys are the `color_scheme_ids`
+ # The values are the `name` of the scheme.
+ #
+ # The preview images are `name-scheme-preview.png`
+ # The stylesheets should use the css class `.name`
+ def color_schemes
+ COLOR_SCHEMES.freeze
+ end
+
# Check if a particular controller is the current one
#
# args - One or more controller names to check
diff --git a/app/views/profiles/design.html.haml b/app/views/profiles/design.html.haml
index 878297fe49d..9ada69c9d5d 100644
--- a/app/views/profiles/design.html.haml
+++ b/app/views/profiles/design.html.haml
@@ -40,23 +40,9 @@
%i.icon-ok
Saved
.code_highlight_opts
- = label_tag do
- .prev
- = image_tag "white.png"
- = f.radio_button :color_scheme_id, 1
- White
- = label_tag do
- .prev
- = image_tag "dark.png"
- = f.radio_button :color_scheme_id, 2
- Dark
- = label_tag do
- .prev
- = image_tag "solarized_dark.png"
- = f.radio_button :color_scheme_id, 3
- Solarized Dark
- = label_tag do
- .prev
- = image_tag "monokai.png"
- = f.radio_button :color_scheme_id, 4
- Monokai
+ - color_schemes.each do |color_scheme_id, color_scheme|
+ = label_tag do
+ .prev
+ = image_tag "#{color_scheme}-scheme-preview.png"
+ = f.radio_button :color_scheme_id, color_scheme_id
+ = color_scheme.gsub(/[-_]+/, ' ').humanize
diff --git a/features/steps/profile/profile.rb b/features/steps/profile/profile.rb
index 8981705df48..c1fe00c8e65 100644
--- a/features/steps/profile/profile.rb
+++ b/features/steps/profile/profile.rb
@@ -74,7 +74,7 @@ class Profile < Spinach::FeatureSteps
When "I change my code preview theme" do
within '.code-preview-theme' do
- choose "Solarized Dark"
+ choose "Solarized dark"
end
end