Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/2-REC/hugo-myportfolio-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Severin <severinderek@gmail.com>2021-08-28 13:48:19 +0300
committerDerek Severin <severinderek@gmail.com>2021-08-28 13:48:19 +0300
commitb2f501df6e9a4998420354a12a0911b226cbee18 (patch)
treeef11fe1a6be21226f43e7ded328e6137c878370a
parent3841cb0efa1a22af12b695e56c5088c92acb40c6 (diff)
Period/duration format + projects title-bar
-rw-r--r--layouts/_default/limage.html27
-rw-r--r--layouts/partials/pages/title.html46
-rw-r--r--layouts/partials/sections/about.html2
-rw-r--r--layouts/partials/sections/contact.html2
-rw-r--r--layouts/partials/sections/projects.html13
-rw-r--r--layouts/partials/sections/services.html2
-rw-r--r--layouts/partials/sections/skills.html2
-rw-r--r--layouts/partials/title-bar.html16
8 files changed, 79 insertions, 31 deletions
diff --git a/layouts/_default/limage.html b/layouts/_default/limage.html
index 658b5f4..daded4a 100644
--- a/layouts/_default/limage.html
+++ b/layouts/_default/limage.html
@@ -40,10 +40,31 @@
{{ end }}
{{ if .Params.startDate }}
<div class="project-date">
- From {{ .Params.startDate }}
- {{ with .Params.endDate }}
- to {{ . }}
+ {{/* TODO: rewrite shorter/cleaner */}}
+ {{ $start := dateFormat .Site.Params.projects.date_format .Params.startDate }}
+ {{ $period := "" }}
+ {{ if .Site.Params.projects.period_format }}
+ {{ if .Params.endDate }}
+ {{ $end := dateFormat .Site.Params.projects.date_format .Params.endDate }}
+ {{ $period = replace .Site.Params.projects.period_format "{start}" $start }}
+ {{ $period = replace $period "{end}" $end }}
+ {{ else }}
+ {{ if .Site.Params.projects.period_format_startonly }}
+ {{ $period = replace .Site.Params.projects.period_format_startonly "{start}" $start }}
+ {{ else }}
+ {{ $period = replace .Site.Params.projects.period_format "{start}" $start }}
+ {{ $period = replace $period "{end}" "..." }}
+ {{ end }}
+ {{ end }}
+ {{ else }}
+ {{ if .Params.endDate }}
+ {{ $end := dateFormat .Site.Params.projects.date_format .Params.endDate }}
+ {{ $period = print "From " $start " to " $end }}
+ {{ else }}
+ {{ $period = print "From " $start }}
+ {{ end }}
{{ end }}
+ {{ $period }}
</div>
{{ end }}
</div>
diff --git a/layouts/partials/pages/title.html b/layouts/partials/pages/title.html
index 1e65a63..16ff432 100644
--- a/layouts/partials/pages/title.html
+++ b/layouts/partials/pages/title.html
@@ -9,18 +9,44 @@
{{/* Period */}}
{{ if .Params.startDate }}
- <h3>
- From {{ dateFormat .Site.Params.projects.date_format .Params.startDate }}
- {{ if .Params.endDate }}
- {{ $end := (time .Params.endDate) }}
- {{ $duration := $end.Sub (time .Params.startDate) }}
- {{ $months := int (div (int (div $duration.Hours 24)) 30.4167) }}
- {{ $years := int (div $months 12) }}
- {{ $months := int (sub $months (mul $years 12)) }}
+ <h3>
+ {{/* TODO: make partial + rewrite shorter/cleaner */}}
+ {{ $start := dateFormat .Site.Params.projects.date_format .Params.startDate }}
+ {{ $period := "" }}
+ {{ if .Site.Params.projects.period_format }}
+ {{ if .Params.endDate }}
+ {{ $end := dateFormat .Site.Params.projects.date_format .Params.endDate }}
+ {{ $period = replace .Site.Params.projects.period_format "{start}" $start }}
+ {{ $period = replace $period "{end}" $end }}
+ {{ else }}
+ {{ if .Site.Params.projects.period_format_startonly }}
+ {{ $period = replace .Site.Params.projects.period_format_startonly "{start}" $start }}
+ {{ else }}
+ {{ $period = replace .Site.Params.projects.period_format "{start}" $start }}
+ {{ $period = replace $period "{end}" "..." }}
+ {{ end }}
+ {{ end }}
+ {{ else }}
+ {{ if .Params.endDate }}
+ {{ $end := dateFormat .Site.Params.projects.date_format .Params.endDate }}
+ {{ $period = print "From " $start " to " $end }}
+ {{ else }}
+ {{ $period = print "From " $start }}
+ {{ end }}
+ {{ end }}
+ {{ $period }}
- to {{ dateFormat .Site.Params.projects.date_format .Params.endDate }}
- | {{ if gt $years 0 }}{{ $years }} year{{ if gt $years 1 }}s{{ end }}{{ end }}{{ if and (gt $years 0) (gt $months 0) }}, {{ end }}{{ if gt $months 0 }}{{ $months }} month{{ if gt $months 1 }}s{{ end }}{{ end }}
+ {{/* Duration */}}
+ {{ $end := now }}
+ {{ if .Params.endDate }}
+ {{ $end = (time .Params.endDate) }}
{{ end }}
+ {{ $duration := $end.Sub (time .Params.startDate) }}
+ {{ $months := int (div (int (div $duration.Hours 24)) 30.4167) }}
+ {{ $years := int (div $months 12) }}
+ {{ $months := int (sub $months (mul $years 12)) }}
+ {{/* TODO: REWRITE! */}}
+ | {{ if gt $years 0 }}{{ $years }} year{{ if gt $years 1 }}s{{ end }}{{ end }}{{ if and (gt $years 0) (gt $months 0) }}, {{ end }}{{ if gt $months 0 }}{{ $months }} month{{ if gt $months 1 }}s{{ end }}{{ end }}
</h3>
{{ end }}
</hgroup>
diff --git a/layouts/partials/sections/about.html b/layouts/partials/sections/about.html
index a31e905..c9425e5 100644
--- a/layouts/partials/sections/about.html
+++ b/layouts/partials/sections/about.html
@@ -33,7 +33,9 @@
{{- end -}}
">
{{ with .title }}
+ <div class="container-fluid">
{{ partial "title-bar.html" (dict "title" . "align" $params.title_align "length" $params.title_length) }}
+ </div>
{{ end }}
<div class="container-fluid">
<div class="row">
diff --git a/layouts/partials/sections/contact.html b/layouts/partials/sections/contact.html
index 4411010..bd88453 100644
--- a/layouts/partials/sections/contact.html
+++ b/layouts/partials/sections/contact.html
@@ -6,7 +6,9 @@
{{ end }}
>
{{ with .title }}
+ <div class="container-fluid">
{{ partial "title-bar.html" (dict "title" . "align" $params.title_align "length" $params.title_length) }}
+ </div>
{{ end }}
<div class="container-fluid">
<div class="row">
diff --git a/layouts/partials/sections/projects.html b/layouts/partials/sections/projects.html
index 8be7c09..c35847f 100644
--- a/layouts/partials/sections/projects.html
+++ b/layouts/partials/sections/projects.html
@@ -1,15 +1,10 @@
-{{ "<!-- PROJECTS -->" | safeHTML }}
+{{ $params := .Site.Params.projects }}
<section class="section projects" id="projects_{{ trim .File.Dir "/\\" }}">
{{ $path := replace .File.Dir "\\" "/" }}
{{ with .Title }}
- <a href="/{{ $path }}" class="container-fluid projects-link">
- <div class="row">
- <div class="col-md-8 section-title-left">
- <h2 class="section-heading">{{ . }}</h2>
- <hr class="primary">
- </div>
- </div>
- </a>
+ <a href="/{{ $path }}" class="container-fluid projects-link">
+ {{ partial "title-bar.html" (dict "title" . "align" $params.title_align "length" $params.title_length) }}
+ </a>
{{ end }}
<div class="container-fluid">
<div class="row no-gutter">
diff --git a/layouts/partials/sections/services.html b/layouts/partials/sections/services.html
index 0c2d37b..ac1333e 100644
--- a/layouts/partials/sections/services.html
+++ b/layouts/partials/sections/services.html
@@ -6,7 +6,9 @@
{{ end }}
>
{{ with .title }}
+ <div class="container-fluid">
{{ partial "title-bar.html" (dict "title" . "align" $params.title_align "length" $params.title_length) }}
+ </div>
{{ end }}
<div class="container services-container">
<div class="row">
diff --git a/layouts/partials/sections/skills.html b/layouts/partials/sections/skills.html
index 72dc59e..dd4405d 100644
--- a/layouts/partials/sections/skills.html
+++ b/layouts/partials/sections/skills.html
@@ -2,7 +2,9 @@
{{ $data := .Site.Data.skills }}
<section class="section" id="skills">
{{ with $data.title }}
+ <div class="container-fluid">
{{ partial "title-bar.html" (dict "title" . "align" $params.title_align "length" $params.title_length) }}
+ </div>
{{ end }}
<div class="container-fluid">
<div class="row">
diff --git a/layouts/partials/title-bar.html b/layouts/partials/title-bar.html
index bc4c574..2bd2ff8 100644
--- a/layouts/partials/title-bar.html
+++ b/layouts/partials/title-bar.html
@@ -4,23 +4,21 @@
- align: alignment (left|center|right)
- title: the title text
*/}}
-<div class="container-fluid">
- <div class="row">
+<div class="row">
{{ $title_length := 10 }}
{{ with .length }}
- {{ $title_length = . }}
+ {{ $title_length = . }}
{{ end }}
{{ if eq .align "left" }}
- <div class="col-md-{{ $title_length }} section-title-left">
+ <div class="col-md-{{ $title_length }} section-title-left">
{{ else if eq .align "right" }}
- <div class="col-md-{{ $title_length }} col-md-offset-{{ sub 12 $title_length }} section-title-right">
+ <div class="col-md-{{ $title_length }} col-md-offset-{{ sub 12 $title_length }} section-title-right">
{{ else }}
- <div class="col-md-{{ $title_length }} col-md-offset-{{ div (sub 12 $title_length) 2 }} section-title-center">
+ <div class="col-md-{{ $title_length }} col-md-offset-{{ div (sub 12 $title_length) 2 }} section-title-center">
{{ end }}
- {{ with .title }}
+ {{ with .title }}
<h2 class="section-heading">{{ . }}</h2>
<hr class="section-hr">
- {{ end }}
+ {{ end }}
</div>
- </div>
</div> \ No newline at end of file