estimancy/projestimate

View on GitHub
app/views/organization_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(@organization_profile) do |f| %>
        <%= f.error_notification %>

        <div class="form-inputs">
          <%= f.input :organization_id, :as => :hidden, :input_html => { :value => @organization.id } %>

          <div class="well input-xxlarge">
             <span><%= I18n.t(:select_profile_or_fill_text_fields) %></span><br>
             <%= select_tag 'profile_id_for_organization', options_for_select(Profile.defined.all.map { |i| [i.name, i.id] }, :selected => nil), prompt: "#{I18n.t("helpers.select.prompt")} #{I18n.t(:profile)}", :class => 'input-xlarge btn btn-info' %>

          </div>

          <%#= f.input :profile_id, label: I18n.t(:profiles), as: :select, collection: Profile.all, selected: @organization_profile.profile_id||nil, prompt: I18n.t("helpers.select.prompt"), input_html: { class: 'input-xxlarge'} %>
          <%= 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)} (#{@organization.currency})" %>
        </div>

        <br />
        <div class="actions-tabs">
          <% if can? :manage, OrganizationProfile %>
              <% 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'), organization_setting_path(@organization, :anchor => 'tabs-profile'), :class => 'btn' %>
        </div>
    <% end %>
  </div>
</div>