Skip to content

Commit

Permalink
New widgets, tested in posts and in sidebar.
Browse files Browse the repository at this point in the history
  • Loading branch information
groundh0g committed May 29, 2016
1 parent 42c40cb commit df3d019
Show file tree
Hide file tree
Showing 22 changed files with 337 additions and 98 deletions.
19 changes: 18 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jaytch:
sidebar_left:
sidebars: false # false | ["facebook", "twitter", ...]
sidebar_right:
sidebars: ["tagcloud", "quote", "quote2", "quote3", "quote4", "twitter"] # false | ["facebook", "twitter", ...]
sidebars: ["tagcloud", "posts", "calendar", "countdown", "quote", "quote2", "quote3", "quote4", "twitter"] # false | ["facebook", "twitter", ...]
columns: 3
hideForHome: false
hideForPage: false
Expand Down Expand Up @@ -156,7 +156,15 @@ jaytch:
type: author
posts:
type: posts
limit: # default 3
words: # default 15
showViewPostLink: false
showArchiveLink: false
archiveUrl: "/archive"
category: # default is all
tag: # default is all
quote:
title: Business Tech
type: quote
quote: The first rule of any technology used in a business is that automation applied to an efficient operation will magnify the efficiency. The second is that automation applied to an inefficient operation will magnify the inefficiency. -- <a href="http://www.brainyquote.com/quotes/authors/b/bill_gates.html">Bill Gates</a>
quote2:
Expand All @@ -168,6 +176,15 @@ jaytch:
quote4:
type: quote
quote: # use the page's quote
calendar:
title: History ...
date: # date of most recent post
width: 100%
countdown:
title: Site Age
class: countup
mode: inline # block
datetime: # page.date

authors:
groundh0g:
Expand Down
19 changes: 19 additions & 0 deletions _includes/jaytch/sidebar/calendar.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% assign sidebarName = include.sidebarName | default: "calendar" %}
{% assign title = site.jaytch.layout.sidebars.[sidebarName].title %}
{% assign date = site.jaytch.layout.sidebars.[sidebarName].date %}
{% assign headBG = site.jaytch.layout.sidebars.[sidebarName].hedBGColor %}
{% assign headFG = site.jaytch.layout.sidebars.[sidebarName].headFGColor %}
{% assign grayDateBG = site.jaytch.layout.sidebars.[sidebarName].grayDateBGColor %}
{% assign grayDateFG = site.jaytch.layout.sidebars.[sidebarName].grayDateFGColor %}
{% assign postDateBG = site.jaytch.layout.sidebars.[sidebarName].postDateBGColor %}
{% assign divWidth = site.jaytch.layout.sidebars.[sidebarName].width %}

<div class="sidebar">
<div class="postSummary">
{% if title %}<p class="title">{{ title }}</p>{% endif %}

{% include jaytch/snips/calendar.liquid date=date width=divWidth headBGColor=headGB headFGColor=headFG grayDateBGColor=grayDateBG grayDateFGColor=grayDateFG postDateBGColor=postDateBG %}
</div>
</div>

{% assign rendered=true %}
15 changes: 15 additions & 0 deletions _includes/jaytch/sidebar/countdown.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% assign sidebarName = include.sidebarName | default: "countdown" %}
{% assign mode = site.jaytch.layout.sidebars.[sidebarName].mode %}
{% assign class = site.jaytch.layout.sidebars.[sidebarName].class %}
{% assign title = site.jaytch.layout.sidebars.[sidebarName].title %}

<div class="sidebar">
<div class="postSummary">
<p class="text">
{% if title %}<p class="title">{{ title }}</p>{% endif %}

{% include jaytch/snips/countdown.liquid mode=mode class=class %}
</p>
</div>
</div>
{% assign rendered=true %}
3 changes: 2 additions & 1 deletion _includes/jaytch/sidebar/facebook.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=659116600861462";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-page" data-href="https://www.facebook.com/{{ pageName }}/" data-tabs="timeline" data-small-header="true" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/{{ pageName }}/"><a href="https://www.facebook.com/{{ pageName }}/">{{ pageTitle | default: pageName }}</a></blockquote></div></div>
<div class="fb-page" data-href="https://www.facebook.com/{{ pageName }}/" data-tabs="timeline" data-small-header="true" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/{{ pageName }}/"><a href="https://www.facebook.com/{{ pageName }}/">{{ pageTitle | default: pageName }}</a></blockquote></div></div>
{% assign rendered=true %}
3 changes: 2 additions & 1 deletion _includes/jaytch/sidebar/googleplus.liquid
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% assign sidebarName = include.sidebarName | default: "googleplus" %}
{% assign profileId = site.jaytch.layout.sidebars.[sidebarName].profileId %}
<div class="googleplusfeed">{{ profileId }}</div>
<div class="googleplusfeed">{{ profileId }}</div>
{% assign rendered=true %}
44 changes: 20 additions & 24 deletions _includes/jaytch/sidebar/posts.liquid
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
{% assign posts = include.posts | default: site.posts %}
{% assign limit = include.limit | default: 3 %}
{% assign words = include.words | default: 25 %}
{% assign showArchiveLink = include.showArchiveLink | default: true %}
{% assign archiveUrl = include.archiveUrl | default: "/archive" %}
{% assign sidebarName = include.sidebarName | default: "posts" %}
{% assign limit = site.jaytch.layout.sidebars.[sidebarName].limit | default: 3 %}
{% assign words = site.jaytch.layout.sidebars.[sidebarName].words | default: 25 %}
{% assign showArchiveLink = site.jaytch.layout.sidebars.[sidebarName].showArchiveLink | default: false %}
{% assign archiveUrl = site.jaytch.layout.sidebars.[sidebarName].archiveUrl | default: "/archive" %}
{% assign showViewPostLink = site.jaytch.layout.sidebars.[sidebarName].showViewPostLink | default: false %}
{% assign category = site.jaytch.layout.sidebars.[sidebarName].category %}
{% assign tag = site.jaytch.layout.sidebars.[sidebarName].tag %}
{% assign title = site.jaytch.layout.sidebars.[sidebarName].title %}

{% if category %}
{% assign posts = site.categories[category] %}
{% elsif tag %}
{% assign posts = site.tags[tag] %}
{% else %}
{% assign posts = site.posts %}
{% endif %}

<div class="sidebar">

{% for post in posts limit limit %}

<div class="postSummary">
<p class="title">{{ post.title }}<br/><small><a href="{{ site.baseurl }}{{ post.url }}">{{ post.date | date: "%B %e, %Y" }}</a></small></p>
<p class="text">{{ post.content | strip_html | truncatewords: words }}</p>
</div>

{% endfor %}

{% if showArchiveLink %}

<div class="postSummary">
<p class="title">Archive</p>

<p class="text">The most recent {% if posts.size > limit %}{{ limit }}{% else %}{{ posts.size }}{% endif %} posts are shown above. <a href="{{ site.baseurl }}{{ archiveUrl }}">Click here</a> to view the archive.</p>
{% if title %}<p class="title">{{ title }}</p>{% endif %}
{% include jaytch/snips/posts.liquid limit=limit words=words showArchiveLink=showArchiveLink archiveUrl=archiveUrl posts=posts showViewPostLink=showViewPostLink %}
</div>

{% endif %}

</div>
{% if posts | size %}{% assign rendered=true %}{% endif%}
11 changes: 10 additions & 1 deletion _includes/jaytch/sidebar/quote.liquid
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{% assign sidebarName = include.sidebarName | default: "quote" %}
{% assign quote = site.jaytch.layout.sidebars.[sidebarName].quote | default: page.quote %}
{% assign title = site.jaytch.layout.sidebars.[sidebarName].title %}

{% if quote %}
{% include jaytch/snips/quote.liquid quote=quote %}
<div class="sidebar">
<div class="postSummary">
{% if title %}<p class="title">{{ title }}</p>{% endif %}
<p class="text">
{% include jaytch/snips/quote.liquid quote=quote %}
{% assign rendered=true %}
</p>
</div>
</div>
{% endif %}
5 changes: 4 additions & 1 deletion _includes/jaytch/sidebar/sidebar-ui.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@

{% if sidebarConfig.sidebars %}
{% for sb in sidebarConfig.sidebars %}
{% unless forloop.first %}<hr/>{% endunless %}
{% assign rendered=false %}
{% assign providerConfig = site.jaytch.layout.sidebars[sb] %}
{% assign providerType = providerConfig.type | default: sb %}
{% assign sbInclude = "jaytch/sidebar/" | append: providerType | append: ".liquid" %}
{% include {{ sbInclude }} context=context config=providerConfig sidebarName=sb %}
{% unless forloop.last %}
{% if rendered %}<hr/>{% endif %}
{% endunless %}
{% endfor %}
{% endif %}
22 changes: 11 additions & 11 deletions _includes/jaytch/sidebar/tagcloud.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
{% assign title = site.jaytch.layout.sidebars.[sidebarName].title %}

<div class="sidebar">

<div class="postSummary">
{% if title %}<p class="title">{{ title }}</p>{% endif %}
<p class="text">
{% for tag in site.tags limit maxTags %}
<span class="tag-cloud-{{ tag | last | size | times: 10 | divided_by: site.tags.size }}">
<a href="{{ BASE_PATH }}tags#{{ tag | first | slugify }}-ref">{{ tag | first }}</a>
</span>
{% endfor %}
</p>
<div class="postSummary">
{% if title %}<p class="title">{{ title }}</p>{% endif %}
<p class="text">
{% for tag in site.tags limit maxTags %}
<span class="tag-cloud-{{ tag | last | size | times: 10 | divided_by: site.tags.size }}">
<a href="{{ BASE_PATH }}tags#{{ tag | first | slugify }}-ref">{{ tag | first }}</a>
</span>
{% endfor %}
</p>
</div>
</div>

</div>
{% assign rendered=true %}
3 changes: 2 additions & 1 deletion _includes/jaytch/sidebar/twitter.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
{% assign screenName = site.jaytch.layout.sidebars.[sidebarName].name %}
{% assign widgetId = site.jaytch.layout.sidebars.[sidebarName].widgetId %}
<a class="twitter-timeline" href="https://twitter.com/{{ screenName }}" data-widget-id="{{ widgetId }}">Tweets by @{{ screenName }}</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
{% assign rendered=true %}
90 changes: 84 additions & 6 deletions _includes/jaytch/snips/calendar.liquid
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
{% assign headBG = include.headBGColor | default: "#000" %}
{% assign headFG = include.headFGColor | default: "#fff" %}
{% assign grayDateBG = include.grayDateBGColor | default: "#eee" %}
{% assign grayDateFG = include.grayDateFGColor | default: "#888" %}
{% assign postDateBG = include.postDateBGColor | default: "#efe" %}
{% assign divWidth = include.width | default: "100%" %}

{% assign floatStyle = "" %}
{% if include.float %}
{% assign floatStyle = "float:" | append: include.float | append: ";" %}
{% endif %}

{% assign lastPost = site.posts | last %}
{% assign aDateInMonth = include.date | default: lastPost.date | default: site.time | date: "%Y-%m-%d" %}

Expand All @@ -24,6 +36,23 @@
{% assign lastDayInPrevMonth = 28 %}{% assign lastDateInPrevMonth = firstDateInPrevMonth | date: "%Y-%m-28" %}{% assign monthNumberTemp = lastDateInPrevMonth | date: "%m" | plus:0 %}{% if prevMonthNumber != monthNumberTemp %}
{% endif %}{% endif %}{% endif %}{% endif %}

{% assign LAST_MONTH = lastDateInPrevMonth | date: "%Y-%m" %}
{% assign THIS_MONTH = aDateInMonth | date: "%Y-%m" %}
{% assign NEXT_MONTH = firstDateInNextMonth | date: "%Y-%m" %}
{% assign postsForCalendar = "" %}
{% if include.links or true %}
{% for post in site.posts %}
{% assign month = post.date | date: "%Y-%m" %}
{% if month == LAST_MONTH or month == THIS_MONTH or month == NEXT_MONTH %}
{% assign date = post.date | date: "%Y-%m-%d" %}
{% assign postsForCalendar = postsForCalendar | append: date | append: "~" %}
{% assign postsForCalendar = postsForCalendar | append: post.url | append: "~" %}
{% assign postsForCalendar = postsForCalendar | append: post.title | append: "?" %}
{% endif %}
{% endfor %}
{% endif %}
{% assign postsForCalendar = postsForCalendar | split: "?" %}

{% assign firstDayOfWeek = firstDateInMonth | date: "%a" %}
{% case firstDayOfWeek %}
{% when 'Sun' %}
Expand All @@ -42,19 +71,43 @@
{% assign daysBeforeFirstDay = 6 %}
{% endcase %}

<div style='text-align:center; width: {{ include.width | default: "50%" }};'>
<div style='text-align:center; width:{{ divWidth }}; {{ floatStyle }}'>
<table border="1" cellspacing="0" cellpadding="0" style="width:100%">
<tr><td colspan="7"><strong>{{ aDateInMonth | date: "%B %Y" }}</strong></td></tr>
<tr style="background-color:{{ headBG }}; color:{{ headFG }};"><td colspan="7"><strong>{{ aDateInMonth | date: "%B %Y" }}</strong></td></tr>
<tr><td>SUN</td><td>MON</td><td>TUE</td><td>WED</td><td>THU</td><td>FRI</td><td>SAT</td></tr>

{% if daysBeforeFirstDay > 0 %}
{% assign dayNum = lastDateInPrevMonth | date: "%d" | minus: daysBeforeFirstDay | plus: 1 %}
<tr>
{% for i in (1..7) %}

{% assign currentPostForCalendar = "" %}
{% assign url = "" %}{% assign title = "" %}
{% assign thisDate = THIS_MONTH %}
{% if daysBeforeFirstDay > 0 %}{% assign thisDate = LAST_MONTH %}{% endif %}
{% assign thisDate = thisDate | append: "-" | append: dayNum | date: "%Y-%m-%d" %}
{% for post in postsForCalendar %}
{% assign postDate = post | slice: 0, 10 %}
{% if postDate == thisDate %}
{% assign currentPostForCalendar = currentPostForCalendar | append: post | append: "?" %}
{% assign url = post | split: "~" %}
{% assign title = url[2] %}
{% assign url = url[1] %}
{% endif %}
{% endfor %}

{% if daysBeforeFirstDay > 0 %}
<td style="color:#ccc;">{{ dayNum }}</td>
{% if url != "" %}
<td style="background-color:{{ grayDateBG }}; color:{{ grayDateFG }};"><a href="{{ url }}" title="{{ title }}">{{ dayNum }}</a></td>
{% else %}
<td style="background-color:{{ grayDateBG }}; color:{{ grayDateFG }};">{{ dayNum }}</td>
{% endif %}
{% else %}
<td>{{ dayNum }}</td>
{% if url != "" %}
<td style="background-color:{{ postDateBG }};"><a href="{{ url }}" title="{{ title }}">{{ dayNum }}</a></td>
{% else %}
<td>{{ dayNum }}</td>
{% endif %}
{% endif %}
{% assign daysBeforeFirstDay = daysBeforeFirstDay | minus: 1 %}
{% if daysBeforeFirstDay == 0 %}{% assign dayNum = 1 %}{% else %}{% assign dayNum = dayNum | plus: 1 %}{% endif %}
Expand All @@ -65,11 +118,36 @@
{% for i in (1..5) %}
<tr>
{% for j in (1..7) %}

{% assign currentPostForCalendar = "" %}
{% assign url = "" %}{% assign title = "" %}
{% assign thisDate = THIS_MONTH | append: "-" | append: dayNum %}
{% if dayNum > lastDayInMonth %}{% assign thisDate = NEXT_MONTH | append: "-" | append: dayNum2 %}{% endif %}
{% assign thisDate = thisDate | date: "%Y-%m-%d" %}
{% for post in postsForCalendar %}
{% assign postDate = post | slice: 0, 10 %}
<!-- JOE: {{ postDate }} / {{ thisDate }} -->
{% if postDate == thisDate %}
{% assign currentPostForCalendar = currentPostForCalendar | append: post | append: "?" %}
{% assign url = post | split: "~" %}
{% assign title = url[2] %}
{% assign url = url[1] %}
{% endif %}
{% endfor %}

{% if dayNum > lastDayInMonth %}
<td style="color:#ccc;">{{ dayNum2 }}</td>
{% if url != "" %}
<td style="background-color:{{ grayDateBG }}; color:{{ grayDateFG }};"><a href="{{ url }}" title="{{ title }}">{{ dayNum2 }}</a></td>
{% else %}
<td style="background-color:{{ grayDateBG }}; color:{{ grayDateFG }};">{{ dayNum2 }}</td>
{% endif %}
{% assign dayNum2 = dayNum2 | plus: 1 %}
{% else %}
<td>{{ dayNum }}</td>
{% if url != "" %}
<td style="background-color:{{ postDateBG }};"><a href="{{ url }}" title="{{ title }}">{{ dayNum }}</a></td>
{% else %}
<td>{{ dayNum }}</td>
{% endif %}
{% endif %}
{% assign dayNum = dayNum | plus: 1 %}
{% endfor %}
Expand Down
6 changes: 6 additions & 0 deletions _includes/jaytch/snips/countdown.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<span class='{{ include.class | default: "countdown" }} {{ include.mode | default: "inline" }}'>
<span class="value" style="display:none">{{ include.datetime | default: page.date | default: site.time }}</span>
<span class="valueGroup"><span class="valueDays">&nbsp;</span> days</span>
<span class="valueGroup"><span class="valueHours">&nbsp;</span> hrs</span>
<span class="valueGroup"><span class="valueMinutes">&nbsp;</span> min</span>
<span class="valueGroup"><span class="valueSeconds">&nbsp;</span> sec</span></span>
34 changes: 0 additions & 34 deletions _includes/jaytch/snips/post-summary.liquid

This file was deleted.

Loading

0 comments on commit df3d019

Please sign in to comment.