diff --git a/app/controllers/org_admin/templates_controller.rb b/app/controllers/org_admin/templates_controller.rb index 20241fe..11cc019 100644 --- a/app/controllers/org_admin/templates_controller.rb +++ b/app/controllers/org_admin/templates_controller.rb @@ -30,7 +30,7 @@ published: published, current_org: current_user.org, orgs: Org.all, - current_tab: params[:r] || 'all-templates', + current_tab: params[:r], scopes: { all: all_templates_hash[:scopes], orgs: own_hash[:scopes], funders: customizable_hash[:scopes] } } end @@ -92,6 +92,7 @@ partial_path: 'edit', template: @template, current: @current, + edit: @template == @current, template_hash: @template_hash, current_tab: @current_tab }) diff --git a/app/controllers/phases_controller.rb b/app/controllers/phases_controller.rb index 3d10ca9..14e3210 100644 --- a/app/controllers/phases_controller.rb +++ b/app/controllers/phases_controller.rb @@ -43,7 +43,7 @@ #show and edit a phase of the template def admin_show - @phase = Phase.includes(:sections).order(:number).find(params[:id]) + @phase = Phase.includes(:template, :sections).order(:number).find(params[:id]) authorize @phase @current = Template.current(@phase.template.dmptemplate_id) @@ -58,6 +58,10 @@ @original_org = @phase.template.org end + if @phase.template != @current + flash[:notice] = _('You are viewing a historical version of this template. You will not be able to make changes.') + end + render('/org_admin/templates/container', locals: { partial_path: 'admin_show', @@ -90,6 +94,7 @@ locals: { partial_path: 'admin_add', template: @template, + edit: true, current_tab: params[:r] || 'all-templates' }) end diff --git a/app/views/org_admin/templates/_admin_nav_tabs.html.erb b/app/views/org_admin/templates/_admin_nav_tabs.html.erb index 23246f1..012229d 100644 --- a/app/views/org_admin/templates/_admin_nav_tabs.html.erb +++ b/app/views/org_admin/templates/_admin_nav_tabs.html.erb @@ -9,7 +9,7 @@ <% end %> - <% if current_user.can_org_admin? && template.customization_of.nil? %> + <% if current_user.can_org_admin? && template.customization_of.nil? && edit %>