X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/1071802079ee3c706d217ce41fd35b4e304a6a30..71f76a45195266c2d25a42c13b1419b000d60ffb:/apps/workbench/app/views/users/profile.html.erb diff --git a/apps/workbench/app/views/users/profile.html.erb b/apps/workbench/app/views/users/profile.html.erb index f8456b944d..5f3a5aa61c 100644 --- a/apps/workbench/app/views/users/profile.html.erb +++ b/apps/workbench/app/views/users/profile.html.erb @@ -1,83 +1,110 @@ -<% - profile_config = Rails.configuration.user_profile_form_fields - this_user = User.limit(1).where(uuid: current_user.uuid).first - user_prefs = User.limit(1).where(uuid: current_user.uuid).first.prefs - current_user_profile = user_prefs[:profile] if user_prefs +<%# Copyright (C) The Arvados Authors. All rights reserved. + +SPDX-License-Identifier: AGPL-3.0 %> + +<% + profile_config = Rails.configuration.Workbench.UserProfileFormFields + current_user_profile = current_user.prefs[:profile] + show_save_button = false + + profile_message = Rails.configuration.Workbench.UserProfileFormMessage %> -
-
+ +
+

Profile

-
-

You can manage your profile using this page. - Any feilds in red are required and missing. - Please fill in those fields before you can accesse Arvados Workbench.


-
-
- <%= form_tag update_profile_path, {method: 'put', id: 'save_profile_form', name: 'save_profile_form', class: 'form-horizontal', remote: true} do %> + <% if !missing_required_profile? && params[:offer_return_to] %> +
+ <% if current_user.prefs[:getting_started_shown] %> +

Thank you for filling in your profile. <%= link_to 'Back to work!', params[:offer_return_to], class: 'btn btn-sm btn-primary' %>

+ <% else %> +

Thank you for filling in your profile. <%= link_to 'Get started', params[:offer_return_to], class: 'btn btn-sm btn-primary' %>

+ <% end %> +
+ <% else %> +
+

<%=raw(profile_message)%>

+
+ <% end %> + + <%= form_for current_user, html: {id: 'save_profile_form', name: 'save_profile_form', class: 'form-horizontal'} do %> + <%= hidden_field_tag :offer_return_to, params[:offer_return_to] %> + <%= hidden_field_tag :return_to, profile_user_path(current_user.uuid, offer_return_to: params[:offer_return_to]) %>
- -
+ +

<%=current_user.email%>

- -
+ +

<%=current_user.first_name%>

- -
+ +

<%=current_user.last_name%>

-
-

<%=this_user.andand.identity_url%>

+
+

<%=current_user.andand.identity_url%>

- <% profile_config.andand.each do |entry| %> - <% - label = entry['required'] ? '* ' : '' - label += entry['form_field_title'] - value = current_user_profile[entry['key'].to_sym] if current_user_profile - %> -
- - <% if entry['type'] == 'select' %> -
- -
- <% else %> -
- -
- <% end %> -
+ <% profile_config.kind_of?(Array) && profile_config.andand.each do |entry| %> + <% if entry['key'] %> + <% + show_save_button = true + label = entry['required'] ? '* ' : '' + label += entry['form_field_title'] + value = current_user_profile[entry['key'].to_sym] if current_user_profile + %> +
+ + <% if entry['type'] == 'select' %> +
+ +
+ <% else %> +
+ +
+ <% end %> +
+ <% end %> <% end %> -
-
- + <%# If the user has other prefs, we need to preserve them %> + <% current_user.prefs.each do |key, value| %> + <% if key != :profile %> + + <% end %> + <% end %> + + <% if show_save_button %> +
+
+ +
-
+ <% end %> <% end %> -
-
+