Changeset - e7c1171b6e3d
[Not reviewed]
0 8 1
Brett Smith (brett) - 7 years ago 2016-12-31 04:12:09
brett@sfconservancy.org
blog: Refactor entry rendering into a partial.

This helps ensure that entries are rendered consistently wherever they
appear.
9 files changed with 68 insertions and 76 deletions:
0 comments (0 inline, 0 general)
www/conservancy/static/css/conservancy.css
Show inline comments
...
 
@@ -247,57 +247,57 @@ h3 { margin-top: .6em; margin-bottom: .4em; }
 
#navbar li ul { display: none; border: 1px solid #444; }
 
#navbar li:hover ul { display: block; position: absolute; }
 
#navbar li ul li { float: none; }
 
#navbar li ul li a { border: 0px; margin: 0px; }
 

	
 
.shaded { background: #F0FFB8; padding: .1em .5em; margin-bottom: .5em; }
 

	
 
.columns {
 
}
 

	
 
.column h2 { font-size: 1.25em; }
 
.column h3 { font-size: 1.1em; }
 
.column hr { width: 50%; margin-left: auto; margin-right: auto; }
 

	
 
.column h2 a { text-decoration: none; color: #000000; }
 
.column h2 a:hover { text-decoration: underline; }
 

	
 
#conservancyfooter {
 
  margin-top: 1em;
 
  border-top: 1px solid #ccc;
 
  text-align: center;
 
  clear: both;
 
}
 

	
 
span.continued {
 
.continued {
 
  display: block;
 
  font-size: .9em;
 
  font-weight: bold;
 
  margin-top: 1em;
 
  margin-bottom: 1em;
 
}
 

	
 
p.date {
 
.date, .blog-tags, .blog-comments {
 
  font-style: italic;
 
  font-size: .9em;
 
  margin-bottom: .3em;
 
  margin-top: .3em;
 
}
 

	
 
a.feedlink /* RSS icon */ { display: block; float: right; font-size: 10pt; }
 

	
 
blockquote, div.quote /* div.quote is used by conservancy whitepaper */ {
 
  margin-left: 2em;
 
  margin-right: 2em;
 
  padding-left: 1em;
 
  padding-right: 1em;
 
  border: 1px solid #fff;
 
  background: #eee;
 
}
 

	
 
.newsgraphic { float: right; }
 
.newsgraphic img { border: 1px solid #000; }
 

	
 
.picture {
 
    text-align: center;
 
    font-style: italic;
 
}
www/conservancy/templates/blog/entry_archive_day.html
Show inline comments
 
{% extends "base_blog.html" %}
 

	
 
{% block subtitle %}Conservancy Blog Archive: {{ day|date:"F j, Y" }} - {% endblock %}
 

	
 
{% block content %}
 

	
 
<h2>Conservancy Blog Archive: {{ day|date:"F j, Y" }}</h2>
 

	
 
{% for object in object_list %}
 
    <h3><a href="{{ object.get_absolute_url }}">{{ object.headline|safe }}</a></h3>
 
        {{ object.summary|safe }}
 
    <p><span class="continued"><a href="{{ object.get_absolute_url }}">Read More...</a></span></p>
 
    <p class="date small">Posted by <strong>{{ object.author.formal_name }}</strong> on {{ object.pub_date|date:"F j, Y" }}
 
    {% if object.tags.all %}<span class="blog-tags">/ Tags: {% for tag in object.tags.all %}<a href="{{ tag.get_absolute_url }}">{{ tag.label }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</span>{% endif %}
 
    </p>
 
{% for entry in object_list %}
 
  {% include "blog/entry_partial.html" with entry=entry show="summary+tags" only %}
 
{% endfor %}
 

	
 
{% endblock %}
www/conservancy/templates/blog/entry_archive_month.html
Show inline comments
 
{% extends "base_blog.html" %}
 

	
 
{% block subtitle %}Conservancy Blog Archive: {{ month|date:"F, Y" }} - {% endblock %}
 

	
 
{% block content %}
 

	
 
<h2>Conservancy Blog Archive: {{ month|date:"F, Y" }}</h2>
 

	
 
{% for object in object_list %}
 
    <h3><a href="{{ object.get_absolute_url }}">{{ object.headline|safe }}</a></h3>
 
        {{ object.summary|safe }}
 
    <p><span class="continued"><a href="{{ object.get_absolute_url }}">Read More...</a></span></p>
 
    <p class="date small">Posted by <strong>{{ object.author.formal_name }}</strong> on {{ object.pub_date|date:"F j, Y" }}
 
    {% if object.tags.all %}<span class="blog-tags">/ Tags: {% for tag in object.tags.all %}<a href="{{ tag.get_absolute_url }}">{{ tag.label }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</span>{% endif %}
 
    </p>
 
{% for entry in object_list %}
 
  {% include "blog/entry_partial.html" with entry=entry show="summary+tags" only %}
 
{% endfor %}
 

	
 
{% endblock %}
www/conservancy/templates/blog/entry_archive_year.html
Show inline comments
 
{% extends "base_blog.html" %}
 

	
 
{% block subtitle %}Conservancy Blog Archive: {{ year|date:"Y" }} - {% endblock %}
 

	
 
{% block content %}
 

	
 
<h2>Conservancy Blog Archive: {{ year|date:"Y" }}</h2>
 

	
 
<ul>
 
{% for object in object_list %}
 
    <li><a href="{{ object.get_absolute_url }}"><b>{{ object.headline|safe }}</b></a><br/>
 
    <i>{{ object.pub_date|date:"F j, Y" }} by {{ object.author.formal_name }}</i></li>
 
{% for entry in object_list %}
 
  {% include "blog/entry_partial.html" with entry=entry show="dateline" only %}
 
{% endfor %}
 
</ul>
 

	
 
{% endblock %}
www/conservancy/templates/blog/entry_detail.html
Show inline comments
 
{% extends "base_blog.html" %}
 

	
 
{% block subtitle %}{{ object.headline|striptags|safe }} - Conservancy Blog - {% endblock %}
 

	
 
{% block content %}
 

	
 
<p class="date">{{ object.pub_date|date:"F j, Y" }} by {{ object.author.formal_name }}</p>
 
<h2>{{ object.headline|safe }}</h2>
 
{{ object.body|safe }}
 
<p><i>Posted by <strong>{{ object.author.formal_name }}</strong> on {{object.pub_date|date:"F j, Y" }}.  Please email any comments on this entry to <a href="mailto:info@sfconservancy.org">info@sfconservancy.org</a>.</i></p>
 
{% include "blog/entry_partial.html" with entry=object htag="h2" only %}
 

	
 
{% if object.tags.all %}<p class="blog-tags">Tags: {% for tag in object.tags.all %}<a href="{{ tag.get_absolute_url }}">{{ tag.label }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</p>{% endif %}
 
<p class="blog-comments">Please email any comments on this entry to
 
  <a href="mailto:info@sfconservancy.org">info@sfconservancy.org</a>.</p>
 

	
 
<p><span class="continued"><a href="/blog/">Other Conservancy Blog entries&hellip;</a></span></p>
 

	
 
{% endblock %}
www/conservancy/templates/blog/entry_list.html
Show inline comments
 
{% extends "base_blog.html" %}
 
{% block subtitle %}Conservancy Blog - {% endblock %}
 

	
 
{% block content %}
 

	
 
<h2><a href="/feeds/blog/" class="feedlink"><img src="/img/feed-icon-14x14.png" alt="[RSS]"/></a> Conservancy Blog{% if author %} &mdash; {{ author.formal_name }}{% endif %}</h2>
 

	
 
{% if authors or tags %}
 
<p>Displaying posts
 
{% if authors %}by {% for author in authors %}{% if not forloop.last %}{% if not forloop.first %}, {% endif %}{% endif %}<a href="{{ author.biography_url }}">{{ author.formal_name }}</a>{% ifequal forloop.revcounter 2 %} and {% endifequal %}{% endfor %}{% endif %}
 
{% if tags %}tagged {% for tag in tags %}{% if not forloop.last %}{% if not forloop.first %}, {% endif %}{% endif %}<a href="{{ tag.get_absolute_url }}">{{ tag.label }}</a>{% ifequal forloop.revcounter 2 %} or {% endifequal %}{% endfor %}{% endif %}
 
</p>
 
{% endif %}
 

	
 
{% for entry in blog_entries %}
 
    <h3><a href="{{ entry.get_absolute_url }}">{{ entry.headline|safe }}</a></h3>
 
        {{ entry.body|safe }}
 
    <p class="date small">Posted by <strong>{{ entry.author.formal_name }}</strong> on {{ entry.pub_date|date:"F j, Y" }}
 
    {% if entry.tags.all %}<span class="blog-tags">/ Tags: {% for tag in entry.tags.all %}<a href="{{ tag.get_absolute_url }}">{{ tag.label }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</span>{% endif %}
 
    </p>
 
  {% include "blog/entry_partial.html" with entry=entry only %}
 
{% endfor %}
 

	
 
<p>
 
{% if blog_entries.has_next %}<a class="next_page_button" href="?page={{ blog_entries.next_page_number }}{% if query_string %}&amp;{{ query_string|escape }}{% endif %}">Next page (older) &raquo;</a>{% endif %}
 
{% if blog_entries.has_previous %}<a href="?page={{ blog_entries.previous_page_number }}{% if query_string %}&amp;{{ query_string|escape }}{% endif %}">&laquo; Previous page (newer)</a>{% endif %}
 
</p>
 
{% if blog_entries.paginator.num_pages > 1 %}<p class="pagination_list"> {% for pagenum in blog_entries.paginator.page_range %}{% ifequal pagenum blog_entries.number %}[{{ pagenum }}]{% else %}<a href="?page={{ pagenum }}">{{ pagenum }}</a>{% endifequal %} {% endfor %}</p>{% endif %}
 
<div class="clear"></div>
 

	
 
{% endblock %}
www/conservancy/templates/blog/entry_partial.html
Show inline comments
 
new file 100644
 
{% comment %}
 

	
 
This partial requires these parameters:
 

	
 
* `entry`: The BlogEntry object to render.
 

	
 
This partial accepts these optional parameters:
 

	
 
* `show`: How much of the BlogEntry to render.  Accepted values are
 
  "headline", "dateline", "summary", "summary+tags", and "body".
 
  Every value will render the parts listed before it, except "body"
 
  doesn't include "summary".  Default "body".
 
* `htag`: Name of the HTML tag to render the entry headline.  Default "h3".
 

	
 
{% endcomment %}
 

	
 
<div class="blog-entry">
 

	
 
<{{ htag|default:"h3" }}
 
  >{% if show|default:"body" != "body" %}<a href="{{ entry.get_absolute_url }}"
 
  >{% endif %}{{ entry.headline|safe }}{% if show|default:"body" != "body" %}</a>{% endif %}</{{ htag|default:"h3" }}>
 

	
 
{% if show != "headline" %}
 
<p class="date">by <span class="author">{{ entry.author.formal_name }}</span>
 
  on {{ entry.pub_date|date:"F j, Y" }}
 
</p>
 

	
 
{% if show != "dateline" %}
 

	
 
{% if show|default:"body" == "body" %}
 
{{ entry.body|safe }}
 
{% else %}
 
{{ entry.summary|safe }}
 
{% endif %}
 

	
 
{% if show|default:"body" != "body" %}
 
<p><a class="continued" href="{{ entry.get_absolute_url }}">Read More&hellip;</a></p>
 
{% endif %}
 

	
 
{% if show != "summary" and entry.tags.exists %}
 
<p class="blog-tags">Tags:
 
  {% for tag in entry.tags.iterator %}
 
  <a href="{{ tag.get_absolute_url }}">{{ tag.label }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</p>
 
{% endif %}
 

	
 
{% endif %}{# show != "dateline" #}
 
{% endif %}{# show != "headline" #}
 

	
 
</div>
www/conservancy/templates/contractpatch/index.html
Show inline comments
...
 
@@ -12,39 +12,31 @@
 
{% block content %}
 
<h1>ContractPatch</h1>
 

	
 
<div id="subhed">Everything is negotiable</div>
 

	
 
<div id="contractpatch-intro" class="section">
 
<h2>What is ContractPatch?</h2>
 

	
 
<p style="clear: both;">Many free and open source software developers sign employment agreements with their employers.  These agreements can affect whether and how developers contribute to FOSS—whether it’s done as part of their employment, after hours, or both.  ContractPatch is Conservancy’s initiative to give developers the words they need to make sure they can continue to do the work that’s important to them and our community.  Whether those words are negotiation tactics for the hiring process, or language to suggest for a prospective employment agreement, ContractPatch helps developers defend their own interests.</p>
 

	
 
<p>In the coming months, we’ll write about legal and strategic points in contract negotiation strategies, pre-negotiation prep and practice, methods for negotiating, and general information on your legal rights around contracts.  We’ll also look at specific contract provisions—especially those that impact tech workers the most, such as non-compete agreements and intellectual property assignment clauses.  This will all go hand-in-hand with a Git repository with forkable sample language for key contract provisions, such as payment terms, benefits, non-competition and non-solicitation agreements, and intellectual property assignment clauses.</p>
 
</div>
 

	
 
<div id="contractpatch-follow" class="section">
 
<h2>Follow ContractPatch</h2>
 

	
 
<p><a href="https://lists.sfconservancy.org/mailman/listinfo/contractpatch">Subscribe to our discussion mailing list.</a>  This is a great place to talk about issues in employment agreements, and suggest what ContractPatch might tackle next.</p>
 

	
 
<p><a href="https://twitter.com/ContractPatch">Follow ContractPatch on Twitter.</a></p>
 
</div>
 

	
 
<div id="contractpatch-blog" class="section">
 
<h2>Blog posts</h2>
 

	
 
{% comment %}
 
FIXME:
 
This is duplicated from blog/entry_list.html
 
{% endcomment %}
 
{% for entry in blog_entries %}
 
    <h3><a href="{{ entry.get_absolute_url }}">{{ entry.headline|safe }}</a></h3>
 
        {{ entry.body|safe }}
 
    <p class="date small">Posted by <strong>{{ entry.author.formal_name }}</strong> on {{ entry.pub_date|date:"F j, Y" }}
 
    {% if entry.tags.all %}<span class="blog-tags">/ Tags: {% for tag in entry.tags.all %}<a href="{{ tag.get_absolute_url }}">{{ tag.label }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</span>{% endif %}
 
    </p>
 
  {% include "blog/entry_partial.html" with entry=entry only %}
 
{% endfor %}
 

	
 
<p><span class="continued"><a href="/blog/?tag=ContractPatch">Read all ContractPatch blog posts…</a></span></p>
 
</div>
 
{% endblock %}
www/conservancy/templates/frontpage.html
Show inline comments
...
 
@@ -28,84 +28,54 @@
 
<h2><a href="/feeds/news/" class="feedlink"><img src="/img/feed-icon-14x14.png" alt="[RSS]"/></a> <a href="/news/">Recent News</a></h2>
 
<p class="date">{{ press_releases.0.pub_date|date:"F j, Y" }}</p>
 
<h3><a href="{{ press_releases.0.get_absolute_url }}">{{ press_releases.0.headline|safe }}</a></h3>
 
{{ press_releases.0.summary|safe }}
 
{% if press_releases.0.body %}<p><span class="continued"><a href="{{ press_releases.0.get_absolute_url }}">Read More...</a></span></p>{% endif %}
 
{% if press_releases.1 and press_releases.1.pub_date|date_within_past_days:30 %}
 
<hr/>
 
<p class="date">{{ press_releases.1.pub_date|date:"F j, Y" }}</p>
 
<h3><a href="{{ press_releases.1.get_absolute_url }}">{{ press_releases.1.headline|safe }}</a></h3>
 
{{ press_releases.1.summary|safe }}
 
{% if press_releases.1.body %}<p><span class="continued"><a href="{{ press_releases.1.get_absolute_url }}">Read More...</a></span></p>{% endif %}
 
{% endif %}
 
{% if press_releases.2 and press_releases.2.pub_date|date_within_past_days:30 %}
 
<hr/>
 
<p class="date">{{ press_releases.2.pub_date|date:"F j, Y" }}</p>
 
<h3><a href="{{ press_releases.2.get_absolute_url }}">{{ press_releases.2.headline|safe }}</a></h3>
 
{{ press_releases.2.summary|safe }}
 
{% if press_releases.2.body %}<p><span class="continued"><a href="{{ press_releases.2.get_absolute_url }}">Read More...</a></span></p>{% endif %}
 
{% endif %}
 
<p><span class="continued"><a href="/news/">Conservancy News Archive&hellip;</a></span></p>
 
</div>
 

	
 
<div class="column">
 
<h2><a href="/feeds/blog/" class="feedlink"><img src="/img/feed-icon-14x14.png" alt="[RSS]"/></a> <a href="/blog/">Conservancy Blog</a></h2>
 
<h3><a href="{{ blog.0.get_absolute_url }}">{{ blog.0.headline|safe }}</a></h3>
 
<p class="date">Posted by {{ blog.0.author.formal_name }} on {{ blog.0.pub_date|date:"F j, Y" }}</p>
 
{{ blog.0.summary|safe }}
 
<p><span class="continued"><a href="{{ blog.0.get_absolute_url }}">Read More from {{ blog.0.author.casual_name }} on this&hellip;</a></span></p>
 

	
 
{% if blog.1 and blog.1.pub_date|date_within_past_days:30 %}
 
<hr/>
 
<h3><a href="{{ blog.1.get_absolute_url }}">{{ blog.1.headline|safe }}</a></h3>
 
<p class="date">Posted by {{ blog.1.author.formal_name }} on {{ blog.1.pub_date|date:"F j, Y" }}</p>
 
{{ blog.1.summary|safe }}
 
<p><span class="continued"><a href="{{ blog.1.get_absolute_url }}">Read More from {{ blog.1.author.casual_name }} on this&hellip;</a></span></p>
 
{% endif %}
 

	
 
{% if blog.2 and blog.2.pub_date|date_within_past_days:30 %}
 
<hr/>
 
<h3><a href="{{ blog.2.get_absolute_url }}">{{ blog.2.headline|safe }}</a></h3>
 
<p class="date">Posted by {{ blog.2.author.formal_name }} on {{ blog.2.pub_date|date:"F j, Y" }}</p>
 
{{ blog.2.summary|safe }}
 
<p><span class="continued"><a href="{{ blog.2.get_absolute_url }}">Read More from {{ blog.2.author.casual_name }} on this&hellip;</a></span></p>
 
{% endif %}
 

	
 
{% if blog.3 and blog.3.pub_date|date_within_past_days:30 %}
 
<hr/>
 
<h3><a href="{{ blog.3.get_absolute_url }}">{{ blog.3.headline|safe }}</a></h3>
 
<p class="date">Posted by {{ blog.3.author.formal_name }} on {{ blog.3.pub_date|date:"F j, Y" }}</p>
 
{{ blog.3.summary|safe }}
 
<p><span class="continued"><a href="{{ blog.3.get_absolute_url }}">Read More from {{ blog.3.author.casual_name }} on this&hellip;</a></span></p>
 
{% endif %}
 

	
 
{% if blog.4 and blog.4.pub_date|date_within_past_days:30 %}
 
<hr/>
 
<h3><a href="{{ blog.4.get_absolute_url }}">{{ blog.4.headline|safe }}</a></h3>
 
<p class="date">Posted by {{ blog.4.author.formal_name }} on {{ blog.4.pub_date|date:"F j, Y" }}</p>
 
{{ blog.4.summary|safe }}
 
<p><span class="continued"><a href="{{ blog.4.get_absolute_url }}">Read More from {{ blog.4.author.casual_name }} on this&hellip;</a></span></p>
 
{% endif %}
 
{% for entry in blog|slice:":5" %}
 
  {% if forloop.first or entry.pub_date|date_within_past_days:30 %}
 
    {% if not forloop.first %}<hr>{% endif %}
 
    {% include "blog/entry_partial.html" with entry=entry show="summary" only %}
 
  {% endif %}
 
{% endfor %}
 

	
 
<p><span class="continued"><a href="/blog/">Conservancy Blog Archive&hellip;</a></span></p>
 
</div>
 

	
 
<div class="column">
 
<h2>Support Conservancy</h2>
 
<p>As a 501(c)(3) non-profit charity, Conservancy relies on
 
  charitable donations for its operations.
 
  Please join {{supporters_count|safe}} others and <a href="/supporter/"><strong>become a Conservancy Supporter
 
  today</strong></a> and/or <a href="/donate/">donate generously</a> to help our work!
 
</p>
 
</div>
 

	
 
<div class="column">
 
<h2>Follow Conservancy News &amp; Blogs</h2>
 

	
 
<p>There is a <a href="/feeds/omnibus/">full site feed available</a> (as
 
  well as separate feeds for the <a href="/feeds/news/">news items</a> and
 
  <a href="/feeds/blog/">blog posts</a>).  You can follow Conservancy
 
 on <a href="https://identi.ca/conservancy">pump.io</a>,
 
  <a href="https://twitter.com/conservancy">Twitter</a>, <a href="https://www.youtube.com/channel/UCUEeuNvX2UyTTyTYXR9dm_A">Youtube</a>, <a href="https://plus.google.com/104268783278405704634/">Google+</a>,
 
      and other social networks, too.  Look
 
      for us everywhere and follow/like us!</p>
 

	
0 comments (0 inline, 0 general)