1 <%# Copyright (C) The Arvados Authors. All rights reserved.
3 SPDX-License-Identifier: AGPL-3.0 %>
7 Rails.configuration.Workbench.UserProfileFormFields.each do |k, v|
12 profile_config.sort_by! { |v| v["Position"] }
14 current_user_profile = current_user.prefs[:profile]
15 show_save_button = false
17 profile_message = Rails.configuration.Workbench.UserProfileFormMessage
21 <div class="panel panel-default">
22 <div class="panel-heading">
23 <h4 class="panel-title">
27 <div class="panel-body">
28 <% if !missing_required_profile? && params[:offer_return_to] %>
29 <div class="alert alert-success">
30 <% if current_user.prefs[:getting_started_shown] %>
31 <p>Thank you for filling in your profile. <%= link_to 'Back to work!', params[:offer_return_to], class: 'btn btn-sm btn-primary' %></p>
33 <p>Thank you for filling in your profile. <%= link_to 'Get started', params[:offer_return_to], class: 'btn btn-sm btn-primary' %></p>
37 <div class="alert alert-info">
38 <p><%=raw(profile_message)%></p>
42 <%= form_for current_user, html: {id: 'save_profile_form', name: 'save_profile_form', class: 'form-horizontal'} do %>
43 <%= hidden_field_tag :offer_return_to, params[:offer_return_to] %>
44 <%= hidden_field_tag :return_to, profile_user_path(current_user.uuid, offer_return_to: params[:offer_return_to]) %>
45 <div class="form-group">
46 <label for="email" class="col-sm-3 control-label"> E-mail </label>
47 <div class="col-sm-8">
48 <p class="form-control-static" id="email" name="email"><%=current_user.email%></p>
51 <div class="form-group">
52 <label for="first_name" class="col-sm-3 control-label"> First Name </label>
53 <div class="col-sm-8">
54 <p class="form-control-static" id="first_name" name="first_name"><%=current_user.first_name%></p>
57 <div class="form-group">
58 <label for="last_name" class="col-sm-3 control-label"> Last Name </label>
59 <div class="col-sm-8">
60 <p class="form-control-static" id="last_name" name="last_name"><%=current_user.last_name%></p>
63 <div class="form-group">
64 <label for="identity_url" class="col-sm-3 control-label"> Identity URL </label>
65 <div class="col-sm-8">
66 <p class="form-control-static" id="identity_url" name="identity_url"><%=current_user.andand.identity_url%></p>
70 <% profile_config.kind_of?(Array) && profile_config.andand.each do |entry| %>
73 show_save_button = true
74 label = entry['Required'] ? '* ' : ''
75 label += entry['FormFieldTitle']
76 value = current_user_profile[entry['Key'].to_sym] if current_user_profile
78 <div class="form-group">
79 <label for="<%=entry['Key']%>"
80 class="col-sm-3 control-label"
81 style=<%="color:red" if entry['Required']&&(!value||value.empty?)%>> <%=label%>
83 <% if entry['Type'] == 'select' %>
84 <div class="col-sm-8">
85 <select class="form-control" name="user[prefs][profile][<%=entry['Key']%>]">
86 <% entry['Options'].each do |option, _| %>
87 <option value="<%=option%>" <%='selected' if option==value%>><%=option%></option>
92 <div class="col-sm-8">
93 <input type="text" class="form-control" name="user[prefs][profile][<%=entry['Key']%>]" placeholder="<%=entry['FormFieldDescription']%>" value="<%=value%>" ></input>
100 <%# If the user has other prefs, we need to preserve them %>
101 <% current_user.prefs.each do |key, value| %>
102 <% if key != :profile %>
103 <input type="hidden" name="user[prefs][<%=key%>]" value="<%=value.to_json%>">
107 <% if show_save_button %>
108 <div class="form-group">
109 <div class="col-sm-offset-3 col-sm-8">
110 <button type="submit" class="btn btn-primary">Save profile</button>