Parcourir la source

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
George Cushen il y a 6 ans
Parent
commit
bfae0511d3

+ 1 - 1
archetypes/default.md

@@ -1,5 +1,5 @@
 +++
-title = "{{ replace .TranslationBaseName "-" " " | title }}"
+title = "{{ replace .Name "-" " " | title }}"
 date = {{ .Date }}
 draft = false
 

+ 1 - 1
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.

+ 1 - 1
archetypes/post.md

@@ -1,5 +1,5 @@
 +++
-title = "{{ replace .TranslationBaseName "-" " " | title }}"
+title = "{{ replace .Name "-" " " | title }}"
 date = {{ .Date }}
 draft = false
 

+ 1 - 1
archetypes/project.md

@@ -1,5 +1,5 @@
 +++
-title = "{{ replace .TranslationBaseName "-" " " | title }}"
+title = "{{ replace .Name "-" " " | title }}"
 date = {{ .Date }}
 draft = false
 

+ 1 - 1
archetypes/publication.md

@@ -1,5 +1,5 @@
 +++
-title = "{{ replace .TranslationBaseName "-" " " | title }}"
+title = "{{ replace .Name "-" " " | title }}"
 date = {{ .Date }}
 draft = false
 

+ 1 - 1
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

+ 1 - 1
archetypes/talk.md

@@ -1,5 +1,5 @@
 +++
-title = "{{ replace .TranslationBaseName "-" " " | title }}"
+title = "{{ replace .Name "-" " " | title }}"
 date = {{ .Date }}  # Schedule page publish date.
 draft = false
 

+ 45 - 0
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."""
+
++++

+ 5 - 0
i18n/en.yaml

@@ -75,6 +75,11 @@
 - id: education
   translation: Education
 
+# Experience widget
+
+- id: present
+  translation: Present
+
 # Publications widget
 
 - id: more_publications

+ 51 - 6
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 {

+ 12 - 0
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 -}}

+ 60 - 0
layouts/partials/widgets/experience.html

@@ -0,0 +1,60 @@
+{{ $ := .root }}
+{{ $page := .page }}
+
+<!-- Experience widget -->
+<div class="row">
+  <div class="col-12 col-lg-4 section-heading">
+    <h1>{{ with $page.Title }}{{ . | markdownify }}{{ end }}</h1>
+    {{ with $page.Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
+  </div>
+  <div class="col-12 col-lg-8">
+    {{ with $page.Content }}<p>{{ . | markdownify }}</p>{{ end }}
+
+    {{ if $page.Params.experience }}
+    {{ $exp_len := len $page.Params.experience }}
+    {{ range $idx, $key := sort $page.Params.experience ".date_start" "desc" }}
+    <div class="row experience">
+      <!-- Timeline -->
+      <div class="col-auto text-center flex-column d-none d-sm-flex">
+        <div class="row h-50">
+          <div class="col {{if gt $idx 0}}border-right{{end}}">&nbsp;</div>
+          <div class="col">&nbsp;</div>
+        </div>
+        <div class="m-2">
+          <span class="badge badge-pill border {{if not .date_end}}exp-fill{{end}}">&nbsp;</span>
+        </div>
+        <div class="row h-50">
+          <div class="col {{if lt $idx (sub $exp_len 1)}}border-right{{end}}">&nbsp;</div>
+          <div class="col">&nbsp;</div>
+        </div>
+      </div>
+      <!-- Content -->
+      <div class="col py-2">
+        <div class="card">
+          <div class="card-body">
+            <div class="float-right text-muted exp-meta">
+              <div>
+                {{ (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}}
+              </div>
+              <div class="text-right">{{.}}</div>
+              {{end}}
+            </div>
+            <h4 class="card-title exp-title text-muted mt-0 mb-1">{{.title | markdownify | emojify}}</h4>
+            <h4 class="card-title exp-company text-muted my-0">
+              {{- with .company_url}}<a href="{{.}}" target="_blank" rel="noopener">{{end}}{{.company | markdownify | emojify}}{{with .company_url}}</a>{{end -}}
+            </h4>
+            {{with .description}}<div class="card-text">{{. | markdownify | emojify}}</div>{{end}}
+          </div>
+        </div>
+      </div>
+    </div>
+    {{end}}
+    {{end}}
+  </div>
+</div>

+ 1 - 1
layouts/partials/widgets/featurette.html

@@ -21,7 +21,7 @@
   {{ if in (slice "fab" "fas" "far" "fal") $pack }}
     {{ $pack_prefix = "fa" }}
   {{ end }}
-  <div class="col-md-4">
+  <div class="col-12 col-sm-4">
     {{ with .icon }}<div class="featurette-icon"><i class="{{ $pack }} {{ $pack_prefix }}-{{ . }}"></i></div>{{ end }}
     <h3>{{ .name | markdownify | emojify }}</h3>
     {{ with .description }}<p>{{ . | markdownify | emojify }}</p>{{ end }}