Skip to content

Commit

Permalink
update taxon_tree onclick event
Browse files Browse the repository at this point in the history
  • Loading branch information
usemodj committed Apr 25, 2015
1 parent 2ab3868 commit 23ab3cd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion backend/controllers/auth/sessions.js
Expand Up @@ -58,7 +58,7 @@ module.exports = {
if (err) return next(err);
if (req.body.rememberMe) req.session.cookie.maxAge = 1000 * 60 * 60 * 24 * 7;
log.debug(user.serialize());
res.json(200, user.serialize());
res.status(200).json( user.serialize());
});
});

Expand Down
13 changes: 11 additions & 2 deletions frontend/app/scripts/controllers/taxon_tree.js
Expand Up @@ -12,9 +12,18 @@ angular.module('frontendApp')
$scope.data = {};
$scope.page = $stateParams.page;

$scope.$watch( 'taxontree.currentNode', function( newObj, oldObj ) {
$scope.selectNode=function(val){
//console.log(val);
if( angular.isObject(val)){
var taxon = val;
$state.go('taxons.products', {id: taxon.id});
}
};

$scope.$watch('taxontree.currentNode', function( newObj, oldObj ) {
//console.log( 'Node Selected!!' );
//console.log($scope.taxontree);
if( $scope.taxontree && angular.isObject($scope.taxontree.currentNode) ) {
console.log( 'Node Selected!!' );
//console.log( $scope.taxontree.currentNode );
var taxon = $scope.taxontree.currentNode;
$state.go('taxons.products', {id: taxon.id});
Expand Down
5 changes: 3 additions & 2 deletions frontend/app/views/partials/include/taxonTree.html
@@ -1,6 +1,7 @@
<div style="overflow-x:auto;overflow-y:hidden;white-space:nowrap; width:100%;" ng-controller="TaxonTreeCtrl">
<div ng-if=" data.taxonTree" style="display:inline-block;"
angular-treeview="true"
<div ng-if="data.taxonTree" style="display:inline-block;"
data-ng-click="selectNode(this.taxontree.currentNode)"
data-angular-treeview="true"
data-tree-id="taxontree"
data-tree-model="data.taxonTree"
data-node-id="id"
Expand Down

0 comments on commit 23ab3cd

Please sign in to comment.