Skip to content

Instantly share code, notes, and snippets.

@chanced
Created September 27, 2011 22:40
Show Gist options
  • Save chanced/1246468 to your computer and use it in GitHub Desktop.
Save chanced/1246468 to your computer and use it in GitHub Desktop.
%ul#addresses
-each address in agency.addresses
%li
%ul
-inputName = 'agency[addresses]['+address._id+']'
%li
%label{for: inputName + '[name]'}
Name
%input{type: "text", name: inputName + "[name]", value: address.name}
%li
%label{for: inputName+'[street1]'}
Address
%input{type: "text", name: inputName + "[street1]", value: address.street1}
%li
%label{for: inputName+'[street2]'}
Apt/Suite
%input{type: "text", name: inputName + "[street2]", value: address.street2}
%li
%label{for: inputName+'[city]'}
City
%input{type: "text", name: inputName + "[city]", value: address.city}
%li
%label{for: inputName+'[state]'}
State
%select{ name : inputName+ "[state]"}
%option{value: '', selected: agency.type == ''}
%option{value: 'ca', selected: agency.type == 'ca'} California
%option{value: 'sc', selected: agency.type == 'sc'} South Carolina
%li
%label{for:inputName+'[zip]'}
<ul id="addresses">
<li>
<ul>
<li>
<label for="agency[addresses][4e81fffc40b613d509000004][name]"></label>Name
<input type="text" name="agency[addresses][4e81fffc40b613d509000004][name]"/></li>
<li>
<label for="agency[addresses][4e81fffc40b613d509000004][street1]"></label>Address
<input type="text" name="agency[addresses][4e81fffc40b613d509000004][street1]"/></li></ul>
<li>
<label for="agency[addresses][4e81fffc40b613d509000004][street2]"></label>Apt/Suite
<input type="text" name="agency[addresses][4e81fffc40b613d509000004][street2]"/></li></li>
<li>
<label for="agency[addresses][4e81fffc40b613d509000004][city]">City
<input type="text" name="agency[addresses][4e81fffc40b613d509000004][city]"/></label></li>
<li>
<label for="agency[addresses][4e81fffc40b613d509000004][state]">State
<select name="agency[addresses][4e81fffc40b613d509000004][state]">
<option ></option>
<option value="ca">California</option>
<option value="sc">South Carolina</option></select></label></li>
<li>
<label for="agency[addresses][4e81fffc40b613d509000004][zip]">Zip
<input type="text" name="agency[addresses][4e81fffc40b613d509000004][zip]"/></label></li>
</ul>
</select>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment