infusionvlc/infusion

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

Summary

Maintainability
Test Coverage
<%= form_for(Report.new) do |f| %>
  <div class="field">
    <%= f.label :title %><br>
    <%= f.text_field :title, class:'form-control' %>
  </div>

  <% if @reportable_type == "Meetup"%>
    <%= f.hidden_field :reportable_id,   value: @meetup.id %>
  <% end %>

  <% if @reportable_type == "Proposal"%>
    <%= f.hidden_field :reportable_id,   value: @proposal.id %>
  <% end %>

  <%= f.hidden_field :reportable_type, value: @reportable_type %>

  <div class="field">
    <%= f.label :type_of %><br />
    <%= f.select :type_of, [[(I18n.t 'report.type.hate'), 0 ], [(I18n.t 'report.type.menace'), 1], [(I18n.t 'report.type.pornography'), 2], [(I18n.t 'report.type.community'), 3], [(I18n.t 'report.type.other'), 4]], {}, class: 'form-control' %>
  </div>

  <div class="field">
    <%= f.label :description %><br>
    <%= f.text_field :description, class:'form-control' %>
  </div>

  <br/>
  <div class="actions">
    <%= f.submit class: 'btn btn-primary', value: I18n.t('report.create') %>
  </div>
<% end %>