From bfae0511d3c438855659916d3f39da0d9d4898ca Mon Sep 17 00:00:00 2001 From: George Cushen Date: Sun, 30 Sep 2018 22:52:52 +0100 Subject: [PATCH] Add experience widget * See `exampleSite/content/home/experience.md` for demo * Add `present` to language pack Also: * Enable color theme packs to change link color * Reduce font size in docs sidebar Close #378 --- archetypes/default.md | 2 +- archetypes/home.md | 2 +- archetypes/post.md | 2 +- archetypes/project.md | 2 +- archetypes/publication.md | 2 +- archetypes/slides.md | 2 +- archetypes/talk.md | 2 +- exampleSite/content/home/experience.md | 45 ++++++++++++++++++ i18n/en.yaml | 5 ++ layouts/partials/css/academic.css | 57 +++++++++++++++++++--- layouts/partials/css/parse_theme.css | 12 +++++ layouts/partials/widgets/experience.html | 60 ++++++++++++++++++++++++ layouts/partials/widgets/featurette.html | 2 +- 13 files changed, 181 insertions(+), 14 deletions(-) create mode 100644 exampleSite/content/home/experience.md create mode 100644 layouts/partials/widgets/experience.html diff --git a/archetypes/default.md b/archetypes/default.md index 1576d28a..196c1270 100644 --- a/archetypes/default.md +++ b/archetypes/default.md @@ -1,5 +1,5 @@ +++ -title = "{{ replace .TranslationBaseName "-" " " | title }}" +title = "{{ replace .Name "-" " " | title }}" date = {{ .Date }} draft = false diff --git a/archetypes/home.md b/archetypes/home.md index f7b5dadd..940323c6 100644 --- a/archetypes/home.md +++ b/archetypes/home.md @@ -5,7 +5,7 @@ active = true date = {{ .Date }} # Note: a full width section format can be enabled by commenting out the `title` and `subtitle` with a `#`. -title = "{{ replace .TranslationBaseName "-" " " | title }}" +title = "{{ replace .Name "-" " " | title }}" subtitle = "" # Order that this section will appear in. diff --git a/archetypes/post.md b/archetypes/post.md index 93370920..cb0f40e8 100644 --- a/archetypes/post.md +++ b/archetypes/post.md @@ -1,5 +1,5 @@ +++ -title = "{{ replace .TranslationBaseName "-" " " | title }}" +title = "{{ replace .Name "-" " " | title }}" date = {{ .Date }} draft = false diff --git a/archetypes/project.md b/archetypes/project.md index 69cef17e..4625b398 100644 --- a/archetypes/project.md +++ b/archetypes/project.md @@ -1,5 +1,5 @@ +++ -title = "{{ replace .TranslationBaseName "-" " " | title }}" +title = "{{ replace .Name "-" " " | title }}" date = {{ .Date }} draft = false diff --git a/archetypes/publication.md b/archetypes/publication.md index 15a5b41a..939a2a96 100644 --- a/archetypes/publication.md +++ b/archetypes/publication.md @@ -1,5 +1,5 @@ +++ -title = "{{ replace .TranslationBaseName "-" " " | title }}" +title = "{{ replace .Name "-" " " | title }}" date = {{ .Date }} draft = false diff --git a/archetypes/slides.md b/archetypes/slides.md index 27e4f6dd..02880bb2 100644 --- a/archetypes/slides.md +++ b/archetypes/slides.md @@ -1,5 +1,5 @@ +++ -title = "Slides" +title = "{{ replace .Name "-" " " | title }}" [slides] # Choose a theme from https://github.com/hakimel/reveal.js#theming diff --git a/archetypes/talk.md b/archetypes/talk.md index 367bb467..0839ffe3 100644 --- a/archetypes/talk.md +++ b/archetypes/talk.md @@ -1,5 +1,5 @@ +++ -title = "{{ replace .TranslationBaseName "-" " " | title }}" +title = "{{ replace .Name "-" " " | title }}" date = {{ .Date }} # Schedule page publish date. draft = false diff --git a/exampleSite/content/home/experience.md b/exampleSite/content/home/experience.md new file mode 100644 index 00000000..d28a47ea --- /dev/null +++ b/exampleSite/content/home/experience.md @@ -0,0 +1,45 @@ ++++ +# Experience widget. +widget = "experience" # Do not modify this line! +active = true # Activate this widget? true/false + +title = "Experience" +subtitle = "" + +# Order that this section will appear in. +weight = 8 + +# Date format for experience +# Refer to https://sourcethemes.com/academic/docs/customization/#date-format +date_format = "January 2006" + +# Experiences. +# Add/remove as many `[[experience]]` blocks below as you like. +# Required fields are `title`, `company`, and `date_start`. +# Leave `date_end` empty if it's your current employer. +# Begin/end multi-line descriptions with 3 quotes `"""`. +[[experience]] + title = "CEO" + company = "GenCoin" + company_url = "" + location = "California" + date_start = "2017-01-01" + date_end = "" + description = """ + Responsibilities include: + + * Analysing + * Modelling + * Deploying + """ + +[[experience]] + title = "Professor" + company = "University X" + company_url = "" + location = "California" + date_start = "2016-01-01" + date_end = "2016-12-31" + description = """Taught electronic engineering and researched semiconductor physics.""" + ++++ diff --git a/i18n/en.yaml b/i18n/en.yaml index e88f524b..4e88ee4c 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -75,6 +75,11 @@ - id: education translation: Education +# Experience widget + +- id: present + translation: Present + # Publications widget - id: more_publications diff --git a/layouts/partials/css/academic.css b/layouts/partials/css/academic.css index 3cf3990d..1ae310e4 100644 --- a/layouts/partials/css/academic.css +++ b/layouts/partials/css/academic.css @@ -100,14 +100,14 @@ h4, h5, h6 { a, h3.article-title a:hover { - color: {{ .Get "primary" }}; + color: {{ .Get "link" }}; text-decoration: none; transition: color 0.6s ease; } a:hover, a:focus { - color: {{ .Get "primary" }}; + color: {{ .Get "link_hover" }}; } img, @@ -715,7 +715,7 @@ article .article-metadata { } .article-metadata a { - color: #888; + color: rgba(0,0,0,.54); } .article-metadata a:hover { @@ -827,6 +827,52 @@ article .article-metadata { overflow: hidden; } +/************************************************* + * Experience + **************************************************/ + +.exp-title { + text-transform: none !important; +} + +.exp-company { + font-weight: normal !important; + text-transform: none !important; +} + +.exp-meta { + font-size: 0.8rem; +} + +.experience .card-text, +.experience .card-text p { + color: #000 !important; + font-size: 0.75rem !important; +} + +.dark .experience .text-muted { + color: rgba(255, 255, 255, 0.8) !important; +} + +.dark .experience .card-text, +.dark .experience .card-text p { + color: rgb(248, 248, 242) !important; +} + +.card .card-text ul { + margin-top: -1rem; + margin-bottom: 0rem; +} + +.experience .m-2 .border, +.experience .col.border-right { + border-color: {{ .Get "primary" }} !important; +} + +.experience .m-2 .border.exp-fill { + background-color: {{ .Get "primary" }} !important; +} + /************************************************* * Talks **************************************************/ @@ -1580,7 +1626,7 @@ div.alert a { .docs-sidebar .nav>li>a { display: block; padding: .25rem 1.5rem; - font-size: 90%; + font-size: 0.8rem; color: rgba(0, 0, 0, .65); } @@ -1834,8 +1880,7 @@ body.dark, } .dark .card { - background: rgb(10, 12, 24); - box-shadow: 0 2px 4px 0 rgba(255, 255, 255, 0.2); + background: #343a40; } .dark .card h4 a { diff --git a/layouts/partials/css/parse_theme.css b/layouts/partials/css/parse_theme.css index ed351b1f..9e1a300c 100644 --- a/layouts/partials/css/parse_theme.css +++ b/layouts/partials/css/parse_theme.css @@ -29,6 +29,18 @@ {{- $scr.Set "background" "rgb(40, 42, 54)" -}} {{ end }} + {{ if $theme.link }} + {{- $scr.Set "link" $theme.link -}} + {{ else }} + {{- $scr.Set "link" $theme.primary -}} + {{ end }} + + {{ if $theme.link_hover }} + {{- $scr.Set "link_hover" $theme.link_hover -}} + {{ else }} + {{- $scr.Set "link_hover" $theme.primary -}} + {{ end }} + {{- $scr.Set "primary" $theme.primary -}} {{- $scr.Set "primary_light" $theme.primary_light -}} {{- $scr.Set "primary_dark" $theme.primary_dark -}} diff --git a/layouts/partials/widgets/experience.html b/layouts/partials/widgets/experience.html new file mode 100644 index 00000000..9e54f979 --- /dev/null +++ b/layouts/partials/widgets/experience.html @@ -0,0 +1,60 @@ +{{ $ := .root }} +{{ $page := .page }} + + +
+
+

{{ with $page.Title }}{{ . | markdownify }}{{ end }}

+ {{ with $page.Params.subtitle }}

{{ . | markdownify }}

{{ end }} +
+
+ {{ with $page.Content }}

{{ . | markdownify }}

{{ end }} + + {{ if $page.Params.experience }} + {{ $exp_len := len $page.Params.experience }} + {{ range $idx, $key := sort $page.Params.experience ".date_start" "desc" }} +
+ +
+
+
 
+
 
+
+
+   +
+
+
 
+
 
+
+
+ +
+
+
+
+
+ {{ (time .date_start).Format ($.Params.date_format | default "January 2006") }} – + {{ if .date_end}} + {{ (time .date_end).Format ($.Params.date_format | default "January 2006") }} + {{else}} + {{ i18n "present" | default "Present" }} + {{end}} + {{with .location}} +
+
{{.}}
+ {{end}} +
+

{{.title | markdownify | emojify}}

+

+ {{- with .company_url}}{{end}}{{.company | markdownify | emojify}}{{with .company_url}}{{end -}} +

+ {{with .description}}
{{. | markdownify | emojify}}
{{end}} +
+
+
+
+ {{end}} + {{end}} +
+
diff --git a/layouts/partials/widgets/featurette.html b/layouts/partials/widgets/featurette.html index ec592410..1aed522c 100644 --- a/layouts/partials/widgets/featurette.html +++ b/layouts/partials/widgets/featurette.html @@ -21,7 +21,7 @@ {{ if in (slice "fab" "fas" "far" "fal") $pack }} {{ $pack_prefix = "fa" }} {{ end }} -
+
{{ with .icon }}
{{ end }}

{{ .name | markdownify | emojify }}

{{ with .description }}

{{ . | markdownify | emojify }}

{{ end }}