60 lines
2.6 KiB
Text
60 lines
2.6 KiB
Text
.row
|
|
.col-md-12
|
|
.page-header
|
|
%h1
|
|
Questions
|
|
- if can? :create, Question.new(conference_id: @conference.id)
|
|
= link_to 'Create New Question','#', 'data-toggle' => 'modal',
|
|
'data-target' => '#new-question', class: 'btn btn-success pull-right'
|
|
%p.text-muted
|
|
People will have to answer your questions during registration to your conference
|
|
.row
|
|
.col-md-12
|
|
- if @questions.count > 0
|
|
|
|
.questions
|
|
%table.table.table-hover.datatable#questions
|
|
%thead
|
|
%th Enabled
|
|
%th Title
|
|
%th Type
|
|
%th Answers
|
|
%th Actions
|
|
%tbody
|
|
- @questions.each do |question|
|
|
%tr
|
|
%td
|
|
= check_box_tag @conference.short_title, question.id, (@conference.questions.include? question),
|
|
method: :patch, url: "/admin/conference/#{@conference.short_title}/questions/#{question.id}/toggle_question?enable=",
|
|
disabled: question.answers.blank? || !(can? :update, Question.new(conference_id: @conference.id) ), class: 'switch-checkbox', data: { size: 'small',
|
|
off_color: 'warning',
|
|
on_text: 'Yes',
|
|
off_text: 'No' }
|
|
|
|
|
|
%td
|
|
= question.title
|
|
%td
|
|
= question.question_type.title
|
|
%td
|
|
= question.answers.map {|answer| "#{answer.title} (#{answer.sum_replies question, @conference})"}.join(', ')
|
|
|
|
%td
|
|
.btn-group
|
|
= link_to 'Show', admin_conference_question_path(@conference.short_title, question), class: 'btn btn-success', disabled: !(can? :show, question)
|
|
= link_to 'Edit', edit_admin_conference_question_path(@conference.short_title, question),
|
|
class: 'btn btn-primary', disabled: !(can? :update, question)
|
|
= link_to 'Delete', admin_conference_question_path(@conference.short_title, question),
|
|
method: :delete, class: 'btn btn-danger',
|
|
data: { confirm: "Delete question '#{question.title}'?" }, disabled: !(can? :destroy, question)
|
|
|
|
|
|
|
|
.modal.fade{id: 'new-question', 'role' => 'dialog', 'aria-hidden' => 'true'}
|
|
.modal-dialog
|
|
.modal-content
|
|
.modal-header
|
|
%h3{id: 'new-question-header'}
|
|
Create Question
|
|
.modal-body
|
|
= render partial: 'form'
|