Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-38598 form: Prevent flickering due to advanced fields

  • Loading branch information...
commit 619fe67e32236dd17d1bbee1ea6dc39a3adecec5 1 parent 373a8e0
@FMCorz FMCorz authored
View
7 lib/form/yui/showadvanced/showadvanced.js
@@ -23,7 +23,7 @@ YUI.add('moodle-form-showadvanced', function(Y) {
DIVFCONTAINER : 'div.fcontainer'
},
CSS = {
- HIDE : 'hide',
+ SHOW : 'show',
MORELESSTOGGLER : 'morelesstoggler'
},
ATTRS = {};
@@ -77,10 +77,9 @@ YUI.add('moodle-form-showadvanced', function(Y) {
morelesslink.addClass(CSS.MORELESSTOGGLER);
if (statuselement.get('value') === '0') {
morelesslink.setHTML(M.str.form.showmore);
- // Hide advanced stuff initially.
- fieldset.all(SELECTORS.DIVFITEMADVANCED).addClass(CSS.HIDE);
} else {
morelesslink.setHTML(M.str.form.showless);
+ fieldset.all(SELECTORS.DIVFITEMADVANCED).addClass(CSS.SHOW);
}
fieldset.one(SELECTORS.DIVFCONTAINER).append(morelesslink);
},
@@ -88,7 +87,7 @@ YUI.add('moodle-form-showadvanced', function(Y) {
e.preventDefault();
var fieldset = this.ancestor(SELECTORS.FIELDSETCONTAINSADVANCED);
// Toggle collapsed class.
- fieldset.all(SELECTORS.DIVFITEMADVANCED).toggleClass(CSS.HIDE);
+ fieldset.all(SELECTORS.DIVFITEMADVANCED).toggleClass(CSS.SHOW);
// Get corresponding hidden variable.
var statuselement = new Y.one('input[name=mform_showmore_'+fieldset.get('id')+']');
// Invert it and change the link text.
View
2  theme/base/style/core.css
@@ -245,6 +245,8 @@ a.skip:active {position: static;display: block;}
.jsenabled .mform fieldset.collapsed {border-width: 1px 0 0 1px; padding: 0; border-color: transparent;}
.jsenabled .mform fieldset.collapsed div.fcontainer {display: none;}
.mform .fitem {width:100%;overflow:hidden;margin-top:5px;margin-bottom:1px;clear:right;}
+.jsenabled .mform .containsadvancedelements .advanced {display: none;}
+.mform .containsadvancedelements .advanced.show {display: block;}
.mform .fitem .fitemtitle {width:15%;text-align:right;float:left;}
.mform .fitem .fitemtitle div {display: inline;}
.mform .fitem .felement {border-width: 0;width:80%;margin-left:16%;}
Please sign in to comment.
Something went wrong with that request. Please try again.