openSUSE/osem

View on GitHub
app/views/admin/tickets/_form.html.haml

Summary

Maintainability
Test Coverage
= form_for(@ticket, url: (@ticket.new_record? ? admin_conference_tickets_path : admin_conference_ticket_path(@conference.short_title, @ticket))) do |f|
  .form-group
    = f.label :title
    %abbr{title: 'This field is required'} *
    = f.text_field :title, required: true, autofocus: true, class: 'form-control'
  .form-group
    = f.text_area :description, rows: 5, data: { provide: 'markdown' }, class: 'form-control'
  .form-group
    = f.label :price
    = f.number_field :price, class: 'form-control'
  - if Ticket.where(conference: @conference).empty?
    .form-group
      = f.label :price_currency, 'Currency'
      = f.select :price_currency, ['USD', 'EUR', 'GBP', 'INR', 'CNY', 'CHF'], { include_blank: false }, { class: 'form-control' }
  - else
    = hidden_field_tag "ticket[price_currency]", f.object.conference.tickets.first.price_currency
    %span.help-block
      Your conference tickets are in
      = f.object.conference.tickets.first.price_currency
  .checkbox
    %label
      = f.check_box :registration_ticket
      A registration ticket is with which user register for the conference.
  %p.text-right
    = f.submit nil, class: 'btn btn-primary'