Merge branch 'MDL-44749-master' of git://github.com/andrewnicols/moodle
This commit is contained in:
+13
@@ -41,6 +41,19 @@ var PLUGINNAME = 'atto_collapse',
|
||||
|
||||
Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
|
||||
initializer: function() {
|
||||
var toolbarGroupCount = Y.Object.size(this.get('host').get('plugins'));
|
||||
if (toolbarGroupCount <= 1 + parseInt(this.get(ATTRSHOWGROUPS), 10)) {
|
||||
Y.log("There are not enough groups to require toggling - not adding the button",
|
||||
'debug','moodle-atto_collapse');
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.toolbar.all(GROUPS).size() > this.get(ATTRSHOWGROUPS)) {
|
||||
Y.log("The collapse plugin is shown after it's cut-off - not adding the button",
|
||||
'debug','moodle-atto_collapse');
|
||||
return;
|
||||
}
|
||||
|
||||
var button = this.addButton({
|
||||
icon: M.util.image_url('icon', PLUGINNAME),
|
||||
callback: this._toggle
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
YUI.add("moodle-atto_collapse-button",function(e,t){var n="atto_collapse",r="showgroups",i="collapse",s="collapsed",o=".atto_group";e.namespace("M.atto_collapse").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{initializer:function(){var e=this.addButton({icon:M.util.image_url("icon",n),callback:this._toggle});this.get("host").on("pluginsloaded",function(e,t){this._setVisibility(t);var n=this.toolbar.all(o).item(this.get(r));n.insert('<div class="toolbarbreak"></div>',"before")},this,e)},_toggle:function(e){e.preventDefault();var t=this.buttons[i];t.getData(s)?this._setVisibility(t,!0):this._setVisibility(t)},_setVisibility:function(e,t){var i=this.toolbar.all(o).slice(this.get(r));t?(e.set("title",M.util.get_string("showfewer",n)),i.show(),e.setData(s,!1)):(e.set("title",M.util.get_string("showmore",n)),i.hide(),e.setData(s,!0))}},{ATTRS:{showgroups:{value:3}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
|
||||
YUI.add("moodle-atto_collapse-button",function(e,t){var n="atto_collapse",r="showgroups",i="collapse",s="collapsed",o=".atto_group";e.namespace("M.atto_collapse").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{initializer:function(){var t=e.Object.size(this.get("host").get("plugins"));if(t<=1+parseInt(this.get(r),10))return;if(this.toolbar.all(o).size()>this.get(r))return;var i=this.addButton({icon:M.util.image_url("icon",n),callback:this._toggle});this.get("host").on("pluginsloaded",function(e,t){this._setVisibility(t);var n=this.toolbar.all(o).item(this.get(r));n.insert('<div class="toolbarbreak"></div>',"before")},this,i)},_toggle:function(e){e.preventDefault();var t=this.buttons[i];t.getData(s)?this._setVisibility(t,!0):this._setVisibility(t)},_setVisibility:function(e,t){var i=this.toolbar.all(o).slice(this.get(r));t?(e.set("title",M.util.get_string("showfewer",n)),i.show(),e.setData(s,!1)):(e.set("title",M.util.get_string("showmore",n)),i.hide(),e.setData(s,!0))}},{ATTRS:{showgroups:{value:3}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
|
||||
|
||||
+9
@@ -41,6 +41,15 @@ var PLUGINNAME = 'atto_collapse',
|
||||
|
||||
Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
|
||||
initializer: function() {
|
||||
var toolbarGroupCount = Y.Object.size(this.get('host').get('plugins'));
|
||||
if (toolbarGroupCount <= 1 + parseInt(this.get(ATTRSHOWGROUPS), 10)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.toolbar.all(GROUPS).size() > this.get(ATTRSHOWGROUPS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var button = this.addButton({
|
||||
icon: M.util.image_url('icon', PLUGINNAME),
|
||||
callback: this._toggle
|
||||
|
||||
@@ -39,6 +39,19 @@ var PLUGINNAME = 'atto_collapse',
|
||||
|
||||
Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
|
||||
initializer: function() {
|
||||
var toolbarGroupCount = Y.Object.size(this.get('host').get('plugins'));
|
||||
if (toolbarGroupCount <= 1 + parseInt(this.get(ATTRSHOWGROUPS), 10)) {
|
||||
Y.log("There are not enough groups to require toggling - not adding the button",
|
||||
'debug','moodle-atto_collapse');
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.toolbar.all(GROUPS).size() > this.get(ATTRSHOWGROUPS)) {
|
||||
Y.log("The collapse plugin is shown after it's cut-off - not adding the button",
|
||||
'debug','moodle-atto_collapse');
|
||||
return;
|
||||
}
|
||||
|
||||
var button = this.addButton({
|
||||
icon: M.util.image_url('icon', PLUGINNAME),
|
||||
callback: this._toggle
|
||||
|
||||
Reference in New Issue
Block a user