Skip to content
Snippets Groups Projects
Commit 0d25549a authored by Frank Valcarcel's avatar Frank Valcarcel
Browse files

updates to templates. realized I cant use jinja to format pretty dates, (sigh)...

updates to templates. realized I cant use jinja to format pretty dates, (sigh) statc vs. dynamic. inc a js function to handle that
parent 190bced5
No related tags found
No related merge requests found
......@@ -14,7 +14,7 @@ img.clown {
}
#post, #page {
padding: 1em 3em;
padding: 1em 1em;
letter-spacing: 0.01rem;
font-weight: 200;
font-style: normal;
......
static/images/favicon.ico

1.12 KiB

// http://jsfiddle.net/MarkSchultheiss/cgMZz/1/
// http://stackoverflow.com/questions/6206963/javascript-pretty-date-with-months-and-years
// thanks to Mark Schultheiss for the following function
function pretty_date(date_str) {
var time = ('' + date_str).replace(/-/g, "/").replace(/[TZ]/g, " ");
var seconds = (new Date - new Date(time)) / 1000;
var token = 'ago',
list_choice = 1;
if (seconds < 0) {
seconds = Math.abs(seconds);
token = 'from now';
list_choice = 2;
}
var i = 0,
format;
while (format = time_formats[i++]) if (seconds < format[0]) {
if (typeof format[2] == 'string') return format[list_choice];
else return Math.floor(seconds / format[2]) + ' ' + format[1] + ' ' + token;
}
return time;
};
var time_formats = [
[60, 'just now', 1], // 60
[120, '1 minute ago', '1 minute from now'], // 60*2
[3600, 'minutes', 60], // 60*60, 60
[7200, '1 hour ago', '1 hour from now'], // 60*60*2
[86400, 'hours', 3600], // 60*60*24, 60*60
[172800, 'yesterday', 'tomorrow'], // 60*60*24*2
[604800, 'days', 86400], // 60*60*24*7, 60*60*24
[1209600, 'last week', 'next week'], // 60*60*24*7*4*2
[2419200, 'weeks', 604800], // 60*60*24*7*4, 60*60*24*7
[4838400, 'last month', 'next month'], // 60*60*24*7*4*2
[29030400, 'months', 2419200], // 60*60*24*7*4*12, 60*60*24*7*4
[58060800, 'last year', 'next year'], // 60*60*24*7*4*12*2
[2903040000, 'years', 29030400], // 60*60*24*7*4*12*100, 60*60*24*7*4*12
[5806080000, 'last century', 'next century'], // 60*60*24*7*4*12*100*2
[58060800000, 'centuries', 2903040000] // 60*60*24*7*4*12*100*20, 60*60*24*7*4*12*100
];
\ No newline at end of file
......@@ -34,36 +34,8 @@
<div class="4u">
<!-- Sidebar -->
<div class="sidebar">
<section>
<header>
<h3>Magna Feugiat</h3>
</header>
<p>Sed tristique purus vitae volutpat commodo suscipit amet sed nibh. Proin a ullamcorper sed blandit. Sed tristique purus vitae volutpat commodo suscipit ullamcorper commodo suscipit amet sed nibh. Proin a ullamcorper sed blandit..</p>
<footer>
<ul class="buttons">
<li><a href="#" class="button small">Learn More</a></li>
</ul>
</footer>
</section>
<section>
<a href="#" class="image feature"><img src="images/pic04.jpg" alt="" /></a>
<header>
<h3>Amet Lorem Tempus</h3>
</header>
<p>Sed tristique purus vitae volutpat commodo suscipit amet sed nibh. Proin a ullamcorper sed blandit. Sed tristique purus vitae volutpat commodo suscipit ullamcorper sed blandit lorem ipsum dolore.</p>
<footer>
<ul class="buttons">
<li><a href="#" class="button small">Learn More</a></li>
</ul>
</footer>
</section>
</div>
</div>
{% include 'sidebar_alt.html' %}
</div> <!-- end sidebar 4u -->
</div>
</section>
......
......@@ -10,7 +10,9 @@
<span class="icon fa-{{ article.icon }}"></span>
<h2>{{ article.title }}</h2>
<!-- add page sub title here -->
<p>posted {{ article.locale_date|pretty_date }}</p>
<p>
posted <span data-date="{{ article.locale_date }}" id="pretty_date"></span>
</p>
</header>
<!-- One -->
......@@ -34,7 +36,7 @@
</section>
<!-- Two -->
{% include 'most_recent.html' %}
{% include 'most_recent_alt.html' %}
{% if DISQUS_SITENAME %}
<section class="wrapper container">
......
<html>
<head>
{% block head %}
<title>{% block title %}{{ SITENAME }} {{ TAGLINE }}{% endblock title %}</title>
<meta name="viewport" content="width=device-width">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
......@@ -9,6 +12,7 @@
<script src="/js/skel.min.js"></script>
<script src="/js/skel-layers.min.js"></script>
<script src="/js/init.js"></script>
<script src="/js/scripts.js"></script>
<link rel="stylesheet" href="/css/main.css" />
<link rel="stylesheet" href="/css/pygment.css" />
<noscript>
......@@ -24,11 +28,7 @@
{% if FEED_RSS %}
<link href="{{ FEED_DOMAIN }}/{{ FEED_RSS }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }}-Feed" />
{% endif %}
{% block head %}
<title>{% block title %}{{ SITENAME }} {{ TAGLINE }}{% endblock title %}</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width">
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.png"/>
{% endblock head %}
</head>
......@@ -74,4 +74,11 @@
{% include 'footer.html' %}
</body>
<script>
$( document ).ready(function() {
$('#pretty_date').text(pretty_date($('#pretty_date').attr('data-date')));
});
</script>
</html>
\ No newline at end of file
......@@ -34,36 +34,8 @@
<div class="4u">
<!-- Sidebar -->
<div class="sidebar">
<section>
<header>
<h3>Magna Feugiat</h3>
</header>
<p>Sed tristique purus vitae volutpat commodo suscipit amet sed nibh. Proin a ullamcorper sed blandit. Sed tristique purus vitae volutpat commodo suscipit ullamcorper commodo suscipit amet sed nibh. Proin a ullamcorper sed blandit..</p>
<footer>
<ul class="buttons">
<li><a href="#" class="button small">Learn More</a></li>
</ul>
</footer>
</section>
<section>
<a href="#" class="image feature"><img src="images/pic04.jpg" alt="" /></a>
<header>
<h3>Amet Lorem Tempus</h3>
</header>
<p>Sed tristique purus vitae volutpat commodo suscipit amet sed nibh. Proin a ullamcorper sed blandit. Sed tristique purus vitae volutpat commodo suscipit ullamcorper sed blandit lorem ipsum dolore.</p>
<footer>
<ul class="buttons">
<li><a href="#" class="button small">Learn More</a></li>
</ul>
</footer>
</section>
</div>
</div>
{% include 'sidebar.html' %}
</div> <!-- end sidebar 4u -->
</div>
</section>
......
......@@ -3,7 +3,8 @@
<h2 class="space-above">Latest Posts</h2>
</div>
<div class="row">
{% for article in articles[:3] %}
{% for article in all_articles %}
{% if loop.index < 4 %}
<div class="4u">
<section>
......@@ -20,6 +21,8 @@
</section>
</div>
{% else %}
{% endif %}
{% endfor %}
</div>
</section>
\ No newline at end of file
<section class="wrapper style1 container special">
<div class="row">
<h2 class="space-above">Latest Posts</h2>
</div>
<div class="row">
{% for article in articles[:3] %}
<div class="4u">
<section>
<span class="icon feature fa-{{ article.icon }}"></span>
<header>
<a href="/{{ article.url }}" rel='bookmark'><h3>{{ article.title }}</h3></a>
</header>
<p>{{ article.content[:196]|striptags }}...</p>
<footer>
<ul class="buttons">
<li><a href="/{{ article.url }}" class="button small">Read More</a></li>
</ul>
</footer>
</section>
</div>
{% endfor %}
</div>
</section>
\ No newline at end of file
......@@ -31,7 +31,7 @@
</section>
<!-- Two -->
{% include 'most_recent.html' %}
{% include 'most_recent_alt.html' %}
</article>
{% endblock content %}
\ No newline at end of file
<!-- Sidebar -->
<div class="sidebar">
{% for article in all_articles %}
{% if article.featured == 'True' %}
<section>
<header>
<h3>{{ article.title }}</h3>
</header>
<p>{{ article.summary[:128]|striptags }}...</p>
<footer>
<ul class="buttons">
<li><a href="/{{ article.url }}" class="button small">Learn More</a></li>
</ul>
</footer>
</section>
{% endif %}
{% endfor %}
</div>
\ No newline at end of file
<!-- Sidebar -->
<div class="sidebar">
{% for article in articles %}
{% if article.featured == 'True' %}
<section>
<header>
<h3>{{ article.title }}</h3>
</header>
<p>{{ article.summary[:128]|striptags }}...</p>
<footer>
<ul class="buttons">
<li><a href="/{{ article.url }}" class="button small">Learn More</a></li>
</ul>
</footer>
</section>
{% endif %}
{% endfor %}
</div>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment