Introduce conference feedback
This commit is contained in:
parent
47d2ec99b1
commit
39217a24c1
|
@ -0,0 +1,24 @@
|
|||
class Public::ConferenceFeedbacksController < Public::ApplicationController
|
||||
def new
|
||||
@feedback = current_conference.feedbacks.build
|
||||
end
|
||||
|
||||
def create
|
||||
@feedback = current_conference.feedbacks.build(feedback_params)
|
||||
@feedback.ip_address = request.remote_ip
|
||||
@feedback.session_id = session.id
|
||||
|
||||
if @feedback.save
|
||||
flash[:notice] = I18n.t('public.conference_feedbacks.new.success')
|
||||
redirect_to root_path
|
||||
else
|
||||
render :new, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def feedback_params
|
||||
params.require(:feedback).permit(:author_email, :rating, :comment)
|
||||
end
|
||||
end
|
|
@ -5,8 +5,11 @@ class Public::EventFeedbacksController < Public::ApplicationController
|
|||
|
||||
def create
|
||||
@feedback = approved_events.find(params[:event_id]).feedbacks.build(feedback_params)
|
||||
@feedback.ip_address = request.remote_ip
|
||||
@feedback.session_id = session.id
|
||||
|
||||
if @feedback.save
|
||||
flash[:notice] = I18n.t('public.event_feedbacks.new.success')
|
||||
redirect_to root_path
|
||||
else
|
||||
render :new, status: :unprocessable_entity
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
bg:
|
||||
public:
|
||||
event_feedbacks:
|
||||
event_feedbacks: &feedbacks_bg
|
||||
new:
|
||||
feedback_for: Оценяване на „%{title}“
|
||||
submit: Изпрати
|
||||
success: Оценката беше изпратена успешно
|
||||
conference_feedbacks: *feedbacks_bg
|
||||
management:
|
||||
volunteers:
|
||||
index:
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
en:
|
||||
public:
|
||||
event_feedbacks:
|
||||
event_feedbacks: &feedbacks_en
|
||||
new:
|
||||
feedback_for: Rating '%{title}'
|
||||
submit: Submit
|
||||
success: The feedback was submitted successfully
|
||||
conference_feedbacks: *feedbacks_en
|
||||
abstract: Abstract
|
||||
helpers:
|
||||
submit:
|
||||
|
|
|
@ -5,7 +5,7 @@ Rails.application.routes.draw do
|
|||
root to: 'home#index'
|
||||
resource :personal_profile, path: 'profile'
|
||||
resources :events do
|
||||
resources :feedbacks, controller: 'event_feedbacks', only: [:new, :create]
|
||||
resources :feedback, controller: 'event_feedbacks', only: [:new, :create]
|
||||
resource :feedback_qr_code, controller: 'event_feedback_qrcodes', only: :show
|
||||
member do
|
||||
get :confirm
|
||||
|
@ -13,6 +13,7 @@ Rails.application.routes.draw do
|
|||
end
|
||||
resources :volunteers
|
||||
resources :volunteer_teams, only: [:index]
|
||||
resources :feedback, as: 'conference_feedbacks', controller: 'conference_feedbacks', only: [:new, :create]
|
||||
end
|
||||
|
||||
namespace :api do
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
- content_for(:title) { t('.feedback_for', title: @feedback.feedback_receiving.title) }
|
||||
|
||||
h1.entry-title = t('.feedback_for', title: @feedback.feedback_receiving.title)
|
||||
|
||||
= simple_form_for @feedback, wrapper: :default, url: conference_feedbacks_path do |f|
|
||||
= f.error_notification
|
||||
|
||||
.form-inputs
|
||||
= f.input :author_email, autofocus: true
|
||||
= f.input :rating, collection: [2, 3, 4, 5, 6], as: :radio_buttons, include_blank: false, wrapper: :default
|
||||
= f.input :comment
|
||||
|
||||
.form-actions
|
||||
= f.button :submit, t('.submit')
|
Loading…
Reference in New Issue