Skip to content

Commit

Permalink
Merge pull request #1011 from eiffel777/check-if-help-tips-exists
Browse files Browse the repository at this point in the history
adding check to make sure Help Tips exist before making a help tour for a portlet
  • Loading branch information
eiffel777 authored Aug 28, 2019
2 parents fae0605 + 4b046e9 commit 8f37ff1
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions html/gui/js/Portlet.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,31 @@
*/
CCR.xdmod.ui.Portlet = Ext.extend(Ext.ux.Portlet, {
helpTour: null,
helpTourDetails: [],
helpTourDetails: {},
initComponent: function () {
this.helpTourDetails.tips.forEach(function (value, index, arr) {
arr[index].target = (value.target.slice(0, 1) !== '/') ? '#' + this.id + ' ' + value.target : value.target.slice(1, value.target.length);
}, this);
if (this.helpTourDetails.tips !== undefined && this.helpTourDetails.tips.length > 0) {
this.helpTourDetails.tips.forEach(function (value, index, arr) {
arr[index].target = (value.target.slice(0, 1) !== '/') ? '#' + this.id + ' ' + value.target : value.target.slice(1, value.target.length);
}, this);

this.helpTour = new Ext.ux.HelpTipTour({
title: this.helpTourDetails.title,
items: this.helpTourDetails.tips
});
this.helpTour = new Ext.ux.HelpTipTour({
title: this.helpTourDetails.title,
items: this.helpTourDetails.tips
});

if (this.tools === undefined) {
this.tools = [];
}

this.tools.push({
id: 'maximize',
qtip: 'View Portlet Help Tour',
scope: this,
handler: function (event, toolEl, panel) {
this.helpTour.startTour();
if (this.tools === undefined) {
this.tools = [];
}
});

this.tools.push({
id: 'maximize',
qtip: 'View Portlet Help Tour',
scope: this,
handler: function (event, toolEl, panel) {
this.helpTour.startTour();
}
});
}

Ext.ux.Portlet.superclass.initComponent.apply(this, arguments);
}
Expand Down

0 comments on commit 8f37ff1

Please sign in to comment.