Skip to content

Instantly share code, notes, and snippets.

@justinfrench
Forked from jtosey/_form.html.haml
Created October 17, 2010 03:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinfrench/630503 to your computer and use it in GitHub Desktop.
Save justinfrench/630503 to your computer and use it in GitHub Desktop.
= semantic_form_for @user_profile, :url => user_user_profile_path(@user), :html => {:multipart => true} do |form|
%p.large Personal information
%hr.profile
%p.smlTitle Phone Number
= form.inputs do
= form.semantic_fields_for :profile_phones do |phone|
= render 'profile_phone_fields', :form => phone
= link_to_add_fields "Add Phone", form, :profile_phones, "addPhone"
= form.buttons
= form.input :id, :as => :hidden
= form.input :number, :label => false
= form.input :phone_type, :label => false, :as => :select, :collection => User.phone_type
= form.input :_destroy, :label => "Remove", :as => :boolean
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>Edit Profile</title>
<meta content='text/html; charset=utf-8' http-equiv='Content-type' />
<meta name="csrf-param" content="authenticity_token"/>
<meta name="csrf-token" content="OHjH2Q+/b/kkV267KVSEf4VLyoQ8x16uw+AxCBvfGgo="/>
</head>
<body>
<div id='content'>
<form accept-charset="UTF-8" action="/users/15/profile" class="formtastic user_profile" enctype="multipart/form-data" id="edit_user_profile_8" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="_method" type="hidden" value="put" /><input name="authenticity_token" type="hidden" value="OHjH2Q+/b/kkV267KVSEf4VLyoQ8x16uw+AxCBvfGgo=" /></div>
<p class='large'>Personal information</p>
<hr class='profile' />
<p class='smlTitle'>Phone Number</p>
<fieldset class="inputs"><ol> <li class="string optional" id="user_profile_profile_phones_attributes_0_number_input"><input id="user_profile_profile_phones_attributes_0_number" maxlength="255" name="user_profile[profile_phones_attributes][0][number]" size="50" type="text" value="sadf" /></li>
<li class="boolean optional" id="user_profile_profile_phones_attributes_0__destroy_input"><label for="user_profile_profile_phones_attributes_0__destroy"><input name="user_profile[profile_phones_attributes][0][_destroy]" type="hidden" value="0" /><input id="user_profile_profile_phones_attributes_0__destroy" name="user_profile[profile_phones_attributes][0][_destroy]" type="checkbox" value="1" />Remove Phone</label></li>
<input id="user_profile_profile_phones_attributes_0_id" name="user_profile[profile_phones_attributes][0][id]" type="hidden" value="2" /> <li class="string optional" id="user_profile_profile_phones_attributes_1_number_input"><input id="user_profile_profile_phones_attributes_1_number" maxlength="255" name="user_profile[profile_phones_attributes][1][number]" size="50" type="text" value="asdfas" /></li>
<li class="boolean optional" id="user_profile_profile_phones_attributes_1__destroy_input"><label for="user_profile_profile_phones_attributes_1__destroy"><input name="user_profile[profile_phones_attributes][1][_destroy]" type="hidden" value="0" /><input id="user_profile_profile_phones_attributes_1__destroy" name="user_profile[profile_phones_attributes][1][_destroy]" type="checkbox" value="1" />Remove Phone</label></li>
<input id="user_profile_profile_phones_attributes_1_id" name="user_profile[profile_phones_attributes][1][id]" type="hidden" value="3" />
</ol></fieldset>
<a href="#" id="addPhone" onclick="add_fields(this.id, &quot;profile_phones&quot;, &quot;&lt;li class=\&quot;string optional\&quot; id=\&quot;user_profile_profile_phones_attributes_new_profile_phones_number_input\&quot;&gt;&lt;input id=\&quot;user_profile_profile_phones_attributes_new_profile_phones_number\&quot; maxlength=\&quot;255\&quot; name=\&quot;user_profile[profile_phones_attributes][new_profile_phones][number]\&quot; size=\&quot;50\&quot; type=\&quot;text\&quot; /&gt;&lt;\/li&gt;\n&lt;li class=\&quot;boolean optional\&quot; id=\&quot;user_profile_profile_phones_attributes_new_profile_phones__destroy_input\&quot;&gt;&lt;label for=\&quot;user_profile_profile_phones_attributes_new_profile_phones__destroy\&quot;&gt;&lt;input name=\&quot;user_profile[profile_phones_attributes][new_profile_phones][_destroy]\&quot; type=\&quot;hidden\&quot; value=\&quot;0\&quot; /&gt;&lt;input id=\&quot;user_profile_profile_phones_attributes_new_profile_phones__destroy\&quot; name=\&quot;user_profile[profile_phones_attributes][new_profile_phones][_destroy]\&quot; type=\&quot;checkbox\&quot; value=\&quot;1\&quot; /&gt;Remove Phone&lt;\/label&gt;&lt;\/li&gt;\n&quot;); return false;">Add Phone</a>
<fieldset class="buttons"><ol><li class="commit"><input class="update" id="user_profile_submit" name="commit" type="submit" value="Update User profile" /></li></ol></fieldset>
</form>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment