community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r1692802 - in /comdev/tools/events_list: models.py templates/events/importMeetups.html templates/events/index.html views.py
Date Mon, 27 Jul 2015 02:25:27 GMT
Author: rgardler
Date: Mon Jul 27 02:25:27 2015
New Revision: 1692802

URL: http://svn.apache.org/r1692802
Log:
make the table of results prettier and allow them to be filtered and sorted

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

Modified: comdev/tools/events_list/models.py
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/models.py?rev=1692802&r1=1692801&r2=1692802&view=diff
==============================================================================
--- comdev/tools/events_list/models.py (original)
+++ comdev/tools/events_list/models.py Mon Jul 27 02:25:27 2015
@@ -43,6 +43,10 @@ class Event(models.Model):
         for hashtag in hashtags:
             tweet = tweet + " #" + hashtag.name
         return tweet
+
+    @property
+    def date_sort(self):
+        return self.local_start.strftime("%Y%m%d%H%M")
     
     def __str__(self):
         return u'{n}, {d}'.format(n=self.name, d=self.local_start)

Modified: comdev/tools/events_list/templates/events/importMeetups.html
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/templates/events/importMeetups.html?rev=1692802&r1=1692801&r2=1692802&view=diff
==============================================================================
--- comdev/tools/events_list/templates/events/importMeetups.html (original)
+++ comdev/tools/events_list/templates/events/importMeetups.html Mon Jul 27 02:25:27 2015
@@ -1,3 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <title>Community Development: Events</title>
+</head>
+<body>
 <h1>Meetups Imported</h1>
 <p>You can view them in the <a href="/admin">Admin</a> interface.</p>
 <p>Better yet you will add code to make a pretty view on the <a href="/events">Events
Index</a> page.</p>
+</body>
+</html>

Modified: comdev/tools/events_list/templates/events/index.html
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/templates/events/index.html?rev=1692802&r1=1692801&r2=1692802&view=diff
==============================================================================
--- comdev/tools/events_list/templates/events/index.html (original)
+++ comdev/tools/events_list/templates/events/index.html Mon Jul 27 02:25:27 2015
@@ -1,3 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <title>Community Development: Events</title>
+
+  <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
+  <script type="text/javascript" src="http://cdn.datatables.net/1.10.7/js/jquery.dataTables.min.js"></script>
+  <script type="text/javascript" src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
+
+  <link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
  
+  <link rel="stylesheet" href="http://cdn.datatables.net/1.10.7/css/jquery.dataTables.min.css"></style>
+</head>
+<body>
 <h1>Events</h1>
 
 {% if can_import %}
@@ -5,46 +18,52 @@
 {% endif %}
 
 {% if upcoming_events_list %}
-<table>
-  <tr>
-    <th>Name</th>
-    <th>City</th>
-    <th>Country</th>
-    <th>Local Start Time</th>
-    <th>Local End Time</th>
-  </tr>
-  {% for event in upcoming_events_list %}
-  <tr>
-    <td><a href="{{ event.event_url }}" target="_blank">{{ event.name }}</a></td>
-    <td>{{ event.group.city }}, {{ event.group.state }}</a></td>
-    <td>{{ event.group.country }}</td>
-    <td>{{ event.local_start }}</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 }}" data-count="none">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>
-      <br/>
-      <a href="http://bufferapp.com/add" class="buffer-add-button" data-text="{{ event.tweet
}}" data-url="{{ event.event_url }}" data-count="none" ></a><script type="text/javascript"
src="https://d389zggrogs7qo.cloudfront.net/js/button.js"></script>
--->      
-      <a href="{{ event.event_url }}" title="{{ event.tweet }}" class="_hs_socialshare">Share</a>
-
-      <script>
-	var _hs = {
-	           size: 5,
-	           partner: "rgardler.github.io"
-	};
-	(function() {
-	    var h = document.createElement('script'); h.type = 'text/javascript'; h.async = true;
-	    h.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'dtirydke3kdq7.cloudfront.net/hootlet.js?v=1';
-	    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(h, s);
-})();
-</script>
-    </td>
-  </tr>
-  {% endfor %}
-</table>	
+<table id="eventList" class="table table-striped">
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>City</th>
+      <th>Country</th>
+      <th>Local Start Time</th>
+      <th>Applicable</th>
+      <th>Social</th>
+    </tr>
+  </thead>
+  <tbody>
+    {% for event in upcoming_events_list %}
+    <tr>
+      <td><a href="{{ event.event_url }}" target="_blank">{{ event.name }}</a></td>
+      <td>{{ event.group.city }}, {{ event.group.state }}</td>
+      <td>{{ event.group.country }}</td>
+      <td data-order='{{ event.date_sort }}'>{{ event.local_start }}</td>
+      <td><a href="{% url 'toggleNA' event.id %}">Mark N/A</a></td>
+      <td>
+	<a href="{{ event.event_url }}" title="{{ event.tweet }}" class="_hs_socialshare">Share</a>
+	<script>
+	  var _hs = {
+	             size: 5,
+	             partner: "rgardler.github.io"
+	  };
+	  (function() {
+	               var h = document.createElement('script'); h.type = 'text/javascript'; h.async
= true;
+	               h.src = ('https:' == document.location.protocol ? 'https://' : 'http://')
+ 'dtirydke3kdq7.cloudfront.net/hootlet.js?v=1';
+	               var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(h,
s);
+	  })();
+	</script>
+      </td>
+    </tr>
+    {% endfor %}
+  </tbody>
+</table>
+<script>
+  $(document).ready(function(){
+    $('#eventList').dataTable({
+       "order": [[ 3, "asc" ]]
+    });
+  });
+</script>	
 {% else %}
 <p>No events are available.</p>
 {% endif %}
+</body>
+</head>

Modified: comdev/tools/events_list/views.py
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/views.py?rev=1692802&r1=1692801&r2=1692802&view=diff
==============================================================================
--- comdev/tools/events_list/views.py (original)
+++ comdev/tools/events_list/views.py Mon Jul 27 02:25:27 2015
@@ -20,7 +20,7 @@ def index(request):
     except:
         pass
 
-    upcoming_events_list = Event.objects.filter(is_applicable = True).filter(local_start__gte=now).order_by('local_start')[:20]
+    upcoming_events_list = Event.objects.filter(is_applicable = True).filter(local_start__gte=now).order_by('local_start')[:100]
     template = loader.get_template('events/index.html')
     context = RequestContext(request, {
                              'upcoming_events_list': upcoming_events_list,



Mime
View raw message