Feedback overview
This commit is contained in:
parent
76ce1bf861
commit
0af5523a88
|
@ -0,0 +1,13 @@
|
|||
module Management
|
||||
class FeedbackController < ManagementController
|
||||
def index
|
||||
@conference = find_conference
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_conference
|
||||
Conference.eager_load(:feedbacks, :feedbacks_with_comment, :event_feedbacks, :event_feedbacks_with_comment).find(params[:conference_id])
|
||||
end
|
||||
end
|
||||
end
|
|
@ -22,10 +22,15 @@ class Conference < ActiveRecord::Base
|
|||
has_many :participants, -> { distinct }, class_name: "User", through: :events
|
||||
has_many :participant_profiles, class_name: "PersonalProfile"
|
||||
has_many :slots, through: :halls
|
||||
has_many :feedbacks, as: :feedback_receiving
|
||||
has_many :editions, primary_key: :host_name, foreign_key: :host_name, class_name: "Conference"
|
||||
has_many :events_of_all_editions, through: :editions, source: :events
|
||||
|
||||
include FeedbackReceiving
|
||||
has_many :feedbacks, as: :feedback_receiving
|
||||
has_many :feedbacks_with_comment, -> { where.not(comment: [nil, ""]) }, as: :feedback_receiving, class_name: 'Feedback'
|
||||
has_many :event_feedbacks, through: :events, source: :feedbacks
|
||||
has_many :event_feedbacks_with_comment, through: :events, source: :feedbacks_with_comment
|
||||
|
||||
accepts_nested_attributes_for :tracks, :halls, :event_types, :volunteer_teams,
|
||||
reject_if: :all_blank, allow_destroy: true
|
||||
|
||||
|
|
|
@ -32,7 +32,9 @@ nav.navbar.navbar-static-top.navbar-inverse role="navigation"
|
|||
/ li class="#{'active' if controller_name == 'propositions'}"
|
||||
/ = link_to [:management, current_conference, :propositions] do
|
||||
/ => icon 'question', Proposition.model_name.human(count: 2).mb_chars.capitalize, class: 'fa-fw'
|
||||
|
||||
li class="#{'active' if controller_name == 'feedback'}"
|
||||
= link_to management_conference_feedback_index_path(current_conference) do
|
||||
=> icon 'star-half-o', t('activerecord.models.feedback', count: 2).mb_chars.capitalize, class: 'fa-fw'
|
||||
ul.nav.navbar-nav.navbar-right
|
||||
li.dropdown
|
||||
= link_to '#', class: 'dropdown-toggle', data: {toggle: 'dropdown'} do
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<%- csv_headers = %w{id feedback_receiving_type feedback_receiving_id name/title author_email rating comment ip session_id created_at} -%>
|
||||
<%= CSV.generate_line(csv_headers).html_safe -%>
|
||||
<%- @conference.feedbacks.each do |feedback| -%>
|
||||
<%= CSV.generate_line([feedback.id, feedback.feedback_receiving_type, feedback.feedback_receiving_id, feedback.feedback_receiving&.title || feefback.feedback_receiving&.name, feedback.author_email, feedback.rating, feedback.comment, feedback.ip_address, feedback.session_id, feedback.created_at]).html_safe -%>
|
||||
<%- end -%>
|
||||
<%- @conference.event_feedbacks.each do |feedback| -%>
|
||||
<%= CSV.generate_line([feedback.id, feedback.feedback_receiving_type, feedback.feedback_receiving_id, feedback.feedback_receiving&.title || feefback.feedback_receiving&.name, feedback.author_email, feedback.rating, feedback.comment, feedback.ip_address, feedback.session_id, feedback.created_at]).html_safe -%>
|
||||
<%- end -%>
|
|
@ -0,0 +1,62 @@
|
|||
- content_for :title
|
||||
= t '.feedback'
|
||||
|
||||
.row
|
||||
.col-lg-12
|
||||
h1.page-header
|
||||
= t '.feedback'
|
||||
= link_to management_conference_feedback_index_path(@conference, format: 'csv'), class: 'btn btn-info pull-right'
|
||||
= icon :download, t('.export')
|
||||
|
||||
- if @conference.start_date.past? || @conference.rated?
|
||||
.row
|
||||
.col-xs-12
|
||||
h3
|
||||
=< t '.overall_organisation'
|
||||
- if @conference.rated?
|
||||
.row
|
||||
.col-md-10
|
||||
.panel.panel-default
|
||||
.panel-heading = t('.comments')
|
||||
- if @conference.feedbacks_with_comment.order(created_at: :asc).size > 0
|
||||
table.table.table-striped
|
||||
tbody
|
||||
= render partial: '/management/shared/feedback', collection: @conference.feedbacks_with_comment.order(created_at: :asc), locals: {hide_title: true}
|
||||
- else
|
||||
.panel-body
|
||||
= t ('.no_comments_received')
|
||||
.col-md-2
|
||||
.panel.panel-info
|
||||
.panel-heading
|
||||
= t '.average_grade'
|
||||
.panel-body.text-right
|
||||
.huge
|
||||
= number_with_precision(@conference.average_rating, precision: 2, strip_insignificant_zeros: true) || '–'
|
||||
= t('.total_feedback_grades', total_grades: @conference.feedbacks.count, count: @conference.feedbacks.count)
|
||||
- else
|
||||
p = t '.no_feedback_received'
|
||||
|
||||
- if @conference.start_date.past? || @conference.event_feedbacks_with_comment.order(created_at: :asc).size > 0
|
||||
.row
|
||||
.col-xs-12
|
||||
h3
|
||||
=< t '.events'
|
||||
|
||||
- if @conference.event_feedbacks.size > 0
|
||||
.row
|
||||
.col-md-10
|
||||
.panel.panel-default
|
||||
.panel-heading = t('.comments')
|
||||
table.table.table-striped
|
||||
tbody
|
||||
= render partial: '/management/shared/feedback', collection: @conference.event_feedbacks_with_comment.order(created_at: :asc)
|
||||
.col-md-2
|
||||
.panel.panel-info
|
||||
.panel-heading
|
||||
= t '.average_grade'
|
||||
.panel-body.text-right
|
||||
.huge
|
||||
= number_with_precision(@conference.event_feedbacks.average(:rating), precision: 2, strip_insignificant_zeros: true) || '–'
|
||||
= t('.total_feedback_grades', total_grades: @conference.event_feedbacks.count, count: @conference.event_feedbacks.count)
|
||||
- else
|
||||
p = t '.no_comments_received'
|
|
@ -11,6 +11,6 @@ tr
|
|||
= feedback.author_email
|
||||
- else
|
||||
= t(".anonymous")
|
||||
- if !local_assigns[:show_title]
|
||||
- if !local_assigns[:hide_title]
|
||||
span<> = t '.about'
|
||||
= link_to feedback.feedback_receiving.title, [:management, feedback.feedback_receiving.conference, feedback.feedback_receiving]
|
||||
= link_to feedback.feedback_receiving.title, [:management, current_conference, feedback.feedback_receiving]
|
||||
|
|
|
@ -11,6 +11,18 @@ bg:
|
|||
events:
|
||||
metadata: "%{type} на %{language} с продължителност %{length} минути"
|
||||
management:
|
||||
feedback:
|
||||
index:
|
||||
feedback: Обратна връзка
|
||||
overall_organisation: За конференцията
|
||||
comments: Коментари
|
||||
average_grade: Средна оценка
|
||||
total_feedback_grades:
|
||||
one: от %{total_grades} оценка
|
||||
other: от %{total_grades} оценки
|
||||
no_feedback_received: Все още няма обратна връзка
|
||||
no_comments_received: Все още няма коментари
|
||||
events: За събитията
|
||||
shared:
|
||||
feedback:
|
||||
anonymous: Анонимен
|
||||
|
|
|
@ -51,6 +51,8 @@ Rails.application.routes.draw do
|
|||
resources :sponsorship_offers
|
||||
resource :call_for_participation, only: [:create, :destroy]
|
||||
|
||||
resources :feedback, controller: :feedback, only: :index
|
||||
|
||||
resources :personal_profiles do
|
||||
member do
|
||||
put :toggle_admin
|
||||
|
|
Loading…
Reference in New Issue