mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
elofgren: USABILITY: Rename 'Save draft' button to 'Save' and make 'Publish' (will be renamed 'Save & Publish') button save the new draft in addition to publishing it.
Requested here: http://www.silverstripe.com/google-summer-of-code-forum/flat/1654?showPost=1730#post1730 (merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41863 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
1e54b9a29d
commit
15d40c5cf1
@ -315,7 +315,7 @@ JS;
|
||||
}
|
||||
|
||||
if($record->canEdit()) {
|
||||
$actions->push(new FormAction('save','Save draft'));
|
||||
$actions->push(new FormAction('save','Save'));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -393,15 +393,6 @@ JS;
|
||||
return "admin/$action";
|
||||
}
|
||||
|
||||
public function publish($urlParams, $form) {
|
||||
$id = $_REQUEST['ID'];
|
||||
$record = DataObject::get_by_id("SiteTree", $id);
|
||||
$form->saveInto($record);
|
||||
$this->performPublish($record);
|
||||
|
||||
return $this->tellBrowserAboutPublicationChange($record, "Published '$record->Title' successfully");
|
||||
}
|
||||
|
||||
public function deletefromlive($urlParams, $form) {
|
||||
$id = $_REQUEST['ID'];
|
||||
Versioned::reading_stage('Live');
|
||||
|
@ -354,7 +354,7 @@ JS;
|
||||
|
||||
|
||||
/**
|
||||
* Save page handler
|
||||
* Save and Publish page handler
|
||||
*/
|
||||
public function save($urlParams, $form) {
|
||||
$className = $this->stat('tree_class');
|
||||
@ -487,8 +487,13 @@ JS;
|
||||
|
||||
|
||||
}
|
||||
|
||||
return FormResponse::respond();
|
||||
// If the 'Save & Publish' button was clicked, also publish the page
|
||||
if (isset($urlParams['publish']) && $urlParams['publish'] == 1) {
|
||||
$this->performPublish($record);
|
||||
return $this->tellBrowserAboutPublicationChange($record, "Published '$record->Title' successfully");
|
||||
} else {
|
||||
return FormResponse::respond();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,13 +1,6 @@
|
||||
function action_publish_right() {
|
||||
$('Form_EditForm').notify('BeforeSave');
|
||||
Ajax.SubmitForm('Form_EditForm', 'action_publish', {
|
||||
onSuccess : function(response) {
|
||||
Ajax.Evaluator(response);
|
||||
},
|
||||
onFailure : function(response) {
|
||||
errorMessage('Error publishing content', response);
|
||||
}
|
||||
});
|
||||
var publish = true;
|
||||
$('Form_EditForm').save(false, null, 'save', publish);
|
||||
}
|
||||
function action_revert_right() {
|
||||
Ajax.SubmitForm('Form_EditForm', 'action_revert', {
|
||||
|
@ -129,8 +129,10 @@ CMSForm.prototype = {
|
||||
/**
|
||||
* Save the contens of the form, by submitting it and resetting is changed checker
|
||||
* on success.
|
||||
*
|
||||
* @param publish boolean (optional) whether to publish in addition to saving
|
||||
*/
|
||||
save: function(ifChanged, callAfter, action) {
|
||||
save: function(ifChanged, callAfter, action, publish) {
|
||||
_AJAX_LOADING = true;
|
||||
if(typeof tinyMCE != 'undefined') tinyMCE.triggerSave();
|
||||
if(!action) action = "save";
|
||||
@ -160,6 +162,10 @@ CMSForm.prototype = {
|
||||
} else {
|
||||
var data = this.serializeAllFields() + '&ajax=1&action_' + action + '=1';
|
||||
}
|
||||
if(publish)
|
||||
{
|
||||
data += '&publish=1';
|
||||
}
|
||||
|
||||
statusMessage("Saving...", null, true);
|
||||
new Ajax.Request(this.action, {
|
||||
|
Loading…
Reference in New Issue
Block a user