accurator/commit
Made next page depend on availability subdomains.
author | Chris Dijkshoorn |
---|---|
Wed Apr 13 16:10:40 2016 +0200 | |
committer | Chris Dijkshoorn |
Wed Apr 13 16:10:40 2016 +0200 | |
commit | 2d2c600453a9d954185ce5fbf8b3eec136fa3afe |
tree | 3db621d01c2afd575f07e5d98309b5099459fcee |
parent | 25959338c13ea281819c85883242e3de3966d9c6 |
Diff style: patch stat
diff --git a/rdf/domain/bible/bible_domain.ttl b/rdf/domain/bible/bible_domain.ttl index b5db2e8..dab2cfd 100644 --- a/rdf/domain/bible/bible_domain.ttl +++ b/rdf/domain/bible/bible_domain.ttl @@ -19,8 +19,7 @@ abib:domain a accu:Domain ; accu:hasAnnotationUI aabib:smallBibleUI ; accu:hasDescriptiveImage abib:jeremia ; accu:hasMaximumExpertiseTopics "50" ; - accu:hasMaximumChildren "0" ; - accu:subDomains () . + accu:hasMaximumChildren "0" . <http://iconclass.org/> a skos:ConceptScheme . diff --git a/rdf/domain/bird/bird_domain.ttl b/rdf/domain/bird/bird_domain.ttl index 513db15..19f778d 100644 --- a/rdf/domain/bird/bird_domain.ttl +++ b/rdf/domain/bird/bird_domain.ttl @@ -17,7 +17,7 @@ abir:domain a accu:Domain ; skos:hasTopConcept birds:class-aves ; accu:hasUI abirui: ; accu:hasAnnotationUI aabir:smallBirdAnnotationUi ; - accu:hasDescriptiveImage abir:hondecoeterImage ; + accu:hasDescriptiveImage abir:bird ; accu:hasMaximumExpertiseTopics "50" ; accu:hasMaximumChildren "2" . diff --git a/web/js/components/domain.js b/web/js/components/domain.js index 72fca21..d89f015 100644 --- a/web/js/components/domain.js +++ b/web/js/components/domain.js @@ -3,14 +3,13 @@ Domain Code for representing domains *******************************************************************************/ -function Domain(id, title, image, imageBrightness) { - console.log(arguments); +function Domain(id, title, image, imageBrightness, subDomains) { this.id = id; // id of domain this.title = title; // title of domain this.image = image; // image illustrating domain this.imageBrightness = imageBrightness; // is the descriptive image dark or light this.link = null; // URL of location where someone can show expertise of domain - // this.subDomains = subDomains; + this.subDomains = subDomains; this.node = null; // html of thumbnail this.init(); @@ -26,24 +25,35 @@ Domain.prototype.init = function() { 'src':this.image}) ); + this.setLink(); this.setTitleColor(); this.setClickEvent(); } +Domain.prototype.setLink = function() { + if (this.subDomains.length > 0) { + this.link = "topics.html"; + } else { + this.link = "results.html"; + } +} + Domain.prototype.setTitleColor = function() { if(this.imageBrightness === "dark") $(this.node).find("#domainTxt" + this.id).css('color', '#fff'); } Domain.prototype.setClickEvent = function() { + var _domain = this; + console.log("Setting event to link ", this.link); $(this.node).find("#domainImg" + this.id).click(function() { - setDomain(this.id) + setDomain(_domain.id) .then(function() { - document.location.href = "results.html"; + document.location.href = _domain.link; }); }); $(this.node).find("#domainTxt" + this.id).click(function() { - setDomain(this.id) + setDomain(_domain.id) .then(function() { document.location.href = "results.html"; }); diff --git a/web/js/domain.js b/web/js/domain.js index bf0a87a..07d40a1 100644 --- a/web/js/domain.js +++ b/web/js/domain.js @@ -66,15 +66,24 @@ function populateDomains(locale, domainLabels) { // define function to keep stable track of row var addDomain = function (row, locale) { return function(domainData) { - console.log(domainData); - var domain = new Domain ( - domainData.domain, - "title", // should retrieve using labels - domainData.image, - domainData.imageBrightness - ); - - $("#domainDiv" + row).append(domain.node); + getLabels(locale, domainData.hasUI + "domain") + .then(function(labels) { + var subDomains; + + domainData.subDomains ? + subDomains = domainData.subDomains + : subDomains = []; + + var domain = new Domain ( + domainData.domain, + labels.domainLabel, + domainData.image, + domainData.imageBrightness, + subDomains + ); + + $("#domainDiv" + row).append(domain.node); + }); } } @@ -82,32 +91,3 @@ function populateDomains(locale, domainLabels) { .then(addDomain(row, locale)); } } - -function domainHtml(domainData, row, locale) { - var domain = domainData.domain; - - getLabels(locale, domainData.hasUI + "domain") - .then(function(labels) { - $("#domainDiv" + row).append(); - - if(domainData.imageBrightness === "dark") - $("#domainTxt" + domainData.domain).css('color', '#fff'); - - addDomainEvent(domain); - }); -} - -function addDomainEvent(domain) { - $("#domainImg" + domain).click(function() { - setDomain(domain) - .then(function() { - document.location.href = "results.html"; - }); - }); - $("#domainTxt" + domain).click(function() { - setDomain(domain) - .then(function() { - document.location.href = "results.html"; - }); - }); -}