Skip to content

Commit

Permalink
Merge pull request #58 from diggyk/master
Browse files Browse the repository at this point in the history
Prevent reloading of page on path change
  • Loading branch information
jathanism committed Sep 30, 2015
2 parents a3b636d + f721c97 commit 8dc5fd5
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 18 deletions.
25 changes: 25 additions & 0 deletions hermes/webapp/src/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,31 @@ button:disabled {
background: #fffdec;
}

.quest-list-entry.ng-enter {
transition: 0.15s ease-out all;
margin-top: -20px;
opacity: 0;
}

.quest-list-entry.ng-enter-active {
opacity: 1;
margin-top: 0px;
}

.quest-list-entry.ng-enter-stagger {
-webkit-transition-delay: 0.05s;
-moz-transition-delay: 0.05s;
-ms-transition-delay: 0.05s;
-o-transition-delay: 0.05s;
transition-delay: 0.05s;

-webkit-transition-duration: 0s;
-moz-transition-duration: 0s;
-ms-transition-duration: 0s;
-o-transition-duration: 0s;
transition-duration: 0s;
}

.quest-details {
padding: 20px 0px 20px 0px;
}
Expand Down
39 changes: 22 additions & 17 deletions hermes/webapp/src/js/controllers/questStatusCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
function QuestStatusCtrl(hermesService, $q, $routeParams, $location) {
var vm = this;

vm.initialized = false;

vm.errorMessage = null;
vm.filterByCreator = null;
vm.queryInput = null;
Expand All @@ -24,22 +26,25 @@
vm.newQuestSelection = newQuestSelection;
vm.goToCreatePage = goToCreatePage;

if ($routeParams.byQuery) {
vm.queryInput = $routeParams.byQuery;
}
if (!vm.initialized) {
vm.initialized = true;
if ($routeParams.byQuery) {
vm.queryInput = $routeParams.byQuery;
}

// if user passed a filter-by-creator query param, that takes precedence.
// otherwise, the default is to use the authenticate user
if ($routeParams.byCreator) {
vm.filterByCreator = $routeParams.byCreator;
getOpenQuests();
} else {
hermesService.getCurrentUser().then(function(user){
if (user) {
vm.filterByCreator = user;
}
// if user passed a filter-by-creator query param, that takes precedence.
// otherwise, the default is to use the authenticate user
if ($routeParams.byCreator) {
vm.filterByCreator = $routeParams.byCreator;
getOpenQuests();
});
} else {
hermesService.getCurrentUser().then(function (user) {
if (user) {
vm.filterByCreator = user;
}
getOpenQuests();
});
}
}


Expand Down Expand Up @@ -95,6 +100,8 @@
function runNewFilter() {
$routeParams.questId = null;
vm.offset = 0;
vm.questData = null;
vm.selectedQuest= null;
getOpenQuests();
}

Expand Down Expand Up @@ -168,7 +175,7 @@
]).then(function(data) {
vm.hostOwners = data[0];
vm.selectedQuestDetails = data[1];
$location.update_path('/v1/quests/' + quest.id, true);
$location.path('/v1/quests/' + quest.id, false);
analyzeLabors(data[0], data[1]);
});
}
Expand Down Expand Up @@ -205,8 +212,6 @@
vm.types = {};
for (var idx in laborsUnique) {
var hostname = laborsUnique[idx]['host']['hostname'];
var owner = null;

var owner = ownerData[hostname];
var creator = questData['creator'];
var forOwner = laborsUnique[idx]['forOwner'];
Expand Down
2 changes: 1 addition & 1 deletion hermes/webapp/src/templates/questStatus.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<div class="col-md-10">
</div>
<div class="col-md-2">
<button ng-click="qc.runNewFilter()">GO</button>
<button type="button" ng-click="qc.runNewFilter()">GO</button>
</div>
</div>
<div style="padding: 5px 0px 5px 0px">
Expand Down

0 comments on commit 8dc5fd5

Please sign in to comment.