- <% profile_config.andand.each do |entry| %>
- <%
- label = entry['required'] ? '* ' : ''
- label += entry['form_field_title']
- value = current_user_profile[entry['key'].to_sym] if current_user_profile
- %>
- <div class="form-group">
- <label for="<%=entry['key']%>"
- class="col-sm-3 control-label"
- style=<%="color:red" if entry['required']&&!value%>> <%=label%>
- </label>
- <% if entry['type'] == 'select' %>
- <div class="col-sm-9">
- <select class="form-control" id="<%=entry['key']%>" name="<%=entry['key']%>">
- <% entry['options'].each do |option| %>
- <option value="<%=option%>" <%='selected' if option==value%>><%=option%></option>
- <% end %>
- </select>
- </div>
- <% else %>
- <div class="col-sm-9">
- <input type="text" class="form-control" id="<%=entry['key']%>" name="<%=entry['key']%>" placeholder="<%=entry['form_field_description']%>" value="<%=value%>" ></input>
- </div>
- <% end %>
- </div>
+ <% profile_config.kind_of?(Array) && profile_config.andand.each do |entry| %>
+ <% if entry['key'] %>
+ <%
+ show_save_button = true
+ label = entry['required'] ? '* ' : ''
+ label += entry['form_field_title']
+ value = current_user_profile[entry['key'].to_sym] if current_user_profile
+ %>
+ <div class="form-group">
+ <label for="<%=entry['key']%>"
+ class="col-sm-3 control-label"
+ style=<%="color:red" if entry['required']&&(!value||value.empty?)%>> <%=label%>
+ </label>
+ <% if entry['type'] == 'select' %>
+ <div class="col-sm-8">
+ <select class="form-control" name="user[prefs][:profile][:<%=entry['key']%>]">
+ <% entry['options'].each do |option| %>
+ <option value="<%=option%>" <%='selected' if option==value%>><%=option%></option>
+ <% end %>
+ </select>
+ </div>
+ <% else %>
+ <div class="col-sm-8">
+ <input type="text" class="form-control" name="user[prefs][:profile][:<%=entry['key']%>]" placeholder="<%=entry['form_field_description']%>" value="<%=value%>" ></input>
+ </div>
+ <% end %>
+ </div>
+ <% end %>