40 lines
1014 B
JavaScript
40 lines
1014 B
JavaScript
/**
|
|
* DO NOT EDIT THIS FILE.
|
|
* See the following change record for more information,
|
|
* https://www.drupal.org/node/2815083
|
|
* @preserve
|
|
**/
|
|
|
|
(function ($, Backbone, Drupal) {
|
|
Drupal.quickedit.ContextualLinkView = Backbone.View.extend({
|
|
events() {
|
|
function touchEndToClick(event) {
|
|
event.preventDefault();
|
|
event.target.click();
|
|
}
|
|
|
|
return {
|
|
'click a': function (event) {
|
|
event.preventDefault();
|
|
this.model.set('state', 'launching');
|
|
},
|
|
'touchEnd a': touchEndToClick
|
|
};
|
|
},
|
|
|
|
initialize(options) {
|
|
this.$el.find('a').each((index, element) => {
|
|
element.textContent = options.strings.quickEdit;
|
|
});
|
|
this.render();
|
|
this.listenTo(this.model, 'change:isActive', this.render);
|
|
},
|
|
|
|
render(entityModel, isActive) {
|
|
this.$el.find('a').attr('aria-pressed', isActive);
|
|
this.$el.closest('.contextual').toggle(!isActive);
|
|
return this;
|
|
}
|
|
|
|
});
|
|
})(jQuery, Backbone, Drupal); |