Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Krombel add i18n #61

Merged
merged 11 commits into from
Mar 31, 2019
Prev Previous commit
Merge branch 'develop' of git+ssh:https://github.com/tomanistor/osprey into…
… krombel-add_i18n
  • Loading branch information
tomanistor committed Mar 28, 2019
commit d44d6fb5c85eefc6ff15d796f0509eb2d7e6f8db
4 changes: 2 additions & 2 deletions layouts/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

<div class="row full center-xs middle-xs">
<div class="col-xs-12">
<h1>404!</h1>
<p>{{ i18n "404Message" }}</p>
<h1>404!</h1>
<p>{{ i18n "404Message" }}</p>
</div>
</div>

Expand Down
21 changes: 4 additions & 17 deletions layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,17 @@
<main>

<section class="blog" id="blog">
<div class="container">
<div class="row center-xs">
<div class="col-xs-12"><h1>{{ humanize .Type }}</h1></div>
</div>
<div class="row">
<div class="col-xs-12 posts-list">
{{ range .Data.Pages }}
<article>
<h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<div class=sub-header>
{{ .Date.Format (.Site.Params.dateform | default "January 2, 2006") }} · {{ i18n "minuteRead" .ReadingTime }}
</div>
</article>
{{ end }}
</div>
</div>
<div class="container">
<div class="row center-xs">
<div class="col-xs-12"><h1>{{ humanize .Type }}</h1></div>
</div>
<div class="row">
<div class="col-xs-12 posts-list">
{{ range .Data.Pages }}
<article>
<h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<div class=sub-header>
{{ .Date.Format (.Site.Params.dateform | default "January 2, 2006") }} · {{ .ReadingTime }} minute read
{{ .Date.Format (.Site.Params.dateform | default "January 2, 2006") }} · {{ i18n "minuteRead" .ReadingTime }}
</div>
</article>
{{ end }}
Expand Down
6 changes: 3 additions & 3 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
<section class="content">
<h1>{{ if .Params.heading }} {{ .Params.heading }} {{ else }} {{ .Title }} {{ end }}</h1>

<div class="sub-header">
{{ .Date.Format (.Site.Params.dateform | default "January 2, 2006") }} · {{ i18n "minuteRead" .ReadingTime }}
</div>
<div class="sub-header">
{{ .Date.Format (.Site.Params.dateform | default "January 2, 2006") }} · {{ i18n "minuteRead" .ReadingTime }}
</div>

<article class="entry-content">
{{ .Content }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/body-top.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1>{{ .Site.Params.tagline }}<span class="cursor">|</span></h1>

<nav class="row middle-xs center-xs">
<div class="col-xs-6 col-sm-1 logo">
<a href="{{ "#" | relLangURL }}"><img src="{{ .Site.Params.logoSmall }}" alt="{{ .Site.Title }}"></a>
<a href="{{ "#" | relLangURL }}"><img {{ if .Site.Params.lazyLoading }}data-src="{{ .Site.Params.logoSmall }}" class="lazyload" lazyload="on"{{ else }}src="{{ .Site.Params.logoSmall }}"{{ end }} alt="{{ .Site.Title }}"></a>
</div>
{{ range .Site.Menus.main }}
<div class="col-xs-3 col-sm-2">
Expand Down
8 changes: 4 additions & 4 deletions layouts/partials/contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ <h1>{{ i18n "letsChat" }}</h1>

<form id="form-contact" action="{{ if .Site.Params.ajaxFormspree }}https://formspree.io/{{ .Site.Params.email }}{{ else if .Site.Params.ajaxBasin }}{{ .Site.Params.ajaxBasin }}{{ end }}" method="POST">
<div class="row center-xs">
<div class="col-xs-12 col-sm-6"><input type="text" name="name" placeholder="{{ i18n "name" }}" required></div>
<div class="col-xs-12 col-sm-6"><input type="email" name="email" placeholder="{{ i18n "email" }}" required></div>
<div class="col-xs-12"><input type="text" name="_subject" placeholder="{{ i18n "subject" }}" required></div>
<div class="col-xs-12"><textarea name="message" placeholder="{{ i18n "message" }}" required></textarea></div>
<div class="col-xs-12 col-sm-6"><input type="text" name="name" aria-label="name" placeholder="{{ i18n "name" }}" required></div>
<div class="col-xs-12 col-sm-6"><input type="email" id="email" name="email" aria-label="email address" placeholder="{{ i18n "email" }}" required></div>
<div class="col-xs-12"><input type="text" name="_subject" aria-label="email subject" placeholder="{{ i18n "subject" }}" required></div>
<div class="col-xs-12"><textarea name="message" aria-label="email message" placeholder="{{ i18n "message" }}" required></textarea></div>
{{ if .Site.Params.ajaxFormspree }}
<input type="text" name="_gotcha" style="display:none">
<input type="hidden" name="_next" value="/">
Expand Down
118 changes: 32 additions & 86 deletions layouts/partials/gallery.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,93 +7,39 @@
{{ .Scratch.Set "$modalID" (slicestr .UniqueID 0 4) }}
{{ end }}

<!-- Where gallery is an odd total -->
{{ if not (modBool $galleryTotal 2) }}
<!-- Where gallery is only one item, display it fully -->
{{ if eq $galleryTotal 1 }}
{{ range first 3 $galleryReverse }}
<div class="col-xs-12" onclick {{ if .Params.color }}style="background-color:{{ .Params.color }}"{{ end }}>
<img src="{{ "images/" | relURL }}{{ .Params.image}}" {{ if .Params.alt }}alt="{{ .Params.alt }}"{{ end }}>
<div class="row middle-xs center-xs overlay">
<div class="col-xs-12">
<h2>{{ .Title }}</h2>
<div class="row middle-xs center-xs">
{{ if .Params.link1 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link1 }}">{{ i18n "view" }}</a></h3></div>{{ end }}
{{ if .Params.link2 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link2 }}">{{ i18n "code" }}</a></h3></div>{{ end }}
</div>
</div>
</div>
</div>
{{ end }}
{{ end }}
<!-- Where gallery is greater than 2 items, first 3 items display together on first row -->
{{ if gt $galleryTotal 2 }}
{{ range first 3 $galleryReverse }}
<div class="col-xs-12 col-md-4" onclick {{ if .Params.color }}style="background-color:{{ .Params.color }}"{{ end }}>
<img src="{{ "images/" | relURL }}{{ .Params.image}}" {{ if .Params.alt }}alt="{{ .Params.alt }}"{{ end }}>
<div class="row middle-xs center-xs overlay">
<div class="col-xs-12">
<h2>{{ .Title }}</h2>
<div class="row middle-xs center-xs">
{{ if .Params.link1 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link1 }}">{{ i18n "view" }}</a></h3></div>{{ end }}
{{ if .Params.link2 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link2 }}">{{ i18n "code" }}</a></h3></div>{{ end }}
</div>
</div>
</div>
</div>
{{ end }}
{{ end }}
<!-- Where gallery is greater than 3 items, all items after the first 3 display evenly in grid colums and rows -->
{{ if gt $galleryTotal 3 }}
{{ range after 3 $galleryReverse }}
<!-- Where gallery items are divisible by 3, they will appear in columns of 3 -->
{{ $col := (mod $galleryTotal 3) }}
<div class="col-xs-12 col-md-6
{{ if gt $galleryTotal 5 }}
{{ if eq $col 0 }} col-lg-4
{{ else }} col-lg-3
{{ end }}
{{ end }}" onclick {{ if .Params.color }}style="background-color:{{ .Params.color }}"{{ end }}>
<img src="{{ "images/" | relURL }}{{ .Params.image}}" {{ if .Params.alt }}alt="{{ .Params.alt }}"{{ end }}>
<div class="row middle-xs center-xs overlay">
<div class="col-xs-12">
<h2>{{ .Title }}</h2>
<div class="row middle-xs center-xs">
{{ if .Params.link1 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link1 }}">{{ i18n "view" }}</a></h3></div>{{ end }}
{{ if .Params.link2 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link2 }}">{{ i18n "code" }}</a></h3></div>{{ end }}
</div>
</div>
</div>
</div>
{{ end }}
{{ end }}
{{ $galleryTotal := len (where .Site.RegularPages "Section" "gallery") }}
{{ $galleryReverse := (where .Site.RegularPages.Reverse "Section" "gallery") }}

<!-- If gallery is an odd total -->
{{ if not (modBool $galleryTotal 2) }}

<!-- If gallery is only one item, display it fully -->
{{ if eq $galleryTotal 1 }}
{{ range first 3 $galleryReverse }}
<div class="gallery-item col-xs-12" onclick {{ if .Params.color }}style="background-color:{{ .Params.color }}"{{ end }}>
<div class= "gallery-img-container">
<img {{ if .Site.Params.lazyLoading }}data-src="{{ "images/" | relURL }}{{ .Params.image}}" lazyload="on"{{ else }}src="{{ "images/" | relURL }}{{ .Params.image}}"{{ end }} {{ if .Params.alt }}alt="{{ .Params.alt }}"{{ end }}>
</div>
<div class="row middle-xs center-xs overlay">
<a href="#modal-{{ .Scratch.Get "$modalID" }}" data-modal="modal-{{ .Scratch.Get "$modal" }}" class="gallery-modal-link"></a>
<h2>{{ .Title }}</h2>
</div>
</div>
{{ end }}
{{ end }}

<!-- Where gallery is an even total, all items display evenly in grid columns and rows -->
{{ if modBool $galleryTotal 2 }}
{{ range $galleryReverse }}
<!-- Where gallery items are great than 7 and are divisible by 4, they will appear in colums of 4, else in colums of 2 or 3 -->
<div class="col-xs-12
{{ if gt $galleryTotal 1 }} col-md-6
{{ if gt $galleryTotal 7 }}
{{ if modBool $galleryTotal 4 }} col-lg-3
{{ else }} col-lg-4
{{ end }}
{{ end }}
{{ end }}" onclick {{ if .Params.color }}style="background-color:{{ .Params.color }}"{{ end }}>
<img src="{{ "images/" | relURL }}{{ .Params.image}}" {{ if .Params.alt }}alt="{{ .Params.alt }}"{{ end }}>
<div class="row middle-xs center-xs overlay">
<div class="col-xs-12">
<h2>{{ .Title }}</h2>
<div class="row middle-xs center-xs">
{{ if .Params.link1 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link1 }}">{{ i18n "view" }}</a></h3></div>{{ end }}
{{ if .Params.link2 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link2 }}">{{ i18n "code" }}</a></h3></div>{{ end }}
</div>
</div>
</div>
</div>
{{ end }}
<!-- If gallery is greater than 2 items, first 3 items display together on first row -->
{{ if gt $galleryTotal 2 }}
{{ range first 3 $galleryReverse }}
<div class="gallery-item col-xs-12 col-md-4" onclick {{ if .Params.color }}style="background-color:{{ .Params.color }}"{{ end }}>
<div class= "gallery-img-container">
<img {{ if .Site.Params.lazyLoading }}data-src="{{ "images/" | relURL }}{{ .Params.image}}" class="lazyload" lazyload="on"{{ else }}src="{{ "images/" | relURL }}{{ .Params.image}}"{{ end }} {{ if .Params.alt }}alt="{{ .Params.alt }}"{{ end }}>
</div>
<div class="row middle-xs center-xs overlay">
<a href="#modal-{{ .Scratch.Get "$modalID" }}" data-modal="modal-{{ .Scratch.Get "$modal" }}" class="gallery-modal-link"></a>
<h2>{{ .Title }}</h2>
</div>
</div>
{{ end }}
{{ end }}

Expand All @@ -110,7 +56,7 @@ <h2>{{ .Title }}</h2>
{{- end }}
{{- end }}" onclick {{ if .Params.color }}style="background-color:{{ .Params.color }}"{{ end }}>
<div class= "gallery-img-container">
<img {{ if .Site.Params.lazyLoading }}data-src="/images/{{ .Params.image }}" class="lazyload" lazyload="on"{{ else }}src="/images/{{ .Params.image }}"{{ end }} {{ if .Params.alt }}alt="{{ .Params.alt }}"{{ end }}>
<img {{ if .Site.Params.lazyLoading }}data-src="{{ "images/" | relURL }}{{ .Params.image}}" class="lazyload" lazyload="on"{{ else }}src="{{ "images/" | relURL }}{{ .Params.image}}"{{ end }} {{ if .Params.alt }}alt="{{ .Params.alt }}"{{ end }}>
</div>
<div class="row middle-xs center-xs overlay">
<a href="#modal-{{ .Scratch.Get "$modalID" }}" data-modal="modal-{{ .Scratch.Get "$modal" }}" class="gallery-modal-link"></a>
Expand All @@ -137,7 +83,7 @@ <h2>{{ .Title }}</h2>
{{- end }}
{{- end }}" onclick {{ if .Params.color }}style="background-color:{{ .Params.color }}"{{ end }}>
<div class= "gallery-img-container">
<img {{ if .Site.Params.lazyLoading }}data-src="/images/{{ .Params.image }}" class="lazyload" lazyload="on"{{ else }}src="/images/{{ .Params.image }}"{{ end }} {{ if .Params.alt }}alt="{{ .Params.alt }}"{{ end }}>
<img {{ if .Site.Params.lazyLoading }}data-src="{{ "images/" | relURL }}{{ .Params.image}}" class="lazyload" lazyload="on"{{ else }}src="{{ "images/" | relURL }}{{ .Params.image}}"{{ end }} {{ if .Params.alt }}alt="{{ .Params.alt }}"{{ end }}>
</div>
<div class="row middle-xs center-xs overlay">
<a href="#modal-{{ .Scratch.Get "$modalID" }}" class="gallery-modal-link"></a>
Expand Down
6 changes: 3 additions & 3 deletions layouts/partials/modals.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<div class="modal-header">
<div class="modal-header-img-container" {{ if .Params.color }}style="background-color:{{ .Params.color }}"{{ end }}>
<img {{ if .Site.Params.lazyLoading }}data-src="/images/{{ .Params.image }}" class="lazyload"{{ else }}src="/images/{{ .Params.image }}"{{ end }} {{ if .Params.alt }}alt="{{ .Params.alt }}"{{ end }}>
<img {{ if .Site.Params.lazyLoading }}data-src="{{ "images/" | relURL }}{{ .Params.image}}" class="lazyload"{{ else }}src="{{ "images/" | relURL }}{{ .Params.image}}"{{ end }} {{ if .Params.alt }}alt="{{ .Params.alt }}"{{ end }}>
</div>
</div>

Expand All @@ -23,8 +23,8 @@ <h2>{{ .Params.title }}</h2>
{{ .Content }}
</article>

{{ if .Params.link1 }}<h3><a href="{{ .Params.link1 }}">View</a></h3>{{ end }}
{{ if .Params.link2 }}<h3><a href="{{ .Params.link2 }}">Code</a></h3>{{ end }}
{{ if .Params.link1 }}<h3><a href="{{ .Params.link1 }}">{{ i18n "view" }}</a></h3>{{ end }}
{{ if .Params.link2 }}<h3><a href="{{ .Params.link2 }}">{{ i18n "code" }}</a></h3>{{ end }}
</div>

</div>
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.