3296: add "message" to profile config
authorradhika <radhika@curoverse.com>
Thu, 7 Aug 2014 01:09:53 +0000 (21:09 -0400)
committerradhika <radhika@curoverse.com>
Thu, 7 Aug 2014 01:09:53 +0000 (21:09 -0400)
apps/workbench/app/views/users/profile.html.erb
apps/workbench/config/application.default.yml

index f8456b944d15f4797a811545560721840fb2ee0e..6af3662626e815535b32c4110d71b599c0a801aa 100644 (file)
@@ -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
 %>
-  <div>
-      <div class="panel panel-default">
+<div>
+    <div class="panel panel-default">
         <div class="panel-heading">
           <h4 class="panel-title">
             Profile
         </div>
         <div class="panel-body">
           <div>
-            <p>You can manage your profile using this page.
-               Any feilds in <font style="color:red">red</font> are required and missing.
-               Please fill in those fields before you can accesse Arvados Workbench.</p><br/>
+            <% 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 %>
+            <p> <%=profile_message%> </p><br/>
           </div>
           <div>
             <%= form_tag update_profile_path, {method: 'put', id: 'save_profile_form', name: 'save_profile_form', class: 'form-horizontal', remote: true} do %>
               </div>
 
               <% 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
-                %>
-                <div class="form-group">
-                  <label for="<%=entry['key']%>"
-                         class="col-sm-3 control-label"
-                         style=<%="color:red" if entry['required']&&!value%>> <%=label%>
-                  </label>
-                  <% if entry['type'] == 'select' %>
-                    <div class="col-sm-9">
-                      <select class="form-control" id="<%=entry['key']%>" name="<%=entry['key']%>">
-                        <% entry['options'].each do |option| %>
-                          <option value="<%=option%>" <%='selected' if option==value%>><%=option%></option>
-                        <% end %>
-                      </select>
-                    </div>
-                  <% else %>
-                    <div class="col-sm-9">
-                      <input type="text" class="form-control" id="<%=entry['key']%>" name="<%=entry['key']%>" placeholder="<%=entry['form_field_description']%>" value="<%=value%>" ></input>
-                    </div>
-                  <% end %>
-                </div>
+                <% if entry['key'] %>
+                  <%
+                      label = entry['required'] ? '* ' : ''
+                      label += entry['form_field_title']
+                      value = current_user_profile[entry['key'].to_sym] if current_user_profile
+                  %>
+                  <div class="form-group">
+                    <label for="<%=entry['key']%>"
+                           class="col-sm-3 control-label"
+                           style=<%="color:red" if entry['required']&&!value%>> <%=label%>
+                    </label>
+                    <% if entry['type'] == 'select' %>
+                      <div class="col-sm-9">
+                        <select class="form-control" id="<%=entry['key']%>" name="<%=entry['key']%>">
+                          <% entry['options'].each do |option| %>
+                            <option value="<%=option%>" <%='selected' if option==value%>><%=option%></option>
+                          <% end %>
+                        </select>
+                      </div>
+                    <% else %>
+                      <div class="col-sm-9">
+                        <input type="text" class="form-control" id="<%=entry['key']%>" name="<%=entry['key']%>" placeholder="<%=entry['form_field_description']%>" value="<%=value%>" ></input>
+                      </div>
+                    <% end %>
+                  </div>
+                <% end %>
               <% end %>
 
               <div class="form-group">
@@ -79,5 +87,5 @@
             <% end %>
           </div>
         </div>
-      </div>
+    </div>
 </div>
index 0dae0bbe15a0ffcf51b20c53a09f94948d7e0c97..a19f707ac95a985110ff1bf0de92764e749d3692 100644 (file)
@@ -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