3 * A Backbone View that renders the visual view of a contextual region element.
6 (function (Drupal, Backbone, Modernizr) {
10 Drupal.contextual.RegionView = Backbone.View.extend(/** @lends Drupal.contextual.RegionView# */{
13 * Events for the Backbone view.
16 * A mapping of events to be used in the view.
20 mouseenter: function () { this.model.set('regionIsHovered', true); },
21 mouseleave: function () {
22 this.model.close().blur().set('regionIsHovered', false);
25 // We don't want mouse hover events on touch.
26 if (Modernizr.touchevents) {
33 * Renders the visual view of a contextual region element.
37 * @augments Backbone.View
39 initialize: function () {
40 this.listenTo(this.model, 'change:hasFocus', this.render);
46 * @return {Drupal.contextual.RegionView}
47 * The current contextual region view.
50 this.$el.toggleClass('focus', this.model.get('hasFocus'));
57 })(Drupal, Backbone, Modernizr);