2010-03-15 09:35:01 +00:00
|
|
|
<p>
|
|
|
|
<%= f.label :name %>
|
|
|
|
<%= f.text_field :name %>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<fieldset>
|
|
|
|
<% @user_attribute.attrs.each_with_index do |attr, i| %>
|
|
|
|
<p>
|
|
|
|
<label><%= attr["key"] %></label>
|
|
|
|
<%= hidden_field_tag "user_attribute[attrs][][key]", attr["key"] %>
|
|
|
|
<%= text_field_tag "user_attribute[attrs][][name]", attr["name"] %>
|
2010-03-18 09:57:26 +00:00
|
|
|
<%= select_tag "user_attribute[attrs][][type]", options_for_select(["text_field", "select"], attr["type"]) %>
|
2010-03-15 09:35:01 +00:00
|
|
|
<a href="#" class="remove">(remove)</a>
|
|
|
|
</p>
|
|
|
|
<% end -%>
|
|
|
|
|
|
|
|
<p id="newone">
|
|
|
|
<label>Key</label>
|
|
|
|
<%= text_field_tag "user_attribute[attrs][][key]", "" %>
|
|
|
|
<label>Name</label>
|
|
|
|
<%= text_field_tag "user_attribute[attrs][][name]", "" %>
|
|
|
|
<%= select_tag "user_attribute[attrs][][type]", options_for_select(["text_field"], "") %>
|
|
|
|
<a href="#" class="remove">(remove)</a>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<a href="#" class="add">(add)</a>
|
|
|
|
|
|
|
|
</fieldset>
|
|
|
|
|
|
|
|
<% content_for :page_specific_javascript do %>
|
|
|
|
<script type="text/javascript" charset="utf-8">
|
|
|
|
var newone = $('fieldset #newone').clone();
|
|
|
|
$('fieldset #newone').remove();
|
|
|
|
|
|
|
|
$('fieldset a.remove').live( "click", function(){
|
|
|
|
$(this).parent().remove();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('fieldset a.add').click(function(){
|
|
|
|
newone.clone().appendTo( $('fieldset') );
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
<% end -%>
|