JordanHatch/maslow-redux

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

Summary

Maintainability
Test Coverage
<%= semantic_form_for need do |f| %>
  <%= f.inputs "What is the user story?", :id => "user-story" do %>
    <%= f.input :role, :label => "As a…", :hint => "Who is the user? E.g. a small business, a tax agent, a healthcare practitioner. Put 'user' when there's more than one type of user.", :required => false, :input_html => { :class => 'input-md-8' } %>
    <%= f.input :goal, :label => "I need to…", :hint => "What does the user want to do?", :required => false, :input_html => { :class => 'input-md-8' } %>
    <%= f.input :benefit, :label => "So that…", :hint => "Why does the user want to do this?", :required => false, :input_html => { :class => 'input-md-8' } %>
  <% end %>

  <% if presenter.show_proposition_statements? %>
    <%= f.inputs "Which criteria of the proposition does this need meet?" do %>
      <%= f.input :proposition_statement_ids, as: :check_boxes,
                                              label: false,
                                              collection: PropositionStatement.all.map {|statement|
                                                [(content_tag(:h3, statement.name) +
                                                    content_tag(:p, statement.description)),
                                                  statement.id]
                                              },
                                              wrapper_html: {
                                                class: 'need-proposition-selection',
                                              } %>
    <% end %>
  <% end %>

  <%= render partial: 'shared/concerns/followable/form', locals: { form: f, label: 'Which teams are involved with this need?' } %>

  <% if presenter.show_tags? %>
    <%= f.inputs "Tag this need to collections", class: 'tags' do %>
      <%= render partial: "tag_type", collection: TagType.all, locals: { f: f } %>
    <% end %>
  <% end %>

  <div class="navbar-btn">
    <%= f.action :submit,
                 :button_html => {
                   :value => "Save",
                   :class => "btn btn-primary"
                 }
               %>
    <%= f.action :submit,
                 :button_html => {
                   :name => "add_new",
                   :value => "Save and add a new need",
                   :class => "btn btn-primary"
                 }
               %>
  </div>
<% end %>