diff --git a/app/controllers/admin/forms_controller.rb b/app/controllers/admin/forms_controller.rb index 15f716482..0b9c6b4bc 100644 --- a/app/controllers/admin/forms_controller.rb +++ b/app/controllers/admin/forms_controller.rb @@ -66,23 +66,6 @@ def export render json: { form: @form, questions: } end - def invite - invitee = invite_params[:refer_user] - - if invitee.present? && invitee =~ URI::MailTo::EMAIL_REGEXP && (ENV['GITHUB_CLIENT_ID'].present? ? true : APPROVED_DOMAINS.any? { |word| invitee.end_with?(word) }) - if User.exists?(email: invitee) - redirect_to permissions_admin_form_path(@form), alert: "User with email #{invitee} already exists" - else - UserMailer.invite(current_user, invitee).deliver_later - redirect_to permissions_admin_form_path(@form), notice: "Invite sent to #{invitee}" - end - elsif ENV['GITHUB_CLIENT_ID'].present? - redirect_to permissions_admin_form_path(@form), alert: 'Please enter a valid email address' - else - redirect_to permissions_admin_form_path(@form), alert: 'Please enter a valid .gov or .mil email address' - end - end - def publish Event.log_event(Event.names[:form_published], 'Form', @form.uuid, "Form #{@form.name} published at #{DateTime.now}", current_user.id) diff --git a/app/models/form.rb b/app/models/form.rb index 4c60920a6..876343ba7 100644 --- a/app/models/form.rb +++ b/app/models/form.rb @@ -56,10 +56,10 @@ def ensure_no_responses end DELIVERY_METHODS = [ - ['touchpoints-hosted-only', 'Hosted only on the Touchpoints site'], - ['modal', 'Tab button & modal'], - ['custom-button-modal', 'Custom button & modal'], - ['inline', 'Embedded inline on your site'], + ['touchpoints-hosted-only', 'Hosted on Touchpoints'], + ['modal', 'Blue button & modal on your website'], + ['custom-button-modal', 'Custom button & modal on your website'], + ['inline', 'Embedded inline on your website'], ].freeze def suppress_submit_button diff --git a/app/views/admin/forms/delivery.html.erb b/app/views/admin/forms/delivery.html.erb index c9dc0dbba..3f31fe75a 100644 --- a/app/views/admin/forms/delivery.html.erb +++ b/app/views/admin/forms/delivery.html.erb @@ -70,8 +70,8 @@
Delivery methods <% Form::DELIVERY_METHODS.each_with_index do |delivery_method, index| %> -
- <%= f.radio_button :delivery_method, delivery_method[0], class: "usa-radio__input" %> +
+ <%= f.radio_button :delivery_method, delivery_method[0], class: "usa-radio__input usa-radio__input--tile" %> <%= f.label delivery_method[1], class: "usa-radio__label", for: "form_delivery_method_#{delivery_method[0]}" %>
<% end %> diff --git a/app/views/admin/submissions/index.html.erb b/app/views/admin/submissions/index.html.erb index c28e652c1..2980ace95 100644 --- a/app/views/admin/submissions/index.html.erb +++ b/app/views/admin/submissions/index.html.erb @@ -4,6 +4,13 @@

<%= link_to "Export All Responses to CSV", export_submissions_admin_form_url(form, start_date: "2019-10-01", format: "json"), class: "usa-button export-btn" %> +
+

+ <%= link_to "Export FY2020", export_submissions_admin_form_url(form, start_date: "2019-10-01", end_date: "2020-09-30", format: "json"), class: "usa-button usa-button--outline export-btn" %> + <%= link_to "Export FY2021", export_submissions_admin_form_url(form, start_date: "2020-10-01", end_date: "2021-09-30", format: "json"), class: "usa-button usa-button--outline export-btn" %> + <%= link_to "Export FY2022", export_submissions_admin_form_url(form, start_date: "2021-10-01", end_date: "2022-09-30", format: "json"), class: "usa-button usa-button--outline export-btn" %> + <%= link_to "Export FY2023", export_submissions_admin_form_url(form, start_date: "2022-10-01", end_date: "2023-09-30", format: "json"), class: "usa-button usa-button--outline export-btn" %> +

<% else %>
diff --git a/app/views/components/_roles_and_permissions.html.erb b/app/views/components/_roles_and_permissions.html.erb index 2ea5d4fca..d9ca3a672 100644 --- a/app/views/components/_roles_and_permissions.html.erb +++ b/app/views/components/_roles_and_permissions.html.erb @@ -129,37 +129,20 @@
- <%= form_with(model: current_user, url: "invite", local: true) do |f| %> -
-
-

- Don't see a user in the dropdown? -

+
+
+

+ Don't see a user in the User dropdown? +

-
- <%= label_tag :refer_user, "Invite a colleague to Touchpoints", class: "usa-label" %> - <%= f.email_field :refer_user, class: "usa-input", placeholder: "user@example.gov" %> -
-
-
-
-
- <%= f.submit "Invite User", class: "usa-button", id: "invite-button", disabled: true %> -
+ <%= link_to "Invite a User to Touchpoints", admin_invite_path, class: "usa-button usa-button--outline full-width" %> + +

+ After the user signs into Touchpoints, they will be available to select in the user dropdown. +

- <% end %> +
-
-
- + + \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index e2653ddab..164f16d91 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -279,7 +279,6 @@ get 'export_submissions', to: 'forms#export_submissions', as: :export_submissions get 'export_a11_header', to: 'forms#export_a11_header', as: :export_a11_header get 'export_a11_submissions', to: 'forms#export_a11_submissions', as: :export_a11_submissions - patch 'invite', to: 'forms#invite', as: :invite get 'js', to: 'forms#js', as: :js get 'permissions', to: 'forms#permissions', as: :permissions get 'compliance', to: 'forms#compliance', as: :compliance diff --git a/spec/features/admin/forms_spec.rb b/spec/features/admin/forms_spec.rb index 125e7bc40..c31bc9e12 100644 --- a/spec/features/admin/forms_spec.rb +++ b/spec/features/admin/forms_spec.rb @@ -143,7 +143,7 @@ find('label', text: 'Display square (80px wide by 80px tall) logo?').click click_on 'Update logo' click_on 'Delivery' - find('label', text: 'Hosted only on the touchpoints site').click + find('label', text: 'Hosted on touchpoints').click click_on 'Update Form' expect(page).to have_content('Form was successfully updated.') visit example_admin_form_path(Form.last) @@ -166,7 +166,7 @@ find('label', text: 'Display square (80px wide by 80px tall) logo?').click click_on 'Update logo' click_on 'Delivery' - find('label', text: 'Embedded inline on your site').click + find('label', text: 'Embedded inline on your website').click fill_in('form_element_selector', with: 'test_selector') click_on 'Update Form' expect(page).to have_content('Form was successfully updated.') @@ -1551,20 +1551,20 @@ context 'with a valid email' do before do - visit permissions_admin_form_path(form) + visit admin_invite_path(form) end it 'sends an invite to the designated user' do fill_in('user[refer_user]', with: 'newuser@domain.gov') click_on 'Invite User' expect(page).to have_content('Invite sent to newuser@domain.gov') - expect(page.current_path).to eq(permissions_admin_form_path(form)) + expect(page.current_path).to eq(admin_invite_path) end end context 'with an invalid email' do before do - visit permissions_admin_form_path(form) + visit admin_invite_path end it 'initially disabled button shows an alert when at least 6 characters of an invalid email address is provided' do @@ -1577,14 +1577,14 @@ expect(find("#invite-button").disabled?).to be(false) click_on 'Invite User' expect(page).to have_content('Please enter a valid .gov or .mil email address') - expect(page.current_path).to eq(permissions_admin_form_path(form)) + expect(page.current_path).to eq(admin_invite_path) end it 'shows a gov-specific user alert when the email address is not a valid email' do fill_in('user[refer_user]', with: 'test@example.com') click_on 'Invite User' expect(page).to have_content('Please enter a valid .gov or .mil email address') - expect(page.current_path).to eq(permissions_admin_form_path(form)) + expect(page.current_path).to eq(admin_invite_path) end context 'when using GitHub for oAuth' do @@ -1609,7 +1609,7 @@ fill_in('user[refer_user]', with: user.email) click_on 'Invite User' expect(page).to have_content("User with email #{user.email} already exists") - expect(page.current_path).to eq(permissions_admin_form_path(form)) + expect(page.current_path).to eq(admin_invite_path) end end end