Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/quickedit/js/views/ContextualLinkView.js @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c75dbcec494b |
---|---|
1 /** | |
2 * DO NOT EDIT THIS FILE. | |
3 * See the following change record for more information, | |
4 * https://www.drupal.org/node/2815083 | |
5 * @preserve | |
6 **/ | |
7 | |
8 (function ($, Backbone, Drupal) { | |
9 Drupal.quickedit.ContextualLinkView = Backbone.View.extend({ | |
10 events: function events() { | |
11 function touchEndToClick(event) { | |
12 event.preventDefault(); | |
13 event.target.click(); | |
14 } | |
15 | |
16 return { | |
17 'click a': function clickA(event) { | |
18 event.preventDefault(); | |
19 this.model.set('state', 'launching'); | |
20 }, | |
21 'touchEnd a': touchEndToClick | |
22 }; | |
23 }, | |
24 initialize: function initialize(options) { | |
25 this.$el.find('a').text(options.strings.quickEdit); | |
26 | |
27 this.render(); | |
28 | |
29 this.listenTo(this.model, 'change:isActive', this.render); | |
30 }, | |
31 render: function render(entityModel, isActive) { | |
32 this.$el.find('a').attr('aria-pressed', isActive); | |
33 | |
34 this.$el.closest('.contextual').toggle(!isActive); | |
35 | |
36 return this; | |
37 } | |
38 }); | |
39 })(jQuery, Backbone, Drupal); |