Skip to content

Commit

Permalink
Merge pull request #696 from dpalou/MOBILE-1824
Browse files Browse the repository at this point in the history
MOBILE-1824 wiki: Prevent changing state if same offline page clicked
  • Loading branch information
jleyva committed Oct 19, 2016
2 parents 16c3a39 + f7cfea9 commit a3c1727
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions www/addons/mod/wiki/controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,20 @@ angular.module('mm.addons.mod_wiki')

$scope.gotoPage = function(page) {
if (!page.id) {
// It's an offline page.
var stateParams = {
module: module,
moduleid: module.id,
courseid: courseId,
pagetitle: page.title,
pageid: null,
wikiid: wiki.id,
subwikiid: page.subwikiid,
action: 'page'
};
return $state.go('site.mod_wiki', stateParams);
// It's an offline page. Check if we are already in the same offline page.
if (currentPage || !pageTitle || page.title != pageTitle) {
var stateParams = {
module: module,
moduleid: module.id,
courseid: courseId,
pagetitle: page.title,
pageid: null,
wikiid: wiki.id,
subwikiid: page.subwikiid,
action: 'page'
};
return $state.go('site.mod_wiki', stateParams);
}
} else if (currentPage != page.id) {
// Add a new State.
return fetchPageContents(page.id).then(function(page) {
Expand Down

0 comments on commit a3c1727

Please sign in to comment.