From d3d05f9ceeeec3aa7a8dd1c7dbbe41cd103805d9 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Thu, 18 Jan 2018 18:20:02 +0100 Subject: [PATCH] Add guide to create a proposal or investment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During a Participatory Budget, some users are getting confused and creating a proposal instead of a budget investment. This intermediate page should help them create investments Adding a feature flag just in case other forks don’t need this feature and setting seeds and dev_seeds for appropriate initial setup --- app/controllers/guides_controller.rb | 8 +++++ app/helpers/guides_helper.rb | 19 ++++++++++ app/views/budgets/index.html.erb | 2 +- app/views/guides/new.html.erb | 11 ++++++ app/views/proposals/index.html.erb | 8 +++-- config/locales/en/guides.yml | 4 +++ config/locales/es/guides.yml | 4 +++ config/routes.rb | 1 + config/routes/guide.rb | 1 + db/dev_seeds.rb | 3 ++ db/seeds.rb | 1 + spec/features/guides_spec.rb | 54 ++++++++++++++++++++++++++++ 12 files changed, 113 insertions(+), 3 deletions(-) create mode 100644 app/controllers/guides_controller.rb create mode 100644 app/helpers/guides_helper.rb create mode 100644 app/views/guides/new.html.erb create mode 100644 config/locales/en/guides.yml create mode 100644 config/locales/es/guides.yml create mode 100644 config/routes/guide.rb create mode 100644 spec/features/guides_spec.rb diff --git a/app/controllers/guides_controller.rb b/app/controllers/guides_controller.rb new file mode 100644 index 000000000..0a03955e9 --- /dev/null +++ b/app/controllers/guides_controller.rb @@ -0,0 +1,8 @@ +class GuidesController < ApplicationController + + skip_authorization_check + + def new + end + +end \ No newline at end of file diff --git a/app/helpers/guides_helper.rb b/app/helpers/guides_helper.rb new file mode 100644 index 000000000..67658f52a --- /dev/null +++ b/app/helpers/guides_helper.rb @@ -0,0 +1,19 @@ +module GuidesHelper + + def new_proposal_guide + if feature?("guides") + new_guide_path + else + new_proposal_path + end + end + + def new_budget_investment_guide + if feature?("guides") + new_guide_path + else + new_budget_investment_path(current_budget) + end + end + +end \ No newline at end of file diff --git a/app/views/budgets/index.html.erb b/app/views/budgets/index.html.erb index 2b1905e29..345731170 100644 --- a/app/views/budgets/index.html.erb +++ b/app/views/budgets/index.html.erb @@ -27,7 +27,7 @@ <% if current_user %> <% if current_user.level_two_or_three_verified? %> <%= link_to t("budgets.investments.index.sidebar.create"), - new_budget_investment_path(@budget), + new_budget_investment_guide, class: "button margin-top expanded" %> <% else %>
diff --git a/app/views/guides/new.html.erb b/app/views/guides/new.html.erb new file mode 100644 index 000000000..3e62296bd --- /dev/null +++ b/app/views/guides/new.html.erb @@ -0,0 +1,11 @@ +<% if current_budget %> +
+ <%= link_to t("guides.new_budget_investment"), + new_budget_investment_path(current_budget) %> +
+<% end %> + +
+ <%= link_to t("guides.new_proposal"), + new_proposal_path %> +
\ No newline at end of file diff --git a/app/views/proposals/index.html.erb b/app/views/proposals/index.html.erb index b5710dfc7..ec9645369 100644 --- a/app/views/proposals/index.html.erb +++ b/app/views/proposals/index.html.erb @@ -63,7 +63,9 @@ <% if @proposals.any? %>
- <%= link_to t("proposals.index.start_proposal"), new_proposal_path, class: 'button expanded' %> + <%= link_to t("proposals.index.start_proposal"), + new_proposal_guide, + class: 'button expanded' %>
<% end %> @@ -92,7 +94,9 @@