Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

Commit

Permalink
improving status change
Browse files Browse the repository at this point in the history
  • Loading branch information
Paulo Gomes committed Sep 6, 2019
1 parent 8f9a20e commit 0d2000b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions views/partials/entry-aside.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</label>
<div class="uk-margin-small-top">
<span class="uk-badge uk-badge-outline">
@lang("Change to:") <strong>@lang("{entry[moderation_field]}")</strong>
{originalModeration !== entry[moderation_field] ? App.i18n.get("Change to:") : App.i18n.get("Save as:")} <strong>@lang("{entry[moderation_field]}")</strong>
</span>
</div>
<select bind="entry.{moderation_field}">
Expand All @@ -26,8 +26,18 @@
$this.canPublish = {{ $app->module("cockpit")->hasaccess('moderation', ['manage', 'publish']) ? 1 : 0 }};
$this.canUnpublish = {{ $app->module("cockpit")->hasaccess('moderation', ['manage', 'unpublish']) ? 1 : 0 }};
this.on('mount', function() {
var oldXHROpen = window.XMLHttpRequest.prototype.open;
window.XMLHttpRequest.prototype.open = function(method, url, async, user, password) {
if (/^.*(\/collections\/save_entry\/\w+)$/.test(url)) {
this.addEventListener('load', function() {
var entry = JSON.parse(this.responseText);
$this.originalModeration = entry[$this.moderation_field];
});
}
return oldXHROpen.apply(this, arguments);
}
this.on('mount', function() {
$this.field = this.collection.fields.filter(function(definition) {
return definition.type === 'moderation';
});
Expand All @@ -49,4 +59,5 @@
$this.update();
});
</script>

0 comments on commit 0d2000b

Please sign in to comment.