accurator/commit

Changed profile page domain button.

authorChris Dijkshoorn
Tue Apr 19 15:25:58 2016 +0200
committerChris Dijkshoorn
Tue Apr 19 15:25:58 2016 +0200
commit818242b070a429552e3ca0355bf9a3bf0e27584d
tree77bc7a53fdcf4a89165876cef0b9c875a1bc7e75
parent13f4ed69c776eab36a5cd3459dda5c41f80c4c24
Diff style: patch stat
diff --git a/rdf/ui/labels.ttl b/rdf/ui/labels.ttl
index f75f487..892691f 100644
--- a/rdf/ui/labels.ttl
+++ b/rdf/ui/labels.ttl
@@ -123,7 +123,6 @@ aui:profile a auis:UI ;
 	aui:profileBtnDomain "Change domain"@en ;
 	aui:navbarBtnRecommend "Recommended works"@en ;
 	aui:navbarBtnSearch "Search"@en ;
-	aui:profileBtnChangeExpertise "Change expertise levels"@en ;
 	aui:profileLblLastAnnotated "Artworks you recently tagged"@en .
 
 aui:profilePageTitle rdfs:subPropertyOf auis:uiLabel .
@@ -134,7 +133,6 @@ aui:profileTxtDomain rdfs:subPropertyOf auis:uiLabel .
 aui:profileBtnDomain rdfs:subPropertyOf auis:uiLabel .
 aui:navbarBtnRecommend rdfs:subPropertyOf auis:uiLabel .
 aui:navbarBtnSearch rdfs:subPropertyOf auis:uiLabel .
-aui:profileBtnChangeExpertise rdfs:subPropertyOf auis:uiLabel .
 aui:profileLblLastAnnotated rdfs:subPropertyOf auis:uiLabel .
 
 ##### Search Screen #####
@@ -165,6 +163,7 @@ aui:results a auis:UI ;
 	aui:resultsHdrRandomResults "Random results"@en ;
 	aui:resultsTxtNoResults "No results found for "@en ;
 	aui:resultsTxtError "Unfortunately an error has occured"@en ;
+	aui:resultsBtnChangeExpertise "Change expertise levels"@en ;
 	aui:resultsLblCluster "Cluster view"@en ;
 	aui:resultsLblList "List view"@en .
 
@@ -180,6 +179,7 @@ aui:resultsHdrRecommendedResults rdfs:subPropertyOf auis:uiLabel .
 aui:resultsHdrRandomResults rdfs:subPropertyOf auis:uiLabel .
 aui:resultsTxtNoResults rdfs:subPropertyOf auis:uiLabel .
 aui:resultsTxtError rdfs:subPropertyOf auis:uiLabel .
+aui:resultsBtnChangeExpertise rdfs:subPropertyOf auis:uiLabel .
 aui:resultsLblCluster rdfs:subPropertyOf auis:uiLabel .
 aui:resultsLblList rdfs:subPropertyOf auis:uiLabel .
 
diff --git a/rdf/ui/labels_nl.ttl b/rdf/ui/labels_nl.ttl
index dd5161e..ddbe506 100644
--- a/rdf/ui/labels_nl.ttl
+++ b/rdf/ui/labels_nl.ttl
@@ -75,7 +75,6 @@ aui:profile a auis:UI ;
 	aui:profileBtnDomain "Verander domein"@nl ;
 	aui:navbarBtnRecommend "Aanbevolen werken"@nl ;
 	aui:navbarBtnSearch "Zoek"@nl ;
-	aui:profileBtnChangeExpertise "Verander expertise niveaus"@nl ;
 	aui:profileLblLastAnnotated "Kunstwerken waaraan u recent informatie heeft toegevoegd"@nl .
 
 ##### Search Screen #####
@@ -102,6 +101,7 @@ aui:results a auis:UI ;
 	aui:resultsHdrRandomResults "Willekeurige resultaten"@nl ;
 	aui:resultsTxtNoResults "Geen resultaten gevonden voor "@nl ;
 	aui:resultsTxtError "Helaas, er is iets fout gegaan"@nl ;
+	aui:resultsBtnChangeExpertise "Verander expertise niveaus"@nl ;
 	aui:resultsLblCluster "Cluster weergave"@nl ;
 	aui:resultsLblList "Lijst weergave"@nl .
 
diff --git a/web/html/profile.html b/web/html/profile.html
index 73e8f4b..4a95162 100644
--- a/web/html/profile.html
+++ b/web/html/profile.html
@@ -68,14 +68,7 @@
 				</div>
 				<div class="row">
 					<div class="col-md-12">
-						<div class="btn-group">
-							<button type="button" class="btn btn-primary dropdown-toggle" id="profileBtnDomain" data-toggle="dropdown" aria-expanded="false">
-								<span class="caret"></span>
-							</button>
-							<ul class="dropdown-menu" id="profileLstDomainItems" role="menu">
-							</ul>
-						</div>
-						<button class="btn btn-default" id="profileBtnChangeExpertise">
+						<button class="btn btn-primary" id="profileBtnDomain">
 						</button>
 					</div>
 				</div>
diff --git a/web/js/profile.js b/web/js/profile.js
index 2010e3c..cbe0281 100644
--- a/web/js/profile.js
+++ b/web/js/profile.js
@@ -25,6 +25,7 @@ function profileInit() {
 	});
 
 	function drawPage(userData) {
+		var domainData;
 		var user = userData.user;
 		var userName = getUserName(user);
 		var realName = userData.real_name;
@@ -33,13 +34,15 @@ function profileInit() {
 		populateNavbar(userName, [], locale);
 
 		domainSettings(domain)
-		.then(function(domainData) {
+		.then(function(data) {
+			domainData = data;
 			return getLabels(locale, domainData.hasUI + "profile");
 		})
 		.then(function(labelData) {
-			addButtonEvents(user);
 			var labels = initLabels(labelData, realName);
-			initDomains(locale, domain, labels);
+
+			addDomainTitle(domainData, locale, labels);
+			addButtonEvents(user);
 			populateRecentlyAnnotated(user, labels);
 		});
 	}
@@ -89,84 +92,33 @@ function initLabels(labelData, realName) {
 	$("#profileTxtSubSlogan").prepend(labelData.profileTxtSubSlogan);
 	$("#profileTxtStartAnnotating").append(labelData.profileTxtStartAnnotating);
 	$("#navbarBtnRecommend").append(labelData.navbarBtnRecommend);
-	$("#profileBtnChangeExpertise").append(labelData.profileBtnChangeExpertise);
 	$("#navbarBtnSearch").append(labelData.navbarBtnSearch);
 	$("#profileBtnDomain").prepend(labelData.profileBtnDomain);
 
 	return labels;
 }
 
-function initDomains(locale, domain, labels) {
-	getAvailableDomains()
-	.then(function(domains) {
-		// set domain settings for all the domains
-		for(var i = 0; i < domains.length; i++) {
-			var currentDomain = domains[i];
-
-			// already create function so currentdomain is not the last deu to asynchronisity
-			var processDomain = function(currentDomain, labels) {
-				return function(domainData) {
-					if (domain === currentDomain) {
-						addDomainTitle(domainData, locale, labels);
-					} else {
-						domainHtml(domainData, locale);
-					}
-				}
-			}
-
-			// add info about all domains except generic
-			if(currentDomain !== "generic") {
-				$.getJSON("domains", {domain:currentDomain})
-				.then(processDomain(currentDomain, labels));
-			}
-		}
-
-		// hide button if length is 2 (current domain and generic)
-		if (domain !== "generic" && domains.length === 2) {
-			$("#profileBtnDomain").parent().hide();
-		}
-	});
-}
-
 function addDomainTitle(domainData, locale, labels) {
+	console.log(labels);
 	// add the title of the current domain to the profile page
-	getLabels(locale, domainData.hasUI + "domain")
+	getLabels(locale, domainData.hasLabel)
 	.then(function(data){
 		$("#profileTxtDomain").append(
 			labels.profileTxtDomain,
-			$.el.span({'class':'text-info'},
-						data.domainLabel));}
-	);
-}
-
-function domainHtml(domainData, locale) {
-	// add the different domains to a dropdown list
-	getLabels(locale, domainData.hasUI + "domain")
-	.then(function(data) {
-		$("#profileLstDomainItems").append(
-			$.el.li(
-				$.el.a({'href':'#',
-						'id':domainData.domain},
-						 data.domainLabel)));
-
-		addDomainEvent(domainData.domain);
-	});
-}
-
-function addDomainEvent(domain) {
-	// add event reloading page on domain selection, saving choice
-	$("#" + domain).click(function() {
-		setDomain(domain)
-		.then(function() {
-			location.reload();
-		});
+			$.el.span({'class':'text-info'}, data.textLabel)
+		);
 	});
 }
 
 function addButtonEvents(user) {
 	$("#navbarBtnRecommend").click(function() {
-		document.location.href = "results.html" + "?user=" + user;
+		document.location.href = "results.html?user=" + user;
+	});
+
+	$("#profileBtnDomain").click(function() {
+		document.location.href = "domain.html";
 	});
+
 	// Search on pressing enter
 	$("#navbarInpSearch").keypress(function(event) {
 		if (event.which == 13) {