diff options
-rw-r--r-- | app/assets/stylesheets/application.scss | 1 | ||||
-rw-r--r-- | app/assets/stylesheets/highlight/solarized_dark.scss | 77 | ||||
-rw-r--r-- | app/helpers/application_helper.rb | 8 | ||||
-rw-r--r-- | app/models/user.rb | 2 | ||||
-rw-r--r-- | app/views/profiles/design.html.haml | 9 | ||||
-rw-r--r-- | db/migrate/20130315124931_user_color_scheme.rb | 12 | ||||
-rw-r--r-- | db/schema.rb | 4 |
7 files changed, 107 insertions, 6 deletions
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 71068e4ae95..d1d51e15992 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -37,6 +37,7 @@ @import "highlight/white.scss"; @import "highlight/dark.scss"; +@import "highlight/solarized_dark.scss"; /** * UI themes: diff --git a/app/assets/stylesheets/highlight/solarized_dark.scss b/app/assets/stylesheets/highlight/solarized_dark.scss new file mode 100644 index 00000000000..1b20d7a6b2d --- /dev/null +++ b/app/assets/stylesheets/highlight/solarized_dark.scss @@ -0,0 +1,77 @@ +.solarized-dark .highlight { + pre { + background-color: #002B36; + color: #eee; + } + + .hll { background-color: #ffffcc } + .c { color: #586E75 } /* Comment */ + .err { color: #93A1A1 } /* Error */ + .g { color: #93A1A1 } /* Generic */ + .k { color: #859900 } /* Keyword */ + .l { color: #93A1A1 } /* Literal */ + .n { color: #93A1A1 } /* Name */ + .o { color: #859900 } /* Operator */ + .x { color: #CB4B16 } /* Other */ + .p { color: #93A1A1 } /* Punctuation */ + .cm { color: #586E75 } /* Comment.Multiline */ + .cp { color: #859900 } /* Comment.Preproc */ + .c1 { color: #586E75 } /* Comment.Single */ + .cs { color: #859900 } /* Comment.Special */ + .gd { color: #2AA198 } /* Generic.Deleted */ + .ge { color: #93A1A1; font-style: italic } /* Generic.Emph */ + .gr { color: #DC322F } /* Generic.Error */ + .gh { color: #CB4B16 } /* Generic.Heading */ + .gi { color: #859900 } /* Generic.Inserted */ + .go { color: #93A1A1 } /* Generic.Output */ + .gp { color: #93A1A1 } /* Generic.Prompt */ + .gs { color: #93A1A1; font-weight: bold } /* Generic.Strong */ + .gu { color: #CB4B16 } /* Generic.Subheading */ + .gt { color: #93A1A1 } /* Generic.Traceback */ + .kc { color: #CB4B16 } /* Keyword.Constant */ + .kd { color: #268BD2 } /* Keyword.Declaration */ + .kn { color: #859900 } /* Keyword.Namespace */ + .kp { color: #859900 } /* Keyword.Pseudo */ + .kr { color: #268BD2 } /* Keyword.Reserved */ + .kt { color: #DC322F } /* Keyword.Type */ + .ld { color: #93A1A1 } /* Literal.Date */ + .m { color: #2AA198 } /* Literal.Number */ + .s { color: #2AA198 } /* Literal.String */ + .na { color: #93A1A1 } /* Name.Attribute */ + .nb { color: #B58900 } /* Name.Builtin */ + .nc { color: #268BD2 } /* Name.Class */ + .no { color: #CB4B16 } /* Name.Constant */ + .nd { color: #268BD2 } /* Name.Decorator */ + .ni { color: #CB4B16 } /* Name.Entity */ + .ne { color: #CB4B16 } /* Name.Exception */ + .nf { color: #268BD2 } /* Name.Function */ + .nl { color: #93A1A1 } /* Name.Label */ + .nn { color: #93A1A1 } /* Name.Namespace */ + .nx { color: #93A1A1 } /* Name.Other */ + .py { color: #93A1A1 } /* Name.Property */ + .nt { color: #268BD2 } /* Name.Tag */ + .nv { color: #268BD2 } /* Name.Variable */ + .ow { color: #859900 } /* Operator.Word */ + .w { color: #93A1A1 } /* Text.Whitespace */ + .mf { color: #2AA198 } /* Literal.Number.Float */ + .mh { color: #2AA198 } /* Literal.Number.Hex */ + .mi { color: #2AA198 } /* Literal.Number.Integer */ + .mo { color: #2AA198 } /* Literal.Number.Oct */ + .sb { color: #586E75 } /* Literal.String.Backtick */ + .sc { color: #2AA198 } /* Literal.String.Char */ + .sd { color: #93A1A1 } /* Literal.String.Doc */ + .s2 { color: #2AA198 } /* Literal.String.Double */ + .se { color: #CB4B16 } /* Literal.String.Escape */ + .sh { color: #93A1A1 } /* Literal.String.Heredoc */ + .si { color: #2AA198 } /* Literal.String.Interpol */ + .sx { color: #2AA198 } /* Literal.String.Other */ + .sr { color: #DC322F } /* Literal.String.Regex */ + .s1 { color: #2AA198 } /* Literal.String.Single */ + .ss { color: #2AA198 } /* Literal.String.Symbol */ + .bp { color: #268BD2 } /* Name.Builtin.Pseudo */ + .vc { color: #268BD2 } /* Name.Variable.Class */ + .vg { color: #268BD2 } /* Name.Variable.Global */ + .vi { color: #268BD2 } /* Name.Variable.Instance */ + .il { color: #2AA198 } /* Literal.Number.Integer.Long */ +} + diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6048c233fb4..fd8f2c4d3ea 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -128,7 +128,13 @@ module ApplicationHelper end def user_color_scheme_class - current_user.dark_scheme ? :black : :white + case current_user.color_scheme_id + when 1 then 'white' + when 2 then 'black' + when 3 then 'solarized-dark' + else + 'white' + end end def show_last_push_widget?(event) diff --git a/app/models/user.rb b/app/models/user.rb index db807d71f42..2b6eebf254f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -40,7 +40,7 @@ class User < ActiveRecord::Base :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :registerable attr_accessible :email, :password, :password_confirmation, :remember_me, :bio, :name, :username, - :skype, :linkedin, :twitter, :dark_scheme, :theme_id, :force_random_password, + :skype, :linkedin, :twitter, :color_scheme_id, :theme_id, :force_random_password, :extern_uid, :provider, as: [:default, :admin] attr_accessible :projects_limit, :can_create_team, :can_create_group, as: :admin diff --git a/app/views/profiles/design.html.haml b/app/views/profiles/design.html.haml index f4b50677203..3ce916dc024 100644 --- a/app/views/profiles/design.html.haml +++ b/app/views/profiles/design.html.haml @@ -43,10 +43,15 @@ = label_tag do .prev = image_tag "white.png" - = f.radio_button :dark_scheme, false + = f.radio_button :color_scheme_id, 1 White code preview = label_tag do .prev = image_tag "dark.png" - = f.radio_button :dark_scheme, true + = f.radio_button :color_scheme_id, 2 Dark code preview + = label_tag do + .prev + = image_tag "dark.png" + = f.radio_button :color_scheme_id, 3 + Solarized Dark code preview diff --git a/db/migrate/20130315124931_user_color_scheme.rb b/db/migrate/20130315124931_user_color_scheme.rb new file mode 100644 index 00000000000..fe139e32ea7 --- /dev/null +++ b/db/migrate/20130315124931_user_color_scheme.rb @@ -0,0 +1,12 @@ +class UserColorScheme < ActiveRecord::Migration + def up + add_column :users, :color_scheme_id, :integer, null: false, default: 1 + User.where(dark_scheme: true).update_all(color_scheme_id: 2) + remove_column :users, :dark_scheme + end + + def down + add_column :users, :dark_scheme, :boolean, null: false, default: false + remove_column :users, :color_scheme_id + end +end diff --git a/db/schema.rb b/db/schema.rb index 2250f418bdd..80c61a4fd6a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130304105317) do +ActiveRecord::Schema.define(:version => 20130315124931) do create_table "events", :force => true do |t| t.string "target_type" @@ -258,7 +258,6 @@ ActiveRecord::Schema.define(:version => 20130304105317) do t.string "linkedin", :default => "", :null => false t.string "twitter", :default => "", :null => false t.string "authentication_token" - t.boolean "dark_scheme", :default => false, :null => false t.integer "theme_id", :default => 1, :null => false t.string "bio" t.integer "failed_attempts", :default => 0 @@ -269,6 +268,7 @@ ActiveRecord::Schema.define(:version => 20130304105317) do t.boolean "can_create_group", :default => true, :null => false t.boolean "can_create_team", :default => true, :null => false t.string "state" + t.integer "color_scheme_id", :default => 1, :null => false end add_index "users", ["admin"], :name => "index_users_on_admin" |