community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r1692980 - in /comdev/tools/events_list: ./ templates/events/ templates/groups/ templates/include/ templatetags/
Date Tue, 28 Jul 2015 03:06:35 GMT
Author: rgardler
Date: Tue Jul 28 03:06:34 2015
New Revision: 1692980

URL: http://svn.apache.org/r1692980
Log:
add a groups page and a navigation bar

Added:
    comdev/tools/events_list/templates/groups/
    comdev/tools/events_list/templates/groups/index.html
    comdev/tools/events_list/templates/include/
    comdev/tools/events_list/templates/include/navbar.html
    comdev/tools/events_list/templatetags/
    comdev/tools/events_list/templatetags/__init__.py
    comdev/tools/events_list/templatetags/navigationTags.py
Modified:
    comdev/tools/events_list/models.py
    comdev/tools/events_list/templates/events/index.html
    comdev/tools/events_list/urls.py
    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=1692980&r1=1692979&r2=1692980&view=diff
==============================================================================
--- comdev/tools/events_list/models.py (original)
+++ comdev/tools/events_list/models.py Tue Jul 28 03:06:34 2015
@@ -23,6 +23,9 @@ class Hashtag(models.Model):
     def __unicode__(self):
         return unicode(self.name)
 
+class Person(models.Model):
+   meetupID =  models.BigIntegerField(verbose_name = "Meetups.com ID", unique=True)
+   lastMeetupVisit = models.DateTimeField()
     
 class Event(models.Model):
     name = models.CharField(max_length=200)

Modified: comdev/tools/events_list/templates/events/index.html
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/templates/events/index.html?rev=1692980&r1=1692979&r2=1692980&view=diff
==============================================================================
--- comdev/tools/events_list/templates/events/index.html (original)
+++ comdev/tools/events_list/templates/events/index.html Tue Jul 28 03:06:34 2015
@@ -11,6 +11,8 @@
   <link rel="stylesheet" href="http://cdn.datatables.net/1.10.7/css/jquery.dataTables.min.css"></link>
 </head>
 <body>
+  {% include "include/navbar.html" %}
+
 <h1>Events</h1>
 
 {% if can_import %}

Added: comdev/tools/events_list/templates/groups/index.html
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/templates/groups/index.html?rev=1692980&view=auto
==============================================================================
--- comdev/tools/events_list/templates/groups/index.html (added)
+++ comdev/tools/events_list/templates/groups/index.html Tue Jul 28 03:06:34 2015
@@ -0,0 +1,54 @@
+<!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 rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"></link>
 
+  <link rel="stylesheet" href="http://cdn.datatables.net/1.10.7/css/jquery.dataTables.min.css"></link>
+</head>
+<body>
+  {% include "include/navbar.html" %}
+
+  <h1>Groups</h1>
+  {% if can_import %}
+    <a href="/events/importMeetups">Import Meetups</a>
+  {% endif %}
+
+  {% if groups_list %}
+    <table id="groupList" class="table table-striped">
+      <thead>
+	<tr>
+	  <th>Name</th>
+	  <th>City</th>
+	  <th>State</th>
+	  <th>Country</th>
+	</tr>
+      </thead>
+      <tbody>
+	{% for group in groups_list %}
+	<tr>
+	  <td>{{ group.name }}</td>
+	  <td>{{ group.city }}</td>
+	  <td>{{ group.state }}</td>
+	  <td>{{ group.country }}</td>
+	</tr>
+	{% endfor %}
+      </tbody>
+    </table>
+    <script>
+      $(document).ready(function(){
+      $('#groupList').dataTable({
+          "order": [[ 0, "asc" ]],
+          "stateSave": true
+        });
+      });
+    </script>	
+  {% else %}
+    <p>No events are available.</p>
+  {% endif %}
+</body>
+</html>

Added: comdev/tools/events_list/templates/include/navbar.html
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/templates/include/navbar.html?rev=1692980&view=auto
==============================================================================
--- comdev/tools/events_list/templates/include/navbar.html (added)
+++ comdev/tools/events_list/templates/include/navbar.html Tue Jul 28 03:06:34 2015
@@ -0,0 +1,24 @@
+{% load navigationTags %}
+
+<nav class="navbar navbar-default">
+  <div class="container-fluid">
+    <!-- Brand and toggle get grouped for better mobile display -->
+    <div class="navbar-header">
+      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"
aria-expanded="false">
+        <span class="sr-only">Toggle navigation</span>
+        <span class="icon-bar"></span>
+        <span class="icon-bar"></span>
+        <span class="icon-bar"></span>
+      </button>
+      <a class="navbar-brand" href="#">ComDev Events</a>
+    </div>
+
+    <!-- Collect the nav links, forms, and other content for toggling -->
+    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
+      <ul class="nav navbar-nav">
+        <li><a class="{% is_active_page request 'eventIndex' %}" href="{% url 'eventIndex'
%}">Events</a></li>
+        <li><a class="{% is_active_page request 'groupIndex' %}" href="{% url 'groupIndex'
%}">Groups</a></li>
+      </ul>
+    </div><!-- /.navbar-collapse -->
+  </div><!-- /.container-fluid -->
+</nav>

Added: comdev/tools/events_list/templatetags/__init__.py
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/templatetags/__init__.py?rev=1692980&view=auto
==============================================================================
    (empty)

Added: comdev/tools/events_list/templatetags/navigationTags.py
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/templatetags/navigationTags.py?rev=1692980&view=auto
==============================================================================
--- comdev/tools/events_list/templatetags/navigationTags.py (added)
+++ comdev/tools/events_list/templatetags/navigationTags.py Tue Jul 28 03:06:34 2015
@@ -0,0 +1,10 @@
+from django import template
+from django.core.urlresolvers import reverse
+
+register = template.Library()
+
+@register.simple_tag
+def is_active_page(request, urls):
+    if request.path in ( reverse(url) for url in urls.split() ):
+        return "active"
+    return ""

Modified: comdev/tools/events_list/urls.py
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/urls.py?rev=1692980&r1=1692979&r2=1692980&view=diff
==============================================================================
--- comdev/tools/events_list/urls.py (original)
+++ comdev/tools/events_list/urls.py Tue Jul 28 03:06:34 2015
@@ -3,8 +3,10 @@ from django.conf.urls import url
 from . import views
 
 urlpatterns = [
-    url(r'^$', views.index, name='index'),
+    url(r'^$', views.index, name='eventIndex'),
     url(r'^(?P<event_id>[0-9]+)/$', views.viewEvent, name='viewEvent'),
     url(r'^(?P<event_id>[0-9]+)/toggleNA/$', views.toggleNA, name='toggleNA'),
     url(r'^importMeetups/$', views.importMeetups, name='importMeetups'),
+
+    url(r'^groups$', views.groupIndex, name='groupIndex'),
 ]

Modified: comdev/tools/events_list/views.py
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/views.py?rev=1692980&r1=1692979&r2=1692980&view=diff
==============================================================================
--- comdev/tools/events_list/views.py (original)
+++ comdev/tools/events_list/views.py Tue Jul 28 03:06:34 2015
@@ -12,19 +12,11 @@ logger = logging.getLogger(__name__)
 
 def index(request):
     now = datetime.now()
-    can_import = True
-    try:
-        last_import = Log.objects.filter(action_type = Log.EVENT_IMPORT)[:1].get()
-        if now - last_import.datetime < timedelta(hours = 1):
-            can_import = False
-    except:
-        pass
-
     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,
-                             'can_import': can_import
+                             'can_import': _canImport()
     })
     return HttpResponse(template.render(context))
 
@@ -56,6 +48,27 @@ def toggleNA(request, event_id):
 
     return redirect('events_list.views.index')
 
+def groupIndex(request):
+    groups_list = Group.objects.all()[:100]
+    template = loader.get_template('groups/index.html')
+    context = RequestContext(request, {
+                             'groups_list': groups_list,
+                             'can_import': _canImport()
+    })
+    return HttpResponse(template.render(context))
+    
+
+def _canImport():
+    can_import = True
+    now = datetime.now()
+    try:
+        last_import = Log.objects.filter(action_type = Log.EVENT_IMPORT)[:1].get()
+        if now - last_import.datetime < timedelta(hours = 1):
+            can_import = False
+    except:
+        pass
+    return can_import
+
 def importMeetups(request):
     # Import latest meetups from meetup.com, if we didn't import them within the last hour
     log = Log()



Mime
View raw message