comindware.core.ui
Version:
Comindware Core UI provides the basic components like editors, lists, dropdowns, popups that we so desperately need while creating Marionette-based single-page applications.
32 lines (26 loc) • 949 B
JavaScript
// @flow
import template from '../templates/defaultButton.hbs';
import { htmlHelpers } from 'utils';
/**
* @name DefaultButtonView
* @memberof module:core.dropdown.views
* @class Trivial implementation of a button View that displays plain text without any styles.
* The <code>text</code> attribute of the passed model is displayed.
* Factory method {@link module:core.dropdown.factory createMenu} uses this view to display menu button.
* @constructor
* @extends Marionette.View
* @param {Object} options Options object.
* @param {Backbone.Model} options.model Data model. Must contain <code>text</code> attribute.
* */
export default Marionette.View.extend({
tagName: 'span',
attributes() {
return {
title: htmlHelpers.getTextfromHTML(this.model.get('text'))
};
},
template: Handlebars.compile(template),
modelEvents: {
change: 'render'
}
});