accurator/commit
Added code adapting the interface according to the specified domain.
author | Chris Dijkshoorn |
---|---|
Thu Feb 12 17:34:08 2015 +0000 | |
committer | Chris Dijkshoorn |
Thu Feb 12 17:34:08 2015 +0000 | |
commit | 61ca5ffa848335cb9fe217a860e4443ad9a22b58 |
tree | 2157a0e58fb748ab322a070207dfd451fbfb039d |
parent | ddbe36454997f6ec055f322f48fe63aa15a2c525 |
Diff style: patch stat
diff --git a/config-available/accurator.pl b/config-available/accurator.pl index d610b36..b0e720b 100644 --- a/config-available/accurator.pl +++ b/config-available/accurator.pl @@ -7,6 +7,7 @@ % Load ui rdf :- rdf_attach_library(accurator(rdf)). +:- rdf_load_library('accurator-generic'). :- rdf_load_library('accurator-bird-domain'). :- rdf_load_library('accurator-bible-domain'). diff --git a/rdf/accurator_domain_bible.ttl b/rdf/accurator_domain_bible.ttl index edb3b03..b3b34b8 100644 --- a/rdf/accurator_domain_bible.ttl +++ b/rdf/accurator_domain_bible.ttl @@ -10,6 +10,7 @@ @prefix skos: <http://www.w3.org/2004/02/skos/core#> . abib:domain a accu:Domain ; + rdfs:label "bible" ; dcterms:requires <http://iconclass.org/> ; skos:hasTopConcept ic:7 ; accu:hasUI abibui: ; @@ -18,4 +19,5 @@ abib:domain a accu:Domain ; <http://iconclass.org/> a skos:ConceptScheme . abib:jeremia a dctypes:StillImage ; - accu:hasFilePath "img/background/bible-dark.jpg" . \ No newline at end of file + accu:hasFilePath "img/background/bible.jpg" ; + accu:brightness "dark" . \ No newline at end of file diff --git a/rdf/accurator_domain_bird.ttl b/rdf/accurator_domain_bird.ttl index 1fe7474..3f954c1 100644 --- a/rdf/accurator_domain_bird.ttl +++ b/rdf/accurator_domain_bird.ttl @@ -10,6 +10,7 @@ @prefix skos: <http://www.w3.org/2004/02/skos/core#> . abir:domain a accu:Domain ; + rdfs:label "bird"; dcterms:requires <http://purl.org/collections/nl/naturalis/ioc_birdlist_en_nl.ttl> ; skos:hasTopConcept birds:class-aves ; accu:hasUI abirui: ; @@ -18,4 +19,5 @@ abir:domain a accu:Domain ; <http://purl.org/collections/nl/naturalis/ioc_birdlist_en_nl.ttl> a skos:ConceptScheme . abir:bird a dctypes:StillImage ; - accu:hasFilePath "img/background/bird.jpg" . \ No newline at end of file + accu:hasFilePath "img/background/bird.jpg" ; + accu:brightness "light" . \ No newline at end of file diff --git a/web/js/accurator_intro.js b/web/js/accurator_intro.js index 8f9a149..0094257 100644 --- a/web/js/accurator_intro.js +++ b/web/js/accurator_intro.js @@ -1,68 +1,44 @@ /* Accurator Intro */ -var locale, ui, domain; +var locale, ui, domain, domainSettings; function introInit() { locale = getLocale(); domain = getParameterByName("domain"); - ui = getUiUri(domain, "intro"); - setBackground(); - // If user is logged in go to profile page otherwise show intro. + // If user is logged in go to profile page onSuccess = function() { document.location.href="profile.html"; }; + // If user is not logged in populate intro page onFail = function() { - populateUI(ui); + //Get domain settings before populating ui + var onDomain = function(data) { + setBackground(data.image, data.image_brightness); + populateUI(data.ui + "intro"); + } + domainSettings = domainSettings(domain, onDomain); }; userLoggedIn(onSuccess, onFail); } -function setBackground() { - // Set a background according to the specified domain - backgroundUrl = "img/background/" + domain + ".jpg"; - backgroundDarkUrl = "img/background/" + domain + "-dark.jpg"; - backgroundGeneric = "img/background/generic.jpg"; - - if(domain === "") { - $(".backgroundImage").attr("src", backgroundGeneric); - return; +function setBackground(backgroundUrl, imageBrightness) { + if(imageBrightness=== "light") { + $(".backgroundImage").attr("src", backgroundUrl); + } else if (imageBrightness === "dark") { + $(".backgroundImage").attr("src", backgroundDarkUrl); + // Make font lighter + $("#txtSlogan").css('color', '#FFFFFF'); + $("#btnLogin").css('color', '#BBBBBB'); } - - $.ajax({url:backgroundUrl, - type:'HEAD', - success: function() { - $(".backgroundImage").attr("src", backgroundUrl); - }, - error: function() { - $.ajax({url:backgroundDarkUrl, - type:'HEAD', - success: function() { - $(".backgroundImage").attr("src", backgroundDarkUrl); - lightFontColor(); - }, - error: function() { - $(".backgroundImage").attr("src", backgroundGeneric); - } - }); - } - }); -} - -function lightFontColor() { - $("#txtSlogan").css('color', '#FFFFFF'); - $("#btnLogin").css('color', '#BBBBBB'); } function populateUI(uiLocal) { + alert(uiLocal); $.getJSON("ui_elements", {locale:locale, ui:uiLocal, type:"labels"}) .done(function(data){ addButtonEvents(); - initLabels(data);}) - .fail(function(data, textStatus){ - //Use generic ui elements - populateUI(getGenericUiUri("intro")); - }); + initLabels(data);}); } function addButtonEvents() { diff --git a/web/js/accurator_utilities.js b/web/js/accurator_utilities.js index 0b3c7d5..ff9d3c9 100644 --- a/web/js/accurator_utilities.js +++ b/web/js/accurator_utilities.js @@ -2,19 +2,19 @@ */ var loginWarning, loginIncomplete; -//UI -function getUiUri(domain, page) { - if(domain === "") { - return getGenericUiUri(page); - } else { - return "http://accurator.nl/ui/" + domain + "#" + page; - } +//Domain +function domainSettings(domain, onDomain) { + if(domain === "") + domain = "generic"; + + $.getJSON("domain_settings", {domain:domain}) + .done(function(data){ + onDomain(data); + }); } -function getGenericUiUri(page) { - return "http://accurator.nl/ui/generic#" + page; -} +//UI function setLinkLogo(page) { if(page === "profile") $(".navbar-brand").attr('href', "profile.html");