Skip to content

Instantly share code, notes, and snippets.

@robertmilner
Created May 2, 2012 17:37
Show Gist options
  • Save robertmilner/2578545 to your computer and use it in GitHub Desktop.
Save robertmilner/2578545 to your computer and use it in GitHub Desktop.
Simple form boolean float and clearing issues
<!DOCTYPE html>
<html lang="en">
<head>
<title>VetGovPartner</title>
<link href="/assets/application.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/assets/token-input.css" media="screen" rel="stylesheet" type="text/css" />
<script src="/assets/application.js" type="text/javascript"></script>
<script src="/assets/jquery-ui.js" type="text/javascript"></script>
<script src="/assets/autocomplete-rails.js" type="text/javascript"></script>
<script src="/assets/jquery.tokeninput.js" type="text/javascript"></script>
<link href="/stylesheets/print.css" media="print" rel="stylesheet" type="text/css" />
<meta content="authenticity_token" name="csrf-param" />
<meta content="on6ydQ/fatuaMF1HmXr619Uo0LG2BbnG2hiHcZduqmo=" name="csrf-token" />
<link href='http://fonts.googleapis.com/css?family=Rokkitt&subset=latin&v2' rel='stylesheet' type='text/css'></link>
</head>
<body>
<div class="navbar navbar-fixed-top" id="main-nav">
<div class="navbar-inner">
<div class="container-fluid">
<ul class="nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
2012 Conference
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li> <a href="#">2011 Conference</a></li>
</ul>
</li>
<li>
<a href="/organizations/3/profiles/4664">My Profile</a>
</li>
<li><a href="/organizations/3">My Organization</a></li>
<li><a href="/agenda">My Agenda</a></li>
</ul>
<form class="navbar-search pull-left" action="/search">
<input type="text" class="search-query" placeholder="Search">
</form>
<ul class="login-info nav pull-right">
<li>
<a href="/profiles/4664">Hello test user</a>
</li>
<li>
<a href="/users/sign_out">Logout</a>
</li>
</ul>
</div>
</div>
</div>
<div id="topbar">
<div id="topimage">
<img alt="Vetlogo" height="80" src="/assets/vetlogo.png" width="80" />
</div>
<div id="toptitle2">
VetGovPartner
</div>
<div class="clear"></div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="headerbar">
<div class="search2">
<form accept-charset="UTF-8" action="/search" class="noformly" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div>
<input id="searchbox2" name="q" placeholder="Search" type="search" />
<input name="commit" type="submit" value="search" />
</form> </div>
</div>
<div class="row-fluid">
<div class="span2">
<div id="search1">
<form accept-charset="UTF-8" action="/search" class="noformly" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div>
<input id="searchbox" name="q" placeholder="Search" type="search" />
<input name="commit" type="submit" value="search" />
</form> </div>
<div class="well" style="padding: 8px 0;">
<ul class="nav nav-list">
<li><a href="/">Home</a></li>
<li><a href="/search">Search</a></li>
<li>
<a href="/organizations/3/profiles/4664">My Profile</a>
</li>
<a href="/organizations/3">My Organization</a>
<li><a href="/agenda">My Agenda</a></li>
<li><a href="/users/sign_out">Logout</a></li>
</div>
</ul>
</div>
<div class="span10">
<div class="subnotice">
</div>
<h1>Editing profile</h1>
<form accept-charset="UTF-8" action="/organizations/3/profiles/4664" class="simple_form edit_profile" enctype="multipart/form-data" id="edit_profile_4664" method="post" novalidate="novalidate"><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="on6ydQ/fatuaMF1HmXr619Uo0LG2BbnG2hiHcZduqmo=" /></div>
<div class="control-group select optional"><label class="select optional control-label" for="profile_field_visibility"> Looking for Partners Visibility</label><div class="controls"><select class="select optional" id="profile_field_visibility" name="profile[field_visibility]"><option value="Public" selected="selected">Public</option>
<option value="Government">Government</option>
<option value="Business Partners">Business Partners</option></select></div></div>
<div class="control-group string optional"><label class="string optional control-label" for="profile_salutation"> Salutation</label><div class="controls"><input class="string optional" id="profile_salutation" name="profile[salutation]" size="50" type="text" value="" /></div></div>
<div class="control-group string required"><label class="string required control-label" for="profile_first_name"><abbr title="required">*</abbr> First name</label><div class="controls"><input class="string required" id="profile_first_name" name="profile[first_name]" size="50" type="text" value="test" /></div></div>
<div class="control-group string required"><label class="string required control-label" for="profile_last_name"><abbr title="required">*</abbr> Last name</label><div class="controls"><input class="string required" id="profile_last_name" name="profile[last_name]" size="50" type="text" value="user" /></div></div>
<div class="control-group string optional"><label class="string optional control-label" for="profile_preferred_name"> Preferred name</label><div class="controls"><input class="string optional" id="profile_preferred_name" name="profile[preferred_name]" size="50" type="text" value="" /></div></div>
<div class="control-group string optional"><label class="string optional control-label" for="profile_role"> Role</label><div class="controls"><input class="string optional" id="profile_role" name="profile[role]" size="50" type="text" value="" /></div></div>
<div class="control-group email optional"><label class="email optional control-label" for="profile_email"> Profile Email Address</label><div class="controls"><input class="string email optional" id="profile_email" name="profile[email]" size="50" type="email" value="[email protected]" /></div></div>
<div class="control-group tel optional"><label class="tel optional control-label" for="profile_phone"> Phone</label><div class="controls"><input class="string tel optional" id="profile_phone" name="profile[phone]" size="50" type="tel" value="" /></div></div>
<div class="control-group text optional"><label class="text optional control-label" for="profile_street"> Street</label><div class="controls"><textarea class="text optional" cols="40" id="profile_street" name="profile[street]" rows="20">
</textarea></div></div>
<div class="control-group string optional"><label class="string optional control-label" for="profile_city"> City</label><div class="controls"><input class="string optional" id="profile_city" name="profile[city]" size="50" type="text" value="" /></div></div>
<div class="control-group string optional"><label class="string optional control-label" for="profile_state"> State</label><div class="controls"><input class="string optional" id="profile_state" name="profile[state]" size="50" type="text" value="" /></div></div>
<div class="control-group string optional"><label class="string optional control-label" for="profile_zip"> Zip</label><div class="controls"><input class="string optional" id="profile_zip" name="profile[zip]" size="50" type="text" value="" /></div></div>
<div class="control-group text optional"><label class="text optional control-label" for="profile_bio"> Bio</label><div class="controls"><textarea class="text optional" cols="40" id="profile_bio" name="profile[bio]" rows="20">
</textarea></div></div>
<div class="control-group text optional"><label class="text optional control-label" for="profile_responsibilities"> Responsibilities</label><div class="controls"><textarea class="text optional" cols="40" id="profile_responsibilities" name="profile[responsibilities]" rows="20">
</textarea></div></div>
<div class="control-group text optional"><label class="text optional control-label" for="profile_picture"> Picture</label><div class="controls"><textarea class="text optional" cols="40" id="profile_picture" name="profile[picture]" rows="20">
</textarea></div></div>
<div class="control-group hidden"><div class="controls"><input class="hidden" id="profile_picture_cache" name="profile[picture_cache]" type="hidden" /></div></div>
<div class="control-group select optional"><label class="select optional control-label" for="profile_veteran_status"> Veteran status</label><div class="controls"><select class="select optional" id="profile_veteran_status" name="profile[veteran_status]"><option value="yes" selected="selected">yes</option>
<option value="no">no</option></select></div></div>
<div class="control-group select optional"><label class="select optional control-label" for="profile_branch"> Branch</label><div class="controls"><select class="select optional" id="profile_branch" name="profile[branch]"><option value="N/A" selected="selected">N/A</option>
<option value="Army">Army</option>
<option value="Navy">Navy</option>
<option value="Air Force">Air Force</option>
<option value="Marines">Marines</option>
<option value="Reserves">Reserves</option>
<option value="Coast Guard">Coast Guard</option>
<option value="National Guard">National Guard</option></select></div></div>
<div class="control-group string optional"><label class="string optional control-label" for="profile_linkedin"> Linkedin</label><div class="controls"><input class="string optional" id="profile_linkedin" name="profile[linkedin]" size="50" type="text" value="" /></div></div>
<div class="control-group boolean optional"><label class="boolean optional control-label" for="profile_government_employee"> Government employee?</label><div class="controls"><input name="profile[government_employee]" type="hidden" value="0" /><label class="checkbox"><input class="boolean optional" id="profile_government_employee" name="profile[government_employee]" type="checkbox" value="1" /></label></div></div>
<p>
The following fields are necessary for confirmation, if you claim to be a government employee.
</p>
<div class="control-group string optional"><label class="string optional control-label" for="profile_supervisor_name"> Supervisor name</label><div class="controls"><input class="string optional" id="profile_supervisor_name" name="profile[supervisor_name]" size="50" type="text" /></div></div>
<div class="control-group string optional"><label class="string optional control-label" for="profile_supervisor_title"> Supervisor title</label><div class="controls"><input class="string optional" id="profile_supervisor_title" name="profile[supervisor_title]" size="50" type="text" /></div></div>
<div class="control-group string optional"><label class="string optional control-label" for="profile_supervisor_organization"> Supervisor organization</label><div class="controls"><input class="string optional" id="profile_supervisor_organization" name="profile[supervisor_organization]" size="50" type="text" /></div></div>
<div class="control-group email optional"><label class="email optional control-label" for="profile_supervisor_email"> Supervisor email</label><div class="controls"><input class="string email optional" id="profile_supervisor_email" name="profile[supervisor_email]" size="50" type="email" /></div></div>
<div class="control-group boolean optional"><label class="boolean optional control-label" for="profile_visible"> Let people see my profile</label><div class="controls"><input name="profile[visible]" type="hidden" value="0" /><label class="checkbox"><input checked="checked" class="boolean optional" id="profile_visible" name="profile[visible]" type="checkbox" value="1" /></label></div></div>
<input class="btn" name="commit" type="submit" value="Update Profile" />
</form>
<a href="/organizations/3/profiles/4664">View this profile</a> |
<a href="/organizations/3/profiles">View all profiles for Halfaker and Associates, LLC</a>
</div>
</div>
<div class="row-fluid footerbar">
<div class="footername">
VetGovPartner - copyright 2012
</div>
<div class="footerlinks">
<a href="/contact">Contact</a>
<a href="/about">About</a>
<a href="/faq">FAQ</a>
<a href="/terms">Terms</a>
</div>
</div>
</div>
</div>
</body>
</html>
<form accept-charset="UTF-8" action="/organizations/3/profiles/4664" class="simple_form edit_profile" enctype="multipart/form-data" id="edit_profile_4664" method="post" novalidate="novalidate"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"><input name="_method" type="hidden" value="put"><input name="authenticity_token" type="hidden" value="on6ydQ/fatuaMF1HmXr619Uo0LG2BbnG2hiHcZduqmo="></div>
<div class="control-group select optional"><label class="select optional control-label" for="profile_field_visibility"> Looking for Partners Visibility</label><div class="controls"><select class="select optional" id="profile_field_visibility" name="profile[field_visibility]"><option value="Public" selected="selected">Public</option>
<option value="Government">Government</option>
<option value="Business Partners">Business Partners</option></select></div></div>
<div class="control-group string optional"><label class="string optional control-label" for="profile_salutation"> Salutation</label><div class="controls"><input class="string optional" id="profile_salutation" name="profile[salutation]" size="50" type="text" value=""></div></div>
<div class="control-group string required"><label class="string required control-label" for="profile_first_name"><abbr title="required">*</abbr> First name</label><div class="controls"><input class="string required" id="profile_first_name" name="profile[first_name]" size="50" type="text" value="test"></div></div>
<div class="control-group string required"><label class="string required control-label" for="profile_last_name"><abbr title="required">*</abbr> Last name</label><div class="controls"><input class="string required" id="profile_last_name" name="profile[last_name]" size="50" type="text" value="user"></div></div>
<div class="control-group string optional"><label class="string optional control-label" for="profile_preferred_name"> Preferred name</label><div class="controls"><input class="string optional" id="profile_preferred_name" name="profile[preferred_name]" size="50" type="text" value=""></div></div>
<div class="control-group string optional"><label class="string optional control-label" for="profile_role"> Role</label><div class="controls"><input class="string optional" id="profile_role" name="profile[role]" size="50" type="text" value=""></div></div>
<div class="control-group email optional"><label class="email optional control-label" for="profile_email"> Profile Email Address</label><div class="controls"><input class="string email optional" id="profile_email" name="profile[email]" size="50" type="email" value="[email protected]"></div></div>
<div class="control-group tel optional"><label class="tel optional control-label" for="profile_phone"> Phone</label><div class="controls"><input class="string tel optional" id="profile_phone" name="profile[phone]" size="50" type="tel" value=""></div></div>
<div class="control-group text optional"><label class="text optional control-label" for="profile_street"> Street</label><div class="controls"><textarea class="text optional" cols="40" id="profile_street" name="profile[street]" rows="20"></textarea></div></div>
<div class="control-group string optional"><label class="string optional control-label" for="profile_city"> City</label><div class="controls"><input class="string optional" id="profile_city" name="profile[city]" size="50" type="text" value=""></div></div>
<div class="control-group string optional"><label class="string optional control-label" for="profile_state"> State</label><div class="controls"><input class="string optional" id="profile_state" name="profile[state]" size="50" type="text" value=""></div></div>
<div class="control-group string optional"><label class="string optional control-label" for="profile_zip"> Zip</label><div class="controls"><input class="string optional" id="profile_zip" name="profile[zip]" size="50" type="text" value=""></div></div>
<div class="control-group text optional"><label class="text optional control-label" for="profile_bio"> Bio</label><div class="controls"><textarea class="text optional" cols="40" id="profile_bio" name="profile[bio]" rows="20"></textarea></div></div>
<div class="control-group text optional"><label class="text optional control-label" for="profile_responsibilities"> Responsibilities</label><div class="controls"><textarea class="text optional" cols="40" id="profile_responsibilities" name="profile[responsibilities]" rows="20"></textarea></div></div>
<div class="control-group text optional"><label class="text optional control-label" for="profile_picture"> Picture</label><div class="controls"><textarea class="text optional" cols="40" id="profile_picture" name="profile[picture]" rows="20"></textarea></div></div>
<div class="control-group hidden"><div class="controls"><input class="hidden" id="profile_picture_cache" name="profile[picture_cache]" type="hidden"></div></div>
<div class="control-group select optional"><label class="select optional control-label" for="profile_veteran_status"> Veteran status</label><div class="controls"><select class="select optional" id="profile_veteran_status" name="profile[veteran_status]"><option value="yes" selected="selected">yes</option>
<option value="no">no</option></select></div></div>
<div class="control-group select optional"><label class="select optional control-label" for="profile_branch"> Branch</label><div class="controls"><select class="select optional" id="profile_branch" name="profile[branch]"><option value="N/A" selected="selected">N/A</option>
<option value="Army">Army</option>
<option value="Navy">Navy</option>
<option value="Air Force">Air Force</option>
<option value="Marines">Marines</option>
<option value="Reserves">Reserves</option>
<option value="Coast Guard">Coast Guard</option>
<option value="National Guard">National Guard</option></select></div></div>
<div class="control-group string optional"><label class="string optional control-label" for="profile_linkedin"> Linkedin</label><div class="controls"><input class="string optional" id="profile_linkedin" name="profile[linkedin]" size="50" type="text" value=""></div></div>
<div class="control-group boolean optional"><label class="boolean optional control-label" for="profile_government_employee"> Government employee?</label><div class="controls"><input name="profile[government_employee]" type="hidden" value="0"><label class="checkbox"><input class="boolean optional" id="profile_government_employee" name="profile[government_employee]" type="checkbox" value="1"></label></div></div>
<p>
The following fields are necessary for confirmation, if you claim to be a government employee.
</p>
<div class="control-group string optional"><label class="string optional control-label" for="profile_supervisor_name"> Supervisor name</label><div class="controls"><input class="string optional" id="profile_supervisor_name" name="profile[supervisor_name]" size="50" type="text"></div></div>
<div class="control-group string optional"><label class="string optional control-label" for="profile_supervisor_title"> Supervisor title</label><div class="controls"><input class="string optional" id="profile_supervisor_title" name="profile[supervisor_title]" size="50" type="text"></div></div>
<div class="control-group string optional"><label class="string optional control-label" for="profile_supervisor_organization"> Supervisor organization</label><div class="controls"><input class="string optional" id="profile_supervisor_organization" name="profile[supervisor_organization]" size="50" type="text"></div></div>
<div class="control-group email optional"><label class="email optional control-label" for="profile_supervisor_email"> Supervisor email</label><div class="controls"><input class="string email optional" id="profile_supervisor_email" name="profile[supervisor_email]" size="50" type="email"></div></div>
<div class="control-group boolean optional"><label class="boolean optional control-label" for="profile_visible"> Let people see my profile</label><div class="controls"><input name="profile[visible]" type="hidden" value="0"><label class="checkbox"><input checked="checked" class="boolean optional" id="profile_visible" name="profile[visible]" type="checkbox" value="1"></label></div></div>
<input class="btn" name="commit" type="submit" value="Update Profile">
</form>
<%= simple_form_for(@profile, url: organization_profile_path(@organization, @profile), html: {:multipart => true}) do |f| %>
<%= f.input :field_visibility,
:label => "Looking for Partners Visibility",
:collection => Profile.field_visibilities,
:include_blank => false %>
<%= f.input :salutation %>
<%= f.input :first_name %>
<%= f.input :last_name %>
<%= f.input :preferred_name %>
<%= f.input :role %>
<%= f.input :email, :label => "Profile Email Address" %>
<%= f.input :phone %>
<%= f.input :street, :as => :text %>
<%= f.input :city %>
<%= f.input :state %>
<%= f.input :zip %>
<%= f.input :bio, :as => :text %>
<% if @profile.organization and @profile.organization.class === AgencyOffice %>
<%= f.input :resume, :as=>:text%>
<% else %>
<%= f.input :responsibilities, :as => :text %>
<% end %>
<%= f.input :picture, :as => :text %>
<%= f.input :picture_cache, :as => :hidden %>
<%= f.input :veteran_status,
:collection => Profile.veteran_status,
:include_blank => false %>
<%= f.input :branch,
:collection => Profile.branch,
:include_blank => false %>
<%= f.input :linkedin %>
<% if @profile.has_gov_email_addy %>
<%= f.input :government_employee?, :as => :boolean %>
<p>
The following fields are necessary for confirmation, if you claim to be a government employee.
</p>
<%= f.input :supervisor_name %>
<%= f.input :supervisor_title %>
<%= f.input :supervisor_organization %>
<%= f.input :supervisor_email %>
<%= f.input :visible, :label => "Let people see my profile" %>
<% end %>
<%= f.button :submit %>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment