diff --git a/app/controllers/feedback_requests_controller.rb b/app/controllers/feedback_requests_controller.rb
index 241c6ad..af26af1 100644
--- a/app/controllers/feedback_requests_controller.rb
+++ b/app/controllers/feedback_requests_controller.rb
@@ -14,12 +14,12 @@
authorize @plan, :request_feedback?
begin
if @plan.request_feedback(current_user)
- redirect_to share_plan_path(@plan), notice: _(request_feedback_flash_notice)
+ redirect_to request_feedback_plan_path(@plan), notice: _(request_feedback_flash_notice)
else
- redirect_to share_plan_path(@plan), alert: ALERT
+ redirect_to request_feedback_plan_path(@plan), alert: ALERT
end
rescue Exception
- redirect_to share_plan_path(@plan), alert: ERROR
+ redirect_to request_feedback_plan_path(@plan), alert: ERROR
end
end
diff --git a/app/controllers/plans_controller.rb b/app/controllers/plans_controller.rb
index 17ab569..361660b 100644
--- a/app/controllers/plans_controller.rb
+++ b/app/controllers/plans_controller.rb
@@ -264,6 +264,16 @@
end
end
+ def request_feedback
+ @plan = Plan.find(params[:id])
+ if @plan.present?
+ authorize @plan
+ @plan_roles = @plan.roles
+ else
+ redirect_to(plans_path)
+ end
+ end
+
def destroy
@plan = Plan.find(params[:id])
authorize @plan
diff --git a/app/views/plans/_navigation.html.erb b/app/views/plans/_navigation.html.erb
index 7fac168..0bdb7bf 100644
--- a/app/views/plans/_navigation.html.erb
+++ b/app/views/plans/_navigation.html.erb
@@ -18,6 +18,11 @@
<%= _('Share') %>
<% end %>
+ <% if (plan.administerable_by?(current_user) || (current_user.can_org_admin? && current_user.org.plans.include?(plan))) && plan.owner_and_coowners.include?(current_user) && plan.owner.org.feedback_enabled? %>
+
<%= _('Download') %>
@@ -32,4 +37,4 @@
-
\ No newline at end of file
+
diff --git a/app/views/plans/_request_feedback_form.html.erb b/app/views/plans/_request_feedback_form.html.erb
new file mode 100644
index 0000000..fdaf700
--- /dev/null
+++ b/app/views/plans/_request_feedback_form.html.erb
@@ -0,0 +1,21 @@
+<% administerable = @plan.administerable_by?(current_user) %>
+
+<% if administerable %>
+
+ <% if plan.owner_and_coowners.include?(current_user) && plan.owner.org.feedback_enabled? %>
+
<%= _('Request expert feedback') %>
+
<%= _("Click below to give data management staff at #{plan.owner.org.name}, the Plan Owner's org, access to read and comment on your plan.") %>
+
+ <%= sanitize plan.owner.org.feedback_email_msg.to_s % { user_name: current_user.name(false), plan_name: plan.title } %>
+
+
<%= _('You can continue to edit and download the plan in the interim.') %>
+
+ <%= link_to _('Request feedback'),
+ feedback_requests_path(plan_id: @plan.id),
+ data: { method: 'post' },
+ class: "btn btn-default#{' disabled' if @plan.feedback_requested?}" %>
+ <%= _("Feedback has been requested.") if @plan.feedback_requested? %>
+
+ <% end %>
+
+<% end %>
diff --git a/app/views/plans/_share_form.html.erb b/app/views/plans/_share_form.html.erb
index b7c83fe..fc74c6a 100644
--- a/app/views/plans/_share_form.html.erb
+++ b/app/views/plans/_share_form.html.erb
@@ -138,21 +138,4 @@
<% end %>
-
- <% if plan.owner_and_coowners.include?(current_user) && plan.owner.org.feedback_enabled? %>
-
<%= _('Request expert feedback') %>
-
<%= _("Click below to give data management staff at #{plan.owner.org.name}, the Plan Owner's org, access to read and comment on your plan.") %>
-
- <%= sanitize plan.owner.org.feedback_email_msg.to_s % { user_name: current_user.name(false), plan_name: plan.title } %>
-
-
<%= _('You can continue to edit and download the plan in the interim.') %>
-
- <%= link_to _('Request feedback'),
- feedback_requests_path(plan_id: @plan.id),
- data: { method: 'post' },
- class: "btn btn-default#{' disabled' if @plan.feedback_requested?}" %>
- <%= _("Feedback has been requested.") if @plan.feedback_requested? %>
-
- <% end %>
-
<% end %>
diff --git a/app/views/plans/request_feedback.html.erb b/app/views/plans/request_feedback.html.erb
new file mode 100644
index 0000000..0878409
--- /dev/null
+++ b/app/views/plans/request_feedback.html.erb
@@ -0,0 +1,13 @@
+<% title "#{@plan.title} - Request feedback" %>
+
+
+
+
<%= @plan.title %>
+
+
+
+
+
+ <%= render partial: 'request_feedback_form', layout: 'navigation', locals: { plan: @plan } %>
+
+
diff --git a/config/routes.rb b/config/routes.rb
index 463ef8d..12e5447 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -116,6 +116,7 @@
member do
get 'answer'
get 'share'
+ get 'request_feedback'
get 'download'
post 'duplicate'
post 'visibility', constraints: {format: [:json]}
diff --git a/spec/features/feedback_requests_spec.rb b/spec/features/feedback_requests_spec.rb
index b08a259..69b0ed7 100644
--- a/spec/features/feedback_requests_spec.rb
+++ b/spec/features/feedback_requests_spec.rb
@@ -25,8 +25,16 @@
# Actions
click_link plan.title
expect(current_path).to eql(plan_path(plan))
- click_link "Share"
- click_link "Request feedback"
+
+ # Click "Request feedback" tab
+ within("ul.nav.nav-tabs") do
+ click_link "Request feedback"
+ end
+
+ # Click "Request feedback" button within panel
+ within("div.panel") do
+ click_link "Request feedback"
+ end
# Expectations
expect(plan.reload).to be_feedback_requested