-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #721 from aholachek/orcid-auth-events
redid history management object, ads login now redirects to page prio…
- Loading branch information
Showing
20 changed files
with
226 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
//widget can publish an alert | ||
|
||
var pubsub = that.getBeeHive().getPubSub(); | ||
pubsub.publish(pubsub.ALERT, new ApiFeedback({ | ||
code: ApiFeedback.CODES.ALERT, | ||
msg: "Logged in to ADS", | ||
type: "success", | ||
modal : true | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,52 @@ | ||
define(["underscore"], function (_) { | ||
|
||
var HistoryManager = function () { | ||
this.history = [] | ||
} | ||
define([ | ||
'js/components/generic_module', | ||
'js/mixins/dependon', | ||
'js/mixins/hardened', | ||
'js/components/pubsub_key' | ||
], | ||
function( | ||
GenericModule, | ||
Dependon, | ||
Hardened, | ||
PubSubKey | ||
) { | ||
|
||
_.extend(HistoryManager.prototype, { | ||
var History = GenericModule.extend({ | ||
|
||
initialize: function () { | ||
this._history = []; | ||
}, | ||
|
||
/* | ||
* This will return the prior PAGE--so the history entry before the current | ||
* one. If you are on the abstract page and were on the results page before that, | ||
* that is what will be returned. Even if you have been on several routes within | ||
* the abstract page, these will be ignored and you will be given the | ||
* actual page name. | ||
* | ||
* */ | ||
getPriorPage : function () { | ||
activate: function (beehive) { | ||
|
||
if (this.history.length <=1){ | ||
return undefined | ||
} | ||
var currentPage, p, priorPage; | ||
this.setBeeHive(beehive); | ||
var pubsub = this.getPubSub(); | ||
pubsub.subscribe(pubsub.NAVIGATE, _.bind(this.recordNav, this)); | ||
|
||
currentPage = _.last(this.history).page; | ||
//first, simplify the dict to include only pages, not subpages | ||
p = 1; | ||
while (p < this.history.length){ | ||
}, | ||
|
||
priorPage = this.history[(this.history.length -1) -p].page | ||
recordNav: function () { | ||
this._history.push([].slice.apply(arguments)); | ||
}, | ||
|
||
if (priorPage !== currentPage){ | ||
return priorPage | ||
} | ||
p+=1 | ||
|
||
} | ||
//nothing was found that differs from currentPage | ||
return undefined | ||
}, | ||
getPriorPageVal : function () { | ||
|
||
if (this.history.length <=1){ | ||
return undefined | ||
} | ||
getCurrentNav : function(){ | ||
return this._history[this._history.length-1]; | ||
}, | ||
|
||
var currentPage, p, prior, priorPage; | ||
getPreviousNav: function(){ | ||
return this._history[this._history.length-2]; | ||
}, | ||
|
||
currentPage = _.last(this.history).page; | ||
//first, simplify the dict to include only pages, not subpages | ||
p = 1; | ||
|
||
while (p < this.history.length){ | ||
prior= this.history[(this.history.length -1) -p] | ||
priorPage = prior.page | ||
|
||
if (priorPage !== currentPage){ | ||
return prior.data | ||
hardenedInterface: { | ||
getPreviousNav : "", | ||
getCurrentNav : "", | ||
} | ||
|
||
p+=1 | ||
} | ||
return undefined | ||
}, | ||
|
||
/* | ||
* Unlike get prior page, this will give you whatever the prior | ||
* route was, even if it was within the current page. | ||
* */ | ||
|
||
getPriorRoute : function(){ | ||
|
||
var subPage = this.history[this.history.length -1].subPage; | ||
var page = this.history[this.history.length -1].page; | ||
|
||
return {page: page, subPage : subPage} | ||
}, | ||
|
||
getPriorRouteVal : function(){ | ||
|
||
return this.history[this.history.length -1].data | ||
|
||
}, | ||
}); | ||
|
||
addEntry : function (item) { | ||
this.history.push(item) | ||
} | ||
}) | ||
_.extend(History.prototype, Dependon.BeeHive, Hardened); | ||
|
||
return HistoryManager | ||
return History; | ||
|
||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.