Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright (c) 2016 Jon Culver

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ Decisions get made by people who show up. Progressive Events is here to tell you

Things you'll need:


1. Postgres database: https://wiki.postgresql.org/wiki/Detailed_installation_guides#MacOS
2. A unique, secure Django `SECRET_KEY` http://www.miniwebtool.com/django-secret-key-generator/
3. A Google Maps API key (server side, for geocoding) https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend&keyType=CLIENT_SIDE&reusekey=true
4. Optionally, Redis: http://jasdeep.ca/2012/05/installing-redis-on-mac-os-x/
2. The GDAL library (http://www.gdal.org/), `brew install GDAL`
3. The Postgres/GIS library, `brew install postgis`
4. A unique, secure Django `SECRET_KEY` http://www.miniwebtool.com/django-secret-key-generator/
5. A Google Maps API key (server side, for geocoding) https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend&keyType=CLIENT_SIDE&reusekey=true
6. Optionally, Redis: http://jasdeep.ca/2012/05/installing-redis-on-mac-os-x/


## Configuration
Expand Down
16 changes: 10 additions & 6 deletions core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from .fields import MoneypatchedRecurrenceField
from .utils import get_point

import pytz


def round_hours(hours=1):
return now().replace(minute=0).replace(second=0) + timedelta(hours=hours)
Expand Down Expand Up @@ -88,13 +90,15 @@ def save(self, *args, **kwargs):
class EventQueryset(models.query.GeoQuerySet):

def filter_by_date(self, as_occurrences=False, **kwargs):
future_date = datetime.now() + timedelta(**kwargs)

midnight_hawaii = datetime.combine(datetime.now(pytz.timezone('US/Hawaii')), datetime.min.time())
future_date = midnight_hawaii + timedelta(**kwargs)
queryset = self.all()
events = filter(lambda e: len(e.recurrences.between(datetime.now(), future_date, inc=True)) > 0, queryset)
events = filter(lambda e: len(e.recurrences.between(midnight_hawaii, future_date, inc=True)) > 0, queryset)
if as_occurrences:
occurrences = []
for e in events:
occurrences += e.recurrences.between(datetime.now(), future_date, inc=True)
occurrences += e.recurrences.between(midnight_hawaii, future_date, inc=True)
return occurrences
else:
return self.filter(pk__in=map(lambda e: e.pk, events))
Expand Down Expand Up @@ -145,6 +149,6 @@ def save(self, *args, **kwargs):
def dates(self, *args, **kwargs):
if not kwargs:
kwargs = {'days': 60}
today = datetime.now().replace(hour=0,minute=0,second=0,microsecond=0)
future_date = today + timedelta(**kwargs)
return [i for i in self.recurrences.between(after=today, before=future_date, inc=True)]
midnight_hawaii = datetime.combine(datetime.now(pytz.timezone('US/Hawaii')), datetime.min.time())
future_date = midnight_hawaii + timedelta(**kwargs)
return [i for i in self.recurrences.between(after=midnight_hawaii, before=future_date, inc=True)]
1 change: 1 addition & 0 deletions core/static/js/sigo.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ var sigo = function(){

self.lookup = new XMLHttpRequest();
self.lookup.open('GET', self.endpoint + '?search=' + encodeURIComponent(self.getElementById(self.input).value));
self.lookup.setRequestHeader('Accept', 'application/json');
self.lookup.send(null);
self.lookup.onreadystatechange = function(){
var DONE = 4, OK = 200;
Expand Down
31 changes: 16 additions & 15 deletions core/static/recurrence/js/recurrence.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,9 @@ recurrence.DateFormat.prototype = {
},

Z: function() {
var offset = this.data.getTimezoneOffset();
return offset * 60;
// var offset = this.data.getTimezoneOffset();
// return offset * 60;
return 0;
}
};
recurrence.DateFormat.formatchars = RegExp(
Expand Down Expand Up @@ -564,10 +565,10 @@ recurrence.serialize = function(rule_or_recurrence) {
};
return pad(dt.getUTCFullYear(), 4) +
pad(dt.getUTCMonth() + 1, 2) +
pad(dt.getUTCDate(), 2) + 'T' +
pad(dt.getUTCHours(), 2) +
pad(dt.getUTCMinutes(), 2) +
pad(dt.getUTCSeconds(), 2) + 'Z';
pad(dt.getUTCDate(), 2); //+ 'T' +
// pad(dt.getUTCHours(), 2) +
// pad(dt.getUTCMinutes(), 2) +
// pad(dt.getUTCSeconds(), 2); // + 'Z';
};

var serialize_rule = function(rule) {
Expand Down Expand Up @@ -669,21 +670,21 @@ recurrence.deserialize = function(text) {
var second = 0;
}
var dt = new Date();
if (text.indexOf('Z') > 0) {
dt.setUTCFullYear(year);
dt.setUTCMonth(month - 1);
dt.setUTCDate(day);
dt.setUTCHours(hour);
dt.setUTCMinutes(minute);
dt.setUTCSeconds(second);
} else {
// if (text.indexOf('Z') > 0) {
// dt.setUTCFullYear(year);
// dt.setUTCMonth(month - 1);
// dt.setUTCDate(day);
// dt.setUTCHours(hour);
// dt.setUTCMinutes(minute);
// dt.setUTCSeconds(second);
// } else {
dt.setFullYear(year);
dt.setMonth(month - 1);
dt.setDate(day);
dt.setHours(hour);
dt.setMinutes(minute);
dt.setSeconds(second);
}
// }
return dt;
};

Expand Down
10 changes: 8 additions & 2 deletions core/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,14 @@ <h3 class="logo"><a href="{% url "index" %}"><img src="{% static "img/pe-logo.pn
<section>
<div class="container">
<footer>
<p>ProgressiveEvents.org is a <a href="http://www.jonculver.com/">Jon Culver</a> production, &copy; 2016&ndash;&infin;.<br />
<a href="{% url "why" %}">Read more about why I made this</a>. Want to help out? <a href="mailto:[email protected]">Get in touch</a> and let's blow this thing up!</p>
<small>
<ul class="list-unstyled"">
<li>ProgressiveEvents.org is a <a href="http://www.jonculver.com/">Jon Culver</a> production, &copy; 2016&ndash;&infin;.</li>
<li><a href="{% url "why" %}">Read more about why I made this</a>. Want to help out?</li>
<li>Get in touch via <a href="mailto:[email protected]">email</a></span> or check us out on <a href="https://github.com/bahoo/progressive-events">github</a>.<li/>
<li>Let's blow this thing up!</li>
<ul/>
<small>
</footer>
</div>
</section>
Expand Down
42 changes: 26 additions & 16 deletions core/templates/embed.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
<style>
html, body{ margin: 0; padding: 0; height: 100%; }
#map{ width: 100%; height: 100%; }

@font-face { font-family: 'Glyphicons Halflings'; src: url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/fonts/glyphicons-halflings-regular.eot'); src: url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/fonts/glyphicons-halflings-regular.woff') format('woff'), url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); }
.glyphicon { position: relative; top: 1px; display: inline-block; font-family: 'Glyphicons Halflings'; font-style: normal; font-weight: normal; line-height: 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
.glyphicon-map-marker:before { content: "\e062"; }
.glyphicon-link:before { content: "\e144"; }
.glyphicon-calendar:before { content: "\e109"; }
.glyphicon-time:before { content: "\e023"; }
.glyphicon-repeat:before { content: "\e030"; }
h5{ font-size: 1.25em; margin: 0 0 0.75em; }
.leaflet-popup-content p{ margin: 12px 0; }
</style>
</head>
<body>
Expand All @@ -31,23 +41,23 @@

var event = events[i];

var template = `<h5>${event.title}</h5>`;
if(event.venue.address){
template += `<p><a href="https://www.google.com/maps/place/${encodeURIComponent(event.venue.address)}%2C+${encodeURIComponent(event.venue.city)}%2C+${encodeURIComponent(event.venue.state)}+${event.venue.zipcode}" target="_blank"><span class="glyphicon glyphicon-map-marker" style="margin-right: 0.33em;"></span><b>${event.venue.title}</b><span class="text-muted" style="margin-left: 0.333em;">${event.venue.address}, ${event.venue.city}</span></a></p>`
}

if(event.description){
template += `<p>${event.description}</p>`
}

if(event.url){
template += `<p><a href="${event.url}" target="_blank" class="link"><span class="glyphicon glyphicon-link" style="margin-right: 0.33em;"></span>${event.url}</a></p>`
} else {
template += `<p><a href="http://www.progressiveevents.org/events/${event.slug}" target="_blank" class="link"><span class="glyphicon glyphicon-link" style="margin-right: 0.33em;"></span>More info on Progressive Events</a></p>`
}

points.push(L.marker([event.venue.point.y, event.venue.point.x])
.bindPopup(`{% spaceless %}
<h5>${event.title}</h5>
{% if event.venue.address %}
<p>
<a href="https://www.google.com/maps/place/{{ event.venue.address|urlencode }}%2C+{{ event.venue.city|urlencode }}%2C+{{ event.venue.state|urlencode }}+{{ event.venue.zipcode|urlencode }}" target="_blank"><span class="glyphicon glyphicon-map-marker" style="margin-right: 0.33em;"></span><b>{{ event.venue.title }}</b><span class="text-muted" style="margin-left: 0.333em;">{{ event.venue.address }}, {{ event.venue.city }}</span></a>
</p>
{% endif %}
{% if event.description %}
<p>{{ event.description | linebreaksbr | safe }}</p>
{% endif %}
<p>
{% if event.url %}
<a href="{{ event.url }}" target="_blank" class="link"><span class="glyphicon glyphicon-link" style="margin-right: 0.33em;"></span>{{ event.url }}</a><br />
{% endif %}
<a href="#{{ event.title | slugify }}-{{ event.pk }}"><span class="glyphicon glyphicon-info-sign" style="margin-right: 0.33em"></span>Jump to listing</a>
</p>{% endspaceless %}`));
.bindPopup(template));

}

Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Django==1.9.6
django-annoying==0.9.0
django-bootstrap3==7.0.1
django-cors-headers==1.1.0
-e git://github.com/jazzband/django-debug-toolbar@637b0b73bc684f6ea600dca5ca1bb1f090fcee93#egg=django_debug_toolbar-master
django-dotenv==1.4.1
django-dynamic-scraper==0.11.0
django-eventtools==0.9.7
Expand Down Expand Up @@ -54,6 +55,7 @@ scrapy-djangoitem==1.1.1
service-identity==16.0.0
simplegeneric==0.8.1
six==1.10.0
sqlparse==0.2.1
traitlets==4.2.1
Twisted==16.2.0
w3lib==1.14.2
Expand Down