estimancy/projestimate

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

Summary

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

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

      <div class="form-inputs">
        <%= f.input :name, :label => I18n.t(:name), :input_html => {:class => 'input-xxlarge', :autofocus => (controller.action_name == 'new')} %>
        <%= f.input :description, :label => I18n.t(:description), :input_html => {:class => 'input-xxlarge', :rows => 8 }  %>
        <%= f.input :cost_per_hour, :label => I18n.t(:cost_per_hour) %>
      </div>

      <div>
        <%= f.association :record_status, :label => I18n.t('record_status'),
            :collection => @profile.record_status_collection,
            :input_html => {:class => 'record_status'},
            :selected => (@profile.is_defined_or_nil? ? @proposed_status.id : @profile.record_status_id),
            :disabled => (true if @profile.is_retired?) %>

        <%= f.input :custom_value, :label => I18n.t('custom_value'), :input_html => {:class => 'custom_value'}, :disabled => (true unless @profile.is_custom?) %>
        <%= f.input :change_comment, :label => I18n.t('change_comment'), :input_html => {:class => 'input-xxlarge', :rows => 2} %>
    </div>

    <br /><br />
    <div class="actions-tabs">
      <% 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 %>
      <%= link_to I18n.t('back'), profiles_path, :class => 'btn' %>
    </div>

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