Permalink
Browse files

fixes bug 1380705 - Events without picture break all sorts of things (#…

  • Loading branch information...
1 parent e7ae6e4 commit 9a204a6a5ca62876b81137b40ed2e4e00ede0ca9 @peterbe peterbe committed Jul 13, 2017
@@ -434,6 +434,20 @@
</form>
</div>
+ {% if not event.picture_id and not event.placeholder_img %}
+ <div id="event-pictureless"
+ class="alert alert-warning alert-dismissible" role="alert">
+ <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
+ <p>
+ <b>Warning!</b><br>
+ This event lacks a valid picture which will break browsing prerequisites.
+ </p>
+ <p>
+ Either upload a placeholder image or select a picture from the gallery.
+ </p>
+ </div>
+ {% endif %}
+
{% include "manage/_default_form_upload.html" %}
{% if suggested_event_comments %}
@@ -74,6 +74,8 @@ <h4>Loading Error</h4>
ng-class="{active: search_only==='needs_approval'}" ng-click="selectSearchOnly('needs_approval')">A</span>
<span class="badge" title="Only events that are upcoming"
ng-class="{active: search_only==='upcoming'}" ng-click="selectSearchOnly('upcoming')">U</span>
+ <span class="badge" title="Only events that lack a picture"
+ ng-class="{active: search_only==='pictureless'}" ng-click="selectSearchOnly('pictureless')">P</span>
</th>
<th style="width: 14%">
Location
@@ -159,6 +161,7 @@ <h4>Loading Error</h4>
<td>
<a href="/{{ event.slug }}/">{{ event.title }}</a>
+ <span class="badge badge-error" title="Event lacks any valid picture!" ng-if="event.pictureless">P</span>
<span class="badge" title="Event is currently Live!" ng-if="event.is_live">L</span>
<span class="badge" title="Needs approval" ng-if="event.needs_approval">A</span>
<span class="badge" title="Event is upcoming" ng-if="event.is_upcoming">U</span>
@@ -65,3 +65,11 @@ a.picture-gallery-use {
a.picture-gallery-use:hover {
opacity: 1;
}
+
+/* Custom extra to be able to use `class="badge badge-error"` */
+.badge-error {
+ background-color: #b94a48;
+}
+.badge-error:hover {
+ background-color: #953b39;
+}
@@ -234,6 +234,8 @@ function EventManagerController($scope, $http, $interval, $timeout) {
return !!event.needs_approval;
} else if ($scope.search_only === 'live') {
return !!event.is_live;
+ } else if ($scope.search_only === 'pictureless') {
+ return !!event.pictureless;
} else {
console.warn('Unrecognized option', $scope.search_only);
}
@@ -368,6 +368,9 @@ def events_data(request):
if event.picture_id:
row['picture'] = event.picture_id
+ if not event.picture_id and not event.placeholder_img:
+ row['pictureless'] = True
+
if row.get('is_pending'):
# this one is only relevant if it's pending
template_name = template_names.get(event.template_id)
@@ -391,9 +394,6 @@ def events_data(request):
urls = {
'manage:event_edit': reverse('manage:event_edit', args=('0',)),
- 'manage:event_duplicate': reverse(
- 'manage:event_duplicate', args=('0',)
- ),
'manage:redirect_event_thumbnail': reverse(
'manage:redirect_event_thumbnail', args=('0',)
),
@@ -428,7 +428,7 @@ def _event_process(request, form, event):
approvals_add = set(approvals_new).difference(approvals_old)
for approval in approvals_add:
group = Group.objects.get(name=approval)
- app = Approval.objects.create(group=group, event=event)
+ Approval.objects.create(group=group, event=event)
sending.email_about_approval_requested(
event,
group,

0 comments on commit 9a204a6

Please sign in to comment.