elofgren: USABILITY: Make 'Add new draft' the default action for 'Create...' in the Newsletter section. Also make 'Add new draft' be selected whenever a selection is made in the left tree. Only select 'Add new type' by default if there are no Newsletter types. This will reduce confusion and make the more common 'Add new draft' action easier since it will be the default. Also select the 'Add new draft' option after a Newsletter type is added since this will be the next logical action. This fixes GSoC trac ticket: http://support.silverstripe.com/gsoc/ticket/70

(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@42061 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-16 02:32:33 +00:00
parent a1fcfa6271
commit 7f4dd7279b
2 changed files with 19 additions and 2 deletions

View File

@ -72,6 +72,8 @@ SiteTree.prototype = {
Element.addClassName(mailingListNode,'nodelete');
this.appendTreeNode( typeNode );
this.changeCurrentTo( typeNode );
// Change the 'Create...' drop-down to 'Add a draft' since this will be the logical next action after a Newsletter type is created
$('add_type').value = 'draft';
}
}
@ -190,6 +192,8 @@ deletedraft = {
}
SiteTreeNode.prototype.onselect = function() {
// Change the 'Create...' drop-down to 'Add a draft' whenever a selection is made in the left tree
$('add_type').value = 'draft';
$('sitetree').changeCurrentTo(this);
if($('sitetree').notify('SelectionChanged', this)) {
autoSave(true, this.getPageFromServer.bind(this));
@ -259,7 +263,20 @@ AddForm.applyTo('#addtype');
AddForm.prototype = {
initialize: function () {
Observable.applyTo($(_HANDLER_FORMS[this.id]));
this.getElementsByTagName('button')[0].onclick = returnFalse;
this.getElementsByTagName('button')[0].onclick = function() {
var st = $('sitetree');
if (st) {
// Select 'Add new draft' if the left tree is not empty,
// because, most likely, the user will want to add a new draft if they already have a newsletter type
if (typeof st.lastTreeNode() != 'undefined') {
$('add_type').value = 'draft';
} else {
$('add_type').value = 'type';
}
} else {
$('add_type').value = 'type';
}
}
$(_HANDLER_FORMS[this.id]).onsubmit = this.form_submit;
},

View File

@ -33,8 +33,8 @@ ul.tree li.MailType span.Sent a {
<form class="actionparams" id="addtype_options" style="display: none" action="admin/newsletter/add">
<input type="hidden" name="ParentID" value="" />
<select name="PageType" id="add_type">
<option value="type">Add new type</option>
<option value="draft">Add new draft</option>
<option value="type">Add new type</option>
</select>
<input class="action" type="submit" value="Go" />
</form>