Skip to content

Commit

Permalink
Move user info elements and add switch for beta program
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidKang committed Aug 23, 2019
1 parent e88f3ae commit 5a39f08
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 54 deletions.
4 changes: 0 additions & 4 deletions src/api/app/assets/stylesheets/webui2/user.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#home-login {
color: $gray-500;
}

.activity-percentil0 {
background-color: #dcd5da;
}
Expand Down
95 changes: 45 additions & 50 deletions src/api/app/views/webui2/webui/user/_info.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,58 @@
.card-body
= image_tag_for(user)

%h4.home-usertitle.mt-4
#home-realname
= user.realname
%h4.d-inline-block#home-login
%h4.mb-0.mt-4#home-realname
= user.realname
%h5.d-inline-block.mb-0.align-middle.text-muted#home-login
= user.login
- role_titles.each do |title|
%span.badge.badge-secondary.align-top
= title.upcase

- if User.session
= mail_to(user.email, title: "Send mail to #{user.name}", class: 'd-block') do
%i.fas.fa-envelope
= user.email
- role_titles.each do |title|
%span.badge.badge-secondary
= title.upcase

- if groups.any?
Member of the #{'group'.pluralize(groups.size)}
%ul
- groups.each do |group|
%li
= link_to(group_show_path(group)) do
#{group.title}
%span.badge.badge-primary.align-top
#{group.tasks} #{'task'.pluralize(group.tasks)}
.mt-4
Member of the #{'group'.pluralize(groups.size)}
%ul
- groups.each do |group|
%li
= link_to(group_show_path(group)) do
#{group.title}
%span.badge.badge-primary.align-baseline
#{group.tasks} #{'task'.pluralize(group.tasks)}

- if is_user
- if user.in_beta?
%p
.badge.badge-info
In public beta program
= link_to(user_save_path(user: { login: user.login, in_beta: 0 }), method: :post, class: 'd-block') do
%i.fas.fa-sign-out-alt
Leave public beta program
- else
= link_to(user_save_path(user: { login: user.login, in_beta: 1 }), method: :post, class: 'd-block') do
%i.fas.fa-sign-in-alt
Join public beta program

- 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

- 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(user_notifications_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
%i.fas.fa-rss-square
RSS for notifications
.mt-4#beta-program
= link_to(user_save_path(user: { login: user.login, in_beta: user.in_beta? ? 0 : 1 }), method: :post) do
%i.fas.text-primary{ class: "#{user.in_beta? ? 'fa-toggle-on' : 'fa-toggle-off'}" }
%span Public beta program
%i.fa.fa-question-circle.text-info{ data: { placement: 'top', toggle: 'popover', html: 'true',
content: 'Enabling <strong>public beta program</strong>, you will be able to try ' + |
'the latest features ongoing development and give us feedback on them.' } } |
.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
- 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(user_notifications_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
%i.fas.fa-rss-square
RSS for notifications
30 changes: 30 additions & 0 deletions src/api/spec/bootstrap/features/webui/users/user_home_page_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
require 'browser_helper'

RSpec.feature "User's home project creation", type: :feature, js: true do
let!(:user) { create(:confirmed_user, login: 'Jim', realname: 'Jim Knopf', email: 'jim.knopf@puppenkiste.com') }

describe 'as a logged-in user' do
before do
login user
visit home_path
end

scenario 'public beta program' do
within('#beta-program') do
expect(page).to have_css('.fa-toggle-off')
end

click_link('Public beta program')
expect(page).to have_text("User data for user 'Jim' successfully updated.")
within('#beta-program') do
expect(page).to have_css('.fa-toggle-on')
end

click_link('Public beta program')
expect(page).to have_text("User data for user 'Jim' successfully updated.")
within('#beta-program') do
expect(page).to have_css('.fa-toggle-off')
end
end
end
end
2 changes: 2 additions & 0 deletions src/api/spec/features/webui/users/user_home_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
end

scenario 'public beta program' do
skip_if_bootstrap

# TODO: Change by have_text('In public beta program') when dropping old UI
expect(page).not_to have_content(/(Participates in|In) public beta program/)

Expand Down

0 comments on commit 5a39f08

Please sign in to comment.