Skip to content

Commit

Permalink
Bug fix for multiple hotgrids in a topic
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertPeek committed Mar 10, 2016
1 parent dd351c2 commit 2161d82
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Hotgrid automatically switches to 2 columns in mobile mode for the best user exp


----------------------------
**Version number:** 2.0.2
**Version number:** 2.0.3
**Framework versions:** 2.0
**Author / maintainer:**
**Accessibility support:** WAI AA
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "adapt-hotgrid-audio",
"version": "2.0.2",
"version": "2.0.3",
"framework": "2.0.4",
"homepage": "https://github.com/deltanet/adapt-hotgrid-audio",
"displayName": "Hotgrid",
Expand Down
26 changes: 23 additions & 3 deletions js/adapt-hotgrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,24 @@ define(function(require) {
// Listen for text change on audio extension
this.listenTo(Adapt, "audio:changeText", this.replaceText);

this.listenTo(Adapt, 'hotgridNotify:back', this.previousItem);
this.listenTo(Adapt, 'hotgridNotify:next', this.nextItem);
this.listenTo(Adapt, 'notify:closed', this.closeNotify, this);

this.setDeviceSize();
},

setupNotifyListeners: function() {
if (componentActive == true) {
this.listenTo(Adapt, 'hotgridNotify:back', this.previousItem);
this.listenTo(Adapt, 'hotgridNotify:next', this.nextItem);
}
},

removeNotifyListeners: function() {;
this.stopListening(Adapt, 'hotgridNotify:back', this.previousItem);
this.stopListening(Adapt, 'hotgridNotify:next', this.nextItem);
componentActive = false;
},

setDeviceSize: function() {
if (Adapt.device.screenSize === 'large') {
this.$el.addClass('desktop').removeClass('mobile');
Expand All @@ -50,7 +62,7 @@ define(function(require) {
if (this.model.get('_reducedText') && this.model.get('_reducedText')._isEnabled) {
this.replaceText(Adapt.audio.textSize);
}

var componentActive = false;
var activeItem = 0;
},

Expand Down Expand Up @@ -132,6 +144,8 @@ define(function(require) {
$link.attr('aria-label', function(index,val) {return val + " " + visitedLabel});
}

componentActive = true;

this.showItemContent(itemModel);

this.evaluateCompletion();
Expand All @@ -140,6 +154,8 @@ define(function(require) {
showItemContent: function(itemModel) {
if(this.isPopupOpen) return;// ensure multiple clicks don't open multiple notify popups

this.setupNotifyListeners();

// Set popup text to default full size
var popupObject_title = itemModel.title;
var popupObject_body = itemModel.body;
Expand Down Expand Up @@ -296,6 +312,10 @@ define(function(require) {
}
},

closeNotify: function() {
this.removeNotifyListeners();
},

// Reduced text
replaceText: function(value) {
// If enabled
Expand Down

0 comments on commit 2161d82

Please sign in to comment.