Commit 8cad1c9f4c2984c0a73627290b5e7c6b465a68c2
1 parent
7799b5bd
Exists in
master
and in
4 other branches
add dark solarized theme for code preview
Showing
7 changed files
with
107 additions
and
6 deletions
Show diff stats
app/assets/stylesheets/application.scss
@@ -0,0 +1,77 @@ | @@ -0,0 +1,77 @@ | ||
1 | +.solarized-dark .highlight { | ||
2 | + pre { | ||
3 | + background-color: #002B36; | ||
4 | + color: #eee; | ||
5 | + } | ||
6 | + | ||
7 | + .hll { background-color: #ffffcc } | ||
8 | + .c { color: #586E75 } /* Comment */ | ||
9 | + .err { color: #93A1A1 } /* Error */ | ||
10 | + .g { color: #93A1A1 } /* Generic */ | ||
11 | + .k { color: #859900 } /* Keyword */ | ||
12 | + .l { color: #93A1A1 } /* Literal */ | ||
13 | + .n { color: #93A1A1 } /* Name */ | ||
14 | + .o { color: #859900 } /* Operator */ | ||
15 | + .x { color: #CB4B16 } /* Other */ | ||
16 | + .p { color: #93A1A1 } /* Punctuation */ | ||
17 | + .cm { color: #586E75 } /* Comment.Multiline */ | ||
18 | + .cp { color: #859900 } /* Comment.Preproc */ | ||
19 | + .c1 { color: #586E75 } /* Comment.Single */ | ||
20 | + .cs { color: #859900 } /* Comment.Special */ | ||
21 | + .gd { color: #2AA198 } /* Generic.Deleted */ | ||
22 | + .ge { color: #93A1A1; font-style: italic } /* Generic.Emph */ | ||
23 | + .gr { color: #DC322F } /* Generic.Error */ | ||
24 | + .gh { color: #CB4B16 } /* Generic.Heading */ | ||
25 | + .gi { color: #859900 } /* Generic.Inserted */ | ||
26 | + .go { color: #93A1A1 } /* Generic.Output */ | ||
27 | + .gp { color: #93A1A1 } /* Generic.Prompt */ | ||
28 | + .gs { color: #93A1A1; font-weight: bold } /* Generic.Strong */ | ||
29 | + .gu { color: #CB4B16 } /* Generic.Subheading */ | ||
30 | + .gt { color: #93A1A1 } /* Generic.Traceback */ | ||
31 | + .kc { color: #CB4B16 } /* Keyword.Constant */ | ||
32 | + .kd { color: #268BD2 } /* Keyword.Declaration */ | ||
33 | + .kn { color: #859900 } /* Keyword.Namespace */ | ||
34 | + .kp { color: #859900 } /* Keyword.Pseudo */ | ||
35 | + .kr { color: #268BD2 } /* Keyword.Reserved */ | ||
36 | + .kt { color: #DC322F } /* Keyword.Type */ | ||
37 | + .ld { color: #93A1A1 } /* Literal.Date */ | ||
38 | + .m { color: #2AA198 } /* Literal.Number */ | ||
39 | + .s { color: #2AA198 } /* Literal.String */ | ||
40 | + .na { color: #93A1A1 } /* Name.Attribute */ | ||
41 | + .nb { color: #B58900 } /* Name.Builtin */ | ||
42 | + .nc { color: #268BD2 } /* Name.Class */ | ||
43 | + .no { color: #CB4B16 } /* Name.Constant */ | ||
44 | + .nd { color: #268BD2 } /* Name.Decorator */ | ||
45 | + .ni { color: #CB4B16 } /* Name.Entity */ | ||
46 | + .ne { color: #CB4B16 } /* Name.Exception */ | ||
47 | + .nf { color: #268BD2 } /* Name.Function */ | ||
48 | + .nl { color: #93A1A1 } /* Name.Label */ | ||
49 | + .nn { color: #93A1A1 } /* Name.Namespace */ | ||
50 | + .nx { color: #93A1A1 } /* Name.Other */ | ||
51 | + .py { color: #93A1A1 } /* Name.Property */ | ||
52 | + .nt { color: #268BD2 } /* Name.Tag */ | ||
53 | + .nv { color: #268BD2 } /* Name.Variable */ | ||
54 | + .ow { color: #859900 } /* Operator.Word */ | ||
55 | + .w { color: #93A1A1 } /* Text.Whitespace */ | ||
56 | + .mf { color: #2AA198 } /* Literal.Number.Float */ | ||
57 | + .mh { color: #2AA198 } /* Literal.Number.Hex */ | ||
58 | + .mi { color: #2AA198 } /* Literal.Number.Integer */ | ||
59 | + .mo { color: #2AA198 } /* Literal.Number.Oct */ | ||
60 | + .sb { color: #586E75 } /* Literal.String.Backtick */ | ||
61 | + .sc { color: #2AA198 } /* Literal.String.Char */ | ||
62 | + .sd { color: #93A1A1 } /* Literal.String.Doc */ | ||
63 | + .s2 { color: #2AA198 } /* Literal.String.Double */ | ||
64 | + .se { color: #CB4B16 } /* Literal.String.Escape */ | ||
65 | + .sh { color: #93A1A1 } /* Literal.String.Heredoc */ | ||
66 | + .si { color: #2AA198 } /* Literal.String.Interpol */ | ||
67 | + .sx { color: #2AA198 } /* Literal.String.Other */ | ||
68 | + .sr { color: #DC322F } /* Literal.String.Regex */ | ||
69 | + .s1 { color: #2AA198 } /* Literal.String.Single */ | ||
70 | + .ss { color: #2AA198 } /* Literal.String.Symbol */ | ||
71 | + .bp { color: #268BD2 } /* Name.Builtin.Pseudo */ | ||
72 | + .vc { color: #268BD2 } /* Name.Variable.Class */ | ||
73 | + .vg { color: #268BD2 } /* Name.Variable.Global */ | ||
74 | + .vi { color: #268BD2 } /* Name.Variable.Instance */ | ||
75 | + .il { color: #2AA198 } /* Literal.Number.Integer.Long */ | ||
76 | +} | ||
77 | + |
app/helpers/application_helper.rb
@@ -128,7 +128,13 @@ module ApplicationHelper | @@ -128,7 +128,13 @@ module ApplicationHelper | ||
128 | end | 128 | end |
129 | 129 | ||
130 | def user_color_scheme_class | 130 | def user_color_scheme_class |
131 | - current_user.dark_scheme ? :black : :white | 131 | + case current_user.color_scheme_id |
132 | + when 1 then 'white' | ||
133 | + when 2 then 'black' | ||
134 | + when 3 then 'solarized-dark' | ||
135 | + else | ||
136 | + 'white' | ||
137 | + end | ||
132 | end | 138 | end |
133 | 139 | ||
134 | def show_last_push_widget?(event) | 140 | def show_last_push_widget?(event) |
app/models/user.rb
@@ -40,7 +40,7 @@ class User < ActiveRecord::Base | @@ -40,7 +40,7 @@ class User < ActiveRecord::Base | ||
40 | :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :registerable | 40 | :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :registerable |
41 | 41 | ||
42 | attr_accessible :email, :password, :password_confirmation, :remember_me, :bio, :name, :username, | 42 | attr_accessible :email, :password, :password_confirmation, :remember_me, :bio, :name, :username, |
43 | - :skype, :linkedin, :twitter, :dark_scheme, :theme_id, :force_random_password, | 43 | + :skype, :linkedin, :twitter, :color_scheme_id, :theme_id, :force_random_password, |
44 | :extern_uid, :provider, as: [:default, :admin] | 44 | :extern_uid, :provider, as: [:default, :admin] |
45 | attr_accessible :projects_limit, :can_create_team, :can_create_group, as: :admin | 45 | attr_accessible :projects_limit, :can_create_team, :can_create_group, as: :admin |
46 | 46 |
app/views/profiles/design.html.haml
@@ -43,10 +43,15 @@ | @@ -43,10 +43,15 @@ | ||
43 | = label_tag do | 43 | = label_tag do |
44 | .prev | 44 | .prev |
45 | = image_tag "white.png" | 45 | = image_tag "white.png" |
46 | - = f.radio_button :dark_scheme, false | 46 | + = f.radio_button :color_scheme_id, 1 |
47 | White code preview | 47 | White code preview |
48 | = label_tag do | 48 | = label_tag do |
49 | .prev | 49 | .prev |
50 | = image_tag "dark.png" | 50 | = image_tag "dark.png" |
51 | - = f.radio_button :dark_scheme, true | 51 | + = f.radio_button :color_scheme_id, 2 |
52 | Dark code preview | 52 | Dark code preview |
53 | + = label_tag do | ||
54 | + .prev | ||
55 | + = image_tag "dark.png" | ||
56 | + = f.radio_button :color_scheme_id, 3 | ||
57 | + Solarized Dark code preview |
@@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
1 | +class UserColorScheme < ActiveRecord::Migration | ||
2 | + def up | ||
3 | + add_column :users, :color_scheme_id, :integer, null: false, default: 1 | ||
4 | + User.where(dark_scheme: true).update_all(color_scheme_id: 2) | ||
5 | + remove_column :users, :dark_scheme | ||
6 | + end | ||
7 | + | ||
8 | + def down | ||
9 | + add_column :users, :dark_scheme, :boolean, null: false, default: false | ||
10 | + remove_column :users, :color_scheme_id | ||
11 | + end | ||
12 | +end |
db/schema.rb
@@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
11 | # | 11 | # |
12 | # It's strongly recommended to check this file into your version control system. | 12 | # It's strongly recommended to check this file into your version control system. |
13 | 13 | ||
14 | -ActiveRecord::Schema.define(:version => 20130304105317) do | 14 | +ActiveRecord::Schema.define(:version => 20130315124931) do |
15 | 15 | ||
16 | create_table "events", :force => true do |t| | 16 | create_table "events", :force => true do |t| |
17 | t.string "target_type" | 17 | t.string "target_type" |
@@ -258,7 +258,6 @@ ActiveRecord::Schema.define(:version => 20130304105317) do | @@ -258,7 +258,6 @@ ActiveRecord::Schema.define(:version => 20130304105317) do | ||
258 | t.string "linkedin", :default => "", :null => false | 258 | t.string "linkedin", :default => "", :null => false |
259 | t.string "twitter", :default => "", :null => false | 259 | t.string "twitter", :default => "", :null => false |
260 | t.string "authentication_token" | 260 | t.string "authentication_token" |
261 | - t.boolean "dark_scheme", :default => false, :null => false | ||
262 | t.integer "theme_id", :default => 1, :null => false | 261 | t.integer "theme_id", :default => 1, :null => false |
263 | t.string "bio" | 262 | t.string "bio" |
264 | t.integer "failed_attempts", :default => 0 | 263 | t.integer "failed_attempts", :default => 0 |
@@ -269,6 +268,7 @@ ActiveRecord::Schema.define(:version => 20130304105317) do | @@ -269,6 +268,7 @@ ActiveRecord::Schema.define(:version => 20130304105317) do | ||
269 | t.boolean "can_create_group", :default => true, :null => false | 268 | t.boolean "can_create_group", :default => true, :null => false |
270 | t.boolean "can_create_team", :default => true, :null => false | 269 | t.boolean "can_create_team", :default => true, :null => false |
271 | t.string "state" | 270 | t.string "state" |
271 | + t.integer "color_scheme_id", :default => 1, :null => false | ||
272 | end | 272 | end |
273 | 273 | ||
274 | add_index "users", ["admin"], :name => "index_users_on_admin" | 274 | add_index "users", ["admin"], :name => "index_users_on_admin" |