diff --git a/app/assets/javascripts/edit_lock.js b/app/assets/javascripts/edit_lock.js index b8985c739..5cf20d79a 100644 --- a/app/assets/javascripts/edit_lock.js +++ b/app/assets/javascripts/edit_lock.js @@ -1,7 +1,7 @@ (function ($) { 'use strict'; - $.fn.editLock = function(id, user_id, path) { + $.fn.editLock = function(id, user_id, path, moderated) { var $html = this; var $message = $html.find('.edit-lock-message'); var $override = $html.find('#edit-lock-override'); @@ -12,6 +12,7 @@ var PATH = path; var INTERVAL = 10000; var LOCK_URL = PATH + '/' + ID + '/lock.json'; + var MODERATED = moderated; var EditLock = { processStatus: function(data) { @@ -59,7 +60,11 @@ }, cancelClicked: function(e) { - window.location = PATH + '/' + ID; + if (MODERATED) { + window.location = PATH + '/' + ID; + } else { + window.history.back(); + } } }; diff --git a/app/views/admin/admin/_edit_lock.html.erb b/app/views/admin/admin/_edit_lock.html.erb index ff07acacf..a144d7d44 100644 --- a/app/views/admin/admin/_edit_lock.html.erb +++ b/app/views/admin/admin/_edit_lock.html.erb @@ -13,9 +13,9 @@