From c424885353afb06ac835e6d44be2d838d193d49f Mon Sep 17 00:00:00 2001 From: radhika Date: Wed, 6 Aug 2014 21:09:53 -0400 Subject: [PATCH] 3296: add "message" to profile config --- .../app/views/users/profile.html.erb | 68 +++++++++++-------- apps/workbench/config/application.default.yml | 14 ++-- 2 files changed, 46 insertions(+), 36 deletions(-) diff --git a/apps/workbench/app/views/users/profile.html.erb b/apps/workbench/app/views/users/profile.html.erb index f8456b944d..6af3662626 100644 --- a/apps/workbench/app/views/users/profile.html.erb +++ b/apps/workbench/app/views/users/profile.html.erb @@ -4,8 +4,8 @@ user_prefs = User.limit(1).where(uuid: current_user.uuid).first.prefs current_user_profile = user_prefs[:profile] if user_prefs %> -
-
+
+

Profile @@ -13,9 +13,15 @@

-

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.


+ <% profile_message = '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.' + profile_config.andand.each do |entry| + if entry['message'] + profile_message = entry['message'] + break + end + end %> +

<%=profile_message%>


<%= form_tag update_profile_path, {method: 'put', id: 'save_profile_form', name: 'save_profile_form', class: 'form-horizontal', remote: true} do %> @@ -45,30 +51,32 @@
<% 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 %> -
+ <% if entry['key'] %> + <% + 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 %>
@@ -79,5 +87,5 @@ <% end %>
-
+
diff --git a/apps/workbench/config/application.default.yml b/apps/workbench/config/application.default.yml index 0dae0bbe15..a19f707ac9 100644 --- a/apps/workbench/config/application.default.yml +++ b/apps/workbench/config/application.default.yml @@ -80,13 +80,15 @@ common: user_profile_form_fields: false # Below is a sample setting of user_profile_form_fields. - # This sample configures two fields as represented by the attribute "key". - # You can specify "type" as "text" or "select". - # Specify "options" when using the type "select". - # Set "required" as "true" for any of the fields to make them required. - # If any of the required fields are missing in the user's profile, the user will be - # redirected to the "/profile" page before they can access any Workbench features. + # Use "message" to configure a message you want to display at the top of the profile page. + # This sample configures two fields as represented by the attribute "key". For these fields, + # You can specify "type" as "text" or "select". + # Specify "options" when using the type "select". + # Set "required" as "true" for any of the fields to make them required. + # If any of the required fields are missing in the user's profile, the user will be + # redirected to the profile page before they can access any Workbench features. #user_profile_form_fields: + # - message: Welcome to Curoverse. Any fields in red are required and missing. Please fill in those fields before you can access Arvados Workbench. # - key: organization # type: text # form_field_title: Institution/Company -- 2.30.2