From c4317c5f7ed4ef9c5e10b82a6b5fe9a8e4c329f8 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Fri, 12 Jun 2015 18:15:09 +0200 Subject: [PATCH] SONAR-6507 Redesign the "My Profile" page --- .../src/main/less/components/panels.less | 5 + .../sonar-web/src/main/less/init/icons.less | 24 ++-- server/sonar-web/src/main/less/init/misc.less | 1 + .../sonar-web/src/main/less/init/tables.less | 7 +- .../app/controllers/account_controller.rb | 6 +- .../account/_change_password_form.html.erb | 26 ++++ .../app/views/account/_favorites.html.erb | 9 ++ .../account/_global_notifications.html.erb | 26 ++-- .../_per_project_notifications.html.erb | 123 +++++++--------- .../WEB-INF/app/views/account/index.html.erb | 134 +++++++++--------- .../resources/org/sonar/l10n/core.properties | 1 + 11 files changed, 197 insertions(+), 165 deletions(-) create mode 100644 server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_change_password_form.html.erb create mode 100644 server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_favorites.html.erb diff --git a/server/sonar-web/src/main/less/components/panels.less b/server/sonar-web/src/main/less/components/panels.less index bc067a025c9..3e072fa1f56 100644 --- a/server/sonar-web/src/main/less/components/panels.less +++ b/server/sonar-web/src/main/less/components/panels.less @@ -36,6 +36,11 @@ padding-right: 0; } +.panel-white { + border: 1px solid @barBorderColor; + background-color: #fff; +} + .panel-info { border: 1px solid @blue; background-color: @lightBlue; diff --git a/server/sonar-web/src/main/less/init/icons.less b/server/sonar-web/src/main/less/init/icons.less index 4165443ea14..4370b75b8ac 100644 --- a/server/sonar-web/src/main/less/init/icons.less +++ b/server/sonar-web/src/main/less/init/icons.less @@ -301,18 +301,22 @@ a[class^="icon-"], a[class*=" icon-"] { content: "\f073"; font-size: @iconFontSize; } -.icon-favorite { font-size: @iconFontSize; } -.icon-favorite:before { - content: "\f005"; - color: @orange; - font-size: @iconFontSize; + +.icon-favorite, +.icon-not-favorite { + display: inline-block; + vertical-align: top; + .square(16px); + background-size: 16px 16px; + background: no-repeat center center; } -.icon-not-favorite { font-size: @iconFontSize; } -.icon-not-favorite:before { - content: "\f005"; - color: @darkGrey; - font-size: @iconFontSize; +.icon-favorite { + background-image: url('data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20stroke-linejoin%3D%22round%22%20stroke-miterlimit%3D%221.414%22%3E%3Cpath%20d%3D%22M15.428%205.777c0%20.13-.078.274-.233.428l-3.24%203.16.767%204.465c.006.042.01.102.01.18%200%20.124-.032.23-.095.316-.062.086-.153.13-.272.13-.113%200-.232-.036-.357-.108l-4.01-2.107L3.99%2014.35c-.13.072-.25.107-.357.107-.125%200-.22-.043-.28-.13-.064-.085-.095-.19-.095-.316%200-.037.006-.096.018-.18l.768-4.464-3.25-3.16C.644%206.045.57%205.9.57%205.775c0-.22.167-.356.5-.41l4.482-.652L7.562.652c.112-.244.258-.366.437-.366.177%200%20.323.122.436.366l2.01%204.062%204.48.652c.335.054.5.19.5.41h.002z%22%20fill%3D%22%23F90%22%20fill-rule%3D%22nonzero%22%2F%3E%3C%2Fsvg%3E'); +} +.icon-not-favorite { + background-image: url('data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20stroke-linejoin%3D%22round%22%20stroke-miterlimit%3D%221.414%22%3E%3Cpath%20d%3D%22M15.428%205.777c0%20.13-.078.274-.233.428l-3.24%203.16.767%204.465c.006.042.01.102.01.18%200%20.124-.032.23-.095.316-.062.086-.153.13-.272.13-.113%200-.232-.036-.357-.108l-4.01-2.107L3.99%2014.35c-.13.072-.25.107-.357.107-.125%200-.22-.043-.28-.13-.064-.085-.095-.19-.095-.316%200-.037.006-.096.018-.18l.768-4.464-3.25-3.16C.644%206.045.57%205.9.57%205.775c0-.22.167-.356.5-.41l4.482-.652L7.562.652c.112-.244.258-.366.437-.366.177%200%20.323.122.436.366l2.01%204.062%204.48.652c.335.054.5.19.5.41h.002z%22%20fill%3D%22%23CDCDCD%22%20fill-rule%3D%22nonzero%22%2F%3E%3C%2Fsvg%3E'); } + .icon-help:before { content: "\f059"; color: @blue; diff --git a/server/sonar-web/src/main/less/init/misc.less b/server/sonar-web/src/main/less/init/misc.less index 7c51d9d1a62..d9d5442cf20 100644 --- a/server/sonar-web/src/main/less/init/misc.less +++ b/server/sonar-web/src/main/less/init/misc.less @@ -81,6 +81,7 @@ td.spacer-top { padding-top: 8px; } .width-15 { width: 15%; } .width-10 { width: 10%; } +.abs-width-240 { width: 240px; } .abs-width-400 { width: 400px; } .justify { diff --git a/server/sonar-web/src/main/less/init/tables.less b/server/sonar-web/src/main/less/init/tables.less index 4b99895eef1..e643f1b7207 100644 --- a/server/sonar-web/src/main/less/init/tables.less +++ b/server/sonar-web/src/main/less/init/tables.less @@ -192,11 +192,16 @@ td.sep { padding: 0 5px; } -table.form td { +table.form td{ padding: 2px 5px; vertical-align: top; } +table.form th { + padding: 2px 5px; + font-weight: 600; +} + table.form td.keyCell { width: 1%; white-space: nowrap; diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/account_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/account_controller.rb index 066c1096ee7..8ee24acdefa 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/account_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/account_controller.rb @@ -56,6 +56,10 @@ class AccountController < ApplicationController redirect_to :controller => 'account', :action => 'index' end + def change_password_form + render :partial => 'change_password_form' + end + def update_notifications verify_post_request # Global notifs @@ -69,7 +73,7 @@ class AccountController < ApplicationController if project_notifs project_notifs.each do |r_id, per_project_notif| per_project_notif.each do |dispatch, channels| - channels.each do |channel| + channels.each do |channel, value| current_user.add_property(:prop_key => 'notification.' + dispatch + '.' + channel, :text_value => 'true', :resource_id => r_id) end end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_change_password_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_change_password_form.html.erb new file mode 100644 index 00000000000..87bd160850c --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_change_password_form.html.erb @@ -0,0 +1,26 @@ +
+ + + + + + +
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_favorites.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_favorites.html.erb new file mode 100644 index 00000000000..629abb7f285 --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_favorites.html.erb @@ -0,0 +1,9 @@ +

<%= message('my_profile.favorites.title') -%>

+ + <% for f in current_user.favourites %> + + + + + <% end %> +
<%= link_to_favourite f -%><%= qualifier_icon f %> <%= link_to_resource f %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_global_notifications.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_global_notifications.html.erb index 0b0b227ccef..2d2b66ce8a9 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_global_notifications.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_global_notifications.html.erb @@ -1,27 +1,31 @@ -

<%= message('my_profile.overall_notifications.title') -%>

+

<%= message('my_profile.overall_notifications.title') -%>

+ +

<%= message('notification.dispatcher.information') -%>

-<%= message('notification.dispatcher.information') -%> -

+ - + <% for channel in @channels %> - + <% end %> + + <% for dispatcher in @global_dispatchers %> <% - for channel in @channels - notification_id = dispatcher + '.' + channel.getKey() - check_box_id = 'global_notifs[' + notification_id + ']' - check_box_checked = @global_notifications[notification_id] + for channel in @channels + notification_id = dispatcher + '.' + channel.getKey() + check_box_id = 'global_notifs[' + notification_id + ']' + check_box_checked = @global_notifications[notification_id] %> - + <% end %> <% end %> +
<%= message('notification.channel.' + channel.getKey()) -%><%= message('notification.channel.' + channel.getKey()) -%>
<%= message('notification.dispatcher.' + dispatcher) -%> + <%= check_box_tag check_box_id, 'true', check_box_checked %> -
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_per_project_notifications.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_per_project_notifications.html.erb index fdd7cb765c7..a05956318dd 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_per_project_notifications.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_per_project_notifications.html.erb @@ -1,78 +1,57 @@ -

<%= message('my_profile.per_project_notifications.title') -%>

- +

<%= message('my_profile.per_project_notifications.title') -%>

+ +<% @per_project_notifications.each do |r_id, per_project_notif| %> +
+ - - - <% - unless @per_project_notifications.empty? - @per_project_dispatchers.each do |dispatcher| - %> - - <% - end - end - %> - - - <% - unless @per_project_notifications.empty? - index = 0 - @per_project_notifications.each do |r_id, per_project_notif| - index += 1 - %> - - - - <% - @per_project_dispatchers.each_with_index do |dispatcher, d_index| - subscribed_channels = per_project_notif[dispatcher] - select_id = index.to_s + "_" + dispatcher - %> - + + <% for channel in @channels %> + <% end %> - - <% end %> - + + + <% @per_project_dispatchers.each do |dispatcher| %> + + + <% + for channel in @channels + check_box_id = 'project_notifs[' + r_id.to_s + '][' + dispatcher + '][' + channel.getKey() + ']' + check_box_checked = per_project_notif[dispatcher].include?(channel.getKey()) + %> + + <% end %> + <% end %> - +
- <%= resource_select_tag 'new_project', { - :qualifiers => ['TRK'], - :width => '250px', - :select2_options => {'placeholder' => "'" + message('my_profile.add_project') + "'"} - } -%> - - <%= message('notification.dispatcher.' + dispatcher) -%>
- - - - - -
<%= Project.by_key(r_id).name -%> - -
-
- - - + +

<%= Project.by_key(r_id).name -%>

+
<%= message('notification.channel.' + channel.getKey()) -%>
<%= message('notification.dispatcher.' + dispatcher) -%> + <%= check_box_tag check_box_id, 'true', check_box_checked %> +
+
+<% end %> + +
+ <%= resource_select_tag 'new_project', {:qualifiers => ['TRK'], :width => '250px', + :select2_options => {'placeholder' => "'" + message('my_profile.add_project') + "'"} + } -%> +
+ + diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/index.html.erb index 90a27075860..dd0cd994586 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/index.html.erb @@ -1,86 +1,80 @@ -<% content_for :style do %> - -<% end %> -
-

<%= message('my_profile.page') -%>

-
- - - - - - - - - - - - - - - - - - - - - -
<%= message('my_profile.login') -%>:<%= current_user.login %>
<%= message('my_profile.name') -%>:<%= current_user.name %>
<%= message('my_profile.email') -%>:<%= current_user.email %>
<%= message('my_profile.groups') -%>:<%= current_user.groups.sort.map(&:name).join(', ') %>
<%= message('my_profile.scm_accounts') -%>:<%= current_user.full_scm_accounts.join(', ') %>
-
+
+
+
+ <% if configuration('sonar.lf.enableGravatar', 'true') == 'true' %> +
+ <% end %> +

<%= current_user.name %>

+

<%= current_user.login %>

+
+

<%= current_user.email %>

+
+
- <% if User.editable_password? %> -
-

<%= message('my_profile.password.title') -%>

+
+

<%= message('my_profile.groups') -%>

+
    + <% current_user.groups.sort.each do |group| -%> +
  • <%= group.name -%>
  • + <% end -%> +
+
-
- - - - - - - - - - - - - - - - - -
<%= password_field_tag 'old_password', nil, {:autocomplete => 'off'} %>
<%= password_field_tag 'password', nil, {:autocomplete => 'off'} %>
<%= password_field_tag 'password_confirmation', nil, {:autocomplete => 'off'} %>
<%= submit_tag message('my_profile.password.submit') %>
-
+
+

<%= message('my_profile.scm_accounts') -%>

+
    + <% current_user.full_scm_accounts.each do |scm_account| -%> +
  • <%= scm_account -%>
  • + <% end -%> +
+
- + <% if User.editable_password? %> +
+ +
+ <% end %>
- <% end -%> +
+ +
+ <% unless current_user.favourites.empty? -%> +
+ <%= render "account/favorites" -%> +
+ <% end %> -
<% unless @global_dispatchers.empty? -%> - <%= render "account/global_notifications" -%> -

+
+ <%= render "account/global_notifications" -%> +
<% end %> <% unless @per_project_dispatchers.empty? -%> - <%= render "account/per_project_notifications" -%> +
+ <%= render "account/per_project_notifications" -%> +
<% end %> - -

- + +
+ +
-
+ + diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index 249651373f0..ac1a9c7b899 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -2119,6 +2119,7 @@ my_profile.overall_notifications.title=Overall notifications my_profile.per_project_notifications.title=Notifications per project my_profile.add_project=Add project my_profile.remove_this_line=Remove this line +my_profile.favorites.title=Favorites -- 2.39.5