diff --git a/app/assets/images/dark.png b/app/assets/images/dark.png new file mode 100644 index 0000000000000000000000000000000000000000..055a9069b63ed88b84acceb366d3eeddd892bb9c Binary files /dev/null and b/app/assets/images/dark.png differ diff --git a/app/assets/images/white.png b/app/assets/images/white.png new file mode 100644 index 0000000000000000000000000000000000000000..67eb87630447df31de8ec2bb21d77e653c63a331 Binary files /dev/null and b/app/assets/images/white.png differ diff --git a/app/assets/stylesheets/projects.css.scss b/app/assets/stylesheets/projects.css.scss index 828b227a7f0c58367da88ff7256ddecf018b4453..33d70e30a88722112ba3bf7b523d496105f0b877 100644 --- a/app/assets/stylesheets/projects.css.scss +++ b/app/assets/stylesheets/projects.css.scss @@ -654,3 +654,15 @@ body.project-page h2.icon.loading { background: url("ajax-loader-tree.gif") no-repeat; } } + +.dark_scheme_box { + padding:20px 0; + + label { + float:left; + box-shadow: 0 0px 5px rgba(0,0,0,.3); + + img { + } + } +} diff --git a/app/controllers/profile_controller.rb b/app/controllers/profile_controller.rb index 232bddb7dd2702bc2132913ef6bddfa2e28758c1..07d0a53f1c25c1039421f4fab620366f2aa29013 100644 --- a/app/controllers/profile_controller.rb +++ b/app/controllers/profile_controller.rb @@ -4,10 +4,14 @@ class ProfileController < ApplicationController @user = current_user end - def social_update + def design + @user = current_user + end + + def update @user = current_user @user.update_attributes(params[:user]) - redirect_to [:profile] + redirect_to :back end def password diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 76323b271e19059c086a3c81a0a64fcd5841df11..4b00c9ab7e24a194c6452f71398e711aeb8ceff6 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2,9 +2,9 @@ require 'digest/md5' module ApplicationHelper include Utils::CharEncode - def gravatar_icon(user_email) + def gravatar_icon(user_email, size = 40) gravatar_host = request.ssl? ? "https://secure.gravatar.com" : "http://www.gravatar.com" - "#{gravatar_host}/avatar/#{Digest::MD5.hexdigest(user_email)}?s=40&d=identicon" + "#{gravatar_host}/avatar/#{Digest::MD5.hexdigest(user_email)}?s=#{size}&d=identicon" end def fixed_mode? diff --git a/app/models/tree.rb b/app/models/tree.rb index 6b6b2d40a55f6e72c91637bde2fef6706768acaa..6040680b969e782dcbb5ebf06224285eb5cd77a2 100644 --- a/app/models/tree.rb +++ b/app/models/tree.rb @@ -7,6 +7,8 @@ class Tree :name, :data, :mime_type, + :mode, + :size, :text?, :colorize, :to => :tree diff --git a/app/models/user.rb b/app/models/user.rb index 4f4c45a8c65b2bee35e61d1f329ee72a24b87771..8b136de90cf7addbf93c8480d50624067319d91d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -6,7 +6,7 @@ class User < ActiveRecord::Base # Setup accessible (or protected) attributes for your model attr_accessible :email, :password, :password_confirmation, :remember_me, - :name, :projects_limit, :skype, :linkedin, :twitter + :name, :projects_limit, :skype, :linkedin, :twitter, :dark_scheme has_many :users_projects, :dependent => :destroy has_many :projects, :through => :users_projects diff --git a/app/views/layouts/profile.html.haml b/app/views/layouts/profile.html.haml index c8c48138775a54db9e2c4e8a0329123fd6a33655..5c4f59dd20f6879b877fadd87f52fec11ca8e768 100644 --- a/app/views/layouts/profile.html.haml +++ b/app/views/layouts/profile.html.haml @@ -19,6 +19,7 @@ %aside = link_to "Profile", profile_path, :class => current_page?(:controller => "profile", :action => :show) ? "current" : nil = link_to "Password & token", profile_password_path, :class => current_page?(:controller => "profile", :action => :password) ? "current" : nil + = link_to "Design", profile_design_path, :class => current_page?(:controller => "profile", :action => :design) ? "current" : nil = link_to keys_path, :class => controller.controller_name == "keys" ? "current" : nil do Keys - unless current_user.keys.empty? diff --git a/app/views/layouts/user.html.haml b/app/views/layouts/user.html.haml deleted file mode 100644 index 5a936450800bfb2a610a25f5d5bb57ca1868bb19..0000000000000000000000000000000000000000 --- a/app/views/layouts/user.html.haml +++ /dev/null @@ -1,31 +0,0 @@ -!!! -%html - %head - %title - GitLab #{" - #{current_user.name}"} - = stylesheet_link_tag "application" - = javascript_include_tag "application" - = csrf_meta_tags - = javascript_tag do - REQ_URI = "#{request.env["REQUEST_URI"]}"; - REQ_REFFER = "#{request.env["HTTP_REFERER"]}"; - %body{ :class => body_class('project-page'), :id => yield(:boyd_id)} - = render :partial => "layouts/flash" - #container - = render :partial => "layouts/head_panel" - .project-container - .project-sidebar - .fixed - %aside - = link_to issues_path, :class => current_page?(issues_path) ? "current" : nil do - Issues - - unless current_user.assigned_issues.empty? - %span{ :class => "number" }= current_user.assigned_issues.count - = link_to merge_requests_path, :class => current_page?(merge_requests_path) ? "current" : nil do - Merge Requests - - unless current_user.assigned_merge_requests.empty? - %span{ :class => "number" }= current_user.assigned_merge_requests.count - - .project-content - = yield - diff --git a/app/views/profile/design.html.haml b/app/views/profile/design.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..4a0f758d31f6ca27117f9793ba3c84220d947895 --- /dev/null +++ b/app/views/profile/design.html.haml @@ -0,0 +1,22 @@ +.ui-box.width-100p + %h3 Design + = form_for @user, :url => profile_update_path, :method => :put do |f| + .data + .left.dark_scheme_box + %label{:for => "user_dark_scheme_false"} + = image_tag "white.png", :width => 310, :height => 212 + %center + %h4 + = f.radio_button :dark_scheme, false + White code preview + .right.dark_scheme_box + %label{:for => "user_dark_scheme_true"} + = image_tag "dark.png", :width => 310, :height => 212 + %center + %h4 + = f.radio_button :dark_scheme, true + Dark code preview + .clear + .buttons + = f.submit 'Save', :class => "grey-button" + diff --git a/app/views/profile/show.html.haml b/app/views/profile/show.html.haml index 15233f70eeea9268fa99e853a8b2c463972a6ba3..8ebb4dcb713a822a7be8881015d718eeb03f3f62 100644 --- a/app/views/profile/show.html.haml +++ b/app/views/profile/show.html.haml @@ -1,33 +1,38 @@ .ui-box.width-100p %h3= @user.name - = form_for @user, :url => profile_edit_path, :method => :put do |f| + = form_for @user, :url => profile_update_path, :method => :put do |f| .data - -if @user.errors.any? - #error_explanation - %ul - - @user.errors.full_messages.each do |msg| - %li= msg + .left + -if @user.errors.any? + #error_explanation + %ul + - @user.errors.full_messages.each do |msg| + %li= msg - .form-row - = f.label :name - %br - = f.text_field :name - .form-row - = f.label :email - %br - = f.text_field :email - .form-row - = f.label :skype - %br - = f.text_field :skype - .form-row - = f.label :linkedin - %br - = f.text_field :linkedin - .form-row - = f.label :twitter - %br - = f.text_field :twitter + .form-row + = f.label :name + %br + = f.text_field :name + .form-row + = f.label :email + %br + = f.text_field :email + .form-row + = f.label :skype + %br + = f.text_field :skype + .form-row + = f.label :linkedin + %br + = f.text_field :linkedin + .form-row + = f.label :twitter + %br + = f.text_field :twitter + + .right + = image_tag gravatar_icon(current_user.email,64), :width => 64, :style => "margin:5px; border:5px solid #eee;" + .clear .buttons = f.submit 'Save', :class => "grey-button" diff --git a/app/views/refs/_tree_file.html.haml b/app/views/refs/_tree_file.html.haml index fdc2469d971bbcf786944eb308d8a27444ea83f2..b32134b0fd57ca388566457d894e5468589b4e7d 100644 --- a/app/views/refs/_tree_file.html.haml +++ b/app/views/refs/_tree_file.html.haml @@ -5,12 +5,12 @@ = name = link_to "raw", blob_project_ref_path(@project, @ref, :path => params[:path] ), :class => "right", :target => "_blank" = link_to "history", project_commits_path(@project, :path => params[:path], :ref => @ref ), :class => "right", :style => "margin-right:10px;" - = switch_colorscheme_link(:class => "right", :style => "margin-right:10px;color:orange") + -#= switch_colorscheme_link(:class => "right", :style => "margin-right:10px;color:orange") %br/ - if file.text? .view_file_content - unless file.empty? - %div{:class => cookies[:colorschema]} + %div{:class => current_user.dark_scheme ? "black" : ""} :erb <%= raw file.colorize %> - else diff --git a/config/routes.rb b/config/routes.rb index 1fbbbfd536a1df93341f84daaa33d40b5d14ab94..882ba00a6b2fadd4f78294dce2bc4548c3da2493 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -19,8 +19,9 @@ Gitlab::Application.routes.draw do get "profile/password", :to => "profile#password" put "profile/password", :to => "profile#password_update" put "profile/reset_private_token", :to => "profile#reset_private_token" - put "profile/edit", :to => "profile#social_update" get "profile", :to => "profile#show" + get "profile/design", :to => "profile#design" + put "profile/update", :to => "profile#update" get "dashboard", :to => "dashboard#index" get "dashboard/issues", :to => "dashboard#issues" diff --git a/db/migrate/20111220190817_add_coloscheme_option_to_user.rb b/db/migrate/20111220190817_add_coloscheme_option_to_user.rb new file mode 100644 index 0000000000000000000000000000000000000000..fe06c3aa34a6307b96b7e2830ab64b3f6fc48529 --- /dev/null +++ b/db/migrate/20111220190817_add_coloscheme_option_to_user.rb @@ -0,0 +1,5 @@ +class AddColoschemeOptionToUser < ActiveRecord::Migration + def change + add_column :users, :dark_scheme, :boolean, :default => false, :null => false + end +end diff --git a/db/schema.rb b/db/schema.rb index 613b65cb2ade02cb3574766f28af7c5f046f2fab..18a3486ee5577c9e3e6916707f45250605e61125 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,19 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20111207211728) do +ActiveRecord::Schema.define(:version => 20111220190817) do + + create_table "features", :force => true do |t| + t.string "name" + t.string "branch_name" + t.integer "assignee_id" + t.integer "author_id" + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "version" + t.integer "status", :default => 0, :null => false + end create_table "issues", :force => true do |t| t.string "title" @@ -118,6 +130,7 @@ ActiveRecord::Schema.define(:version => 20111207211728) 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 end add_index "users", ["email"], :name => "index_users_on_email", :unique => true