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 <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 <div class="alert alert-info">
23 <p><%=raw(profile_message)%></p>
27 <%= form_for current_user, html: {id: 'save_profile_form', name: 'save_profile_form', class: 'form-horizontal'} do %>
28 <%= hidden_field_tag :offer_return_to, params[:offer_return_to] %>
29 <%= hidden_field_tag :return_to, profile_user_path(current_user.uuid, offer_return_to: params[:offer_return_to]) %>
30 <div class="form-group">
31 <label for="email" class="col-sm-3 control-label"> E-mail </label>
32 <div class="col-sm-8">
33 <p class="form-control-static" id="email" name="email"><%=current_user.email%></p>
36 <div class="form-group">
37 <label for="first_name" class="col-sm-3 control-label"> First Name </label>
38 <div class="col-sm-8">
39 <p class="form-control-static" id="first_name" name="first_name"><%=current_user.first_name%></p>
42 <div class="form-group">
43 <label for="last_name" class="col-sm-3 control-label"> Last Name </label>
44 <div class="col-sm-8">
45 <p class="form-control-static" id="last_name" name="last_name"><%=current_user.last_name%></p>
48 <div class="form-group">
49 <label for="identity_url" class="col-sm-3 control-label"> Identity URL </label>
50 <div class="col-sm-8">
51 <p class="form-control-static" id="identity_url" name="identity_url"><%=current_user.andand.identity_url%></p>
55 <% profile_config.kind_of?(Array) && profile_config.andand.each do |entry| %>
58 show_save_button = true
59 label = entry['required'] ? '* ' : ''
60 label += entry['form_field_title']
61 value = current_user_profile[entry['key'].to_sym] if current_user_profile
63 <div class="form-group">
64 <label for="<%=entry['key']%>"
65 class="col-sm-3 control-label"
66 style=<%="color:red" if entry['required']&&(!value||value.empty?)%>> <%=label%>
68 <% if entry['type'] == 'select' %>
69 <div class="col-sm-8">
70 <select class="form-control" name="user[prefs][:profile][:<%=entry['key']%>]">
71 <% entry['options'].each do |option| %>
72 <option value="<%=option%>" <%='selected' if option==value%>><%=option%></option>
77 <div class="col-sm-8">
78 <input type="text" class="form-control" name="user[prefs][:profile][:<%=entry['key']%>]" placeholder="<%=entry['form_field_description']%>" value="<%=value%>" ></input>
85 <% if show_save_button %>
86 <div class="form-group">
87 <div class="col-sm-offset-3 col-sm-8">
88 <button type="submit" class="btn btn-primary">Save profile</button>