diff --git a/app/controllers/events/surveys_controller.rb b/app/controllers/events/surveys_controller.rb new file mode 100644 index 000000000..a9a0ba9e6 --- /dev/null +++ b/app/controllers/events/surveys_controller.rb @@ -0,0 +1,14 @@ +class Events::SurveysController < ApplicationController + before_action :authenticate_user! + before_action :validate_organizer! + before_action :find_event + + def edit + end + + private + + def find_event + @event = Event.find(params[:event_id]) + end +end diff --git a/app/views/events/_form.html.erb b/app/views/events/_form.html.erb index 10b923452..ecea682f8 100644 --- a/app/views/events/_form.html.erb +++ b/app/views/events/_form.html.erb @@ -216,15 +216,6 @@ <%= f.input :student_details, label: 'Student Details', input_html: {rows: 4} %> -

Survey Details

- -
-

- Email body - Link to survey will be included at bottom -

- <%= f.input :survey_greeting, label: 'Greeting', input_html: {rows: 4} %> -
- <% unless @event.published? %>

Announcement Email

diff --git a/app/views/events/organizer_tools/index.html.erb b/app/views/events/organizer_tools/index.html.erb index fef85e67f..0cd33bcf2 100644 --- a/app/views/events/organizer_tools/index.html.erb +++ b/app/views/events/organizer_tools/index.html.erb @@ -87,15 +87,15 @@ tip: 'Click here to send a link to the follow up survey to all students and volunteers.', confirm: 'Are you sure?' } %> + <%= render partial: 'shared/organizer_action', locals: { + path: edit_event_survey_path(@event), + icon: 'fa fa-edit', + text: 'Edit Survey Header', + tip: 'Change the text that attendees will see when they edit the survey.' + } %> <% end %> -
-
-

Survey Greeting

- <%= simple_format_with_html(@event.survey_greeting) %> -
-
diff --git a/app/views/events/surveys/edit.html.erb b/app/views/events/surveys/edit.html.erb new file mode 100644 index 000000000..2c7f8e1c4 --- /dev/null +++ b/app/views/events/surveys/edit.html.erb @@ -0,0 +1,16 @@ +<%= simple_form_for @event do |f| %> + <%= render 'shared/model_error_messages', model: @event %> + +

Survey Details

+ +
+

+ Email body - Link to survey will be included at bottom +

+ <%= f.input :survey_greeting, label: 'Greeting', input_html: {rows: 4} %> +
+ +
+ <%= f.submit %> +
+<% end %> diff --git a/config/routes.rb b/config/routes.rb index d9b7ea0da..26b46c0d0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -56,6 +56,7 @@ resources :organizer_tools, only: [:index], controller: "events/organizer_tools" controller "events/organizer_tools" do get "send_survey_email" + resource :survey, only: [:edit], controller: "events/surveys" get "organize_sections" get "diets" get "rsvp_preview" diff --git a/spec/features/event_organizer_dashboard_request_spec.rb b/spec/features/event_organizer_dashboard_request_spec.rb index fadd9cb23..b7ec96f2e 100644 --- a/spec/features/event_organizer_dashboard_request_spec.rb +++ b/spec/features/event_organizer_dashboard_request_spec.rb @@ -138,4 +138,12 @@ expect(rsvp_session1.reload).not_to be_checked_in end + + it "lets the organizer update the survey greeting" do + visit event_organizer_tools_path(@event) + click_link "Edit Survey Header" + fill_in 'Greeting', with: 'Here is a fun survey' + click_on 'Update' + expect(@event.reload.survey_greeting).to eq('Here is a fun survey') + end end