Skip to content
Browse files

refactor lists to use singe event partial, adds contact email link in…

… header, adds onhold button to event detail view and tweaks all future to not show deleted events
  • Loading branch information...
1 parent 72487f8 commit f8ffd8973d28abe7e72cdfdf480bab52d4d7d215 @billsaysthis billsaysthis committed Jan 16, 2011
View
3 main.py
@@ -202,6 +202,9 @@ def post(self, id):
if state.lower() == 'unstaff' and access_rights.can_unstaff:
event.remove_staff(user)
desc = 'Removed self as staff'
+ if state.lower() == 'onhold' and access_rights.can_cancel:
+ event.on_hold()
+ desc = 'Put event on hold'
if state.lower() == 'cancel' and access_rights.can_cancel:
event.cancel()
desc = 'Cancelled event'
View
7 models.py
@@ -48,6 +48,7 @@ class Event(db.Model):
def get_all_future_list(cls):
return cls.all() \
.filter('start_time >', local_today()) \
+ .filter('status IN', ['approved', 'canceled', 'pending', 'onhold']) \
.order('start_time')
@classmethod
@@ -124,6 +125,12 @@ def cancel(self):
self.put()
logging.info('%s canceled %s' % (user.nickname, self.name))
+ def on_hold(self):
+ user = users.get_current_user()
+ self.status = 'onhold'
+ self.put()
+ logging.info('%s put %s on hold' % (user.nickname, self.name))
+
def delete(self):
user = users.get_current_user()
self.status = 'deleted'
View
1 static/style.css
@@ -10,6 +10,7 @@ body { font-family: Verdana,Arial,sans-serif; margin: 0px;}
#header h2 { font-size: x-large; margin: 0px; }
#new-event-link {position: absolute; right: 0px; padding: 2px 2px; background-color:#d50025;}
#new-event-link a {color: #fff; text-decoration: none;}
+#contact-link {float:left; margin-left: 10px;}
body.new #new-event-link {display: none;}
.step span { color: white; background-color: #b10026; padding: 1px; padding-left: 4px; padding-right: 4px;}
View
2 templates/all_future.html
@@ -10,7 +10,7 @@
<h4>{% ifequal events.grouper today.date %}<span style="text-decoration:underline;">Today</span> - {% endifequal %}{% ifequal events.grouper tomorrow.date %}<span style="text-decoration:underline;">Tomorrow</span> - {% endifequal %}{{events.grouper|date:"l, F j"}}</h4>
<table>
{% for event in events.list %}
- <tr><td width="75">{{event.start_time|date:"g:iA"|lower}}</td><td><a {% if event.is_canceled %}style="text-decoration: line-through;"{% endif %} href="/event/{{event.key.id}}-{{event.name|slugify}}">{{event.name}}</a> {% ifnotequal event.status "approved" %}<span style="color: white; font-size: x-small; padding: 2px; background: gray">{{event.status}}</span>{% endifnotequal %}<div style="font-size:80%">Hosted by <a href="mailto:{{event.member.email}}">{{event.owner}}</a> {% if event.roomlist %}in {{event.roomlist}}{% endif %}</div></td></tr>
+ {% include 'list_event.html' %}
{% endfor %}
</table>
{% endfor %}
View
2 templates/approved.html
@@ -10,7 +10,7 @@
<h4>{% ifequal events.grouper today.date %}<span style="text-decoration:underline;">Today</span> - {% endifequal %}{% ifequal events.grouper tomorrow.date %}<span style="text-decoration:underline;">Tomorrow</span> - {% endifequal %}{{events.grouper|date:"l, F j"}}</h4>
<table>
{% for event in events.list %}
- <tr><td width="75">{{event.start_time|date:"g:iA"|lower}}</td><td><a {% if event.is_canceled %}style="text-decoration: line-through;"{% endif %} href="/event/{{event.key.id}}-{{event.name|slugify}}">{{event.name}}</a> {% if event.is_canceled %}<span style="color: white; font-size: x-small; padding: 2px; background: gray">canceled</span>{% endif %}<div style="font-size:80%">Hosted by <a href="mailto:{{event.member.email}}">{{event.owner}}</a> {{event.roomlist_as_phrase}}</div></td></tr>
+ {% include 'list_event.html' %}
{% endfor %}
</table>
{% endfor %}
View
1 templates/base.html
@@ -15,6 +15,7 @@
<body>
<div id="top">
<div>
+ <span id="contact-link"><a href="mailto:events@hackerdojo.com">Contact Events Team</a></span>
{% if user %}
<strong>{{user.email}}</strong> | <a href="/myevents">My Events</a> | <a href="{{logout_url}}">Logout</a>
{% else %}
View
1 templates/event.html
@@ -10,6 +10,7 @@
(This will return the event to the &ldquo;pending&rdquo; status.)
{% else %}
{% if access_rights.can_approve %}<input type="submit" name="state" value="Approve" />{% endif %}
+ {% if access_rights.can_cancel and not event.is_canceled %}<input type="submit" name="state" value="OnHold" />{% endif %}
{% if access_rights.can_cancel and not event.is_canceled %}<input type="submit" name="state" value="Cancel" />{% endif %}
{% if access_rights.is_admin %}<input type="submit" name="state" value="Delete" />{% endif %}
{% if access_rights.can_edit %}<input type="button" value="Edit" onclick="document.location.href='/edit/{{event.key.id}}';" />{% endif %}
View
1 templates/list_event.html
@@ -0,0 +1 @@
+<tr><td width="75">{{event.start_time|date:"g:iA"|lower}}</td><td><a {% if event.is_canceled %}style="text-decoration: line-through;"{% endif %} href="/event/{{event.key.id}}-{{event.name|slugify}}">{{event.name}}</a> {% ifnotequal event.status "approved" %}<span style="color: white; font-size: x-small; padding: 2px; background: gray">{{event.status}}</span>{% endifnotequal %}{% if event.is_past %}(<a href="/feedback/new/{{event.key.id}}">Give your feedback</a>){% endif %}<div style="font-size:80%">Hosted by <a href="mailto:{{event.member.email}}">{{event.owner}}</a> {% if event.roomlist %}in {{event.roomlist}}{% endif %}</div></td></tr>
View
4 templates/myevents.html
@@ -10,8 +10,8 @@
<h4>{% ifequal events.grouper today.date %}<span style="text-decoration:underline;">Today</span> - {% endifequal %}{% ifequal events.grouper tomorrow.date %}<span style="text-decoration:underline;">Tomorrow</span> - {% endifequal %}{{events.grouper|date:"l, F j"}}</h4>
<table>
{% for event in events.list %}
- <tr><td width="75">{{event.start_time|date:"g:iA"|lower}}</td><td><a href="/event/{{event.key.id}}-{{event.name|slugify}}">{{event.name}}</a>{% if not event.is_staffed %} <span style="color: white; font-size: x-small; padding: 2px; background: red; text-decoration: none">understaffed!</span>{% endif %}</td></tr>
- {% endfor %}
+ {% include 'list_event.html' %}
+ {% endfor %}
</table>
{% endfor %}
View
13 templates/past.html
@@ -10,17 +10,8 @@
<h4>{% ifequal events.grouper today.date %}<span style="text-decoration:underline;">Today</span> - {% endifequal %}{{events.grouper|date:"l, F j"}}</h4>
<table>
{% for event in events.list %}
- <tr>
- <td width="75">{{event.start_time|date:"g:iA"|lower}}</td>
- <td>
- <a
- {% if event.is_canceled %}style="text-decoration: line-through;"{% endif %}
- href="/event/{{event.key.id}}-{{event.name|slugify}}">{{event.name}}</a>
- {% if event.is_canceled %}<span style="color: white; font-size: x-small; padding: 2px; background: gray">canceled</span>
- {% else %}(<a href="/feedback/new/{{event.key.id}}">Give your feedback</a>){% endif %}
- </td>
- </tr>
- {% endfor %}
+ {% include 'list_event.html' %}
+ {% endfor %}
</table>
{% endfor %}
View
2 templates/pending.html
@@ -9,7 +9,7 @@
<h4>{% ifequal events.grouper today.date %}<span style="text-decoration:underline;">Today</span> - {% endifequal %}{% ifequal events.grouper tomorrow.date %}<span style="text-decoration:underline;">Tomorrow</span> - {% endifequal %}{{events.grouper|date:"l, F j"}}</h4>
<table>
{% for event in events.list %}
- <tr><td width="75">{{event.start_time|date:"g:iA"|lower}}</td><td><a href="/event/{{event.key.id}}-{{event.name|slugify}}">{{event.name}}</a> <span style="color: white; font-size: x-small; padding: 2px; background: gray">{{event.status}}</span><div style="font-size:80%">Hosted by <a href="mailto:{{event.member.email}}">{{event.owner}}</a> {{event.roomlist_as_phrase}}</div></td></tr>
+ {% include 'list_event.html' %}
{% endfor %}
</table>
{% endfor %}

0 comments on commit f8ffd89

Please sign in to comment.
Something went wrong with that request. Please try again.