diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 69a3d743c5a82ec63ce2f273acfac5d5cd55cf7c..fda8d54cec8918d239db87241c72befedf440540 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -699,7 +699,14 @@ li.note { .active { img { border:1px solid #ccc; + background:$hover; @include border-radius(5px); } } } + +.btn-build-token { + float: left; + padding: 6px 20px; + margin-right: 12px; +} diff --git a/app/assets/stylesheets/main.scss b/app/assets/stylesheets/main.scss index 9a6d44563b31b0972ef9ac9cfa77b36ad00ee7c8..75001d3a7c34d23b29450409816ae3e58be2ba1d 100644 --- a/app/assets/stylesheets/main.scss +++ b/app/assets/stylesheets/main.scss @@ -160,6 +160,11 @@ $hover: #fdf5d9; */ @import "sections/notes.scss"; +/** + * This file represent profile styles + */ +@import "sections/profile.scss"; + /** * Devise styles */ diff --git a/app/assets/stylesheets/sections/profile.scss b/app/assets/stylesheets/sections/profile.scss new file mode 100644 index 0000000000000000000000000000000000000000..206da3a95f796910dc9bc41fd39f97147272ab36 --- /dev/null +++ b/app/assets/stylesheets/sections/profile.scss @@ -0,0 +1,8 @@ +.profile_history { + .event_feed { + min-height:20px; + .avatar { + width:20px; + } + } +} diff --git a/app/controllers/profile_controller.rb b/app/controllers/profile_controller.rb index a95a331096a6d9192c69611a75343db37eae2183..ba68af2e84c52a92d68b937f0964955ec0f49e7e 100644 --- a/app/controllers/profile_controller.rb +++ b/app/controllers/profile_controller.rb @@ -32,10 +32,14 @@ class ProfileController < ApplicationController def reset_private_token current_user.reset_authentication_token! - redirect_to profile_token_path + redirect_to profile_account_path end - private + def history + @events = current_user.recent_events.page(params[:page]).per(20) + end + + private def user @user = current_user diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index fb1393e227964bdd4c3a28e3fe4298cae192dea7..3e435840baedd9c62d81d4d59afa339f6bb73e04 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -104,7 +104,8 @@ module ApplicationHelper # Profile Area when :profile; current_page?(controller: "profile", action: :show) - when :password; current_page?(controller: "profile", action: :password) + when :history; current_page?(controller: "profile", action: :history) + when :account; current_page?(controller: "profile", action: :account) when :token; current_page?(controller: "profile", action: :token) when :design; current_page?(controller: "profile", action: :design) when :ssh_keys; controller.controller_name == "keys" diff --git a/app/views/layouts/profile.html.haml b/app/views/layouts/profile.html.haml index 810b346f1cdf5fa548e30648af891a1de862d8e4..62c8db5be125757fb563b300a144fa7d9c3d4af3 100644 --- a/app/views/layouts/profile.html.haml +++ b/app/views/layouts/profile.html.haml @@ -9,20 +9,20 @@ %li.home{class: tab_class(:profile)} = link_to "Profile", profile_path - %li{class: tab_class(:password)} - = link_to "Authentication", profile_password_path + %li{class: tab_class(:account)} + = link_to "Account", profile_account_path %li{class: tab_class(:ssh_keys)} = link_to keys_path do SSH Keys %span.count= current_user.keys.count - %li{class: tab_class(:token)} - = link_to "Token", profile_token_path - %li{class: tab_class(:design)} = link_to "Design", profile_design_path + %li{class: tab_class(:history)} + = link_to "History", profile_history_path + .content = yield diff --git a/app/views/profile/account.html.haml b/app/views/profile/account.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..6707a8ff443c47cd53a9bb2a7091b311d1b5a9ba --- /dev/null +++ b/app/views/profile/account.html.haml @@ -0,0 +1,57 @@ +- if Gitlab.config.omniauth_enabled? + %fieldset + %legend + %h3.page_title Social Accounts + .oauth_select_holder + %p.hint Tip: Click on icon to activate sigin with one of the following services + - User.omniauth_providers.each do |provider| + %span{class: oauth_active_class(provider) } + = link_to authbutton(provider, 32), omniauth_authorize_path(User, provider) + + +%fieldset + %legend + %h3.page_title + Private token + %span.cred.right + keep it in secret! + .padded + = form_for @user, url: profile_reset_private_token_path, method: :put do |f| + .data + %p.slead + Private token used to access application resources without authentication. + %br + It can be used for atom feed or API + %p.cgray + - if current_user.private_token + = text_field_tag "token", current_user.private_token, class: "xxlarge large_text" + = f.submit 'Reset', confirm: "Are you sure?", class: "btn primary btn-build-token" + - else + %span You don`t have one yet. Click generate to fix it. + = f.submit 'Generate', class: "btn success btn-build-token" + +%fieldset + %legend + %h3.page_title Password + = form_for @user, url: profile_password_path, method: :put do |f| + .padded + %p.slead 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 save-btn" + + + + + diff --git a/app/views/profile/history.html.haml b/app/views/profile/history.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..aa7006c569be75052d9504cd0c44761b98fe59d6 --- /dev/null +++ b/app/views/profile/history.html.haml @@ -0,0 +1,5 @@ +.profile_history + = render @events +%hr += paginate @events, theme: "gitlab" + diff --git a/app/views/profile/password.html.haml b/app/views/profile/password.html.haml deleted file mode 100644 index 805429e3629db9b6c4035d20afc11194dc25b753..0000000000000000000000000000000000000000 --- a/app/views/profile/password.html.haml +++ /dev/null @@ -1,29 +0,0 @@ -- if Gitlab.config.omniauth_enabled? - %h3.page_title Accounts - %hr - %p.hint Tip: Click on icon to activate sigin with one of the following services - .oauth_select_holder - - User.omniauth_providers.each do |provider| - %span{class: oauth_active_class(provider) } - = link_to authbutton(provider, 32), omniauth_authorize_path(User, provider) - -.clearfix.prepend-top-20 -%h3.page_title Password -%hr - -= form_for @user, url: profile_password_path, method: :put do |f| - %p.slead 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 save-btn" diff --git a/app/views/profile/show.html.haml b/app/views/profile/show.html.haml index 5ac84122aa29e00b3f35f3d8a3470a744b845eff..7b62529116e35253a2b53001949a67049a0aff23 100644 --- a/app/views/profile/show.html.haml +++ b/app/views/profile/show.html.haml @@ -33,13 +33,13 @@ %ul -unless Gitlab.config.disable_gravatar? %li - %p.hint You can change your avatar at gravatar.com + %p.hint You can change your avatar at #{link_to "gravatar.com", "http://gravatar.com"} - if Gitlab.config.omniauth_enabled? && @user.provider? %li %p.hint You can login through #{@user.provider.titleize}! - = link_to "click here to change", profile_password_path + = link_to "click here to change", profile_account_path %hr .row diff --git a/app/views/profile/token.html.haml b/app/views/profile/token.html.haml deleted file mode 100644 index 6c870c364de1509678c71bdaeabc9d614444bdf1..0000000000000000000000000000000000000000 --- a/app/views/profile/token.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -%h3.page_title - Private token - %span.cred.right - keep it in secret! -%hr -= form_for @user, url: profile_reset_private_token_path, method: :put do |f| - .data - %p.slead - Private token used to access application resources without authentication. - %br - It can be used for atom feed or API - %p.cgray - - if current_user.private_token - = text_field_tag "token", current_user.private_token, class: "xxlarge large_text" - - 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/config/routes.rb b/config/routes.rb index ed5eac0ddd00af00f83560f5ccfac2fe8680884b..84a0c6ab170e3ee3659089b4e98a22f26428e432 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -63,7 +63,8 @@ Gitlab::Application.routes.draw do # # Profile Area # - get "profile/password", :to => "profile#password" + get "profile/account", :to => "profile#account" + get "profile/history", :to => "profile#history" put "profile/password", :to => "profile#password_update" get "profile/token", :to => "profile#token" put "profile/reset_private_token", :to => "profile#reset_private_token" diff --git a/features/profile/profile.feature b/features/profile/profile.feature index f4b2f198f0addb9bd28a35c43aa0772d2066bbd6..03cb7a13a6e5c5dec70495a5700d5a8ea2f50753 100644 --- a/features/profile/profile.feature +++ b/features/profile/profile.feature @@ -12,7 +12,7 @@ Feature: Profile And I should see new contact info Scenario: I change my password - Given I visit profile password page + Given I visit profile account page Then I change my password And I should be redirected to sign in page diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index 05ae88e63e94554d2913e945f7165d40594bb422..b0028f9c27ed0873b89f207d9cff9cd5b825726a 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -21,8 +21,8 @@ module SharedPaths visit profile_path end - Given 'I visit profile password page' do - visit profile_password_path + Given 'I visit profile account page' do + visit profile_account_path end Given 'I visit profile token page' do diff --git a/spec/requests/security/profile_access_spec.rb b/spec/requests/security/profile_access_spec.rb index 9f6fe6a2b50353d6b2f99bca1e14287bae37e366..69c1c29cf12022bfb03ffbc0373079e6f89941f4 100644 --- a/spec/requests/security/profile_access_spec.rb +++ b/spec/requests/security/profile_access_spec.rb @@ -28,8 +28,8 @@ describe "Users Security" do it { should be_denied_for :visitor } end - describe "GET /profile/password" do - subject { profile_password_path } + describe "GET /profile/account" do + subject { profile_account_path } it { should be_allowed_for @u1 } it { should be_allowed_for :admin }