Skip to content

Commit

Permalink
Merge branch '6.2.x' into api-docs-gulp-6.2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
zdrawku authored Jan 23, 2019
2 parents 6c97429 + b8db79f commit 30fd6b2
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 24 deletions.
22 changes: 14 additions & 8 deletions extras/docs/themes/config.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
{
"en": {
"development": {
"url": "https://dev.infragistics.local"
"url": "https://dev.infragistics.local",
"gaID": "GTM-WLXLBZD"
},
"staging": {
"url": "https://staging.infragistics.local"
"url": "https://staging.infragistics.local",
"gaID": "GTM-NCKNPN"
},
"production": {
"url": "https://www.infragistics.com"
"url": "https://www.infragistics.com",
"gaID": "GTM-T65CF7"
}
},
"jp": {
"development": {
"url": "https://jp.dev.infragistics.local"
"url": "https://jp.dev.infragistics.local",
"gaID": "GTM-NNHVMC7"
},
"staging": {
"url": "https://jp.staging.infragistics.local"
"url": "https://jp.staging.infragistics.local",
"gaID": "GTM-WLWSDK"
},
"production": {
"url": "https://jp.infragistics.com"
"url": "https://jp.infragistics.com",
"gaID": "GTM-KVNSWJ"
}
}
}
}
}
32 changes: 20 additions & 12 deletions extras/docs/themes/sassdoc/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,13 @@ const theme = themeleon(__dirname, function (t) {
return value.substring(0, 3);
},
retrieveEnvLink: () => {
let {
NODE_ENV: node,
SASSDOC_LANG: lang
} = process.env;

if (!node || !lang) {
return;
}

const pathConfig = path.join('extras', 'docs', 'themes', 'config.json');
const config_file = JSON.parse(fs.readFileSync(pathConfig, 'utf8'));
const config = config_file[lang.trim()][node.trim()];
const config = getConfigData(process.env);
return config ? config.url : '';
},
gaID: () => {
const config = getConfigData(process.env);
return config ? config.gaID : '';
},
ifCond: (v1, operator, v2, options) => {
switch (operator) {
case '==':
Expand Down Expand Up @@ -290,3 +283,18 @@ module.exports = function (dest, ctx) {
*/
return theme.apply(this, arguments);
};

function getConfigData(envs) {
let {
NODE_ENV: env,
SASSDOC_LANG: lang
} = envs;

if (!env || !lang) {
return;
}

const pathConfig = path.join('extras', 'docs', 'themes', 'config.json');
const data = JSON.parse(fs.readFileSync(pathConfig, 'utf8'));
return data[lang.trim()][env.trim()];
}
19 changes: 19 additions & 0 deletions extras/docs/themes/sassdoc/views/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,29 @@
<link rel="shortcut icon" href="https://www.infragistics.com/assets/images/favicon.ico">
<link rel="stylesheet" href="https://use.typekit.net/zhy2hpz.css">
<link rel="stylesheet" href="assets/css/main.css" />

<!-- Google Tag Manager -->
<script>
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer', "{{gaID}}");
</script>
<!-- End Google Tag Manager -->
</head>

<body data-base-url="{{retrieveEnvLink}}">

<!-- Google Tag Manager (noscript) -->
<noscript>
<iframe src="https://www.googletagmanager.com/ns.html?id={{gaID}}"
height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript>
<!-- End Google Tag Manager (noscript) -->

{{> header}}

{{!
! You can access any variable you set in your configuration file from the `view` object.
! Basically your configuration file is passed to the view as the `view` object.
Expand Down
6 changes: 3 additions & 3 deletions extras/docs/themes/typedoc/src/assets/js/src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ export default class EnvironmentLinkSetup extends DefaultTheme {

constructor(renderer: Renderer, basePath) {
super(renderer, basePath);
Handlebars.registerHelper('envUrl', this.retrieveEnvUrl);
Handlebars.registerHelper('getConfigData', this.getConfigData);
}

private retrieveEnvUrl() {
private getConfigData(prop) {
const fileName = 'config.json';
let settings;
let config;
Expand All @@ -32,6 +32,6 @@ export default class EnvironmentLinkSetup extends DefaultTheme {
data = config[settings.localize][process.env.NODE_ENV.trim()];
}

return data ? data.url : '';
return data ? data[prop] : '';
}
}
19 changes: 18 additions & 1 deletion extras/docs/themes/typedoc/src/layouts/default.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,25 @@
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://use.typekit.net/zhy2hpz.css">
<link rel="stylesheet" href="{{relativeURL "assets/css/main.css"}}">

<!-- Google Tag Manager -->
<script>
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer', "{{getConfigData 'gaID'}}");
</script>
<!-- End Google Tag Manager -->
</head>
<body id="body" data-base-url="{{envUrl}}">
<body id="body" data-base-url="{{getConfigData "url"}}">

<!-- Google Tag Manager (noscript) -->
<noscript>
<iframe src="https://www.googletagmanager.com/ns.html?id={{getConfigData 'gaID'}}"
height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript>
<!-- End Google Tag Manager (noscript) -->

{{> header}}

Expand Down

0 comments on commit 30fd6b2

Please sign in to comment.