43 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| <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"] %>
 | |
|        <%= select_tag "user_attribute[attrs][][type]", options_for_select(["text_field", "select"], attr["type"]) %>
 | |
|        <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 -%> |