app/controllers/spotlight/pages_controller.rb in blacklight-spotlight-0.2.0 vs app/controllers/spotlight/pages_controller.rb in blacklight-spotlight-0.3.0
- old
+ new
@@ -52,21 +52,21 @@
# PATCH/PUT /pages/1
def update
@page.lock.delete if @page.lock
if @page.update(page_params.merge(last_edited_by: current_user))
- redirect_to [@page.exhibit, @page], notice: t(:'helpers.submit.page.updated', model: @page.class.model_name.human.downcase)
+ redirect_to [@page.exhibit, @page], flash: { html_safe: true }, notice: view_context.safe_join([t(:'helpers.submit.page.updated', model: @page.class.model_name.human.downcase), undo_link], " ")
else
render action: 'edit'
end
end
# DELETE /pages/1
def destroy
@page.destroy
- redirect_to [@page.exhibit, page_collection_name], notice: t(:'helpers.submit.page.destroyed', model: @page.class.model_name.human.downcase)
+ redirect_to [@page.exhibit, page_collection_name], flash: { html_safe: true }, notice: view_context.safe_join([t(:'helpers.submit.page.destroyed', model: @page.class.model_name.human.downcase), undo_link], " ")
end
def update_all
notice = if @exhibit.update update_all_page_params
t(:'helpers.submit.page.batch_updated', model: human_name)
@@ -76,9 +76,14 @@
redirect_to :back, notice: notice
end
def _prefixes
@_prefixes ||= super + ['catalog']
+ end
+
+ def undo_link
+ return unless can? :manage, @page
+ view_context.link_to(t(:'spotlight.versions.undo'), revert_version_path(@page.versions.last), :method => :post)
end
protected
##