diff --git a/static/scripts/packed/mvc/ui/ui-portlet.js b/static/scripts/packed/mvc/ui/ui-portlet.js new file mode 100644 index 00000000000..efd2ee87576 --- /dev/null +++ b/static/scripts/packed/mvc/ui/ui-portlet.js @@ -0,0 +1 @@ +define(["utils/utils"],function(a){var b=Backbone.View.extend({visible:false,optionsDefault:{label:"",icon:"fa-tasks",buttons:null,body:null,height:null,operations:null,placement:"bottom",overflow:"auto"},$content:null,initialize:function(d){this.options=a.merge(d,this.optionsDefault);this.setElement(this.template(this.options));this.$content=this.$el.find("#content");if(this.options.height){this.$el.find("#body").css("height",this.options.height);this.$el.find("#content").css("overflow",this.options.overflow)}this.$buttons=$(this.el).find("#buttons");if(this.options.buttons){var c=this;$.each(this.options.buttons,function(e,f){f.$el.prop("id",e);c.$buttons.append(f.$el)})}else{this.$buttons.remove()}this.$operations=$(this.el).find("#operations");if(this.options.operations){var c=this;$.each(this.options.operations,function(e,f){f.$el.prop("id",e);c.$operations.append(f.$el)})}if(this.options.body){this.append(this.options.body)}},append:function(c){this.$content.append(a.wrap(c))},content:function(){return this.$content},show:function(){this.$el.fadeIn("fast");this.visible=true},hide:function(){this.$el.fadeOut("fast");this.visible=false},enableButton:function(c){this.$buttons.find("#"+c).prop("disabled",false)},disableButton:function(c){this.$buttons.find("#"+c).prop("disabled",true)},hideOperation:function(c){this.$operations.find("#"+c).hide()},showOperation:function(c){this.$operations.find("#"+c).show()},setOperation:function(e,d){var c=this.$operations.find("#"+e);c.off("click");c.on("click",d)},label:function(c){var d=this.$el.find("#label");if(c){d.html(c)}return d.html()},template:function(d){var c='
';if(d.label||d.icon){c+='
';if(d.icon){c+=' '}c+='
'+d.label+"
";c+="
"}c+='
';if(d.placement=="top"){c+='
'}c+='
';if(d.placement=="bottom"){c+='
'}c+="
";return c}});return{View:b}}); \ No newline at end of file