estimancy/projestimate

View on GitHub
app/views/record_statuses/_form.html.erb

Summary

Maintainability
Test Coverage
<div class="tabs">
  <ul>
    <li><a href="#tabs-1"><%= I18n.t(:record_status) %> </a></li>
  </ul>
  <div id="tabs-1">
    <%= simple_form_for(@record_status) do |f| %>
        <%= f.error_notification %>

        <%= f.input :name, :label => I18n.t('name'), :input_html => {:autofocus => (controller.action_name == 'new')} %>
        <%= f.input :description, :label => I18n.t('description'), :input_html => {:class => 'input-xxlarge'} %>

        <table>
          <tr>
            <td>
              <%= f.association :record_status, :label => I18n.t('record_status'),
                                :collection => @record_status.record_status_collection,
                                :input_html => {:class => 'record_status'},
                                :selected => (@record_status.is_defined_or_nil? ? @proposed_status.id : @record_status.record_status_id),
                                :disabled => (true if @record_status.is_retired?) %>
            </td>
            <td>
              <%= f.input :custom_value, :label => I18n.t('custom_value'), :input_html => {:class => 'custom_value'}, :disabled => (true unless @record_status.is_custom?) %>
            </td>
          </tr>
        </table>
        <%= f.input :change_comment, :label => I18n.t('change_comment'), :input_html => {:class => 'input-xxlarge', :rows => 2} %>

        <div class="actions-tabs">
          <% if action_name.in?(%w(new create)) %>
              <%= submit_tag I18n.t('save_and_create'), :class => 'btn' %>
              <%= submit_tag I18n.t('save'), :class => 'btn' %>
          <% elsif action_name == 'edit' || action_name=="update" %>
              <%= submit_tag I18n.t('save'), :class => 'btn' %>
              <%= submit_tag I18n.t('apply'), :class => 'btn' %>
          <% end %>
          <%= link_to I18n.t('back'), record_statuses_path, :class => 'btn' %>

        </div>
    <% end %>
  </div>
</div>