e98a95fb37434f81743c79ff18eb0b6dc8f01389
[yaffs-website] / web / core / modules / quickedit / js / views / ContextualLinkView.js
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);