fiuba/alfred

View on GitHub
admin/views/courses/_form.erb

Summary

Maintainability
Test Coverage
<% error = @course.errors.key?(:name) && @course.errors[:name].count > 0 %>
<fieldset class='control-group <%= error ? 'has-error' : ''%>'>
  <%= f.label :name, :class => 'control-label' %>
  <div class='controls'>
    <%= f.text_field :name, :class => 'input-xlarge input-with-feedback', :autofocus => true %>
    <span class='help-inline'><%= error ? f.error_message_on(:name) : "Ex: a simple text" %></span>
  </div>
</fieldset>
<% error = @course.errors.key?(:active) && @course.errors[:active].count > 0 %>
<fieldset class='control-group <%= error ? 'has-error' : ''%>'>
  <%= f.label :active, :class => 'control-label' %>
  <div class='controls'>
    <%= f.check_box :active, :class => 'input-xlarge input-with-feedback' %>
    <span class='help-inline'><%= error ? f.error_message_on(:active) : "Ex: a simple text" %></span>
  </div>
</fieldset>


<div class="form-actions">
  <%= f.submit pat(:save), :class => 'btn btn-primary' %>
  &nbsp;
  <%= f.submit pat(:save_and_continue), :class => 'btn btn-info', :name => 'save_and_continue' %>
  &nbsp;
  <%= link_to pat(:cancel), url(:courses, :index), :class => 'btn' %>
</div>