Mercurial > hg > isophonics-drupal-site
annotate core/modules/quickedit/js/views/ContextualLinkView.js @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 4c8ae668cc8c |
children |
rev | line source |
---|---|
Chris@0 | 1 /** |
Chris@0 | 2 * DO NOT EDIT THIS FILE. |
Chris@0 | 3 * See the following change record for more information, |
Chris@0 | 4 * https://www.drupal.org/node/2815083 |
Chris@0 | 5 * @preserve |
Chris@0 | 6 **/ |
Chris@0 | 7 |
Chris@0 | 8 (function ($, Backbone, Drupal) { |
Chris@0 | 9 Drupal.quickedit.ContextualLinkView = Backbone.View.extend({ |
Chris@0 | 10 events: function events() { |
Chris@0 | 11 function touchEndToClick(event) { |
Chris@0 | 12 event.preventDefault(); |
Chris@0 | 13 event.target.click(); |
Chris@0 | 14 } |
Chris@0 | 15 |
Chris@0 | 16 return { |
Chris@0 | 17 'click a': function clickA(event) { |
Chris@0 | 18 event.preventDefault(); |
Chris@0 | 19 this.model.set('state', 'launching'); |
Chris@0 | 20 }, |
Chris@0 | 21 'touchEnd a': touchEndToClick |
Chris@0 | 22 }; |
Chris@0 | 23 }, |
Chris@0 | 24 initialize: function initialize(options) { |
Chris@0 | 25 this.$el.find('a').text(options.strings.quickEdit); |
Chris@0 | 26 |
Chris@0 | 27 this.render(); |
Chris@0 | 28 |
Chris@0 | 29 this.listenTo(this.model, 'change:isActive', this.render); |
Chris@0 | 30 }, |
Chris@0 | 31 render: function render(entityModel, isActive) { |
Chris@0 | 32 this.$el.find('a').attr('aria-pressed', isActive); |
Chris@0 | 33 |
Chris@0 | 34 this.$el.closest('.contextual').toggle(!isActive); |
Chris@0 | 35 |
Chris@0 | 36 return this; |
Chris@0 | 37 } |
Chris@0 | 38 }); |
Chris@0 | 39 })(jQuery, Backbone, Drupal); |