openSUSE/osem

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

Summary

Maintainability
Test Coverage
.row
  .col-md-12
    .page-header
      - if @survey.new_record?
        %h1 New Survey
      - else
        %h1 Edit Survey: #{ @survey.title }

  .col-md-6
    = form_for @survey, url: @url do |f|
      = f.hidden_field :surveyable_type
      = f.hidden_field :surveyable_id
      .form-group
        = f.label :title
        %abbr{title: 'This field is required'} *
        = f.text_field :title, class: 'form-control'
      .form-group
        = f.label :description
        = f.text_area :description, rows: 3, class: 'form-control'
      .form-group
        = f.label :target, "When to ask"
        = f.select :target, Survey.targets.keys, class: 'form-control'
      .form-group
        = f.label :start_date
        = f.datetime_field :start_date, class: 'form-control'
        = f.label :end_date
        = f.datetime_field :end_date, class: 'form-control'
      = f.submit nil, class: 'btn btn-primary'