Skip to content

Commit

Permalink
Merge pull request #10263 from danidoni/move-actions-to-sidebar-on-th…
Browse files Browse the repository at this point in the history
…e-user-page

Move the actions present in the user's profile page to the left menu
  • Loading branch information
danidoni committed Oct 15, 2020
2 parents 4da0a16 + e35ca8b commit 80f215b
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 16 deletions.
6 changes: 6 additions & 0 deletions src/api/app/views/webui/user/_change_password.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- if feature_enabled?(:responsive_ux)
= render partial: 'webui/user/index_actions'
- else
= link_to('#', data: { toggle: 'modal', target: '#password-modal' }, class: 'd-block') do
%i.fas.fa-key
Change your password
20 changes: 20 additions & 0 deletions src/api/app/views/webui/user/_edit_account.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
- if feature_enabled?(:responsive_ux)
- content_for :actions do
- if account_edit_link.present?
%li.nav-item
= link_to(account_edit_link, class: 'nav-link') do
%i.fas.fa-lg.mr-2.fa-user-edit
Edit your account
- else
%li.nav-item
= link_to('#', data: { toggle: 'modal', target: '#edit-modal' }, class: 'nav-link') do
%i.fas.fa-lg.mr-2.fa-user-edit
Edit your account
- elsif account_edit_link.present?
= link_to(account_edit_link, class: 'd-block') do
%i.fas.fa-user-edit
Edit your account
- else
= link_to('#', data: { toggle: 'modal', target: '#edit-modal' }, class: 'd-block') do
%i.fas.fa-user-edit
Edit your account
5 changes: 5 additions & 0 deletions src/api/app/views/webui/user/_index_actions.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- content_for :actions do
%li.nav-item
= link_to('#', data: { toggle: 'modal', target: '#password-modal' }, class: 'nav-link') do
%i.fas.fa-lg.mr-2.fa-plus-square
Change your password
26 changes: 12 additions & 14 deletions src/api/app/views/webui/user/_info.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,19 @@
'features we develop and give us feedback on them before they go live.' } } |
.mt-4
- if configuration.accounts_editable?(user)
- if account_edit_link.present?
= link_to(account_edit_link, class: 'd-block') do
%i.fas.fa-user-edit
Edit your account
- else
= link_to('#', data: { toggle: 'modal', target: '#edit-modal' }, class: 'd-block') do
%i.fas.fa-user-edit
Edit your account
= render partial: 'webui/user/edit_account', locals: { account_edit_link: account_edit_link }
- if configuration.passwords_changable?(user)
= link_to('#', data: { toggle: 'modal', target: '#password-modal' }, class: 'd-block') do
%i.fas.fa-key
Change your password
= link_to(my_subscriptions_path, class: 'd-block') do
%i.fas.fa-bell
Change your notifications
= render partial: 'webui/user/change_password'
- if feature_enabled?(:responsive_ux)
- content_for :actions do
%li.nav-item
= link_to(my_subscriptions_path, class: 'nav-link') do
%i.fas.fa-lg.mr-2.fa-bell
Change your notifications
- else
= link_to(my_subscriptions_path, class: 'd-block') do
%i.fas.fa-bell
Change your notifications
- if user.rss_token
= link_to(user_rss_notifications_path(token: user.rss_token.string, format: 'rss'),
title: 'RSS Feed for Notifications', class: 'd-block') do
Expand Down
10 changes: 8 additions & 2 deletions src/api/spec/features/beta/webui/users/user_home_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
expect(page).to have_css('#home-realname', text: 'Jim Knopf')
expect(page).to have_css("a[href='mailto:jim.knopf@puppenkiste.com']", text: 'jim.knopf@puppenkiste.com')

within('#bottom-navigation-area') { click_link('Actions') } if mobile?
expect(page).to have_text('Edit your account')
expect(page).to have_text('Change your password')

Expand All @@ -49,7 +50,7 @@

expect(page).to have_link('Incoming Requests')
# TODO: Remove this line if the dropdown is changed to a scrollable tab, and responsive_ux is out of beta.
find('.nav-link.dropdown-toggle').click if mobile?
within('#requests') { find('.nav-link.dropdown-toggle').click } if mobile?
expect(page).to have_link('Outgoing Requests')
expect(page).to have_link('Declined Requests')
expect(page).to have_link('All Requests')
Expand All @@ -58,7 +59,12 @@
end

it 'edit account information' do
click_link('Edit your account')
if mobile?
within('#bottom-navigation-area') { click_link('Actions') }
within('#bottom-navigation-area') { click_link('Edit your account') }
else
click_link('Edit your account')
end

fill_in('user_realname', with: 'John Doe')
fill_in('user_email', with: 'john.doe@opensuse.org')
Expand Down

0 comments on commit 80f215b

Please sign in to comment.