From c76b465ce8935ae8b1ba9d250957d7af99f7f859 Mon Sep 17 00:00:00 2001 From: decabeza Date: Thu, 11 Apr 2019 17:50:08 +0200 Subject: [PATCH] Show message when request a resource to admins --- app/views/dashboard/_form.html.erb | 6 ++++++ config/locales/en/general.yml | 2 +- config/locales/es/general.yml | 2 +- spec/features/dashboard/dashboard_spec.rb | 16 +++++++++++++++- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/app/views/dashboard/_form.html.erb b/app/views/dashboard/_form.html.erb index 1d49372d6..b33b74063 100644 --- a/app/views/dashboard/_form.html.erb +++ b/app/views/dashboard/_form.html.erb @@ -1,3 +1,9 @@ +<% if dashboard_action.requested_for?(proposal) %> +
+ <%= t("dashboard.create_request.success") %> +
+<% end %> + <% if dashboard_action.request_to_administrators && !dashboard_action.requested_for?(proposal) %> <%= form_for @dashboard_executed_action, url: create_request_proposal_dashboard_action_url(proposal, diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml index 17a093e1c..2500e7dd4 100644 --- a/config/locales/en/general.yml +++ b/config/locales/en/general.yml @@ -482,7 +482,7 @@ en: form: request: Request create_request: - success: The request for the administrator has been successfully sent. + success: The request has been successfully sent. We will contact you as soon as possible to inform you about it. progress: title: Graphic group_by_month: Monthly diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml index 6701f47fe..a95f5244f 100644 --- a/config/locales/es/general.yml +++ b/config/locales/es/general.yml @@ -482,7 +482,7 @@ es: form: request: Solicitar create_request: - success: La petición ha sido correctamente enviada al administrador. + success: La petición ha sido correctamente enviada. Te contactaremos lo antes posible para informarte al respecto. progress: title: Gráfico group_by_month: Mensual diff --git a/spec/features/dashboard/dashboard_spec.rb b/spec/features/dashboard/dashboard_spec.rb index 9f484acf2..f02294082 100644 --- a/spec/features/dashboard/dashboard_spec.rb +++ b/spec/features/dashboard/dashboard_spec.rb @@ -278,7 +278,8 @@ feature "Proposal's dashboard" do click_link(feature.title) click_button "Request" - expect(page).to have_content("The request for the administrator has been successfully sent.") + expect(page).to have_content("The request has been successfully sent. We will contact you "\ + "as soon as possible to inform you about it.") end scenario "Request already requested resource with admin request", js: true do @@ -293,6 +294,19 @@ feature "Proposal's dashboard" do expect(page).to have_content("Proposal has already been taken") end + scenario "Resource requested show message instead of button" do + feature = create(:dashboard_action, :resource, :active, :admin_request) + + visit proposal_dashboard_path(proposal) + within("#side_menu") do + click_link(feature.title) + end + click_button "Request" + + expect(page).to have_content("The request has been successfully sent. We will contact you "\ + "as soon as possible to inform you about it.") + end + scenario "Resource without admin request do not have a request link", js: true do feature = create(:dashboard_action, :resource, :active)