1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- "use strict";
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: Cognos Analytics
- * Copyright IBM Corp. 2015, 2018
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['underscore', 'q', 'bi/commons/ui/View', 'bi/admin/nls/StringResource', 'doT', 'text!bi/admin/account/templates/FeaturesHeaderTemplate.html', 'bi/admin/common/ui/MagicWand'], function (_, Q, View, StringResource, dot, FeaturesHeaderTemplate, MagicWand) {
- 'use strict'; //NOSONAR
- var FeaturesHeader = View.extend({
- $body: null,
- init: function init(options) {
- FeaturesHeader.inherited('init', this, arguments);
- _.extend(this, options);
- },
- render: function render() {
- var deferred = Q.defer();
- var sHtml = dot.template(FeaturesHeaderTemplate)({
- 'title': StringResource.get('features'),
- 'onFilter': this.onFilter
- });
- this.$el.html(sHtml);
- MagicWand.searchInput(this.$el).done(function (widgets) {
- if (widgets.length === 1) {
- this._filterInput = widgets[0];
- this._filterInput.on('changed', function (e) {
- if (this.onFilter) {
- var trimmed = e.text.trim();
- if (trimmed.length > 0 || e.text === '') {
- this.onFilter(trimmed);
- }
- }
- }.bind(this));
- }
- deferred.resolve(this.$el);
- }.bind(this));
- return deferred.promise;
- },
- setFocus: function setFocus() {},
- remove: function remove() {
- if (this.$body) {
- this.$body.remove();
- }
- }
- });
- return FeaturesHeader;
- });
|