Skip to content
This repository was archived by the owner on Sep 19, 2018. It is now read-only.

Commit 96b5a8d

Browse files
author
Mateja
committed
Merge remote-tracking branch 'upstream/master' into paginated_search
2 parents 7ab8557 + 47bb493 commit 96b5a8d

26 files changed

+298
-57
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ install:
2323
- pip install -r ./requirements.txt
2424

2525
# command to run tests, e.g. python setup.py test
26-
script: python ./manage.py test api web
27-
--settings=codeweekeu.settings_travis
26+
script: python ./manage.py test api web.tests --settings=codeweekeu.settings_travis
2827

2928
notifications:
3029
email:

api/models/events.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ class Event(models.Model):
3838
('PENDING', 'Pending'),
3939
('REJECTED', 'Rejected'),
4040
)
41+
42+
CUSTOM_COUNTRY_ENTRIES = (
43+
('00',' All countries'),
44+
('01','---------------'),
45+
)
46+
4147
status = models.CharField(max_length=50, choices=STATUS_CHOICES, default='PENDING')
4248
title = models.CharField(max_length=255, default=None)
4349
slug = models.SlugField(max_length=255, null=True, blank=True)

api/processors.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,30 @@ def get_pending_events(limit=None, order=None, country_code=None, past=False):
5050
events = events[:limit]
5151
return events
5252

53+
def get_next_or_previous (event, country_code=None, past=False, direction=True):
54+
55+
"""
56+
Get next or previous pending event
57+
"""
58+
59+
next_event = None
60+
events = Event.objects.filter(status='PENDING')
61+
62+
if direction:
63+
events = events.filter(pk__gt=event.pk).order_by("pk")
64+
else:
65+
events = events.filter(pk__lt=event.pk).order_by("-pk")
66+
67+
if not past:
68+
events = events.filter(end_date__gte=datetime.datetime.now())
69+
if country_code:
70+
events = events.filter(country=country_code)
71+
72+
if events:
73+
next_event = events[0]
74+
75+
return next_event
76+
5377

5478
def get_filtered_events(search_filter=None, country_filter=None, theme_filter=None, audience_filter=None):
5579

@@ -65,7 +89,7 @@ def get_filtered_events(search_filter=None, country_filter=None, theme_filter=No
6589
filter_args = (Q(title__icontains=search_filter) | Q(description__icontains=search_filter) | Q(tags__name__icontains=search_filter)
6690
| Q(organizer__icontains=search_filter) | Q(location__icontains=search_filter),)
6791

68-
if country_filter:
92+
if country_filter and country_filter not in [ custom_country[0] for custom_country in Event.CUSTOM_COUNTRY_ENTRIES ]:
6993
filter_kwargs['country'] = country_filter
7094

7195
if theme_filter:

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ argparse>=1.1
55
distribute==0.6.34
66
django-appconf==0.6
77
django-avatar==2.0
8-
django-compressor==1.3
8+
django-compressor==1.4
99
django-countries==2.0c1
1010
django-debug-toolbar==1.0.1
1111
django-geoposition==0.1.5

static/css/style.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5796,14 +5796,15 @@ a {
57965796
-ms-transform: rotate(45deg);
57975797
transform: rotate(45deg); }
57985798

5799+
57995800
.btn-directional {
58005801
padding: 15px 120px 15px 30px;
58015802
overflow: hidden; }
58025803
.btn-directional:before {
58035804
left: auto;
58045805
right: 10px;
58055806
z-index: 2;
5806-
line-height: 2.4; }
5807+
line-height: 4; }
58075808
.btn-directional:after {
58085809
width: 30%;
58095810
height: 200%;
@@ -5812,6 +5813,7 @@ a {
58125813
right: 0;
58135814
top: 0;
58145815
margin: -5px 0 0 -5px;
5816+
pointer-events: none;
58155817
-webkit-transform-origin: 0 0;
58165818
-moz-transform-origin: 0 0;
58175819
-ms-transform-origin: 0 0;

static/img/codeweek-logo.jpg

22.7 KB
Loading

static/img/new_logo_white_tilted.png

-3.61 KB
Loading

static/js/index.js

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ var Codeweek = window.Codeweek || {};
1010
map,
1111
markers = {},
1212
place,
13-
placeinfowindow = null;
14-
13+
placeinfowindow = null,
14+
overlapSpiderifier = null;
1515

1616
function createMap(events, lat, lng, zoomVal) {
1717
var markerData = JSON.parse(events),
@@ -34,6 +34,8 @@ var Codeweek = window.Codeweek || {};
3434
position: google.maps.ControlPosition.RIGHT_BOTTOM
3535
}
3636
});
37+
overlapSpiderifier = new OverlappingMarkerSpiderfier(map,
38+
{markersWontMove: true, markersWontHide: true, keepSpiderfied: true, circleSpiralSwitchover: 5});
3739
placeinfowindow = new google.maps.InfoWindow({
3840
content: "loading..."
3941
});
@@ -96,34 +98,42 @@ var Codeweek = window.Codeweek || {};
9698
marker = new google.maps.Marker({
9799
position: myLatLng,
98100
map: map,
99-
title: markTitle
101+
title: markTitle,
102+
description: markDesc,
103+
image: markImg,
104+
url: markUrl
100105
});
101106

102-
google.maps.event.addListener(marker, 'click', function () {
107+
overlapSpiderifier.addListener('click', function(marker) {
103108
placeinfowindow.close();
104109

105-
var infoWindowContent = placeinfowindow.getContent(),
110+
var infoWindowContent = '',
106111
buble_content = '',
107-
image = '';
112+
image = '',
113+
description = '';
108114

109-
if (markImg !== "") {
110-
image += '<img src="' + Codeweek.Index.media_url + markImg + '" class="img-polaroid marker-buble-img">';
115+
if (marker.image !== "") {
116+
image += '<img src="' + Codeweek.Index.media_url + marker.image + '" class="img-polaroid marker-buble-img">';
111117
}
112118

113-
if (markDesc.length > 15) {
114-
markDesc = markDesc.substring(0, 150) + '... ';
119+
if (marker.description.length > 150) {
120+
description = marker.description.substring(0, 150) + '... ';
121+
} else {
122+
description = marker.description;
115123
}
116124

117-
buble_content += '<div><h4><a href="' + markUrl + '" class="map-marker">' + markTitle + '</a></h4><div>' +
125+
buble_content = '<div><h4><a href="' + marker.url + '" class="map-marker">' + marker.title + '</a></h4><div>' +
118126
image +
119-
'<p style="overflow:hidden;">' + markDesc +
120-
'&nbsp;<a href="' + markUrl + '" class="map-marker"><span>More...</span></a></p>';
127+
'<p style="overflow:hidden;">' + description +
128+
'&nbsp;<a href="' + marker.url + '" class="map-marker"><span>More...</span></a></p>';
121129

122130

123131
placeinfowindow.setContent(buble_content);
124-
placeinfowindow.open(this.map, this);
132+
placeinfowindow.open(marker.map, marker);
125133
});
126134

135+
overlapSpiderifier.addMarker(marker);
136+
127137
return marker;
128138
}
129139

@@ -201,6 +211,7 @@ var Codeweek = window.Codeweek || {};
201211
$('#country').html(country_name);
202212
}
203213

214+
204215
function initialize(events, lon, lan) {
205216
map = createMap(events, lon, lan, 3);
206217
//setAutocomplete();
@@ -239,6 +250,11 @@ var Codeweek = window.Codeweek || {};
239250
document.location.hash = "!" + country_code;
240251
});
241252

253+
$("#past-link").click(function (event) {
254+
var newUrl = $(this).attr('href') + document.location.hash;
255+
$(this).attr('href', newUrl);
256+
});
257+
242258
$("#zoomEU").click(function (event) {
243259
event.preventDefault();
244260

static/js/oms.min.js

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/scss/_base.scss

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,30 @@ INDEX PAGE STYLES
138138
padding-left: 0.5em;
139139
padding-right: 0.5em;
140140
}
141+
141142
#showcountries{
142143
background-color: $whitesmoke;
143144
padding-bottom: 25px;
144145
}
146+
147+
#past-events{
148+
position: absolute;
149+
top: 0;
150+
right: 0;
151+
padding-top: 15px;
152+
padding-bottom: 15px;
153+
padding-left: 30px;
154+
padding-right: 25px;
155+
z-index: 0;
156+
border-style: solid;
157+
border-color: $primary-color;
158+
border-width: 0px 0px 2px 2px;
159+
background-color: $whitesmoke;
160+
background: rgba($whitesmoke, 0.8);
161+
font-size: 14px;
162+
@include border-radius(15px);
163+
}
164+
145165
.country-link {
146166
margin: 1em 0;
147167
height: 80px;
@@ -427,6 +447,10 @@ ABOUT SITE STYLES
427447
padding: 0;
428448
}
429449
}
450+
451+
}
452+
#codeweek-about-logo {
453+
margin-bottom: 30px;
430454
}
431455

432456
.supporters {

0 commit comments

Comments
 (0)