From 1633e1075463d62b84a5ba9701ba1fd8949bc06f Mon Sep 17 00:00:00 2001 From: deemeetree Date: Tue, 29 Oct 2013 20:34:49 +0100 Subject: [PATCH 1/6] after adding a triplet redirect to user page --- clientApp/js/controllers.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clientApp/js/controllers.js b/clientApp/js/controllers.js index 227b3af..272c19d 100644 --- a/clientApp/js/controllers.js +++ b/clientApp/js/controllers.js @@ -438,7 +438,9 @@ function TripletInputCtrl($scope, $rootScope, $q, $route, wikinode, resource, co console.log("startID: ", startResourceId, "endId: ", endResourceId); connection.create(startResourceId, $scope.connectionTitle, $scope.connectionType, endResourceId) .success(function (data, status) { - $route.reload(); + // Dmitry Mod - When a triplet is added, redirect user to their profile page + window.location = '/user/' + $rootScope.user.KN_ID; + // $route.reload(); }) .error(function (data, status) { console.log('Connection creation failed with error : ' + status); From bd605d0360681e02049c2b7bfe533f2411f2f623 Mon Sep 17 00:00:00 2001 From: deemeetree Date: Tue, 29 Oct 2013 21:20:38 +0100 Subject: [PATCH 2/6] user page default sort most recent --- clientApp/js/controllers.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/clientApp/js/controllers.js b/clientApp/js/controllers.js index 272c19d..7db2ec9 100644 --- a/clientApp/js/controllers.js +++ b/clientApp/js/controllers.js @@ -188,6 +188,7 @@ function TripletListCtrl($scope, $routeParams, $location, userService, resource, }; $scope.orderProp = "-(upvotes-downvotes)"; + // First, check whether the resource is a KN Resource or a Wikipedia Article if ($routeParams.id != null) { // KN Resource @@ -762,8 +763,8 @@ function UserProfilePageCtrl($scope, $location, $http, $routeParams, userService $scope.goToUrl = function (something) { $location.path(something); }; - - $scope.orderProp = "-(upvotes - downvotes)"; + // Dmitry Mod - show by default the most recent connection the user made on his page + $scope.orderProp = "-connection.__CreatedOn__"; } function InfoLineCtrl($scope, userService, $http) { From 80823a2011126170f6ab7bb4a60988e97ae6494f Mon Sep 17 00:00:00 2001 From: deemeetree Date: Wed, 30 Oct 2013 13:55:57 +0100 Subject: [PATCH 3/6] last resource shows up as startResource on users page --- clientApp/js/app.js | 4 ++++ clientApp/js/controllers.js | 29 ++++++++++++++++++++++++----- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/clientApp/js/app.js b/clientApp/js/app.js index b9e5b15..14df407 100644 --- a/clientApp/js/app.js +++ b/clientApp/js/app.js @@ -74,6 +74,10 @@ var KnowNodesAppModule = angular.module('KnowNodesApp', ['angulartics', 'angular templateUrl: 'screens/userProfilePage', controller: UserProfilePageCtrl }). + when('/user/:id/:rid', { + templateUrl: 'screens/userProfilePage', + controller: UserProfilePageCtrl + }). otherwise({ redirectTo: '/' }); diff --git a/clientApp/js/controllers.js b/clientApp/js/controllers.js index 7db2ec9..9c687fd 100644 --- a/clientApp/js/controllers.js +++ b/clientApp/js/controllers.js @@ -341,10 +341,15 @@ function TripletInputCtrl($scope, $rootScope, $q, $route, wikinode, resource, co $scope.reversedDirection = false; $scope.$watch('concept', function (newValue) { - if ($scope.startResource == null) - $scope.startResource = newValue; + + if ($scope.startResource == null) + $scope.startResource = newValue; }); + + + + $scope.$on('resourceSelected', function (event, result) { event.stopPropagation(); $scope[result.resourceName] = result.resource; @@ -358,6 +363,7 @@ function TripletInputCtrl($scope, $rootScope, $q, $route, wikinode, resource, co $scope.endResource = start; } + $scope.bgColor = 'explain'; $scope.isFormValid = function () { @@ -440,7 +446,7 @@ function TripletInputCtrl($scope, $rootScope, $q, $route, wikinode, resource, co connection.create(startResourceId, $scope.connectionTitle, $scope.connectionType, endResourceId) .success(function (data, status) { // Dmitry Mod - When a triplet is added, redirect user to their profile page - window.location = '/user/' + $rootScope.user.KN_ID; + window.location = '/user/' + $rootScope.user.KN_ID + '/' + $scope.startResource.KN_ID; // $route.reload(); }) .error(function (data, status) { @@ -461,8 +467,8 @@ function ResourceInputCtrl($scope) { function emit() { $scope.$emit('resourceSelected', {resourceName: $scope.resourceName, resource: $scope.resource}); - } + } $scope.clear = function () { $scope.resource = null; emit(); @@ -751,7 +757,7 @@ function VoteCtrl($scope, $http, loginModal) { }; } -function UserProfilePageCtrl($scope, $location, $http, $routeParams, userService) { +function UserProfilePageCtrl($scope, $location, $http, $routeParams, resource, userService) { $scope.knownodeList = {}; $scope.isUserLoggedIn = userService.isUserLoggedIn(); @@ -765,6 +771,19 @@ function UserProfilePageCtrl($scope, $location, $http, $routeParams, userService }; // Dmitry Mod - show by default the most recent connection the user made on his page $scope.orderProp = "-connection.__CreatedOn__"; + + if ($routeParams.rid) { + + // First, check whether the resource is a KN Resource or a Wikipedia Article + // KN Resource + resource.get($routeParams.rid).then(function (resource) { + $scope.startResource = resource; + + + }); + + + } } function InfoLineCtrl($scope, userService, $http) { From fd697b5048340b62cf279d67d8d8d16dcbf93157 Mon Sep 17 00:00:00 2001 From: deemeetree Date: Sat, 9 Nov 2013 16:17:11 +0100 Subject: [PATCH 4/6] user interface mods --- config/passport.conf.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/passport.conf.js b/config/passport.conf.js index 77e1adb..cc360a8 100755 --- a/config/passport.conf.js +++ b/config/passport.conf.js @@ -13,8 +13,8 @@ bcrypt = require('bcrypt'), User = require('../model/User') - basicURL = 'http://www.knownodes.com/', - //basicURL = 'http://localhost:3000/', + //basicURL = 'http://www.knownodes.com/', + basicURL = 'http://localhost:3000/', FACEBOOK_APP_ID = "138799776273826", FACEBOOK_APP_SECRET = "6e3e885f57d1eaaca309509a7e86479a"; From d7bf89f0ceb3bdb114e5a74f1cadf6447dfed3bf Mon Sep 17 00:00:00 2001 From: deemeetree Date: Sat, 9 Nov 2013 16:20:02 +0100 Subject: [PATCH 5/6] corrected settings --- config/passport.conf.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/passport.conf.js b/config/passport.conf.js index cc360a8..5f65b71 100755 --- a/config/passport.conf.js +++ b/config/passport.conf.js @@ -13,8 +13,8 @@ bcrypt = require('bcrypt'), User = require('../model/User') - //basicURL = 'http://www.knownodes.com/', - basicURL = 'http://localhost:3000/', + basicURL = 'http://www.knownodes.com/', + // basicURL = 'http://localhost:3000/', FACEBOOK_APP_ID = "138799776273826", FACEBOOK_APP_SECRET = "6e3e885f57d1eaaca309509a7e86479a"; From e1d1be4b596ca1cd032e93a1a08c84f558be92c0 Mon Sep 17 00:00:00 2001 From: deemeetree Date: Sat, 9 Nov 2013 16:20:49 +0100 Subject: [PATCH 6/6] changed settings --- config/passport.conf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/passport.conf.js b/config/passport.conf.js index 5f65b71..77e1adb 100755 --- a/config/passport.conf.js +++ b/config/passport.conf.js @@ -14,7 +14,7 @@ User = require('../model/User') basicURL = 'http://www.knownodes.com/', - // basicURL = 'http://localhost:3000/', + //basicURL = 'http://localhost:3000/', FACEBOOK_APP_ID = "138799776273826", FACEBOOK_APP_SECRET = "6e3e885f57d1eaaca309509a7e86479a";