diff --git a/app/controllers/templates_controller.rb b/app/controllers/templates_controller.rb index 76d55a5..c1ea7e8 100644 --- a/app/controllers/templates_controller.rb +++ b/app/controllers/templates_controller.rb @@ -50,7 +50,7 @@ } end - # PUT /org/admin/templates/:id/admin_customize + # GET /org/admin/templates/:id/admin_customize # ----------------------------------------------------- def admin_customize @template = Template.find(params[:id]) diff --git a/app/views/phases/_answer_form.html.erb b/app/views/phases/_answer_form.html.erb index 4a1028f..223ddd0 100644 --- a/app/views/phases/_answer_form.html.erb +++ b/app/views/phases/_answer_form.html.erb @@ -71,13 +71,16 @@ <% if annotations.present? %> + <% num_annotations = 0 %> <% annotations.each do |annotation| %>
- +
<%= annotation.org.abbreviation %> <%= _('Guidance') %>
@@ -85,16 +88,16 @@
-
+
<%= raw annotation.text %>
- + <% num_annotations += 1%>
<% end %> <% end %> - <% guidance_accordion_id = 0 %> + <% guidance_accordion_id = num_annotations %> <% question_guidances.each_pair do |theme, group| %> <% group.each do |gobj| %>
diff --git a/app/views/templates/_admin_nav_tabs.html.erb b/app/views/templates/_admin_nav_tabs.html.erb index 937faae..0399cc3 100644 --- a/app/views/templates/_admin_nav_tabs.html.erb +++ b/app/views/templates/_admin_nav_tabs.html.erb @@ -11,13 +11,13 @@ <% template.phases.each do |phase| %> - <% if active == phase.id %> -
  • - <% else %> -
  • - <% end %> - <%= link_to phase.title, admin_show_phase_path(phase.id) %> -
  • + <% if active == phase.id %> +
  • + <% else %> +
  • + <% end %> + <%= link_to phase.title, admin_show_phase_path(phase.id) %> +
  • <% end %> <% if current_user.can_org_admin? && @@ -25,14 +25,14 @@ current_user.org.funder? || (template.org == current_user.org)) %> <% if active == 'add_plan' %> -
  • - <% else %> -
  • - <% end %> - <% if @template == @current || @edit %> +
  • + <% else %> +
  • + <% end %> + <% if (@template == @current || @edit) && template.customization_of.nil? %> <%= link_to _('Add new phase +'), admin_add_phase_path(template) %> <% end %>
  • - <%end%> + <% end %>
    diff --git a/app/views/templates/admin_index.html.erb b/app/views/templates/admin_index.html.erb index 71ee063..37e6b6a 100644 --- a/app/views/templates/admin_index.html.erb +++ b/app/views/templates/admin_index.html.erb @@ -139,7 +139,7 @@ <% if hash[:current].customization_of.nil? %> <% b_label = _('Customise') %> - <%= link_to b_label, admin_customize_template_path(hash[:current]), method: :put, class: "dmp_table_link" %> + <%= link_to b_label, admin_customize_template_path(hash[:current]), method: :get, class: "dmp_table_link" %> <% else %> <% b_label = _('Edit customisation') %> <%= link_to b_label, admin_template_template_path(hash[:current]), class: "dmp_table_link" %> diff --git a/config/routes.rb b/config/routes.rb index 8fee9ee..4591fc9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -125,10 +125,10 @@ get 'admin_template' get 'admin_new' get 'admin_template_history' + get 'admin_customize' delete 'admin_destroy' post 'admin_create' put 'admin_update' - put 'admin_customize' put 'admin_publish' put 'admin_unpublish' end diff --git a/test/functional/templates_controller_test.rb b/test/functional/templates_controller_test.rb index 70e6edd..0987259 100644 --- a/test/functional/templates_controller_test.rb +++ b/test/functional/templates_controller_test.rb @@ -211,7 +211,7 @@ # ---------------------------------------------------------- test "customize a funder template" do # Make sure we are redirected if we're not logged in - put admin_customize_template_path(@template) + get admin_customize_template_path(@template) assert_unauthorized_redirect_to_root_path funder_template = Template.create(org: Org.funders.first, title: 'Testing integration') @@ -228,7 +228,7 @@ template = Template.live(funder_template.dmptemplate_id) - put admin_customize_template_path(template) + get admin_customize_template_path(template) customization = Template.where(customization_of: template.dmptemplate_id).last