From 1e4d15b406de131d1260f1477d0077c6f5e93ddd Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sat, 19 May 2012 12:00:46 +0300 Subject: [PATCH] Password & token split up, icon to button for top panel --- app/assets/stylesheets/ui_basic.scss | 24 ++++----- app/assets/stylesheets/ui_mars.scss | 47 ++++++++++------- app/controllers/profile_controller.rb | 6 ++- app/views/keys/_show.html.haml | 2 +- app/views/keys/index.html.haml | 7 ++- app/views/layouts/_head_panel.html.haml | 15 +++--- app/views/layouts/profile.html.haml | 3 +- app/views/notes/_form.html.haml | 2 +- app/views/profile/password.html.haml | 68 +++++++------------------ app/views/profile/token.html.haml | 22 ++++++++ app/views/projects/index.html.haml | 1 + config/routes.rb | 1 + spec/requests/profile_spec.rb | 2 +- 13 files changed, 108 insertions(+), 92 deletions(-) create mode 100644 app/views/profile/token.html.haml diff --git a/app/assets/stylesheets/ui_basic.scss b/app/assets/stylesheets/ui_basic.scss index 251083df..b60662c0 100644 --- a/app/assets/stylesheets/ui_basic.scss +++ b/app/assets/stylesheets/ui_basic.scss @@ -81,20 +81,6 @@ } } - .top_panel_ico { - width: 16px; - height: 16px; - padding: 5px; - margin-right:10px; - float:right; - background: #EEE; - @include border-radius(5px); - border: 1px solid #DDD; - img { - vertical-align:top; - } - } - .project_name { float:left; width:360px; @@ -107,6 +93,14 @@ text-shadow: 0 1px 1px #FFF; } + .fbtn { + float: right; + margin-right:10px; + .btn { + margin-left:8px; + } + } + .search { float: right; margin-right: 55px; @@ -117,6 +111,8 @@ background-repeat: no-repeat; background-position: 10px; padding-left:25px; + @include border-radius(5px); + border:1px solid #ccc; } } } diff --git a/app/assets/stylesheets/ui_mars.scss b/app/assets/stylesheets/ui_mars.scss index 0f7bc939..24951991 100644 --- a/app/assets/stylesheets/ui_mars.scss +++ b/app/assets/stylesheets/ui_mars.scss @@ -24,6 +24,29 @@ z-index:10; height:60px; + .fbtn { + float: right; + margin-right:10px; + .btn { + margin-left:8px; + background-image: -webkit-gradient(linear, 0 0, 0 30, color-stop(0.066, #595D63), to(#31363E)); + background-image: -webkit-linear-gradient(#595D63 6.6%, #31363E); + background-image: -moz-linear-gradient(#595D63 6.6%, #31363E); + background-image: -o-linear-gradient(#595D63 6.6%, #31363E); + font-size: 12px; + &:hover { + background-image: -webkit-gradient(linear, 0 0, 0 30, color-stop(0.066, #595D63), to(#2C2F35)); + background-image: -webkit-linear-gradient(#595D63 6.6%, #2C2F35); + background-image: -moz-linear-gradient(#595D63 6.6%, #202227); + background-image: -o-linear-gradient(#595D63 6.6%, #202227); + background-position:0 0; + } + + border: 1px solid #31363E; + color:#D6DADF; + text-shadow: 0 -1px 0 #000000; + } + } .search { float: right; margin-right: 55px; @@ -61,16 +84,14 @@ float:left; h1 { - background: url('logo_mars.png') no-repeat -3px -4px; + background: url('images.png') no-repeat -3px -6px; + width: 65px; + height: 26px; + margin: 6px 0; + padding: 0; + float: left; + text-indent: -1000em; float:left; - margin-left:5px; - font-size:20px; - line-height:36px; - font-weight:normal; - color:#a1a8ae; - text-shadow: 0 1px 1px #111; - padding-left:50px; - padding-top:5px; } } } @@ -93,14 +114,6 @@ padding:15px 0; } } - - .top_panel_ico { - width: 16px; - height: 16px; - padding: 5px; - margin-right:10px; - float:right; - } } /* * End of Application Header diff --git a/app/controllers/profile_controller.rb b/app/controllers/profile_controller.rb index 07d0a53f..0da46375 100644 --- a/app/controllers/profile_controller.rb +++ b/app/controllers/profile_controller.rb @@ -14,6 +14,10 @@ class ProfileController < ApplicationController redirect_to :back end + def token + @user = current_user + end + def password @user = current_user end @@ -32,6 +36,6 @@ class ProfileController < ApplicationController def reset_private_token current_user.reset_authentication_token! - redirect_to profile_password_path + redirect_to profile_token_path end end diff --git a/app/views/keys/_show.html.haml b/app/views/keys/_show.html.haml index 1df9b91d..7035e609 100644 --- a/app/views/keys/_show.html.haml +++ b/app/views/keys/_show.html.haml @@ -4,7 +4,7 @@ %p %strong= key.title %td - %span.right.cgray + %span.cgray Added = time_ago_in_words(key.created_at) ago diff --git a/app/views/keys/index.html.haml b/app/views/keys/index.html.haml index 2e2bfaab..61b558a2 100644 --- a/app/views/keys/index.html.haml +++ b/app/views/keys/index.html.haml @@ -4,6 +4,11 @@ %br -%table#keys-table.table +%table#keys-table.admin-table + %thead + %tr + %th Name + %th Added + %th - @keys.each do |key| = render(:partial => 'show', :locals => {:key => key}) diff --git a/app/views/layouts/_head_panel.html.haml b/app/views/layouts/_head_panel.html.haml index dff7a5dd..cdb4ebf4 100644 --- a/app/views/layouts/_head_panel.html.haml +++ b/app/views/layouts/_head_panel.html.haml @@ -11,12 +11,15 @@ .search = form_tag search_path, :method => :get do |f| = text_field_tag "search", nil, :placeholder => "Search", :class => "search-input" - - if current_user.can_create_project? - = link_to new_project_path, :class => "top_panel_ico", :title => "Create New Project" do - = image_tag "new_project.png", :width => 16 - - if current_user.is_admin? - = link_to admin_root_path, :class => "top_panel_ico", :title => "Admin area" do - = image_tag "admin.PNG", :width => 16 + .fbtn + - if current_user.is_admin? + = link_to admin_root_path, :class => "btn small", :title => "Admin area" do + %i.icon-cog + Admin + - if current_user.can_create_project? + = link_to new_project_path, :class => "btn small", :title => "Create New Project" do + %i.icon-plus + Project .account-box = link_to profile_path, :class => "pic" do = image_tag gravatar_icon(current_user.email) diff --git a/app/views/layouts/profile.html.haml b/app/views/layouts/profile.html.haml index 571612e0..93f7c182 100644 --- a/app/views/layouts/profile.html.haml +++ b/app/views/layouts/profile.html.haml @@ -7,7 +7,8 @@ .container %nav.main_menu = link_to "Profile", profile_path, :class => "home #{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 "Password", profile_password_path, :class => current_page?(:controller => "profile", :action => :password) ? "current" : nil + = link_to "Token", profile_token_path, :class => current_page?(:controller => "profile", :action => :token) ? "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 SSH Keys diff --git a/app/views/notes/_form.html.haml b/app/views/notes/_form.html.haml index 8a5dde2f..ec07411a 100644 --- a/app/views/notes/_form.html.haml +++ b/app/views/notes/_form.html.haml @@ -10,7 +10,7 @@ = f.text_area :note, :size => 255 %p.hint Markdown is enabled. - .row + .row.note_advanced_opts .span4 %h5 Notify via email: .clearfix diff --git a/app/views/profile/password.html.haml b/app/views/profile/password.html.haml index 4c86b727..7ef15470 100644 --- a/app/views/profile/password.html.haml +++ b/app/views/profile/password.html.haml @@ -1,50 +1,20 @@ -.row - .span6 - .thumbnail - .caption - %h3 Password - %hr - = form_for @user, :url => profile_password_path, :method => :put do |f| - .data - .alert.alert-info - %p After successful password update you will be redirected to login page where you should login with new password - -if @user.errors.any? - .alert-message.block-message.error - %ul - - @user.errors.full_messages.each do |msg| - %li= msg - - .clearfix - = f.label :password - .input= f.password_field :password - .clearfix - = f.label :password_confirmation - .input= f.password_field :password_confirmation - %hr - = f.submit 'Save', :class => "btn" - - .span6.right - .thumbnail - .caption - %h3 - Private token - %span.cred.right - keep it in secret! - %hr - = form_for @user, :url => profile_reset_private_token_path, :method => :put do |f| - .data - .alert.alert-info - %p Private token used to access application resources without authentication. - %hr - %p * required for rss feed - %p.cgray - - if current_user.private_token - = text_field_tag "token", current_user.private_token - - else - You don`t have one yet. Click generate to fix it. - %hr - - if current_user.private_token - = f.submit 'Reset', :confirm => "Are you sure?", :class => "btn" - - else - = f.submit 'Generate', :class => "btn" +%h3 Password +%hr += form_for @user, :url => profile_password_path, :method => :put do |f| + .data + .alert.alert-info + %span After successful password update you will be redirected to login page where you should login with new password + -if @user.errors.any? + .alert-message.block-message.error + %ul + - @user.errors.full_messages.each do |msg| + %li= msg + .clearfix + = f.label :password + .input= f.password_field :password + .clearfix + = f.label :password_confirmation + .input= f.password_field :password_confirmation + .actions + = f.submit 'Save', :class => "btn primary" diff --git a/app/views/profile/token.html.haml b/app/views/profile/token.html.haml new file mode 100644 index 00000000..c277adf9 --- /dev/null +++ b/app/views/profile/token.html.haml @@ -0,0 +1,22 @@ +%h3 + Private token + %span.cred.right + keep it in secret! +%hr += form_for @user, :url => profile_reset_private_token_path, :method => :put do |f| + .data + .alert.alert-info + %p Private token used to access application resources without authentication. + %p * required for rss feed + %p.cgray + - if current_user.private_token + = text_field_tag "token", current_user.private_token + - else + You don`t have one yet. Click generate to fix it. + .actions + - if current_user.private_token + = f.submit 'Reset', :confirm => "Are you sure?", :class => "btn" + - else + = f.submit 'Generate', :class => "btn primary" + + diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml index 3578b71c..e18f37e1 100644 --- a/app/views/projects/index.html.haml +++ b/app/views/projects/index.html.haml @@ -23,6 +23,7 @@ - if current_user.can_create_project? %span.right = link_to new_project_path, :class => "btn very_small info" do + %i.icon-plus New Project - @projects.each do |project| = link_to project_path(project), :class => dom_class(project) do diff --git a/config/routes.rb b/config/routes.rb index e137ff71..d409d508 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -35,6 +35,7 @@ Gitlab::Application.routes.draw do get "errors/githost" get "profile/password", :to => "profile#password" put "profile/password", :to => "profile#password_update" + get "profile/token", :to => "profile#token" put "profile/reset_private_token", :to => "profile#reset_private_token" get "profile", :to => "profile#show" get "profile/design", :to => "profile#design" diff --git a/spec/requests/profile_spec.rb b/spec/requests/profile_spec.rb index ea88a651..6f9af608 100644 --- a/spec/requests/profile_spec.rb +++ b/spec/requests/profile_spec.rb @@ -30,7 +30,7 @@ describe "Profile" do describe "Reset private token" do before do - visit profile_password_path + visit profile_token_path end it "should reset private token" do