Commit 9a2a8612769d472503b367fa35e99f6fb2876704

Authored by Dmitriy Zaporozhets
1 parent 2f7b6716

Design tab for profile. Colorscheme as db value

app/assets/images/dark.png 0 → 100644

16.5 KB

app/assets/images/white.png 0 → 100644

16.8 KB

app/assets/stylesheets/projects.css.scss
@@ -654,3 +654,15 @@ body.project-page h2.icon.loading { @@ -654,3 +654,15 @@ body.project-page h2.icon.loading {
654 background: url("ajax-loader-tree.gif") no-repeat; 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,10 +4,14 @@ class ProfileController < ApplicationController
4 @user = current_user 4 @user = current_user
5 end 5 end
6 6
7 - def social_update 7 + def design
  8 + @user = current_user
  9 + end
  10 +
  11 + def update
8 @user = current_user 12 @user = current_user
9 @user.update_attributes(params[:user]) 13 @user.update_attributes(params[:user])
10 - redirect_to [:profile] 14 + redirect_to :back
11 end 15 end
12 16
13 def password 17 def password
app/helpers/application_helper.rb
@@ -2,9 +2,9 @@ require 'digest/md5' @@ -2,9 +2,9 @@ require 'digest/md5'
2 module ApplicationHelper 2 module ApplicationHelper
3 include Utils::CharEncode 3 include Utils::CharEncode
4 4
5 - def gravatar_icon(user_email) 5 + def gravatar_icon(user_email, size = 40)
6 gravatar_host = request.ssl? ? "https://secure.gravatar.com" : "http://www.gravatar.com" 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 end 8 end
9 9
10 def fixed_mode? 10 def fixed_mode?
app/models/tree.rb
@@ -7,6 +7,8 @@ class Tree @@ -7,6 +7,8 @@ class Tree
7 :name, 7 :name,
8 :data, 8 :data,
9 :mime_type, 9 :mime_type,
  10 + :mode,
  11 + :size,
10 :text?, 12 :text?,
11 :colorize, 13 :colorize,
12 :to => :tree 14 :to => :tree
app/models/user.rb
@@ -6,7 +6,7 @@ class User < ActiveRecord::Base @@ -6,7 +6,7 @@ class User < ActiveRecord::Base
6 6
7 # Setup accessible (or protected) attributes for your model 7 # Setup accessible (or protected) attributes for your model
8 attr_accessible :email, :password, :password_confirmation, :remember_me, 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 has_many :users_projects, :dependent => :destroy 11 has_many :users_projects, :dependent => :destroy
12 has_many :projects, :through => :users_projects 12 has_many :projects, :through => :users_projects
app/views/layouts/profile.html.haml
@@ -19,6 +19,7 @@ @@ -19,6 +19,7 @@
19 %aside 19 %aside
20 = link_to "Profile", profile_path, :class => current_page?(:controller => "profile", :action => :show) ? "current" : nil 20 = link_to "Profile", profile_path, :class => current_page?(:controller => "profile", :action => :show) ? "current" : nil
21 = link_to "Password & token", profile_password_path, :class => current_page?(:controller => "profile", :action => :password) ? "current" : nil 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 = link_to keys_path, :class => controller.controller_name == "keys" ? "current" : nil do 23 = link_to keys_path, :class => controller.controller_name == "keys" ? "current" : nil do
23 Keys 24 Keys
24 - unless current_user.keys.empty? 25 - unless current_user.keys.empty?
app/views/layouts/user.html.haml
@@ -1,31 +0,0 @@ @@ -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 -  
app/views/profile/design.html.haml 0 → 100644
@@ -0,0 +1,22 @@ @@ -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 .ui-box.width-100p 1 .ui-box.width-100p
2 %h3= @user.name 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 .data 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 .buttons 36 .buttons
32 = f.submit 'Save', :class => "grey-button" 37 = f.submit 'Save', :class => "grey-button"
33 38
app/views/refs/_tree_file.html.haml
@@ -5,12 +5,12 @@ @@ -5,12 +5,12 @@
5 = name 5 = name
6 = link_to "raw", blob_project_ref_path(@project, @ref, :path => params[:path] ), :class => "right", :target => "_blank" 6 = link_to "raw", blob_project_ref_path(@project, @ref, :path => params[:path] ), :class => "right", :target => "_blank"
7 = link_to "history", project_commits_path(@project, :path => params[:path], :ref => @ref ), :class => "right", :style => "margin-right:10px;" 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 %br/ 9 %br/
10 - if file.text? 10 - if file.text?
11 .view_file_content 11 .view_file_content
12 - unless file.empty? 12 - unless file.empty?
13 - %div{:class => cookies[:colorschema]} 13 + %div{:class => current_user.dark_scheme ? "black" : ""}
14 :erb 14 :erb
15 <%= raw file.colorize %> 15 <%= raw file.colorize %>
16 - else 16 - else
config/routes.rb
@@ -19,8 +19,9 @@ Gitlab::Application.routes.draw do @@ -19,8 +19,9 @@ Gitlab::Application.routes.draw do
19 get "profile/password", :to => "profile#password" 19 get "profile/password", :to => "profile#password"
20 put "profile/password", :to => "profile#password_update" 20 put "profile/password", :to => "profile#password_update"
21 put "profile/reset_private_token", :to => "profile#reset_private_token" 21 put "profile/reset_private_token", :to => "profile#reset_private_token"
22 - put "profile/edit", :to => "profile#social_update"  
23 get "profile", :to => "profile#show" 22 get "profile", :to => "profile#show"
  23 + get "profile/design", :to => "profile#design"
  24 + put "profile/update", :to => "profile#update"
24 25
25 get "dashboard", :to => "dashboard#index" 26 get "dashboard", :to => "dashboard#index"
26 get "dashboard/issues", :to => "dashboard#issues" 27 get "dashboard/issues", :to => "dashboard#issues"
db/migrate/20111220190817_add_coloscheme_option_to_user.rb 0 → 100644
@@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
  1 +class AddColoschemeOptionToUser < ActiveRecord::Migration
  2 + def change
  3 + add_column :users, :dark_scheme, :boolean, :default => false, :null => false
  4 + end
  5 +end
@@ -11,7 +11,19 @@ @@ -11,7 +11,19 @@
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 => 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 create_table "issues", :force => true do |t| 28 create_table "issues", :force => true do |t|
17 t.string "title" 29 t.string "title"
@@ -118,6 +130,7 @@ ActiveRecord::Schema.define(:version =&gt; 20111207211728) do @@ -118,6 +130,7 @@ ActiveRecord::Schema.define(:version =&gt; 20111207211728) do
118 t.string "linkedin", :default => "", :null => false 130 t.string "linkedin", :default => "", :null => false
119 t.string "twitter", :default => "", :null => false 131 t.string "twitter", :default => "", :null => false
120 t.string "authentication_token" 132 t.string "authentication_token"
  133 + t.boolean "dark_scheme", :default => false, :null => false
121 end 134 end
122 135
123 add_index "users", ["email"], :name => "index_users_on_email", :unique => true 136 add_index "users", ["email"], :name => "index_users_on_email", :unique => true