Story #3296

Updated by Tom Clegg over 9 years ago

 Form fields we want to collect: 
 * Institution/Company (required) 
 * Lab 
 * Website URL 
 * Title 
 * What best describes your role (dropdown): 
     Computational Biologist 
     Software Developers 

 New behavior and implementation notes: 
 * Add a link in the email address dropdown menu in Workbench called 'Edit profile'. 
 * Add a new page (@/users/{my_uuid}/profile@) with a form allowing the user to add/edit profile data. 
 * Get the list of form fields from the @user_profile_form_fields@ configuration value. 
 * Use standard bootstrap form markup (see @app/views/users/_setup_popup.html@ for an example, or bootstrap docs). 
 * Store the values in user prefs: @current_user.prefs["profile"]["title"]@, etc. 
 * On the "edit profile" page, display (but not offer to edit) the user fields that get populated automatically during the OpenID login process (email, first name, last name, identity_url). 
 * Add comments to @application.defaults.yml@ showing how to add profile fields. 
 * The default configuration should be an empty hash (i.e., no form fields are shown, and the link to the "edit profile" page is removed from the email address dropdown menu). 
 * If the @user_profile_form_fields@ configuration hash is non-empty, and the current user's prefs["profile"] is nil or empty: 
 ** Redirect most[1] dashboard pages to the "edit profile" page. 
 ** Add an alert panel to the "edit profile" page asking the user to please provide the following information. 

 fn1. Avoid constructing a catch-22 where (for example) the user agreement cannot be signed until the profile is edited, and vice versa. 

 Structure and example yaml encoding for @user_profile_form_fields@: 

 <pre><code class="yaml"> 
       key: organization 
       type: text 
       form_field_title: Institution/Company 
       form_field_description: ~ 
       required: true 
       key: role 
       type: select 
       form_field_title: Your role 
       form_field_description: Choose the category that best describes your role in your lab. 
         - Bio-informatician 
         - Computational biologist 
         - Biologist or geneticist 
         - Software developer 
         - IT 
         - Other 

 Example encoding for @user.prefs[:profile]@: 

 <pre><code class="javascript"> 
 {"organization":"Laidlaw Lab","role":"Software developer"}