From 3384a7320451904d04e2a07c54a5871fc602f01d Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 22 Oct 2017 22:38:48 +0300 Subject: [PATCH 1/4] Introduce feedbacks for events --- .../public/event_feedbacks_controller.rb | 25 +++++++++++++++++++ app/models/conference.rb | 1 + app/models/event.rb | 1 + app/models/feedback.rb | 5 ++++ app/views/api/events/index.jbuilder | 1 + config/locales/bg.yml | 16 ++++++++++++ config/locales/en.yml | 13 ++++++++++ config/routes.rb | 1 + db/migrate/20171022182011_create_feedbacks.rb | 14 +++++++++++ .../public/event_feedbacks/new.html.slim | 14 +++++++++++ .../public/event_feedbacks/show.html.slim | 1 + 11 files changed, 92 insertions(+) create mode 100644 app/controllers/public/event_feedbacks_controller.rb create mode 100644 app/models/feedback.rb create mode 100644 db/migrate/20171022182011_create_feedbacks.rb create mode 100644 lib/initfest/views/public/event_feedbacks/new.html.slim create mode 100644 lib/initfest/views/public/event_feedbacks/show.html.slim diff --git a/app/controllers/public/event_feedbacks_controller.rb b/app/controllers/public/event_feedbacks_controller.rb new file mode 100644 index 0000000..b857484 --- /dev/null +++ b/app/controllers/public/event_feedbacks_controller.rb @@ -0,0 +1,25 @@ +class Public::EventFeedbacksController < Public::ApplicationController + def new + @feedback = approved_events.find(params[:event_id]).feedbacks.build + end + + def create + @feedback = approved_events.find(params[:event_id]).feedbacks.build(feedback_params) + + if @feedback.save + 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 + + def approved_events + current_conference.events.joins(:proposition).approved + end +end diff --git a/app/models/conference.rb b/app/models/conference.rb index 47eeb30..4b9532f 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -22,6 +22,7 @@ class Conference < ActiveRecord::Base has_many :participants, -> { uniq }, class_name: 'User', through: :events has_many :participant_profiles, class_name: 'PersonalProfile' has_many :slots, through: :halls + has_many :feedbacks, as: :feedback_receiving, dependent: :destroy accepts_nested_attributes_for :tracks, :halls, :event_types, :volunteer_teams, reject_if: :all_blank, allow_destroy: true diff --git a/app/models/event.rb b/app/models/event.rb index dc60733..62c18d8 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -11,6 +11,7 @@ class Event < ActiveRecord::Base has_many :participants, through: :approved_participations has_many :participants_with_personal_profiles, through: :approved_participations, source: :participant_with_personal_profile has_many :conflict_counts, -> { order(number_of_conflicts: :desc) }, foreign_key: :left_id + has_many :feedbacks, as: :feedback_receiving, dependent: :destroy belongs_to :event_type diff --git a/app/models/feedback.rb b/app/models/feedback.rb new file mode 100644 index 0000000..99a90e0 --- /dev/null +++ b/app/models/feedback.rb @@ -0,0 +1,5 @@ +class Feedback < ActiveRecord::Base + belongs_to :feedback_receiving, polymorphic: true + + validates :rating, presence: true, inclusion: {in: [2, 3, 4, 5 ,6]} +end diff --git a/app/views/api/events/index.jbuilder b/app/views/api/events/index.jbuilder index 543b195..72f5a0b 100644 --- a/app/views/api/events/index.jbuilder +++ b/app/views/api/events/index.jbuilder @@ -9,5 +9,6 @@ json.event_type_id event.event_type_id json.track_id event.track_id json.participant_user_ids event.participations.map(&:participant_id) + json.feedback_url new_event_feedback_url(event_id: event.id) end end diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 88cf97d..497e092 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -1,4 +1,9 @@ bg: + public: + event_feedbacks: + new: + feedback_for: Оценяване на „%{title}“ + submit: Изпрати management: volunteers: index: @@ -103,6 +108,10 @@ bg: title: "Преглед на %{model}" activerecord: attributes: + feedback: + author_email: E-mail + rating: Оценка + comment: Коментар participation: participant: Участник approved: Потвърдено от участника @@ -208,6 +217,9 @@ bg: volunteer_teams: invalid_volunteer_team: "невалиден екип от доброволци" models: + feedback: + one: Оценка + other: Оценки participation: one: Участие other: Участия @@ -372,6 +384,10 @@ bg: vegetarian: Вегетарианец vegan: Веган hints: + feedback: + author_email: Адресът на електронната ви поща, ако счетете за нужно + rating: Посочете оценката си + comment: Тук може да изразите по-подробно мнението си conference: description: "Описание на конференцията" email: Email на организаторския екип diff --git a/config/locales/en.yml b/config/locales/en.yml index 1a48fdb..7efef82 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,4 +1,9 @@ en: + public: + event_feedbacks: + new: + feedback_for: Rating '%{title}' + submit: Submit abstract: Abstract helpers: submit: @@ -29,6 +34,10 @@ en: title: Viewing %{model} activerecord: attributes: + feedback: + author_email: E-mail + rating: Rating + comment: Comment conference: description: Description email: E-mail @@ -271,6 +280,10 @@ en: vegetarian: Vegetarian vegan: Vegan hints: + feedback: + author_email: "Your E-mail address if you'd like to share it with us" + rating: Select your rating for the event + comment: Express your opinion in greater detail here conference: description: Conference description email: Orga team email diff --git a/config/routes.rb b/config/routes.rb index d0663bb..893252b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,6 +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] member do get :confirm end diff --git a/db/migrate/20171022182011_create_feedbacks.rb b/db/migrate/20171022182011_create_feedbacks.rb new file mode 100644 index 0000000..606dbe7 --- /dev/null +++ b/db/migrate/20171022182011_create_feedbacks.rb @@ -0,0 +1,14 @@ +class CreateFeedbacks < ActiveRecord::Migration + def change + create_table :feedbacks do |t| + t.references :feedback_receiving, index: {name: :feedbacks_polymorphic_index}, polymorphic: true, null: false + t.string :author_email + t.integer :rating, null: false + t.text :comment, null: false + t.string :ip_address + t.string :session_id, index: true + + t.timestamps null: false + end + end +end diff --git a/lib/initfest/views/public/event_feedbacks/new.html.slim b/lib/initfest/views/public/event_feedbacks/new.html.slim new file mode 100644 index 0000000..02c6d61 --- /dev/null +++ b/lib/initfest/views/public/event_feedbacks/new.html.slim @@ -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: event_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') diff --git a/lib/initfest/views/public/event_feedbacks/show.html.slim b/lib/initfest/views/public/event_feedbacks/show.html.slim new file mode 100644 index 0000000..3603360 --- /dev/null +++ b/lib/initfest/views/public/event_feedbacks/show.html.slim @@ -0,0 +1 @@ +p Hello From 47d2ec99b19d079073cb5c0aa8eb413a42eeec60 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 22 Oct 2017 23:24:28 +0300 Subject: [PATCH 2/4] Add event feedback QR codes --- Gemfile | 2 ++ Gemfile.lock | 4 ++++ .../public/event_feedback_qrcodes_controller.rb | 13 +++++++++++++ app/views/api/events/index.jbuilder | 1 + config/initializers/mime_types.rb | 2 ++ config/routes.rb | 1 + 6 files changed, 23 insertions(+) create mode 100644 app/controllers/public/event_feedback_qrcodes_controller.rb diff --git a/Gemfile b/Gemfile index 42f20dd..d78616d 100644 --- a/Gemfile +++ b/Gemfile @@ -56,6 +56,8 @@ gem 'search_object' gem 'faraday' +gem 'rqrcode' + group :development do gem 'spring' gem 'spring-commands-rspec' diff --git a/Gemfile.lock b/Gemfile.lock index d0d8f5e..b7fec7f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -89,6 +89,7 @@ GEM mime-types (>= 1.16) mimemagic (>= 0.3.0) choice (0.2.0) + chunky_png (1.3.8) coderay (1.1.1) coffee-rails (4.2.1) coffee-script (>= 2.2.0) @@ -284,6 +285,8 @@ GEM mime-types (>= 1.16, < 3.0) netrc (~> 0.7) rmagick (2.16.0) + rqrcode (0.10.1) + chunky_png (~> 1.0) rspec (3.5.0) rspec-core (~> 3.5.0) rspec-expectations (~> 3.5.0) @@ -423,6 +426,7 @@ DEPENDENCIES refile refile-mini_magick rmagick + rqrcode rspec-rails sass-rails search_object diff --git a/app/controllers/public/event_feedback_qrcodes_controller.rb b/app/controllers/public/event_feedback_qrcodes_controller.rb new file mode 100644 index 0000000..2ec1ae1 --- /dev/null +++ b/app/controllers/public/event_feedback_qrcodes_controller.rb @@ -0,0 +1,13 @@ +class Public::EventFeedbackQrcodesController < Public::ApplicationController + def show + event = current_conference.events.joins(:proposition).approved.find(params[:event_id]) + @qr = RQRCode::QRCode.new(new_event_feedback_url(event_id: event.id), level: :l) + + respond_to do |format| + format.svg do + render(inline: @qr.as_svg(shape_rendering: 'crispEdges', module_size: 11, fill: 'ffffff', offset: 10), + filename: "feedback_qr_code_#{event.id}.svg") + end + end + end +end diff --git a/app/views/api/events/index.jbuilder b/app/views/api/events/index.jbuilder index 72f5a0b..a53ef36 100644 --- a/app/views/api/events/index.jbuilder +++ b/app/views/api/events/index.jbuilder @@ -10,5 +10,6 @@ json.track_id event.track_id json.participant_user_ids event.participations.map(&:participant_id) json.feedback_url new_event_feedback_url(event_id: event.id) + json.feedback_qr_code_url event_feedback_qr_code_url(event_id: event.id, format: :svg) end end diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index dc18996..f4c73f9 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -2,3 +2,5 @@ # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf + +Mime::Type.register "image/svg+xml", :svg diff --git a/config/routes.rb b/config/routes.rb index 893252b..7167f63 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,6 +6,7 @@ Rails.application.routes.draw do resource :personal_profile, path: 'profile' resources :events do resources :feedbacks, controller: 'event_feedbacks', only: [:new, :create] + resource :feedback_qr_code, controller: 'event_feedback_qrcodes', only: :show member do get :confirm end From 39217a24c1d6b2788fc8af92143ac92c6d6a4a66 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 22 Oct 2017 23:40:12 +0300 Subject: [PATCH 3/4] Introduce conference feedback --- .../public/conference_feedbacks_controller.rb | 24 +++++++++++++++++++ .../public/event_feedbacks_controller.rb | 3 +++ config/locales/bg.yml | 4 +++- config/locales/en.yml | 4 +++- config/routes.rb | 3 ++- .../public/conference_feedbacks/new.html.slim | 14 +++++++++++ 6 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 app/controllers/public/conference_feedbacks_controller.rb create mode 100644 lib/initfest/views/public/conference_feedbacks/new.html.slim diff --git a/app/controllers/public/conference_feedbacks_controller.rb b/app/controllers/public/conference_feedbacks_controller.rb new file mode 100644 index 0000000..dc3b677 --- /dev/null +++ b/app/controllers/public/conference_feedbacks_controller.rb @@ -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 diff --git a/app/controllers/public/event_feedbacks_controller.rb b/app/controllers/public/event_feedbacks_controller.rb index b857484..f2246da 100644 --- a/app/controllers/public/event_feedbacks_controller.rb +++ b/app/controllers/public/event_feedbacks_controller.rb @@ -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 diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 497e092..0a643ab 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -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: diff --git a/config/locales/en.yml b/config/locales/en.yml index 7efef82..6215436 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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: diff --git a/config/routes.rb b/config/routes.rb index 7167f63..1bcb44a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 diff --git a/lib/initfest/views/public/conference_feedbacks/new.html.slim b/lib/initfest/views/public/conference_feedbacks/new.html.slim new file mode 100644 index 0000000..03e4028 --- /dev/null +++ b/lib/initfest/views/public/conference_feedbacks/new.html.slim @@ -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') From a12baf2b94e11845b8c7ef5cd00ae222ee8707fc Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Mon, 23 Oct 2017 00:29:21 +0300 Subject: [PATCH 4/4] Implement listing of things that feedback can be submitted for --- .../public/conference_feedbacks_controller.rb | 22 ++++++++++++++-- .../public/event_feedbacks_controller.rb | 14 ++++++++--- app/helpers/events_helper.rb | 11 ++++++++ app/models/feedback.rb | 8 ++++++ config/deploy.rb | 2 +- config/locales/bg.yml | 15 ++++++++--- config/locales/en.yml | 15 ++++++++--- config/routes.rb | 2 +- .../conference_feedbacks/index.html.slim | 25 +++++++++++++++++++ .../public/conference_feedbacks/new.html.slim | 2 +- .../public/event_feedbacks/new.html.slim | 2 +- 11 files changed, 103 insertions(+), 15 deletions(-) create mode 100644 lib/initfest/views/public/conference_feedbacks/index.html.slim diff --git a/app/controllers/public/conference_feedbacks_controller.rb b/app/controllers/public/conference_feedbacks_controller.rb index dc3b677..00d3ddd 100644 --- a/app/controllers/public/conference_feedbacks_controller.rb +++ b/app/controllers/public/conference_feedbacks_controller.rb @@ -1,6 +1,24 @@ class Public::ConferenceFeedbacksController < Public::ApplicationController + def index + @conference = current_conference + @unrated_events = @conference.events + .joins(:proposition).approved + .joins('LEFT JOIN feedbacks ON feedbacks.feedback_receiving_id = events.id AND feedbacks.feedback_receiving_type = "Event"') + .where('feedbacks.session_id != ? OR feedbacks.id IS NULL', session.id) + + @rated_events = @conference.events + .joins(:proposition).approved + .joins(:feedbacks) + .where(feedbacks: {session_id: session.id}).distinct + + end + def new - @feedback = current_conference.feedbacks.build + if current_conference.feedbacks.where(session_id: session.id).exists? + @feedback = current_conference.feedbacks.where(session_id: session.id).order(updated_at: :asc).last + else + @feedback = current_conference.feedbacks.build + end end def create @@ -10,7 +28,7 @@ class Public::ConferenceFeedbacksController < Public::ApplicationController if @feedback.save flash[:notice] = I18n.t('public.conference_feedbacks.new.success') - redirect_to root_path + redirect_to conference_feedbacks_path else render :new, status: :unprocessable_entity end diff --git a/app/controllers/public/event_feedbacks_controller.rb b/app/controllers/public/event_feedbacks_controller.rb index f2246da..358d732 100644 --- a/app/controllers/public/event_feedbacks_controller.rb +++ b/app/controllers/public/event_feedbacks_controller.rb @@ -1,16 +1,20 @@ class Public::EventFeedbacksController < Public::ApplicationController def new - @feedback = approved_events.find(params[:event_id]).feedbacks.build + if event.feedbacks.where(session_id: session.id).exists? + @feedback = event.feedbacks.where(session_id: session.id).order(updated_at: :asc).last + else + @feedback = event.feedbacks.build + end end def create - @feedback = approved_events.find(params[:event_id]).feedbacks.build(feedback_params) + @feedback = event.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 + redirect_to conference_feedbacks_path else render :new, status: :unprocessable_entity end @@ -22,6 +26,10 @@ class Public::EventFeedbacksController < Public::ApplicationController params.require(:feedback).permit(:author_email, :rating, :comment) end + def event + approved_events.find(params[:event_id]) + end + def approved_events current_conference.events.joins(:proposition).approved end diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index dcedbc0..815fc65 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -23,4 +23,15 @@ module EventsHelper end end end + + def participant_names(event) + event.participants.map do |participant| + if participant.personal_profile(event.conference).present? + profile = participant.personal_profile(event.conference) + "#{profile.name}" + else + nil + end + end.compact + end end diff --git a/app/models/feedback.rb b/app/models/feedback.rb index 99a90e0..37517db 100644 --- a/app/models/feedback.rb +++ b/app/models/feedback.rb @@ -2,4 +2,12 @@ class Feedback < ActiveRecord::Base belongs_to :feedback_receiving, polymorphic: true validates :rating, presence: true, inclusion: {in: [2, 3, 4, 5 ,6]} + + before_create :destroy_older_feedbacks_by_the_session + + private + + def destroy_older_feedbacks_by_the_session + feedback_receiving.feedbacks.where(session_id: session_id).destroy_all + end end diff --git a/config/deploy.rb b/config/deploy.rb index ceff646..eec7549 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -32,7 +32,7 @@ set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/uploads', 'tmp/pids', # set :default_env, { path: "/opt/ruby/bin:$PATH" } # Default value for keep_releases is 5 -# set :keep_releases, 5 +set :keep_releases, 10 set :rvm_ruby_version, '2.2.2' diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 0a643ab..f012191 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -1,11 +1,20 @@ bg: public: - event_feedbacks: &feedbacks_bg - new: + event_feedbacks: + new: &new_feedbacks_bg feedback_for: Оценяване на „%{title}“ submit: Изпрати success: Оценката беше изпратена успешно - conference_feedbacks: *feedbacks_bg + conference_feedbacks: + new: *new_feedbacks_bg + index: + feedback_for_the_conference: Оценяване на конференцията + general_feedback_for: Оценете цялостно %{title} + change_general_feedback_for: Преоценете цялостно %{title} + feedback_for: Оценете „%{title}“ + change_feedback_for: Преоценете „%{title}“ + by: от %{authors} + feedback_incentive: Бихме били благодарни, ако споделите с нас мнението си за конференцията и събитията в нея. management: volunteers: index: diff --git a/config/locales/en.yml b/config/locales/en.yml index 6215436..13a76ad 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,11 +1,20 @@ en: public: - event_feedbacks: &feedbacks_en - new: + event_feedbacks: + new: &new_feedbacks_en feedback_for: Rating '%{title}' submit: Submit success: The feedback was submitted successfully - conference_feedbacks: *feedbacks_en + conference_feedbacks: + new: *new_feedbacks_en + index: + feedback_for_the_conference: Feedback for the conference + general_feedback_for: Submit general feedback for "%{title}" + change_general_feedback_for: Resubmit general feedback for "%{title}" + feedback_for: Submit feedback for "%{title}" + change_feedback_for: Resubmit feedback for "%{title}" + by: by %{authors} + feedback_incentive: We would be happy to receive your feedback about the conference and its events. abstract: Abstract helpers: submit: diff --git a/config/routes.rb b/config/routes.rb index 1bcb44a..56de69a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -13,7 +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] + resources :feedback, as: 'conference_feedbacks', controller: 'conference_feedbacks', only: [:new, :create, :index] end namespace :api do diff --git a/lib/initfest/views/public/conference_feedbacks/index.html.slim b/lib/initfest/views/public/conference_feedbacks/index.html.slim new file mode 100644 index 0000000..5a36d9b --- /dev/null +++ b/lib/initfest/views/public/conference_feedbacks/index.html.slim @@ -0,0 +1,25 @@ +- content_for(:title) { t('.feedback_for_the_conference') } + +h1.entry-title = t('.feedback_for_the_conference') + +p = t('.feedback_incentive') + +ul + - if @conference.feedbacks.where(session_id: session.id).exists? + li = link_to t('.change_general_feedback_for', title: @conference.title), new_conference_feedback_path + - else + li = link_to t('.general_feedback_for', title: @conference.title), new_conference_feedback_path + +ul + - @unrated_events.each do |event| + li + = link_to t('.feedback_for', title: event.title), new_event_feedback_path(event_id: event.id) + - if participant_names(event).any? + =< t('.by', authors: participant_names(event).join(', ')) + +ul + - @rated_events.each do |event| + li + = link_to t('.change_feedback_for', title: event.title), new_event_feedback_path(event_id: event.id) + - if participant_names(event).any? + =< t('.by', authors: participant_names(event).join(', ')) diff --git a/lib/initfest/views/public/conference_feedbacks/new.html.slim b/lib/initfest/views/public/conference_feedbacks/new.html.slim index 03e4028..3143800 100644 --- a/lib/initfest/views/public/conference_feedbacks/new.html.slim +++ b/lib/initfest/views/public/conference_feedbacks/new.html.slim @@ -2,7 +2,7 @@ h1.entry-title = t('.feedback_for', title: @feedback.feedback_receiving.title) -= simple_form_for @feedback, wrapper: :default, url: conference_feedbacks_path do |f| += simple_form_for @feedback, wrapper: :default, url: conference_feedbacks_path, method: :post do |f| = f.error_notification .form-inputs diff --git a/lib/initfest/views/public/event_feedbacks/new.html.slim b/lib/initfest/views/public/event_feedbacks/new.html.slim index 02c6d61..e4cdc2d 100644 --- a/lib/initfest/views/public/event_feedbacks/new.html.slim +++ b/lib/initfest/views/public/event_feedbacks/new.html.slim @@ -2,7 +2,7 @@ h1.entry-title = t('.feedback_for', title: @feedback.feedback_receiving.title) -= simple_form_for @feedback, wrapper: :default, url: event_feedbacks_path do |f| += simple_form_for @feedback, wrapper: :default, url: event_feedback_index_path, method: :post do |f| = f.error_notification .form-inputs