mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
ENHANCEMENT Moving placeholder HTML for CMS EditForm out of the <form> tag, and picking it up for later usage in the EditForm javascript
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92691 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
471afa4002
commit
c48c7755bb
@ -511,7 +511,7 @@ class LeftAndMain extends Controller {
|
|||||||
// Wrap the root if needs be.
|
// Wrap the root if needs be.
|
||||||
|
|
||||||
if(!$rootID) {
|
if(!$rootID) {
|
||||||
$rootLink = $this->Link() . '0';
|
$rootLink = '#';
|
||||||
|
|
||||||
// This lets us override the tree title with an extension
|
// This lets us override the tree title with an extension
|
||||||
if($this->hasMethod('getCMSTreeTitle')) $treeTitle = $this->getCMSTreeTitle();
|
if($this->hasMethod('getCMSTreeTitle')) $treeTitle = $this->getCMSTreeTitle();
|
||||||
|
@ -17,10 +17,10 @@
|
|||||||
return/** @lends ss.Form_EditForm */{
|
return/** @lends ss.Form_EditForm */{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type String HTML text to show when the form has been deleted.
|
* @type String HTML text to show when no form content is chosen.
|
||||||
* @todo i18n
|
* Will show inside the <form> tag.
|
||||||
*/
|
*/
|
||||||
RemoveText: 'Removed',
|
PlaceholderHtml: '',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type Object
|
* @type Object
|
||||||
@ -31,10 +31,15 @@
|
|||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this._setupChangeTracker();
|
this._setupChangeTracker();
|
||||||
|
|
||||||
// Can't bind this through jQuery
|
// Can't bind this through jQuery
|
||||||
window.onbeforeunload = function(e) {return self._checkChangeTracker(false);};
|
window.onbeforeunload = function(e) {return self._checkChangeTracker(false);};
|
||||||
|
|
||||||
|
// set default placeholder if form has no children
|
||||||
|
this.setPlaceholderHtml(jQuery('.ss-cmsForm-welcomeMessage').html());
|
||||||
|
jQuery('.ss-cmsForm-welcomeMessage').remove();
|
||||||
|
if(!self.find('*').length) self.removeForm();
|
||||||
|
|
||||||
$._super();
|
$._super();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -199,17 +199,19 @@ TreeAPI.prototype = {
|
|||||||
TreeNodeAPI = Class.create();
|
TreeNodeAPI = Class.create();
|
||||||
TreeNodeAPI.prototype = {
|
TreeNodeAPI.prototype = {
|
||||||
selectTreeNode : function() {
|
selectTreeNode : function() {
|
||||||
if(this.getElementsByTagName('a')[0].href) {
|
var url = jQuery(this).find('a').attr('href');
|
||||||
|
if(url && url != '#') {
|
||||||
_AJAX_LOADING = true;
|
_AJAX_LOADING = true;
|
||||||
if($('sitetree').notify('SelectionChanged', this)) {
|
if($('sitetree').notify('SelectionChanged', this)) {
|
||||||
this.getPageFromServer();
|
this.getPageFromServer();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
jQuery('#Form_EditForm').concrete('ss').removeForm();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getPageFromServer : function() {
|
getPageFromServer : function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var xmlhttp = jQuery('#Form_EditForm').concrete('ss').load(
|
var xmlhttp = jQuery('#Form_EditForm').concrete('ss').load(
|
||||||
jQuery(this).find('a').attr('href'),
|
jQuery(this).find('a').attr('href'),
|
||||||
function(response) {
|
function(response) {
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
|
<div class='ss-cmsForm-welcomeMessage'>
|
||||||
|
<h1>$ApplicationName</h1>
|
||||||
|
<p>
|
||||||
|
<% _t('WELCOMETO','Welcome to') %> $ApplicationName!
|
||||||
|
<% _t('CHOOSEPAGE','Please choose a page from the left.') %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
<% if EditForm %>
|
<% if EditForm %>
|
||||||
$EditForm
|
$EditForm
|
||||||
<% else %>
|
<% else %>
|
||||||
<form id="Form_EditForm" action="admin?executeForm=EditForm" method="post" enctype="multipart/form-data">
|
<form id="Form_EditForm" action="admin/EditForm" method="post" enctype="multipart/form-data">
|
||||||
<h1>$ApplicationName</h1>
|
|
||||||
<p>
|
|
||||||
<% _t('WELCOMETO','Welcome to') %> $ApplicationName!
|
|
||||||
<% _t('CHOOSEPAGE','Please choose a page from the left.') %>
|
|
||||||
</p>
|
|
||||||
</form>
|
</form>
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user