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
10 <div class="panel panel-default">
11 <div class="panel-heading">
12 <h4 class="panel-title">
16 <div class="panel-body">
17 <% if !missing_required_profile? && params[:offer_return_to] %>
18 <div class="alert alert-success">
19 <% if current_user.prefs[:getting_started_shown] %>
20 <p>Thank you for filling in your profile. <%= link_to 'Back to work!', params[:offer_return_to], class: 'btn btn-sm btn-primary' %></p>
22 <p>Thank you for filling in your profile. <%= link_to 'Get started', params[:offer_return_to], class: 'btn btn-sm btn-primary' %></p>
26 <div class="alert alert-info">
27 <p><%=raw(profile_message)%></p>
31 <%= form_for current_user, html: {id: 'save_profile_form', name: 'save_profile_form', class: 'form-horizontal'} do %>
32 <%= hidden_field_tag :offer_return_to, params[:offer_return_to] %>
33 <%= hidden_field_tag :return_to, profile_user_path(current_user.uuid, offer_return_to: params[:offer_return_to]) %>
34 <div class="form-group">
35 <label for="email" class="col-sm-3 control-label"> E-mail </label>
36 <div class="col-sm-8">
37 <p class="form-control-static" id="email" name="email"><%=current_user.email%></p>
40 <div class="form-group">
41 <label for="first_name" class="col-sm-3 control-label"> First Name </label>
42 <div class="col-sm-8">
43 <p class="form-control-static" id="first_name" name="first_name"><%=current_user.first_name%></p>
46 <div class="form-group">
47 <label for="last_name" class="col-sm-3 control-label"> Last Name </label>
48 <div class="col-sm-8">
49 <p class="form-control-static" id="last_name" name="last_name"><%=current_user.last_name%></p>
52 <div class="form-group">
53 <label for="identity_url" class="col-sm-3 control-label"> Identity URL </label>
54 <div class="col-sm-8">
55 <p class="form-control-static" id="identity_url" name="identity_url"><%=current_user.andand.identity_url%></p>
59 <% profile_config.kind_of?(Array) && profile_config.andand.each do |entry| %>
62 show_save_button = true
63 label = entry['required'] ? '* ' : ''
64 label += entry['form_field_title']
65 value = current_user_profile[entry['key'].to_sym] if current_user_profile
67 <div class="form-group">
68 <label for="<%=entry['key']%>"
69 class="col-sm-3 control-label"
70 style=<%="color:red" if entry['required']&&(!value||value.empty?)%>> <%=label%>
72 <% if entry['type'] == 'select' %>
73 <div class="col-sm-8">
74 <select class="form-control" name="user[prefs][:profile][:<%=entry['key']%>]">
75 <% entry['options'].each do |option| %>
76 <option value="<%=option%>" <%='selected' if option==value%>><%=option%></option>
81 <div class="col-sm-8">
82 <input type="text" class="form-control" name="user[prefs][:profile][:<%=entry['key']%>]" placeholder="<%=entry['form_field_description']%>" value="<%=value%>" ></input>
89 <%# If the user has other prefs, we need to preserve them %>
90 <% current_user.prefs.each do |key, value| %>
91 <% if key != :profile %>
92 <input type="hidden" name="user[prefs][:<%=key%>]" value="<%=value.to_json%>">
96 <% if show_save_button %>
97 <div class="form-group">
98 <div class="col-sm-offset-3 col-sm-8">
99 <button type="submit" class="btn btn-primary">Save profile</button>