/* * Licensed Materials - Property of IBM * * IBM Cognos Products: SHARE * * (C) Copyright IBM Corp. 2015, 2017 * * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with * IBM Corp. */ define([ 'jquery', 'q', 'bi/sharecommon/utils/simpledoT', 'bi/sharecommon/utils/translator', 'bi/glass/app/ContentView', 'bi/commons/utils/Utils', 'bi/commons/ui/properties/PropertyUIControl', 'bootstrap' ], function($, Q, dot, t, View, Utils, PropertyUIControl) { 'use strict'; var optionsSlideoutView = View.extend({ /** * @constructs * @public * @param {Object} options - set of initial properties * @param {Object} options.$el - The HTML element this view will be created at * @param {Object} options.slideout - Glass slideout object. * @param {function} options.closeCallback - If defined this is called when remove() is executed. */ init: function(options) { optionsSlideoutView.inherited('init', this, arguments); $.extend(this, options); }, render: function() { var deferred = Q.defer(); this._propertyUIControl = new PropertyUIControl({ 'glassContext': this.glassContext, 'el': this.$el, 'closeCallback': this._close.bind(this), 'items': [{ 'type': 'Banner', 'centerLabel': true, 'backButton': this.slideout.overlay, 'value': this.title }] }); this._propertyUIControl.render().done(function() { this.$el.find('.propertiesUIControlPageView').append(this.content); this.$el.find('.propertyUIControl').addClass('new_schedule_panel'); if(typeof this.setUpCallback === 'function') { this.setUpCallback(this.content); } this._setEvents(); deferred.resolve(true); }.bind(this)); return deferred.promise; }, setFocus: function() { if(!this.slideout.overlay){ this.$el.find(".checkbox:eq(0)").focus(); } else { this.$el.find('*[tabindex]:eq(0)').focus(); } }, remove: function() { if(typeof this.closeCallback === 'function') { this.closeCallback(); } }, _setEvents: function() { this.$el.find('.schedule_primary_button').on('clicktap', function(){ this._close(); }.bind(this)); }, _close: function() { this.slideout.hide({ hideOnly: true }); } }); return optionsSlideoutView; });