Skip to content

Commit

Permalink
Discussion #78: Add option for custom greeting message
Browse files Browse the repository at this point in the history
  • Loading branch information
daledavies committed Apr 13, 2023
1 parent 0f2045c commit ed9178b
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion jumpapp/.jump-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.3.2 (1681419310)
v1.3.2 (1681425251)

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion jumpapp/classes/Pages/HomePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ protected function render_header(): string {
$template = $this->mustache->loadTemplate('header');
$greeting = null;
if (!$this->config->parse_bool($this->config->get('showgreeting'))) {
$greeting = $this->language->get('tags.home');
$greeting = '#'.$this->language->get('tags.home');
} else if ($this->config->get('customgreeting') !== ''){
$greeting = $this->config->get('customgreeting');
}
$csrfsection = $this->session->getSection('csrf');
$unsplashdata = $this->cache->load('unsplash');
Expand Down
3 changes: 2 additions & 1 deletion jumpapp/classes/Pages/TagPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ class TagPage extends AbstractPage {
protected function render_header(): string {
$template = $this->mustache->loadTemplate('header');
$this->tagname = $this->routeparams['tag'];
$greeting = '#'.$this->tagname;
$title = 'Tag: '.$this->tagname;
$csrfsection = $this->session->getSection('csrf');
$unsplashdata = $this->cache->load('unsplash');
$showsearch = $this->config->parse_bool($this->config->get('showsearch', false));
$checkstatus = $this->config->parse_bool($this->config->get('checkstatus', false));
$templatecontext = [
'csrftoken' => $csrfsection->get('token'),
'greeting' => $this->tagname,
'greeting' => $greeting,
'noindex' => $this->config->parse_bool($this->config->get('noindex')),
'title' => $title,
'owmapikey' => !!$this->config->get('owmapikey', false),
Expand Down
5 changes: 4 additions & 1 deletion jumpapp/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@
'showclock' => getenv('SHOWCLOCK') ?: true,
// 12 hour clock format?
'ampmclock' => getenv('AMPMCLOCK') ?: false,
// Show a friendly greeting message rather than "#home".
// Show a friendly greeting message rather than "#home", defaults to a dynamic
// greeting based on time of day. E.g Good Morning.
'showgreeting' => getenv('SHOWGREETING') ?: true,
// Custom greeting string as alternative to built-in friendy greeting.
'customgreeting' => getenv('CUSTOMGREETING') ?: '',
// Show the search bar, requires /search/searchengines.json etc.
'showsearch' => getenv('SHOWSEARCH') ?: true,
// Include the robots noindex meta tag in site header.
Expand Down
2 changes: 1 addition & 1 deletion jumpapp/templates/header.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<body>
<div class="content fixed hidden {{# checkstatus}}status{{/ checkstatus}}">
<div class="greeting">
{{# greeting}}<span class="tagname"><span>#</span>{{greeting}}</span>{{/ greeting}}
{{# greeting}}<span class="tagname"><span></span>{{greeting}}</span>{{/ greeting}}
{{^ greeting}}<span class="chosen"></span>{{/ greeting}}
</div>

2 changes: 1 addition & 1 deletion jumpapp/templates/partials/jsbundle.mustache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<script defer src="{{{wwwurl}}}/assets/js/index.fd2874ea51dbd2dad294.min.js"></script>
<script defer src="{{{wwwurl}}}/assets/js/index.f2468ba60142a7aa8d24.min.js"></script>

0 comments on commit ed9178b

Please sign in to comment.