community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r1684100 - in /comdev/tools/events_list: models.py templates/events/index.html
Date Mon, 08 Jun 2015 06:56:02 GMT
Author: rgardler
Date: Mon Jun  8 06:56:01 2015
New Revision: 1684100

URL: http://svn.apache.org/r1684100
Log:
add a tweet button to the events list

Modified:
    comdev/tools/events_list/models.py
    comdev/tools/events_list/templates/events/index.html

Modified: comdev/tools/events_list/models.py
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/models.py?rev=1684100&r1=1684099&r2=1684100&view=diff
==============================================================================
--- comdev/tools/events_list/models.py (original)
+++ comdev/tools/events_list/models.py Mon Jun  8 06:56:01 2015
@@ -25,6 +25,13 @@ class Event(models.Model):
     utc_offset = models.BigIntegerField()
     is_applicable = models.BooleanField(help_text = "Indicates if an event is applicable
to our audience or not.", default=True)
     
+    @property
+    def tweet(self):
+        hashtags = "#Apache #Meetup"
+        tweet = self.group.city + ", " + self.local_start.strftime("%-d %b") + ": " + self.name

+        tweet = tweet + ' ' + hashtags
+        return tweet
+    
     def __str__(self):
         return u'{n}, {d}'.format(n=self.name, d=self.local_start)
 

Modified: comdev/tools/events_list/templates/events/index.html
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/templates/events/index.html?rev=1684100&r1=1684099&r2=1684100&view=diff
==============================================================================
--- comdev/tools/events_list/templates/events/index.html (original)
+++ comdev/tools/events_list/templates/events/index.html Mon Jun  8 06:56:01 2015
@@ -1,4 +1,5 @@
 <h1>Events</h1>
+
 {% if upcoming_events_list %}
 <table>
   <tr>
@@ -10,8 +11,12 @@
   <tr>
     <td><a href="{{ event.event_url }}">{{ event.name }}</a></td>
     <td>{{ event.local_start }}</td>
-    <td>{{ event.local_end }}</td>
     <td><a href="{% url 'toggleNA' event.id %}">Mark N/A</a></td>
+    <td>
+      <a href="https://twitter.com/share" class="twitter-share-button" data-url="{{ event.event_url
}}"
+	 data-text="{{ event.tweet }}">Tweet</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>
+    </td>
   </tr>
   {% endfor %}
 </table>	



Mime
View raw message