diff --git a/lib/form/yui/showadvanced/showadvanced.js b/lib/form/yui/showadvanced/showadvanced.js index 3cf1b58ef5559..75e45b98be44a 100644 --- a/lib/form/yui/showadvanced/showadvanced.js +++ b/lib/form/yui/showadvanced/showadvanced.js @@ -24,7 +24,13 @@ YUI.add('moodle-form-showadvanced', function(Y) { }, CSS = { SHOW : 'show', - MORELESSTOGGLER : 'morelesstoggler' + MORELESSACTIONS: 'moreless-actions', + MORELESSTOGGLER : 'moreless-toggler', + SHOWLESS : 'moreless-less' + }, + WRAPPERS = { + FITEM : '
', + FELEMENT : '
' }, ATTRS = {}; @@ -73,15 +79,24 @@ YUI.add('moodle-form-showadvanced', function(Y) { fieldset.get('id') + "'", 'debug'); return; } + var morelesslink = Y.Node.create(''); morelesslink.addClass(CSS.MORELESSTOGGLER); if (statuselement.get('value') === '0') { morelesslink.setHTML(M.str.form.showmore); } else { morelesslink.setHTML(M.str.form.showless); + morelesslink.addClass(CSS.SHOWLESS); fieldset.all(SELECTORS.DIVFITEMADVANCED).addClass(CSS.SHOW); } - fieldset.one(SELECTORS.DIVFCONTAINER).append(morelesslink); + + var fitem = Y.Node.create(WRAPPERS.FITEM); + fitem.addClass(CSS.MORELESSACTIONS); + var felement = Y.Node.create(WRAPPERS.FELEMENT); + felement.append(morelesslink); + fitem.append(felement); + + fieldset.one(SELECTORS.DIVFCONTAINER).append(fitem); }, switch_state : function(e) { e.preventDefault(); @@ -93,9 +108,11 @@ YUI.add('moodle-form-showadvanced', function(Y) { // Invert it and change the link text. if (statuselement.get('value') === '0') { statuselement.set('value', 1); + this.addClass(CSS.SHOWLESS); this.setHTML(M.util.get_string('showless', 'form')); } else { statuselement.set('value', 0); + this.removeClass(CSS.SHOWLESS); this.setHTML(M.util.get_string('showmore', 'form')); } } diff --git a/pix/t/less.png b/pix/t/less.png new file mode 100644 index 0000000000000..ca20c2f68e84e Binary files /dev/null and b/pix/t/less.png differ diff --git a/pix/t/less.svg b/pix/t/less.svg new file mode 100644 index 0000000000000..0994d86319189 --- /dev/null +++ b/pix/t/less.svg @@ -0,0 +1,15 @@ + + + +]> + + + + + + + diff --git a/pix/t/more.png b/pix/t/more.png new file mode 100644 index 0000000000000..fd8cbbe438e43 Binary files /dev/null and b/pix/t/more.png differ diff --git a/pix/t/more.svg b/pix/t/more.svg new file mode 100644 index 0000000000000..9197663cd7748 --- /dev/null +++ b/pix/t/more.svg @@ -0,0 +1,14 @@ + + + +]> + + + + + diff --git a/theme/base/style/core.css b/theme/base/style/core.css index 59baf38220ecb..994782833ee56 100644 --- a/theme/base/style/core.css +++ b/theme/base/style/core.css @@ -276,6 +276,9 @@ a.skip:active {position: static;display: block;} .mform fieldset.fdate_selector label {display:inline;float: none;width: auto;} .mform .ftags label.accesshide {display: block;position: static;} .mform .ftags select {margin-bottom: 0.7em;min-width: 22em;} +.mform .moreless-toggler {background: url([[pix:t/more]]) left center no-repeat; padding-left: 16px;} +.dir-rtl .moreless-toggler {padding-left: 0; padding-right: 16px; background-position: right center; } +.mform .moreless-less {background-image: url([[pix:t/less]]);} .mform .helplink img { margin: 0 0 0 .45em; padding: 0;} .dir-rtl .mform .helplink img { margin: 0 .45em 0 0; padding: 0;} .mform legend .helplink img { margin-right: .2em; }