estimancy/projestimate

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

Summary

Maintainability
Test Coverage
<div class="tabs">
  <ul>
    <li><a href="#tabs-1"><%= I18n.t(:size_unit) %> </a></li>
  </ul>

  <div id="tabs-1">
    <%= simple_form_for(@size_unit) do |f| %>
      <%= f.error_notification %>

      <div class="form-inputs">
        <%= f.input :name %>
        <%= f.input :alias %>
        <%= f.input :description, :input_html => { :class => 'input-xxlarge', :rows => 5} %>
      </div>

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

      <br>

      <div class="actions-tabs">
        <% if can? :edit_organizations, Organization %>
          <% if action_name == 'new' || action_name=='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 %>
        <% end %>
        <%= link_to I18n.t('back'), organizationals_params_path(:anchor => "tabs-2"), :class => 'btn' %>
      </div>
    <% end %>
  </div>
</div>