X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fcontextual%2Fjs%2Fmodels%2FStateModel.js;fp=web%2Fcore%2Fmodules%2Fcontextual%2Fjs%2Fmodels%2FStateModel.js;h=306f5672ab53d66a0f9c93153336a4a79b083cdc;hp=465d717d56360be45b02f2790b1aa6f78fa86f4b;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/modules/contextual/js/models/StateModel.js b/web/core/modules/contextual/js/models/StateModel.js index 465d717d5..306f5672a 100644 --- a/web/core/modules/contextual/js/models/StateModel.js +++ b/web/core/modules/contextual/js/models/StateModel.js @@ -1,78 +1,25 @@ /** - * @file - * A Backbone Model for the state of a contextual link's trigger, list & region. - */ +* DO NOT EDIT THIS FILE. +* See the following change record for more information, +* https://www.drupal.org/node/2815083 +* @preserve +**/ (function (Drupal, Backbone) { - - 'use strict'; - - /** - * Models the state of a contextual link's trigger, list & region. - * - * @constructor - * - * @augments Backbone.Model - */ - Drupal.contextual.StateModel = Backbone.Model.extend(/** @lends Drupal.contextual.StateModel# */{ - - /** - * @type {object} - * - * @prop {string} title - * @prop {bool} regionIsHovered - * @prop {bool} hasFocus - * @prop {bool} isOpen - * @prop {bool} isLocked - */ - defaults: /** @lends Drupal.contextual.StateModel# */{ - - /** - * The title of the entity to which these contextual links apply. - * - * @type {string} - */ + Drupal.contextual.StateModel = Backbone.Model.extend({ + defaults: { title: '', - /** - * Represents if the contextual region is being hovered. - * - * @type {bool} - */ regionIsHovered: false, - /** - * Represents if the contextual trigger or options have focus. - * - * @type {bool} - */ hasFocus: false, - /** - * Represents if the contextual options for an entity are available to - * be selected (i.e. whether the list of options is visible). - * - * @type {bool} - */ isOpen: false, - /** - * When the model is locked, the trigger remains active. - * - * @type {bool} - */ isLocked: false }, - /** - * Opens or closes the contextual link. - * - * If it is opened, then also give focus. - * - * @return {Drupal.contextual.StateModel} - * The current contextual state model. - */ - toggleOpen: function () { + toggleOpen: function toggleOpen() { var newIsOpen = !this.get('isOpen'); this.set('isOpen', newIsOpen); if (newIsOpen) { @@ -80,30 +27,11 @@ } return this; }, - - /** - * Closes this contextual link. - * - * Does not call blur() because we want to allow a contextual link to have - * focus, yet be closed for example when hovering. - * - * @return {Drupal.contextual.StateModel} - * The current contextual state model. - */ - close: function () { + close: function close() { this.set('isOpen', false); return this; }, - - /** - * Gives focus to this contextual link. - * - * Also closes + removes focus from every other contextual link. - * - * @return {Drupal.contextual.StateModel} - * The current contextual state model. - */ - focus: function () { + focus: function focus() { this.set('hasFocus', true); var cid = this.cid; this.collection.each(function (model) { @@ -113,20 +41,11 @@ }); return this; }, - - /** - * Removes focus from this contextual link, unless it is open. - * - * @return {Drupal.contextual.StateModel} - * The current contextual state model. - */ - blur: function () { + blur: function blur() { if (!this.get('isOpen')) { this.set('hasFocus', false); } return this; } - }); - -})(Drupal, Backbone); +})(Drupal, Backbone); \ No newline at end of file