Merge pull request #313 from differentreality/questions_fix
Questions fix
This commit is contained in:
commit
2830256ebb
4 changed files with 35 additions and 24 deletions
|
|
@ -1,8 +1,10 @@
|
||||||
.row
|
.row
|
||||||
.col-md-6
|
.col-md-6
|
||||||
%legend Question
|
%legend Question
|
||||||
= f.input :title, :label => "Your Question"
|
= f.input :title, label: 'Your Question'
|
||||||
= f.input :question_type
|
= f.input :question_type
|
||||||
= f.input :global, :label => "Make Global", :hint => "(Global questions are available for selection to all conferences)"
|
= f.input :global, label: 'Make Global',
|
||||||
|
hint: '(Global questions are available for selection to all conferences)'
|
||||||
.col-md-6
|
.col-md-6
|
||||||
= dynamic_association :answers, "Answers", f, :hint => "Insert your answers in the order you want them to appear"
|
= dynamic_association :answers, 'Answers', f,
|
||||||
|
hint: 'Insert your answers in the order you want them to appear'
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,28 @@
|
||||||
%h2
|
%h2
|
||||||
Questions for #{@conference.short_title}
|
Questions for #{@conference.short_title}
|
||||||
- if @questions_conference.count
|
- if @questions_conference.count
|
||||||
= "(#{@questions_conference.count})"
|
= "(#{@questions_conference.count})"
|
||||||
%i The questions will appear in the registration page of the conference
|
%i The questions will appear in the registration page of the conference
|
||||||
|
|
||||||
%table.table
|
%table.table
|
||||||
- @questions.each do |q|
|
- @questions.each do |q|
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
= hidden_field_tag "conference[question_ids][]", nil
|
= hidden_field_tag "conference[question_ids][]", nil
|
||||||
= check_box_tag "conference[question_ids][]", q.id, @conference.question_ids.include?(q.id), id: dom_id(q)
|
= check_box_tag "conference[question_ids][]", q.id,
|
||||||
|
@conference.question_ids.include?(q.id), id: dom_id(q)
|
||||||
%td
|
%td
|
||||||
= label_tag dom_id(q), q.title
|
= label_tag dom_id(q), q.title
|
||||||
|
%br
|
||||||
= label_tag dom_id(q), "Type: #{q.question_type.title}"
|
= label_tag dom_id(q), "Type: #{q.question_type.title}"
|
||||||
|
= ','
|
||||||
= label_tag dom_id(q), "Answers: #{q.answers.map {|a| a.title}.join(', ')}"
|
= label_tag dom_id(q), "Answers: #{q.answers.map {|a| a.title}.join(', ')}"
|
||||||
|
|
||||||
%td= link_to "Edit", edit_admin_conference_question_path(@conference.short_title, q), :class => "btn btn-primary", :disabled => q.global == true && !has_role?(current_user, "Admin")
|
%td= link_to 'Edit', edit_admin_conference_question_path(@conference.short_title, q),
|
||||||
|
class: 'btn btn-primary',
|
||||||
%td= link_to "Delete", admin_conference_question_path(@conference.short_title, q), :method => :delete, :remote => true, :class => "btn btn-danger", :confirm => "Delete question '#{q.title}'?", :disabled => q.global == true && !has_role?(current_user, "Admin")
|
disabled: q.global == true && !has_role?(current_user, 'Admin')
|
||||||
|
|
||||||
|
%td= link_to 'Delete', admin_conference_question_path(@conference.short_title, q),
|
||||||
|
method: :delete, remote: true, class: 'btn btn-danger',
|
||||||
|
confirm: "Delete question '#{q.title}'?",
|
||||||
|
disabled: q.global == true && !has_role?(current_user, "Admin")
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
Edit Question
|
Edit Question
|
||||||
%h3
|
%h3
|
||||||
"#{@question.title}"
|
"#{@question.title}"
|
||||||
= semantic_form_for(@question, :url => admin_conference_question_path(@conference.short_title, @question.id)) do |f|
|
= semantic_form_for(@question, url: admin_conference_question_path(@conference.short_title, @question.id)) do |f|
|
||||||
|
|
||||||
= render :partial => "form", :locals => {:f => f}
|
= render partial: 'form', locals: {f: f}
|
||||||
|
|
||||||
= f.submit "Save", :class => "btn btn-primary", :confirm => "Are you sure you want to make these changes?"
|
= f.submit 'Save', class: 'btn btn-primary', confirm: 'Are you sure you want to make these changes?'
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,28 @@
|
||||||
.row
|
.row
|
||||||
.col-md-8
|
.col-md-8
|
||||||
.pull-right
|
.pull-right
|
||||||
%b= link_to "Create New Question","#", "data-toggle" => "modal", "data-target" => "#new-question", :class => "btn btn-success"
|
%b= link_to 'Create New Question','#', 'data-toggle' => 'modal',
|
||||||
|
'data-target' => '#new-question', class: 'btn btn-success'
|
||||||
%br
|
%br
|
||||||
%br
|
%br
|
||||||
- if @questions.count > 0
|
- if @questions.count > 0
|
||||||
= semantic_form_for(@conference, :url => admin_conference_questions_update_conference_path(@conference.short_title), :method => 'put') do |f|
|
= semantic_form_for(@conference, url: admin_conference_questions_update_conference_path(@conference.short_title)) do |f|
|
||||||
.questions{:id => "myquestions"}
|
.questions{id: 'myquestions'}
|
||||||
= render :partial => "questions"
|
= render partial: 'questions'
|
||||||
= f.submit "Update Questions for #{@conference.short_title}", :class => "btn btn-primary", :confirm => "Are you sure you want to make these changes?"
|
= f.submit "Update Questions for #{@conference.short_title}", class: 'btn btn-primary',
|
||||||
|
confirm: 'Are you sure you want to make these changes?'
|
||||||
|
|
||||||
|
.modal.fade{id: 'new-question', 'role' => 'dialog', 'aria-hidden' => 'true'}
|
||||||
.modal.fade{:id => "new-question", "role" => "dialog", "aria-hidden" => "true"}
|
|
||||||
.modal-dialog
|
.modal-dialog
|
||||||
.modal-content
|
.modal-content
|
||||||
.modal-header
|
.modal-header
|
||||||
%h3{:id => "new-question-header"}
|
%h3{id: 'new-question-header'}
|
||||||
Add new question
|
Add new question
|
||||||
.modal-body
|
.modal-body
|
||||||
= semantic_form_for(@new_question, :url => admin_conference_questions_path(@conference.short_title), :method => :post) do |f|
|
= semantic_form_for(@new_question, url: admin_conference_questions_path(@conference.short_title), method: :post) do |f|
|
||||||
= render :partial => "form", :locals => {:f => f}
|
= render partial: 'form', locals: {f: f}
|
||||||
%button{:class => "btn btn-primary"}
|
%button{class: 'btn btn-primary'}
|
||||||
Save
|
Save
|
||||||
.pull-right
|
.pull-right
|
||||||
%button{:class=> "btn btn-danger", "data-dismiss"=> "modal", "aria-hidden"=>"true"}
|
%button{class: 'btn btn-danger', 'data-dismiss'=> 'modal', 'aria-hidden'=>'true'}
|
||||||
Cancel
|
Cancel
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue