Skip to content

Commit

Permalink
completing implementing new weekly digest RSS feed
Browse files Browse the repository at this point in the history
  • Loading branch information
Ross Karchner committed May 19, 2011
1 parent 5c8b0cb commit 3efa5ea
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 93 deletions.
5 changes: 2 additions & 3 deletions django_templates/base-cacheable.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
<link rel="stylesheet" href="{% versioned "/static/decogrids-16.css" %}"/>
<link rel="stylesheet" href="{% versioned "/static/screen.css" %}" media="screen"/>
<link rel="alternate" type="text/calendar" href="/ical/" title="upcoming events"/>
<link rel="alternate" type="application/rss+xml" href="/events/feeds/latest/" title="latest additions"/>


<link rel="alternate" type="application/rss+xml" href="/events/feeds/latest/" title="Latest Additions"/>
<link rel="alternate" type="application/rss+xml" href="/thisweek.xml" title="Weekly Newsletter"/>

<script>
$(function(){
Expand Down
13 changes: 5 additions & 8 deletions django_templates/events/one_event_newsletter.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,19 @@



<td>{% if event.allday %}
"All Day"
{% if event.allday %}
All Day:
{% else %}
{{event.local_start|time:"P"}}

{% endif %}</td> <td> <strong class="summary entry-title"> {{ event|eventlink|safe }}</strong>
{% endif %}{{ event|eventlink|safe }}

{% if event.multiday %}
{% if event.allday %}
(continuing through <abbr class="dtend" title="{{event.end.isoformat}}Z">{{event.local_end|naturalday}}</abbr>)
(continuing through {{event.local_end|naturalday}})
{% else %}
(through {{event.local_end|naturalday}})

{% endif %}
{% endif %}
</td>



<br/>
4 changes: 3 additions & 1 deletion django_templates/eventsite/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ <h2>Subscribe to {{site.name}}</h2>
</form>

</div>
<div id="ical">Or, get the: <a href="webcal://{{site.host}}/ical">iCal</a></div>
<div id="ical">Or, get the <a href="webcal://{{site.host}}/ical">iCal</a>
or <a href="/thisweek.xml">RSS feed</a>
</div>



Expand Down
115 changes: 37 additions & 78 deletions django_templates/eventsite/week.xml
Original file line number Diff line number Diff line change
@@ -1,94 +1,53 @@
{% extends "base.html" %}
{% load cdn_helper %}
{% load humanize %}
{% load utility %}

{% block headextra %}
{% ifequal user.userlevel 10 %}
<script src="{% versioned "/static/editing.js" %}"></script>
{% endifequal %}
{% endblock %}
{% block subtitle %}Week of {{ start|date:"F j, Y"}}{% endblock %}


{% block opengraph %}
<meta name="title" content="{{ site.name }} for the week of {{ start|date:"F j, Y"}}" />
<meta name="description" content="{{site.name}} is a calendar for {{site.audience}} " />
<meta property="og:type" content="article" />
{% endblock opengraph %}


{% block content %}
<div id="positioner">


<div class="row">
<div class="cell position-0 width-12" id="events">
<h1> upcoming events for the week of <em>{{ start|date:"F j, Y"}}</em></h1>
<?xml version="1.0"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ site.name }}</title>
<link>http://{{site.host}}/</link>
<atom:link href="http://{{site.host}}/thisweek.xml" rel="self" type="application/rss+xml" />
<language>en-us</language>
<webMaster>[email protected] (Ross Karchner)</webMaster>
<description> a calendar for {{site.audience}}</description>
<item>
<title>This Week on {{ site.name }}</title>
<link>http://{{site.host}}/week-of/{{start|date:"c"}}</link>
<description>
<![CDATA[ <h1> <a href="http://{{site.host}}/week-of/{{start|date:"c"}}">{{ site.name }} for the week of {{ start|date:"F j, Y"}}</a></h1>
<div>Please consider forwarding this along to your friends and colleagues in the community. If you find it useful, they might too.</div>
<div>Did we miss something? <a href="http://{{site.host}}/events/add">You can still add events</a>!</div>
<div>
<!-- AddThis Button BEGIN -->
<script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script>
<div class="addthis_toolbox addthis_default_style">
<a href="http://addthis.com/bookmark.php?v=250&amp;username=rosskarchner" class="addthis_button_compact">Share</a>
<span class="addthis_separator">|</span>
<a class="addthis_button_facebook"></a>
<a class="addthis_button_twitter"></a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=rosskarchner"></script>
<!-- AddThis Button END -->

</div>
<div>
{% for event in continuing %}

{% ifequal forloop.counter 1 %}
<h2>Continuing</h2>
{% endifequal %}
{% include "events/one_event.html" %}
{% ifequal user.userlevel 10 %}
{% include "events/edit_form.html" %}
{% endifequal %}
{% include "events/one_event_newsletter.html" %}</tr>
{% if forloop.last %}
{% endif %}
{% endfor %}
{% for event in events_soon %}

{% ifchanged event.local_start.date %}
<a name="{{event.local_start.date|date:'Y-m-d' }}">
<h2>{{event.local_start.date|naturalday }}</h2>
<h2>{{event.local_start.date|date:"l (n/j)" }}</h2>
{% else %}
{% endifchanged %}
{% include "events/one_event.html" %}
{% ifequal user.userlevel 10 %}
{% include "events/edit_form.html" %}
{% endifequal %}

{% endfor %}

{% include "events/one_event_newsletter.html" %}

</div>
<div class="cell position-12 width-4" id="sidebar">

{% include "eventsite/sidebar.html" %}
{% endfor %}
</div>


</div>
{% endblock %}

{% block endcode %}
<script type="text/javascript">
var disqus_shortname = '{{site.disqus_shortname}}';
(function () {
var s = document.createElement('script'); s.async = true;
s.src = 'http://disqus.com/forums/{{site.disqus_shortname}}/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>


{% endblock %}

]]>
</description>
<pubDate>Mon, {{start|date:"d M Y 00:00:01 -0500"}}</pubDate>
<guid>http://{{site.host}}/week-of/{{start|date:"c"}}</guid>
</item>
</channel>
</rss>
7 changes: 4 additions & 3 deletions eventsite/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def week_of_index(request, datestring=None, format=None):

return render_to_response(template, locals(), context_instance=RequestContext(request))


@cache_page(60 * 10)
@site_required
def this_week_rss(request):

Expand All @@ -142,8 +142,9 @@ def this_week_rss(request):

template='eventsite/week.xml'

return render_to_response(template, locals(), context_instance=RequestContext(request))

response= render_to_response(template, locals(), context_instance=RequestContext(request),mimetype='application/rss+xml')
response['Cache-Control']="public; max-age=3600;"
return response



Expand Down

0 comments on commit 3efa5ea

Please sign in to comment.