'use strict'; /** * Licensed Materials - Property of IBM * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2018 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ /** * Simple Dialog to Create a New Board */ define(['../../../lib/@waca/core-client/js/core-client/ui/dialogs/BaseDialog', 'jquery', 'underscore', '../../nls/StringResources'], function (BaseDialog, $, _, stringResources) { var Dialog = null; Dialog = BaseDialog.extend({ /** * Rename dialog init function. * @param item object to rename * @param okCallback function that performs the rename */ init: function init(item, okCallback) { Dialog.inherited('init', this, arguments); this._okCallback = okCallback; if (item) { this._currentName = _.unescape(item.name); this._type = item.type ? item.type : 'Board'; this._allowEmpty = item.allowEmpty ? true : false; } else { this._type = 'Board'; this._allowEmpty = false; } this.$input = $('', { id: 'boardName', name: 'boardName', value: this._currentName, type: 'text', maxlength: '100', OnFocus: function OnFocus() { this.select(); }, on: { 'focus': function focus() { // 'this' is the jquery instance object, we don't want to bind(this) this.setSelectionRange(0, 9999); } } }); this.$input.on('input', this.toggleOk.bind(this)); }, renderContent: function renderContent(n) { this.$form = $('