annotate core/modules/contextual/js/views/AuralView.js @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 /**
Chris@0 2 * DO NOT EDIT THIS FILE.
Chris@0 3 * See the following change record for more information,
Chris@0 4 * https://www.drupal.org/node/2815083
Chris@0 5 * @preserve
Chris@0 6 **/
Chris@0 7
Chris@0 8 (function (Drupal, Backbone) {
Chris@0 9 Drupal.contextual.AuralView = Backbone.View.extend({
Chris@0 10 initialize: function initialize(options) {
Chris@0 11 this.options = options;
Chris@0 12
Chris@0 13 this.listenTo(this.model, 'change', this.render);
Chris@0 14
Chris@0 15 this.$el.attr('role', 'form');
Chris@0 16
Chris@0 17 this.render();
Chris@0 18 },
Chris@0 19 render: function render() {
Chris@0 20 var isOpen = this.model.get('isOpen');
Chris@0 21
Chris@0 22 this.$el.find('.contextual-links').prop('hidden', !isOpen);
Chris@0 23
Chris@0 24 this.$el.find('.trigger').text(Drupal.t('@action @title configuration options', {
Chris@0 25 '@action': !isOpen ? this.options.strings.open : this.options.strings.close,
Chris@0 26 '@title': this.model.get('title')
Chris@0 27 })).attr('aria-pressed', isOpen);
Chris@0 28 }
Chris@0 29 });
Chris@0 30 })(Drupal, Backbone);