AuralView.js 860 B

123456789101112131415161718192021222324252627282930
  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 (Drupal, Backbone) {
  8. Drupal.contextual.AuralView = Backbone.View.extend({
  9. initialize: function initialize(options) {
  10. this.options = options;
  11. this.listenTo(this.model, 'change', this.render);
  12. this.$el.attr('role', 'form');
  13. this.render();
  14. },
  15. render: function render() {
  16. var isOpen = this.model.get('isOpen');
  17. this.$el.find('.contextual-links').prop('hidden', !isOpen);
  18. this.$el.find('.trigger').text(Drupal.t('@action @title configuration options', {
  19. '@action': !isOpen ? this.options.strings.open : this.options.strings.close,
  20. '@title': this.model.get('title')
  21. })).attr('aria-pressed', isOpen);
  22. }
  23. });
  24. })(Drupal, Backbone);