Merge remote-tracking branch 'remotes/origin/AD-756-branding-for-sluiceascribeio-brow' into AD-1080-restyle-webapp-with-new-corporate-identity

Conflicts:
	js/components/header.js
This commit is contained in:
diminator 2015-10-13 11:39:20 +02:00
commit 097e158e50
3 changed files with 52 additions and 18 deletions

View File

@ -2,23 +2,7 @@
<html>
<head>
<link rel="apple-touch-icon" sizes="57x57" href="<%= BASE_URL %>static/img/hq-favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="<%= BASE_URL %>static/img/hq-favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="<%= BASE_URL %>static/img/hq-favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="<%= BASE_URL %>static/img/hq-favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="<%= BASE_URL %>static/img/hq-favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="<%= BASE_URL %>static/img/hq-favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="<%= BASE_URL %>static/img/hq-favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="<%= BASE_URL %>static/img/hq-favicons/apple-touch-icon-152x152.png">
<link rel="icon" type="image/png" href="<%= BASE_URL %>static/img/hq-favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="<%= BASE_URL %>static/img/hq-favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="<%= BASE_URL %>static/img/hq-favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="<%= BASE_URL %>static/img/hq-favicons/manifest.json">
<link rel="shortcut icon" href="<%= BASE_URL %>static/img/hq-favicons/favicon.ico">
<meta name="msapplication-TileColor" content="#00aba9">
<meta name="msapplication-TileImage" content="<%= BASE_URL %>static/img/hq-favicons/mstile-144x144.png">
<meta name="msapplication-config" content="<%= BASE_URL %>static/img/hq-favicons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

View File

@ -29,6 +29,7 @@ import NavRoutesLinks from './nav_routes_links';
import { mergeOptions } from '../utils/general_utils';
import { getLangText } from '../utils/lang_utils';
import { constructHead, setTitle } from '../utils/head_setter';
let Header = React.createClass({
propTypes: {
@ -65,8 +66,15 @@ let Header = React.createClass({
getLogo(){
let { whitelabel } = this.state;
if (whitelabel && whitelabel.logo){
return <img className="img-brand" src={whitelabel.logo} />;
if (whitelabel.title && whitelabel.head) {
setTitle(whitelabel.title);
constructHead(whitelabel.head);
}
else{
setTitle('ascribe');
}
if (whitelabel.subdomain !== 'www'){
return (<img className="img-brand" src={whitelabel.logo}/>);
}
return (
<span>

42
js/utils/head_setter.js Normal file
View File

@ -0,0 +1,42 @@
'use strict';
// elementType: string, is the type of the element, such as link, meta, etc.
// elementId id of the element
// elementAttributes: hash table containing the attributes of the relevant element
function constructHeadElement(elementType, elementId, elementAttributes) {
let head = (document.head || document.getElementsByTagName('head')[0]);
let element = document.createElement(elementType);
let oldElement = document.getElementById(elementId);
element.setAttribute('id', elementId);
for (let k in elementAttributes){
try {
element.setAttribute(k, elementAttributes[k]);
}
catch(e){
console.log(e.message);
console.log(elementAttributes);
continue;
}
}
if (oldElement) {
head.removeChild(oldElement);
}
head.appendChild(element);
}
// Accepts a dictionary of dictionaries which comprises a part or all of html head part
// {link : {id1: {rel: ... }}}
// traverses a tree of depth 3 (no backtracking)
export function constructHead(headObject){
for (let k in headObject){
let favicons = headObject[k];
for (let f in favicons){
constructHeadElement(k, f, favicons[f]);
}
}
}
export function setTitle(titleString){
document.title = titleString;
}