Skip to content
This repository was archived by the owner on Jun 18, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions clientApp/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: '/'
});
Expand Down
34 changes: 28 additions & 6 deletions clientApp/js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -340,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;
Expand All @@ -357,6 +363,7 @@ function TripletInputCtrl($scope, $rootScope, $q, $route, wikinode, resource, co
$scope.endResource = start;
}


$scope.bgColor = 'explain';

$scope.isFormValid = function () {
Expand Down Expand Up @@ -438,7 +445,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 + '/' + $scope.startResource.KN_ID;
// $route.reload();
})
.error(function (data, status) {
console.log('Connection creation failed with error : ' + status);
Expand All @@ -458,8 +467,8 @@ function ResourceInputCtrl($scope) {

function emit() {
$scope.$emit('resourceSelected', {resourceName: $scope.resourceName, resource: $scope.resource});
}

}
$scope.clear = function () {
$scope.resource = null;
emit();
Expand Down Expand Up @@ -748,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();
Expand All @@ -760,8 +769,21 @@ function UserProfilePageCtrl($scope, $location, $http, $routeParams, userService
$scope.goToUrl = function (something) {
$location.path(something);
};
// Dmitry Mod - show by default the most recent connection the user made on his page
$scope.orderProp = "-connection.__CreatedOn__";

$scope.orderProp = "-(upvotes - downvotes)";
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) {
Expand Down