ContextualLinkView.js 1015 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. (function ($, Backbone, Drupal) {
  8. Drupal.quickedit.ContextualLinkView = Backbone.View.extend({
  9. events: function events() {
  10. function touchEndToClick(event) {
  11. event.preventDefault();
  12. event.target.click();
  13. }
  14. return {
  15. 'click a': function clickA(event) {
  16. event.preventDefault();
  17. this.model.set('state', 'launching');
  18. },
  19. 'touchEnd a': touchEndToClick
  20. };
  21. },
  22. initialize: function initialize(options) {
  23. this.$el.find('a').text(options.strings.quickEdit);
  24. this.render();
  25. this.listenTo(this.model, 'change:isActive', this.render);
  26. },
  27. render: function render(entityModel, isActive) {
  28. this.$el.find('a').attr('aria-pressed', isActive);
  29. this.$el.closest('.contextual').toggle(!isActive);
  30. return this;
  31. }
  32. });
  33. })(jQuery, Backbone, Drupal);