diff --git a/app/controllers/templates_controller.rb b/app/controllers/templates_controller.rb index 7ad732e..57cbabc 100644 --- a/app/controllers/templates_controller.rb +++ b/app/controllers/templates_controller.rb @@ -3,6 +3,7 @@ # [+Copyright:+] Digital Curation Centre and University of California Curation Center class TemplatesController < ApplicationController + respond_to :html after_action :verify_authorized # GET /dmptemplates @@ -31,15 +32,13 @@ # PUT /dmptemplates/1 def admin_update - @dmptemplate = Dmptemplate.find(params[:id]) - authorize @dmptemplate - @dmptemplate.description = params["template-desc"] - respond_to do |format| - if @dmptemplate.update_attributes(params[:dmptemplate]) - format.html { redirect_to admin_template_dmptemplate_path(params[:dmptemplate]), notice: I18n.t('org_admin.templates.updated_message') } - else - format.html { render action: "edit" } - end + @template = Template.find(params[:id]) + authorize @template + @template.description = params["template-desc"] + if @template.update_attributes(params[:template]) + redirect_to admin_template_template_path(params[:template]), notice: I18n.t('org_admin.templates.updated_message') + else + render action: "edit" end end diff --git a/app/views/templates/_edit_template.html.erb b/app/views/templates/_edit_template.html.erb index 051d4b4..10c33ea 100644 --- a/app/views/templates/_edit_template.html.erb +++ b/app/views/templates/_edit_template.html.erb @@ -20,7 +20,7 @@