// ========================================================================== // Button View Builder // ========================================================================== require('builders/builder') ; /** */ SC.ButtonView.Builder = SC.Builder.extend({ _targetClass: 'SC.ButtonView', /** Defined by subclasses. If this is true, then the content of the view is the HTML generated by children. */ isContainer: NO, /** Defined by subclasses. If true, then views will be generated with an outletFor() attached to them. */ isOutletView: YES, /** The default profile. New records will inherit a cloned set of these attributes. */ defaultAttributes: { propertySettings: {}, bindSettings: {}, attributeSettings: {}, htmlTemplate: '<{%TagName%}{%Attributes%}>{%Content%}', cssClassNames: ['sc-button-view', 'regular', 'normal'], lazyOutlet: NO, tagName: 'a', title: 'Hello!' }, init: function() { arguments.callee.base.apply(this) ; if (this.get('newRecord')) { var attrs = this._deepClone(this.get('defaultAttributes')); attrs.name = attrs.targetClass = this._targetClass ; attrs.guid = attrs.htmlId = 'id%@'.fmt(Date.now().toString()); this.updateAttributes(attrs, YES, YES); } }, /** Invoked just before the attributes are written out. You can add anything you want here. */ prepareAttributes: function(attrs) { return attrs ; }, /** Invoked just before the class name is set. Add anything you want here. */ prepareClassNames: function(classNames) { return classNames ; }, /** Invoked just before outlets are added and the final JS is generated. Add anything here you might pull from specialized preferences. */ prepareProperties: function(props) { return props; }, /** Invoked just before bindings are blended into properties. Add your own. */ prepareBindings: function(binds) { return binds; }, innerHtml: function() { return this.get('title') ; }.property('title') }) ;