Skip to content

Commit

Permalink
Merge pull request #423 from Libisch/go_back_from_tree_to_search
Browse files Browse the repository at this point in the history
419 fix "Exit Tree"
  • Loading branch information
Libisch authored Jun 15, 2017
2 parents 8c15fa0 + b925a6b commit d0b2d14
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
10 changes: 8 additions & 2 deletions js/modules/main/src/controllers/itemPreviewCtrl.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
var ItemPreviewCtrl = function($state, $scope, itemTypeMap, mjs, item, langManager) {
var ItemPreviewCtrl = function($state, $scope, $location, $rootScope, itemTypeMap, mjs, item, langManager) {

var self = this;
this.$state = $state;
this.$rootScope = $rootScope;
this.$location = $location;
this.mjs = mjs;
this.$scope = $scope;
this.item = item;
Expand All @@ -16,6 +18,10 @@ var ItemPreviewCtrl = function($state, $scope, itemTypeMap, mjs, item, langManag

ItemPreviewCtrl.prototype = {

saveCurrentSearchUrl: function(){
this.$rootScope.lastSearchUrl = this.$location.url();
},

get_item_url: function(item_data) {
// TODO: refactor to user item.get_url
if (this.url !== undefined) {
Expand Down Expand Up @@ -67,4 +73,4 @@ ItemPreviewCtrl.prototype = {

};

angular.module('main').controller('ItemPreviewCtrl', ['$state', '$scope', 'itemTypeMap', 'mjs', 'item', 'langManager', ItemPreviewCtrl]);
angular.module('main').controller('ItemPreviewCtrl', ['$state', '$scope', '$location', '$rootScope', 'itemTypeMap', 'mjs', 'item', 'langManager', ItemPreviewCtrl]);
5 changes: 5 additions & 0 deletions js/modules/main/src/controllers/personViewController.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ var PersonViewController = function ($http, $window, $document, $rootScope,
self.load(toParams);
}
});

$scope.backToLastSearch = function() {
$location.path($rootScope.lastSearchUrl);
$rootScope.lastSearchUrl = null;
};

document.documentElement.addEventListener('mouseup', function (e) {
self.mouseUp(e)
Expand Down
2 changes: 1 addition & 1 deletion templates/main/ftrees/person.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h3>
<icon class="twitter-icon" position="[-305, -443]"></icon>
<icon class="mail-icon" position="[-340, -443]"></icon>
<mjs-widget item="ctrl.node"></mjs-widget>
<div class="ftree-title__back" ng-click="ctrl.$state.go('general-search', ctrl.persons_search)">
<div class="ftree-title__back" ng-click="backToLastSearch()">
<icon class="ftree-title__back-icon" position="[-313, -700]"></icon>
<h3>
<en>Exit Tree</en>
Expand Down
2 changes: 1 addition & 1 deletion templates/main/item-preview.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="{{itemPreviewController.collection_name==='genTreeIndividuals'? 'person-preview':'item-preview'}}">
<ng-switch on="itemPreviewController.collection_name==='genTreeIndividuals'">
<a ng-switch-when="true" ng-href="{{itemPreviewController.get_item_url(previewData)}}">
<a ng-switch-when="true" ng-href="{{itemPreviewController.get_item_url(previewData)}}" ng-click="itemPreviewController.saveCurrentSearchUrl()">
<div class="top">
<div class="tree-num">
<div class="tree-num__title">
Expand Down

0 comments on commit d0b2d14

Please sign in to comment.