openSUSE/osem

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

Summary

Maintainability
Test Coverage
.row
  .col-md-12
    .page-header
      %h1
        Surveys
        = link_to 'New', new_admin_conference_survey_path(@conference.short_title, survey: {  surveyable_type: 'Conference', surveyable_id: @conference.id }), class: 'btn btn-success pull-right'
      %p.text-muted
        Available surveys for this conference


- if @surveys.any?
  .row
    .col-md-12
      %table.table.table-hover.datatable#surveys
        %thead
          %tr
            %th Title
            %th # of questions
            %th # of submissions
            %th When
            %th Start Date
            %th End Date
            %th Actions
        %tbody
          - @surveys.each_with_index do |survey, index|
            %tr
              %td
                = link_to survey.title, admin_conference_survey_path(@conference.short_title, survey)
              %td
                = survey.survey_questions.length
              %td
                = survey.survey_submissions.length
              %td
                = survey.target
              %td
                = survey.start_date
              %td
                = survey.end_date
              %td
                .btn-group
                  = link_to 'Edit', edit_admin_conference_survey_path(@conference.short_title, survey),
                  class: 'btn btn-primary'
                  = link_to 'Delete', admin_conference_survey_path(@conference.short_title, survey),
                  method: :delete, class: 'btn btn-danger',
                  data: { confirm: "Do you really want to delete #{survey.title}?"}