estimancy/projestimate

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

Summary

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

      <div>
        <%= f.input :name, :label => I18n.t('name'), :input_html => {:class => 'input-xxlarge', :autofocus => (controller.action_name == 'new')} %>
        <%= f.input :alias, :label => I18n.t('alias'), :input_html => {:class => 'input-xxlarge'} %>
        <%#= f.input :factor_type, :label => I18n.t(:type), :input_html => {:class => 'input-xxlarge'}, collection: ["intermediate", "expert_early_design", "expert_post_architecture"] %>
        <%= f.input :factor_type, :label => I18n.t(:type), :input_html => {:class => 'input-xxlarge'}, collection: ["intermediate", "advanced", "early_design", "expert_early_design", "expert_post_architecture"] %>
        <%= f.input :description, :label => I18n.t('description'), :input_html => {:class => 'input-xxlarge', :rows => 5} %>
        <%= tinymce %>
        <% if current_user.language.locale.downcase == "fr" %>
            <%= f.input :fr_helps, :label => I18n.t(:help_text), :input_html => {class: 'tinymce', rows: 15, cols: 20 } %>
        <% else %>
            <%= f.input :en_helps, :label => I18n.t(:help_text), :input_html => {class: 'tinymce', rows: 15, cols: 20 } %>
        <% end %>

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

      <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'), factors_path(:anchor => 'tabs-1'), :class => 'btn' %>
      </div>
    <% end %>
  </div>

</div>