Commit 9a2a8612769d472503b367fa35e99f6fb2876704
1 parent
2f7b6716
Exists in
master
and in
4 other branches
Design tab for profile. Colorscheme as db value
Showing
15 changed files
with
100 additions
and
66 deletions
Show diff stats
16.5 KB
16.8 KB
app/assets/stylesheets/projects.css.scss
... | ... | @@ -654,3 +654,15 @@ body.project-page h2.icon.loading { |
654 | 654 | background: url("ajax-loader-tree.gif") no-repeat; |
655 | 655 | } |
656 | 656 | } |
657 | + | |
658 | +.dark_scheme_box { | |
659 | + padding:20px 0; | |
660 | + | |
661 | + label { | |
662 | + float:left; | |
663 | + box-shadow: 0 0px 5px rgba(0,0,0,.3); | |
664 | + | |
665 | + img { | |
666 | + } | |
667 | + } | |
668 | +} | ... | ... |
app/controllers/profile_controller.rb
... | ... | @@ -4,10 +4,14 @@ class ProfileController < ApplicationController |
4 | 4 | @user = current_user |
5 | 5 | end |
6 | 6 | |
7 | - def social_update | |
7 | + def design | |
8 | + @user = current_user | |
9 | + end | |
10 | + | |
11 | + def update | |
8 | 12 | @user = current_user |
9 | 13 | @user.update_attributes(params[:user]) |
10 | - redirect_to [:profile] | |
14 | + redirect_to :back | |
11 | 15 | end |
12 | 16 | |
13 | 17 | def password | ... | ... |
app/helpers/application_helper.rb
... | ... | @@ -2,9 +2,9 @@ require 'digest/md5' |
2 | 2 | module ApplicationHelper |
3 | 3 | include Utils::CharEncode |
4 | 4 | |
5 | - def gravatar_icon(user_email) | |
5 | + def gravatar_icon(user_email, size = 40) | |
6 | 6 | gravatar_host = request.ssl? ? "https://secure.gravatar.com" : "http://www.gravatar.com" |
7 | - "#{gravatar_host}/avatar/#{Digest::MD5.hexdigest(user_email)}?s=40&d=identicon" | |
7 | + "#{gravatar_host}/avatar/#{Digest::MD5.hexdigest(user_email)}?s=#{size}&d=identicon" | |
8 | 8 | end |
9 | 9 | |
10 | 10 | def fixed_mode? | ... | ... |
app/models/tree.rb
app/models/user.rb
... | ... | @@ -6,7 +6,7 @@ class User < ActiveRecord::Base |
6 | 6 | |
7 | 7 | # Setup accessible (or protected) attributes for your model |
8 | 8 | attr_accessible :email, :password, :password_confirmation, :remember_me, |
9 | - :name, :projects_limit, :skype, :linkedin, :twitter | |
9 | + :name, :projects_limit, :skype, :linkedin, :twitter, :dark_scheme | |
10 | 10 | |
11 | 11 | has_many :users_projects, :dependent => :destroy |
12 | 12 | has_many :projects, :through => :users_projects | ... | ... |
app/views/layouts/profile.html.haml
... | ... | @@ -19,6 +19,7 @@ |
19 | 19 | %aside |
20 | 20 | = link_to "Profile", profile_path, :class => current_page?(:controller => "profile", :action => :show) ? "current" : nil |
21 | 21 | = link_to "Password & token", profile_password_path, :class => current_page?(:controller => "profile", :action => :password) ? "current" : nil |
22 | + = link_to "Design", profile_design_path, :class => current_page?(:controller => "profile", :action => :design) ? "current" : nil | |
22 | 23 | = link_to keys_path, :class => controller.controller_name == "keys" ? "current" : nil do |
23 | 24 | Keys |
24 | 25 | - unless current_user.keys.empty? | ... | ... |
app/views/layouts/user.html.haml
... | ... | @@ -1,31 +0,0 @@ |
1 | -!!! | |
2 | -%html | |
3 | - %head | |
4 | - %title | |
5 | - GitLab #{" - #{current_user.name}"} | |
6 | - = stylesheet_link_tag "application" | |
7 | - = javascript_include_tag "application" | |
8 | - = csrf_meta_tags | |
9 | - = javascript_tag do | |
10 | - REQ_URI = "#{request.env["REQUEST_URI"]}"; | |
11 | - REQ_REFFER = "#{request.env["HTTP_REFERER"]}"; | |
12 | - %body{ :class => body_class('project-page'), :id => yield(:boyd_id)} | |
13 | - = render :partial => "layouts/flash" | |
14 | - #container | |
15 | - = render :partial => "layouts/head_panel" | |
16 | - .project-container | |
17 | - .project-sidebar | |
18 | - .fixed | |
19 | - %aside | |
20 | - = link_to issues_path, :class => current_page?(issues_path) ? "current" : nil do | |
21 | - Issues | |
22 | - - unless current_user.assigned_issues.empty? | |
23 | - %span{ :class => "number" }= current_user.assigned_issues.count | |
24 | - = link_to merge_requests_path, :class => current_page?(merge_requests_path) ? "current" : nil do | |
25 | - Merge Requests | |
26 | - - unless current_user.assigned_merge_requests.empty? | |
27 | - %span{ :class => "number" }= current_user.assigned_merge_requests.count | |
28 | - | |
29 | - .project-content | |
30 | - = yield | |
31 | - |
... | ... | @@ -0,0 +1,22 @@ |
1 | +.ui-box.width-100p | |
2 | + %h3 Design | |
3 | + = form_for @user, :url => profile_update_path, :method => :put do |f| | |
4 | + .data | |
5 | + .left.dark_scheme_box | |
6 | + %label{:for => "user_dark_scheme_false"} | |
7 | + = image_tag "white.png", :width => 310, :height => 212 | |
8 | + %center | |
9 | + %h4 | |
10 | + = f.radio_button :dark_scheme, false | |
11 | + White code preview | |
12 | + .right.dark_scheme_box | |
13 | + %label{:for => "user_dark_scheme_true"} | |
14 | + = image_tag "dark.png", :width => 310, :height => 212 | |
15 | + %center | |
16 | + %h4 | |
17 | + = f.radio_button :dark_scheme, true | |
18 | + Dark code preview | |
19 | + .clear | |
20 | + .buttons | |
21 | + = f.submit 'Save', :class => "grey-button" | |
22 | + | ... | ... |
app/views/profile/show.html.haml
1 | 1 | .ui-box.width-100p |
2 | 2 | %h3= @user.name |
3 | - = form_for @user, :url => profile_edit_path, :method => :put do |f| | |
3 | + = form_for @user, :url => profile_update_path, :method => :put do |f| | |
4 | 4 | .data |
5 | - -if @user.errors.any? | |
6 | - #error_explanation | |
7 | - %ul | |
8 | - - @user.errors.full_messages.each do |msg| | |
9 | - %li= msg | |
5 | + .left | |
6 | + -if @user.errors.any? | |
7 | + #error_explanation | |
8 | + %ul | |
9 | + - @user.errors.full_messages.each do |msg| | |
10 | + %li= msg | |
10 | 11 | |
11 | - .form-row | |
12 | - = f.label :name | |
13 | - %br | |
14 | - = f.text_field :name | |
15 | - .form-row | |
16 | - = f.label :email | |
17 | - %br | |
18 | - = f.text_field :email | |
19 | - .form-row | |
20 | - = f.label :skype | |
21 | - %br | |
22 | - = f.text_field :skype | |
23 | - .form-row | |
24 | - = f.label :linkedin | |
25 | - %br | |
26 | - = f.text_field :linkedin | |
27 | - .form-row | |
28 | - = f.label :twitter | |
29 | - %br | |
30 | - = f.text_field :twitter | |
12 | + .form-row | |
13 | + = f.label :name | |
14 | + %br | |
15 | + = f.text_field :name | |
16 | + .form-row | |
17 | + = f.label :email | |
18 | + %br | |
19 | + = f.text_field :email | |
20 | + .form-row | |
21 | + = f.label :skype | |
22 | + %br | |
23 | + = f.text_field :skype | |
24 | + .form-row | |
25 | + = f.label :linkedin | |
26 | + %br | |
27 | + = f.text_field :linkedin | |
28 | + .form-row | |
29 | + = f.label :twitter | |
30 | + %br | |
31 | + = f.text_field :twitter | |
32 | + | |
33 | + .right | |
34 | + = image_tag gravatar_icon(current_user.email,64), :width => 64, :style => "margin:5px; border:5px solid #eee;" | |
35 | + .clear | |
31 | 36 | .buttons |
32 | 37 | = f.submit 'Save', :class => "grey-button" |
33 | 38 | ... | ... |
app/views/refs/_tree_file.html.haml
... | ... | @@ -5,12 +5,12 @@ |
5 | 5 | = name |
6 | 6 | = link_to "raw", blob_project_ref_path(@project, @ref, :path => params[:path] ), :class => "right", :target => "_blank" |
7 | 7 | = link_to "history", project_commits_path(@project, :path => params[:path], :ref => @ref ), :class => "right", :style => "margin-right:10px;" |
8 | - = switch_colorscheme_link(:class => "right", :style => "margin-right:10px;color:orange") | |
8 | + -#= switch_colorscheme_link(:class => "right", :style => "margin-right:10px;color:orange") | |
9 | 9 | %br/ |
10 | 10 | - if file.text? |
11 | 11 | .view_file_content |
12 | 12 | - unless file.empty? |
13 | - %div{:class => cookies[:colorschema]} | |
13 | + %div{:class => current_user.dark_scheme ? "black" : ""} | |
14 | 14 | :erb |
15 | 15 | <%= raw file.colorize %> |
16 | 16 | - else | ... | ... |
config/routes.rb
... | ... | @@ -19,8 +19,9 @@ Gitlab::Application.routes.draw do |
19 | 19 | get "profile/password", :to => "profile#password" |
20 | 20 | put "profile/password", :to => "profile#password_update" |
21 | 21 | put "profile/reset_private_token", :to => "profile#reset_private_token" |
22 | - put "profile/edit", :to => "profile#social_update" | |
23 | 22 | get "profile", :to => "profile#show" |
23 | + get "profile/design", :to => "profile#design" | |
24 | + put "profile/update", :to => "profile#update" | |
24 | 25 | |
25 | 26 | get "dashboard", :to => "dashboard#index" |
26 | 27 | get "dashboard/issues", :to => "dashboard#issues" | ... | ... |
db/migrate/20111220190817_add_coloscheme_option_to_user.rb
0 → 100644
db/schema.rb
... | ... | @@ -11,7 +11,19 @@ |
11 | 11 | # |
12 | 12 | # It's strongly recommended to check this file into your version control system. |
13 | 13 | |
14 | -ActiveRecord::Schema.define(:version => 20111207211728) do | |
14 | +ActiveRecord::Schema.define(:version => 20111220190817) do | |
15 | + | |
16 | + create_table "features", :force => true do |t| | |
17 | + t.string "name" | |
18 | + t.string "branch_name" | |
19 | + t.integer "assignee_id" | |
20 | + t.integer "author_id" | |
21 | + t.integer "project_id" | |
22 | + t.datetime "created_at" | |
23 | + t.datetime "updated_at" | |
24 | + t.string "version" | |
25 | + t.integer "status", :default => 0, :null => false | |
26 | + end | |
15 | 27 | |
16 | 28 | create_table "issues", :force => true do |t| |
17 | 29 | t.string "title" |
... | ... | @@ -118,6 +130,7 @@ ActiveRecord::Schema.define(:version => 20111207211728) do |
118 | 130 | t.string "linkedin", :default => "", :null => false |
119 | 131 | t.string "twitter", :default => "", :null => false |
120 | 132 | t.string "authentication_token" |
133 | + t.boolean "dark_scheme", :default => false, :null => false | |
121 | 134 | end |
122 | 135 | |
123 | 136 | add_index "users", ["email"], :name => "index_users_on_email", :unique => true | ... | ... |