Skip to content

Instantly share code, notes, and snippets.

@PeteMichaud
Created June 28, 2012 16:37
Show Gist options
  • Save PeteMichaud/3012373 to your computer and use it in GitHub Desktop.
Save PeteMichaud/3012373 to your computer and use it in GitHub Desktop.
<fieldset>
<legend><%= form_legend %></legend>
<div class='control-group<%= " error" if @user.errors.has_key?(:email) %>'>
<label class='control-label'>Email</label>
<div class='controls'>
<%= f.text_field :email, :class => 'input-xlarge' %>
<% if @user.errors.has_key?(:email) %>
<span class='help-inline'>Email <%= @user.errors.get(:email).first %></span>
<% end %>
</div>
</div>
<div class='control-group<%= " error" if @user.errors.has_key?(:password) %>'>
<label class='control-label'>Password</label>
<div class='controls'>
<%= f.password_field :password, :class => 'input-xlarge ' %>
<% if @user.errors.has_key?(:password) %>
<span class='help-inline'>Password <%= @user.errors.get(:password).first %></span>
<% end %>
</div>
</div>
<div class='control-group<%= " error" if @user.errors.has_key?(:password) %>'>
<label class='control-label'> </label>
<div class='controls'>
<%= password_field_tag :password_confirmation, "", { :class => 'input-xlarge ', :placeholder => 'Password Confirmation...' } %>
<% if @user.errors.has_key?(:password_confirmation) %>
<span class='help-inline'>Password <%= @user.errors.get(:password_confirmation).first %></span>
<% end %>
</div>
</div>
<div class='control-group<%= " error" if @user.errors.has_key?(:first_name) %>'>
<label class='control-label'>First Name</label>
<div class='controls'>
<%= f.text_field :first_name, :class => 'input-xlarge ' %>
<% if @user.errors.has_key?(:first_name) %>
<span class='help-inline'>Password <%= @user.errors.get(:first_name).first %></span>
<% end %>
</div>
</div>
<div class='control-group<%= " error" if @user.errors.has_key?(:last_name) %>'>
<label class='control-label'>Last Name</label>
<div class='controls'>
<%= f.text_field :last_name, :class => 'input-xlarge ' %>
<% if @user.errors.has_key?(:last_name) %>
<span class='help-inline'>Password <%= @user.errors.get(:last_name).first %></span>
<% end %>
</div>
</div>
<% if @user.subscription.nil? %>
Can't update user plan because this user is not subscribed.
<% else %>
<div class='control-group<%= " error" if @user.errors.has_key?(:plan_id) %>'>
<label class='control-label'>Plan</label>
<div class='controls'>
<%= f.select :plan_id, @plans.map {|p| [p.plan_name, p.id] } %>
<% if @user.errors.has_key?(:plan_id) %>
<span class='help-inline'>Plan <%= @user.errors.get(:plan_id).first %></span>
<% end %>
</div>
</div>
<% end %>
<div class='form-actions'>
<%= submit_tag submit_label, :class => 'btn btn-primary' %>
<%= link_to "Cancel", {:action => 'index'}, :class => 'btn' %>
</div>
</fieldset>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment