2014-01-08 07:03:02 +00:00
|
|
|
/**
|
2017-05-19 22:12:53 +00:00
|
|
|
* DO NOT EDIT THIS FILE.
|
|
|
|
* See the following change record for more information,
|
2017-05-23 14:30:14 +00:00
|
|
|
* https://www.drupal.org/node/2815083
|
2017-05-19 22:12:53 +00:00
|
|
|
* @preserve
|
|
|
|
**/
|
2014-01-08 07:03:02 +00:00
|
|
|
|
|
|
|
(function (Drupal, Backbone) {
|
2017-05-19 22:12:53 +00:00
|
|
|
Drupal.contextual.AuralView = Backbone.View.extend({
|
2021-12-18 06:12:16 +00:00
|
|
|
initialize(options) {
|
2014-01-27 21:41:32 +00:00
|
|
|
this.options = options;
|
|
|
|
this.listenTo(this.model, 'change', this.render);
|
|
|
|
this.render();
|
|
|
|
},
|
2021-12-18 06:12:16 +00:00
|
|
|
|
|
|
|
render() {
|
|
|
|
const isOpen = this.model.get('isOpen');
|
2017-05-19 22:12:53 +00:00
|
|
|
this.$el.find('.contextual-links').prop('hidden', !isOpen);
|
2022-01-28 09:53:59 +00:00
|
|
|
const $trigger = this.$el.find('.trigger');
|
|
|
|
$trigger.each((index, element) => {
|
|
|
|
element.textContent = Drupal.t('@action @title configuration options', {
|
|
|
|
'@action': !isOpen ? this.options.strings.open : this.options.strings.close,
|
|
|
|
'@title': this.model.get('title')
|
|
|
|
});
|
|
|
|
}).attr('aria-pressed', isOpen);
|
2014-01-27 21:41:32 +00:00
|
|
|
}
|
2021-12-18 06:12:16 +00:00
|
|
|
|
2014-01-27 21:41:32 +00:00
|
|
|
});
|
2017-05-19 22:12:53 +00:00
|
|
|
})(Drupal, Backbone);
|