From bddf9c07bba4b15e967fbcb3e67d3e2f5bb34da6 Mon Sep 17 00:00:00 2001 From: ymcrcat Date: Tue, 13 Dec 2016 16:11:04 -0800 Subject: [PATCH] Add Talks feature and widgets (#63) --- archetypes/talk.md | 10 +++ layouts/partials/talk_li_detailed.html | 30 ++++++++ layouts/partials/talk_li_simple.html | 12 +++ layouts/partials/talk_links.html | 28 +++++++ layouts/partials/widgets/talks.html | 35 +++++++++ layouts/partials/widgets/talks_selected.html | 26 +++++++ layouts/section/talk.html | 35 +++++++++ layouts/talk/single.html | 81 ++++++++++++++++++++ static/css/hugo-academic.css | 10 +++ 9 files changed, 267 insertions(+) create mode 100644 archetypes/talk.md create mode 100644 layouts/partials/talk_li_detailed.html create mode 100644 layouts/partials/talk_li_simple.html create mode 100644 layouts/partials/talk_links.html create mode 100644 layouts/partials/widgets/talks.html create mode 100644 layouts/partials/widgets/talks_selected.html create mode 100644 layouts/section/talk.html create mode 100644 layouts/talk/single.html diff --git a/archetypes/talk.md b/archetypes/talk.md new file mode 100644 index 00000000..a5b877e3 --- /dev/null +++ b/archetypes/talk.md @@ -0,0 +1,10 @@ ++++ +math = false +title = "" +abstract = "" +abstract_short = "" +selected = false +url_pdf = "" +url_slides = "" +url_video = "" ++++ diff --git a/layouts/partials/talk_li_detailed.html b/layouts/partials/talk_li_detailed.html new file mode 100644 index 00000000..65c72d80 --- /dev/null +++ b/layouts/partials/talk_li_detailed.html @@ -0,0 +1,30 @@ +
+
+ +

+ +

+ +
+ {{ if .Params.abstract_short }} + {{ .Params.abstract_short }} + {{ else }} + {{ .Params.abstract }} + {{ end }} +
+ +
+ {{ if .Params.event }} + {{ .Params.event | markdownify }} + {{ else if .Params.event_short }} + {{ .Params.event_short | markdownify }} + {{ end }} +
+ + + +
+
+ diff --git a/layouts/partials/talk_li_simple.html b/layouts/partials/talk_li_simple.html new file mode 100644 index 00000000..4d602a90 --- /dev/null +++ b/layouts/partials/talk_li_simple.html @@ -0,0 +1,12 @@ +
  • + + {{ .Title }} +
    + {{ if .Params.event_short }} + {{ .Params.event_short | markdownify }} + {{ else if .Params.event }} + {{ .Params.event | markdownify }} + {{ end }} +
    +

    {{ partial "talk_links" (dict "content" . "is_list" 1) }}

    +
  • diff --git a/layouts/partials/talk_links.html b/layouts/partials/talk_links.html new file mode 100644 index 00000000..3386c87f --- /dev/null +++ b/layouts/partials/talk_links.html @@ -0,0 +1,28 @@ +{{ $is_list := .is_list }} +{{ $ := .content }} + +{{ if $is_list }} + + Details + +{{ end }} +{{ with $.Params.url_pdf }} + + PDF + +{{ end }} +{{ with $.Params.url_slides }} + + Slides + +{{ end }} +{{ with $.Params.url_video }} + + Video + +{{ end }} +{{ range $.Params.url_custom }} + + {{ .name }} + +{{ end }} diff --git a/layouts/partials/widgets/talks.html b/layouts/partials/widgets/talks.html new file mode 100644 index 00000000..4a67a945 --- /dev/null +++ b/layouts/partials/widgets/talks.html @@ -0,0 +1,35 @@ +{{ $ := .root }} +{{ $page := .page }} +{{ $talks_len := len (where $.Data.Pages "Type" "talk") }} + + +
    +
    +

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

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

    {{ . | markdownify }}

    {{ end }} + {{ if gt $talks_len $page.Params.count }} +

    + + {{ with $page.Params.str_all }}{{ . | markdownify }}{{ end }} + + +

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

    {{ . | markdownify }}

    {{ end }} + + {{ if $page.Params.detailed_list }} + {{ range first $page.Params.count (where $.Data.Pages "Type" "talk") }} + {{ partial "talk_li_detailed" . }} + {{ end }} + {{ else }} +
      + {{ range first $page.Params.count (where $.Data.Pages "Type" "talk") }} + {{ partial "talk_li_simple" . }} + {{ end }} +
    + {{ end }} + +
    +
    diff --git a/layouts/partials/widgets/talks_selected.html b/layouts/partials/widgets/talks_selected.html new file mode 100644 index 00000000..446cfcec --- /dev/null +++ b/layouts/partials/widgets/talks_selected.html @@ -0,0 +1,26 @@ +{{ $ := .root }} +{{ $page := .page }} + + +
    +
    +

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

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

    {{ . | markdownify }}

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

    {{ . | markdownify }}

    {{ end }} + + {{ if $page.Params.detailed_list }} + {{ range (where (where $.Data.Pages "Type" "talk") ".Params.selected" true) }} + {{ partial "talk_li_detailed" . }} + {{ end }} + {{ else }} +
      + {{ range (where (where $.Data.Pages "Type" "talk") ".Params.selected" true) }} + {{ partial "talk_li_simple" . }} + {{ end }} +
    + {{ end }} + +
    +
    diff --git a/layouts/section/talk.html b/layouts/section/talk.html new file mode 100644 index 00000000..85a56c29 --- /dev/null +++ b/layouts/section/talk.html @@ -0,0 +1,35 @@ +{{ partial "header.html" . }} +{{ partial "navbar.html" . }} +
    +
    +
    +

    Talks

    + + {{ range .Data.Pages.GroupByDate "2006" }} +
    +
    +

    {{ .Key }}

    +
    +
    +
      + + {{ range .Pages.ByDate.Reverse }} +
    • + + {{ .Title }} +

      {{ partial "talk_links" (dict "content" . "is_list" 1) }}

      +
    • + {{ end }} + +
    +
    +
    + {{ end }} + +
    +
    + +
    +{{ partial "footer_container.html" . }} +{{ partial "footer.html" . }} diff --git a/layouts/talk/single.html b/layouts/talk/single.html new file mode 100644 index 00000000..09f4cd14 --- /dev/null +++ b/layouts/talk/single.html @@ -0,0 +1,81 @@ +{{ partial "header.html" . }} +{{ partial "navbar.html" . }} +
    + +
    +
    +

    {{ .Title }}

    + + + {{ partial "share.html" . }} + +
    + + {{ if .Params.image }} + + {{end}} + + {{ if .Params.abstract }} +

    Abstract

    +

    {{ .Params.abstract }}

    + {{ else }} +
    + {{ end }} + +
    +
    +
    +
    +
    Event
    +
    {{ .Params.event | markdownify }}
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    Date
    + +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    Links
    +
    + + {{ partial "publication_links" (dict "content" . "is_list" 0) }} + +
    +
    +
    +
    +
    +
    + +
    + +
    {{ .Content }}
    + +
    + + {{ partial "section_pager.html" . }} + +
    +{{ partial "footer_container.html" . }} +{{ partial "footer.html" . }} diff --git a/static/css/hugo-academic.css b/static/css/hugo-academic.css index 1f1e56c6..a6a37524 100644 --- a/static/css/hugo-academic.css +++ b/static/css/hugo-academic.css @@ -491,6 +491,16 @@ article { padding-top: 10px; } + +/************************************************* + * Talks + **************************************************/ + +.talk-event { + color: #090; + font-size: 1rem; +} + /************************************************* * Projects **************************************************/