2 profile_config = Rails.configuration.user_profile_form_fields
3 current_user_profile = current_user.prefs[:profile]
4 show_save_button = false
6 profile_message = Rails.configuration.user_profile_form_message ? Rails.configuration.user_profile_form_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.'
8 missing_required = missing_required_profile?
10 profile_url = '/users/'+current_user.uuid+'/profile'
11 target = request.url.partition('?target=')[-1]
12 target = request.url if target.empty?
13 return_to_url = (request.url.ends_with? profile_url) ? profile_url : profile_url+'?target='+target
17 <div class="panel panel-default">
18 <div class="panel-heading">
19 <h4 class="panel-title">
23 <div class="panel-body">
24 <% if !missing_required && params.andand.keys.include?('target') %>
25 <div class="rounded" style="border-width: 1px; border-style: dotted; border-color: lightgray;">
26 <p style="margin: 8px;">Thank you for filling in your profile. If you are done updating your profile,
27 you can now access Arvados Workbench by clicking on this button.
28 <form action="<%=target%>">
29 <input style="margin-left: 8px;" class="btn btn-primary" type="submit" value="Access Arvados Workbench">
34 <div class="rounded" style="border-width: 1px; border-style: dotted; border-color: lightgray;">
35 <p style="margin: 8px;"> <%=raw(profile_message)%> </p>
39 <div class="rounded" style="border-width: 1px; border-style: dotted; border-color: lightgray;">
40 <%= form_tag "/users/#{current_user.uuid}", {method: 'patch', id: 'save_profile_form', name: 'save_profile_form', class: 'form-horizontal'} do %>
41 <%= hidden_field_tag :return_to, return_to_url %>
42 <div class="form-group">
43 <label for="email" class="col-sm-3 control-label"> Email </label>
44 <div class="col-sm-8">
45 <p class="form-control-static" id="email" name="email"><%=current_user.email%></p>
48 <div class="form-group">
49 <label for="first_name" class="col-sm-3 control-label"> First name </label>
50 <div class="col-sm-8">
51 <p class="form-control-static" id="first_name" name="first_name"><%=current_user.first_name%></p>
54 <div class="form-group">
55 <label for="last_name" class="col-sm-3 control-label"> Last name </label>
56 <div class="col-sm-8">
57 <p class="form-control-static" id="last_name" name="last_name"><%=current_user.last_name%></p>
60 <div class="form-group">
61 <label for="identity_url" class="col-sm-3 control-label"> Identity URL </label>
62 <div class="col-sm-8">
63 <p class="form-control-static" id="identity_url" name="identity_url"><%=current_user.andand.identity_url%></p>
67 <% profile_config.kind_of?(Array) && profile_config.andand.each do |entry| %>
70 show_save_button = true
71 label = entry['required'] ? '* ' : ''
72 label += entry['form_field_title']
73 value = current_user_profile[entry['key'].to_sym] if current_user_profile
75 <div class="form-group">
76 <label for="<%=entry['key']%>"
77 class="col-sm-3 control-label"
78 style=<%="color:red" if entry['required']&&(!value||value.empty?)%>> <%=label%>
80 <% if entry['type'] == 'select' %>
81 <div class="col-sm-8">
82 <select class="form-control" name="user[prefs][:profile][:<%=entry['key']%>]">
83 <% entry['options'].each do |option| %>
84 <option value="<%=option%>" <%='selected' if option==value%>><%=option%></option>
89 <div class="col-sm-8">
90 <input type="text" class="form-control" name="user[prefs][:profile][:<%=entry['key']%>]" placeholder="<%=entry['form_field_description']%>" value="<%=value%>" ></input>
97 <% if show_save_button %>
98 <div class="form-group">
99 <div class="col-sm-offset-3 col-sm-8">
100 <button type="submit" class="btn btn-primary">Save profile</button>