Commit 86d33f0f authored by Sean Madsen's avatar Sean Madsen

Material cust - links in header to switch editions

parent d3b4b1c9
......@@ -13,22 +13,31 @@ header.md-header .civi-logo a {
padding: 0;
}
.md-main__inner {
header.md-header .md-main__inner {
margin-top: 0;
padding-top: 1rem;
}
header .civi-header {
header.md-header .civi-header {
padding-top: 0.8rem;
padding-left: 2rem;
font-size: 1.4rem;
font-style: italic;
}
header .civi-header span {
header.md-header .civi-header span {
color: white;
}
header.md-header .edition, header.md-header .other-editions {
color: #A5CCDC !important;
}
header.md-header .other-editions {
padding-left: 2rem;
font-style: normal;
}
/* Custom colors */
button[data-md-color-primary=indigo]{background-color:#3387ac}
[data-md-color-primary=indigo] .md-typeset a{color:#3387ac}
......@@ -45,3 +54,6 @@ button[data-md-color-accent=green]{background-color:#81c459}
@media only screen and (max-width:76.1875em){html [data-md-color-primary=indigo] .md-nav--primary .md-nav__title--site{background-color:#3387ac}}
@media only screen and (min-width:60em){[data-md-color-primary=indigo] .md-nav--secondary{border-left:.4rem solid #3387ac}}
a:hover {text-decoration: underline; }
md-header-nav__source a:hover {text-decoration: none;}
......@@ -18,21 +18,16 @@
<span class="md-header-nav__parent">
<a href="/">Documentation</a>
</span>
<span class="md-header-nav__parent">
<a href="{{ base_url }}">{{ config.site_name }}</a>
</span>
<a href="{{ base_url }}">
{{ config.site_name }}
<span class="edition">({{ config.extra.edition }})</span>
</a>
<a href="{{ config.extra.book_home }}" class="other-editions">
(Other editions)
</a>
</div>
</div>
<div class="md-flex">
<!--
<div class="md-flex__cell md-flex__cell--shrink">
<a href="{{ nav.homepage.url }}" title="{{ config.site_name }}" class="{% if config.extra.logo %} md-logo {% else %} md-icon md-icon--home {% endif %} md-header-nav__button">
{% if config.extra.logo %}
<img src="{{ base_url }}/{{ config.extra.logo }}" width="24" height="24">
{% endif %}
</a>
</div>
-->
<div class="md-flex__cell md-flex__cell--stretch">
<span class="md-flex__ellipsis md-header-nav__title">
{% block site_name %}
......
......@@ -45,6 +45,12 @@ class MkDocs {
*/
private $themeCustomPath;
/**
* @var array A associative array with config values to put in the 'extra'
* setting when building the book
*/
private $extraConfig;
/**
* @var string The full filesystem location of the mkdocs.yml config file to
* use when building the book. This is the file as it's stored
......@@ -85,10 +91,21 @@ class MkDocs {
$config['theme_dir'] = $this->themeCustomPath;
}
// Set up custom colors in Material
// Set extra config which was passed into build()
foreach ($this->extraConfig as $key => $val) {
$config['extra'][$key] = $val;
}
// Set up custom config for our Material theme extension
if ($theme == 'material') {
$config['extra']['palette']['primary'] = 'indigo';
$config['extra']['palette']['accent'] = 'green';
if (!isset($config['extra']['edition'])) {
$config['extra']['edition'] = "English / Latest";
}
if (!isset($config['extra']['book_home'])) {
$config['extra']['book_home'] = "/";
}
}
// Dump config out
......@@ -122,10 +139,14 @@ class MkDocs {
*
* @param string $destinationPath The full filesystem path to the directory
* where we want the published content to go
*
* @param array $extraConfig A associative array with config values to put in
* the 'extra' setting when building the book
*/
public function build($sourcePath, $destinationPath) {
public function build($sourcePath, $destinationPath, $extraConfig = array()) {
$this->sourcePath = $sourcePath;
$this->destinationPath = $destinationPath;
$this->extraConfig = $extraConfig;
$this->customizeConfig();
......
......@@ -351,8 +351,11 @@ class Publisher {
* @return boolean TRUE if success
*/
private function build() {
$extraConfig['edition']
= "{$this->language->nativeName()} / {$this->version->name}";
$extraConfig['book_home'] = "/{$this->book->slug}";
try {
$this->mkDocs->build($this->repoPath, $this->publishPath);
$this->mkDocs->build($this->repoPath, $this->publishPath, $extraConfig);
}
catch (\Exception $e) {
$this->addMessage('CRITICAL',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment