12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- "use strict";
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: Cognos Analytics
- * Copyright IBM Corp. 2015, 2017
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['q', 'underscore', 'bi/commons/ui/View', 'bi/admin/nls/StringResource', 'bi/commons/ui/ButtonBar'], function (Q, _, View, StringResource, ButtonBar) {
- 'use strict'; //NOSONAR
- var FeaturesFooter = View.extend({
- init: function init(options) {
- FeaturesFooter.inherited('init', this, arguments);
- _.extend(this, options);
- this._buttonBar = null;
- },
- render: function render() {
- var deferred = Q.defer();
- this._buttonBar = new ButtonBar({
- buttons: [{
- 'id': 'applyID',
- 'label': StringResource.get('apply'),
- 'onSelect': this.onApply.bind(this),
- 'disabled': true
- }, {
- 'id': 'admin-features-resetToDefaultsID',
- 'label': StringResource.get('reset'),
- 'onSelect': this.onReset.bind(this),
- 'disabled': this.isCustomized ? false : true
- }]
- });
- this._buttonBar.render().then(function (el) {
- _.each(this._buttonBar.getButtonList(), function (button) {
- button.disabled ? button.disable() : button.enable();
- }.bind(this));
- deferred.resolve(el);
- }.bind(this));
- return deferred.promise;
- },
- remove: function remove() {
- if (this._buttonBar) {
- this._buttonBar.remove();
- }
- },
- setModified: function setModified(modified) {
- _.each(this._buttonBar.getButtonList(), function (button) {
- if (modified) {
- if (button.id === 'applyID') {
- button.enable();
- }
- } else {
- button.disable();
- }
- });
- }
- });
- return FeaturesFooter;
- });
|