diff --git a/app/controllers/annotations_controller.rb b/app/controllers/annotations_controller.rb index 5e3b826..9191895 100644 --- a/app/controllers/annotations_controller.rb +++ b/app/controllers/annotations_controller.rb @@ -19,7 +19,8 @@ template.dirty = true template.save! end - redirect_to "#{admin_show_phase_path(question.section.phase.id)}?section_id=#{question.section.id}" + tab = params[:r] || 'all-templates' + redirect_to "#{admin_show_phase_path(question.section.phase.id)}?section_id=#{question.section.id}&r=#{tab}" end #delete an annotation @@ -35,7 +36,8 @@ flash[:alert] = failed_destroy_error(annotation, type) end end - redirect_to "#{admin_show_phase_path(parent_ids[0])}?section_id=#{parent_ids[1]}" + tab = params[:r] || 'all-templates' + redirect_to "#{admin_show_phase_path(parent_ids[0])}?section_id=#{parent_ids[1]}&r=#{tab}" end private diff --git a/app/controllers/org_admin/templates_controller.rb b/app/controllers/org_admin/templates_controller.rb index 24d5436..20241fe 100644 --- a/app/controllers/org_admin/templates_controller.rb +++ b/app/controllers/org_admin/templates_controller.rb @@ -68,12 +68,13 @@ authorize @template @current = Template.current(@template.dmptemplate_id) - + @current_tab = params[:r] || 'all-templates' + if @template == @current if @template.published? new_version = @template.get_new_version if !new_version.nil? - redirect_to(action: 'edit', id: new_version.id) + redirect_to(action: 'edit', id: new_version.id, r: @current_tab) return else flash[:alert] = _('Unable to create a new version of this template. You are currently working with a published copy.') @@ -85,7 +86,6 @@ # once the correct template has been generated, we convert it to hash @template_hash = @template.to_hash - @current_tab = params[:r] || 'all-templates' render('container', locals: { diff --git a/app/views/org_admin/templates/_edit.html.erb b/app/views/org_admin/templates/_edit.html.erb index 20ffefd..f1efae8 100644 --- a/app/views/org_admin/templates/_edit.html.erb +++ b/app/views/org_admin/templates/_edit.html.erb @@ -38,9 +38,9 @@