show users per question
This commit is contained in:
parent
9963c1550f
commit
3b8b86eb85
4 changed files with 32 additions and 0 deletions
|
|
@ -10,6 +10,10 @@ module Admin
|
||||||
@new_question = @conference.questions.new
|
@new_question = @conference.questions.new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@registrations = @conference.registrations.joins(:qanswers).uniq
|
||||||
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@question = Question.new(conference_id: @conference.id)
|
@question = Question.new(conference_id: @conference.id)
|
||||||
authorize! :create, @question
|
authorize! :create, @question
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ class Registration < ActiveRecord::Base
|
||||||
delegate :email, to: :user
|
delegate :email, to: :user
|
||||||
delegate :nickname, to: :user
|
delegate :nickname, to: :user
|
||||||
delegate :affiliation, to: :user
|
delegate :affiliation, to: :user
|
||||||
|
delegate :username, to: :user
|
||||||
|
|
||||||
alias_attribute :other_needs, :other_special_needs
|
alias_attribute :other_needs, :other_special_needs
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
%td
|
%td
|
||||||
.btn-group
|
.btn-group
|
||||||
|
= link_to 'Show', admin_conference_question_path(@conference.short_title, q), class: 'btn btn-success'
|
||||||
= link_to 'Edit', edit_admin_conference_question_path(@conference.short_title, q),
|
= link_to 'Edit', edit_admin_conference_question_path(@conference.short_title, q),
|
||||||
class: 'btn btn-primary', disabled: !(can? :update, q)
|
class: 'btn btn-primary', disabled: !(can? :update, q)
|
||||||
= link_to 'Delete', admin_conference_question_path(@conference.short_title, q),
|
= link_to 'Delete', admin_conference_question_path(@conference.short_title, q),
|
||||||
|
|
|
||||||
26
app/views/admin/questions/show.html.haml
Normal file
26
app/views/admin/questions/show.html.haml
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
.container
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
.page-header
|
||||||
|
%h1= @question.title
|
||||||
|
- @question.answers.each do |answer|
|
||||||
|
= answer.title
|
||||||
|
(#{answer.qanswers.find_by(question: @question).registrations.where(conference: @conference).count})
|
||||||
|
|
||||||
|
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
|
||||||
|
%table.table.table-border.table-hover.datatable#question_users
|
||||||
|
%thead
|
||||||
|
%th Name
|
||||||
|
%th Username
|
||||||
|
%th Email
|
||||||
|
%th Answer
|
||||||
|
%tbody
|
||||||
|
- @registrations.each do |registration|
|
||||||
|
%tr
|
||||||
|
%td= registration.name
|
||||||
|
%td= registration.username
|
||||||
|
%td= registration.email
|
||||||
|
%td= registration.qanswers.find_by(question: @question).answer.title
|
||||||
Loading…
Add table
Add a link
Reference in a new issue