Skip to content

Commit

Permalink
Added some styling, public/private as well as showing public on home …
Browse files Browse the repository at this point in the history
…page
  • Loading branch information
dustball committed Apr 27, 2012
1 parent 5a3dc30 commit 84f2ac5
Show file tree
Hide file tree
Showing 9 changed files with 133 additions and 69 deletions.
12 changes: 12 additions & 0 deletions index.yaml
Expand Up @@ -37,6 +37,18 @@ indexes:
- name: end_time
direction: desc

- kind: Issue
properties:
- name: visibility
- name: creation_date
direction: desc

- kind: Issue
properties:
- name: visibility=
- name: creation_date
direction: desc

- kind: Vote
properties:
- name: member
Expand Down
12 changes: 7 additions & 5 deletions main.py
Expand Up @@ -16,18 +16,18 @@ def get(self):
logout_url = users.create_logout_url('/')
else:
login_url = users.create_login_url('/')
issues = Issue.all().order('creation_date').fetch(30)
issues = Issue.all().order('-creation_date').filter('visibility',"public").fetch(30)
success_type = self.request.get('success')
success_msg = None
if success_type == 'vote':
success_msg = 'Your vote was successfully cast!'
if success_type == 'updated':
success_msg = 'Your vote was successfully updated!'
created_by = Issue.issues_created_by(member=user,limit=20)
voted_on = Issue.issues_voted_on(member=user,limit=20)
#created_by = Issue.issues_created_by(member=user,limit=20)
#voted_on = Issue.issues_voted_on(member=user,limit=20)
#recent_results = [issue for issue in voted_on if issue.has_results]
recent_voted = [issue for issue in voted_on if issue.is_active()]
recent_results = Issue.recent_results(limit=20)
#recent_voted = [issue for issue in voted_on if issue.is_active()]
#recent_results = Issue.recent_results(limit=20)
self.response.out.write(template.render('templates/overview.html', locals()))


Expand All @@ -52,7 +52,9 @@ def post(self):

duration_amount = int(self.request.get('duration_amount'))
multiplier = int(self.request.get('duration_multiplier'))
visibility = self.request.get('visibility')
issue = Issue(
visibility = visibility,
title = cgi.escape(self.request.get('title')),
description = cgi.escape(self.request.get('description')),
duration = duration_amount * multiplier,
Expand Down
1 change: 1 addition & 0 deletions models.py
Expand Up @@ -12,6 +12,7 @@ class Issue(db.Model):
is_public = db.BooleanProperty(default=False) #is issue listed on site or just by sharing url?
creator = db.UserProperty(auto_current_user=True)
title = db.StringProperty(required=True)
visibility = db.StringProperty()
description = db.TextProperty()
duration = db.IntegerProperty()
creation_date = db.DateTimeProperty(auto_now_add=True)
Expand Down
Binary file modified models.pyc
Binary file not shown.
Binary file added static/logo250.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 57 additions & 10 deletions templates/base.html
@@ -1,28 +1,75 @@
<html>
<head>
<title>Hacker Dojo Member Vote</title>
{% block feed %}
<link rel="alternate" type="application/xml" title="Hacker Dojo Member" href="/events.rss" />
{% endblock %}
<style>



body {
font-family: arial, helvetica;
margin:2em 0;
background: #d32424;
}

.content {
background: #fff;
margin:0 auto;
padding:36px;
padding-bottom:18px;
border:4px solid #ccc;
border-radius:18px;
-moz-border-radius:18px;
-webkit-border-radius:18px;
}

h1,h2,h3 {
color:#333;
font-weight:strong;
margin-bottom:.5em;
}

h2 {
font-size:16px;
}

a {
color:#0885c8;
text-decoration:none;
}

a:hover {
text-decoration:underline;
}

label {
color:#105984;
font-size:20px;
}

#header { border-bottom:1px solid #999; margin-bottom:2.0em}

</style>
<title>Hacker Dojo Member Powered Voting System</title>
</head>
<body>
<div id="top">
<div class="content" style="width:900px">
<div style="float:right">
{% if user %}
<span><strong>{{user.email}}</strong> <!--| <a href="/myvotes">My Votes</a> --> | <a href="{{logout_url}}">Logout</a></span>
<span>{{user.email}} | <a href="{{logout_url}}">Logout</a></span>
{% else %}
<span><a style="font-weight: bold;" href="{{login_url}}">Login</a> | <a href="http://signup.hackerdojo.com/upgrade/needaccount">Need an account?</a></span>
<span><a style="font-weight: bold;" href="{{login_url}}">Login</a>
{% endif %}
</div>
<div id="wrapper">
<div id="header">
<img src="/static/dojo_icon.png" style="float: left;" />
<h1>Member Vote</h1>
</div>
<a href="/"><img src="/static/logo250.png" border="0"/></a>
<p style="margin-bottom:0">Member Powered Voting System</p>
</div>
<div id="content">
{% block content %}{% endblock %}
</div>
</div>

</div>

</body>
</html>
33 changes: 17 additions & 16 deletions templates/edit.html
Expand Up @@ -93,22 +93,23 @@ <h1>Edit Issue:{{issue.title}}</h1>
<option>the first vote</option>
</select>
</div>
Visibility: (coming soon)
<div><select>
<option selected>Private (email link only)</option>
<!--
<option>All members</option>
<optgroup label="Member Group">
<option>Events</option>
<option>Operations</option>
<option>Other team</option>
</optgroup>
<optgroup label="Private Group">
<option>Directors</option>
<option>Other Private Group</option>
</optgroup>
-->
</select>
Visibility:
<div><select name="visibility">
<option value="private" {% ifequal issue.visibility "private" %}selected{% endifequal %}>Private (email link only)</option>
<option value="public" {% ifequal issue.visibility "public" %}selected{% endifequal %}>Public (all members)</option>
<!--
<optgroup label="Member Group">
<option>Events</option>
<option>Operations</option>
<option>Other team</option>
</optgroup>
<optgroup label="Private Group">
<option>Directors</option>
<option>Other Private Group</option>
</optgroup>
-->
</select>

</div>
</br>
<div><input type="submit" value="Save Changes" name="save_changes"></div>
Expand Down
8 changes: 4 additions & 4 deletions templates/new.html
Expand Up @@ -41,10 +41,10 @@ <h1>New Issue</h1>
</select>
</div>
Visibility: (coming soon)
<div><select>
<option selected>Private (email link only)</option>
<!--
<option>All members</option>
<div><select name="visibility">
<option value="private" selected>Private (email link only)</option>
<option value="public">Public (all members)</option>
<!--
<optgroup label="Member Group">
<option>Events</option>
<option>Operations</option>
Expand Down
69 changes: 35 additions & 34 deletions templates/overview.html
@@ -1,44 +1,45 @@
{% extends 'base.html' %}
{% block content %}

<form action="/new" method="get">
<div><input type="submit" value="New Issue"></div>
</form>
<style>
table#issues {border-top:1px solid #999; border-left:1px solid #999;}
table#issues td, table#issues th {text-align:left; border-bottom:1px solid #999; border-right:1px solid #999;}
table#issues td {font-size:14px}
.mid {text-align:center !important}
</style>

{% if success_msg %}
<div class="success_msg"><b>{{success_msg}}</b></div>
{% endif %}

<!--
<h3>Current Issues</h3>
{% if user %}
{% for issue in issues %}
<a href="/issue/{{issue.key.id}}">{{issue.title}}</a></br>
{% endfor %}
{% else %}
<b>You must log in to vote</b>
{% endif %}

<h3>Recent Results</h3>
{% for issue in recent_results %}
<a href="/issue/{{issue.key.id}}">{{issue.title}}</a></br>
{% endfor %}
<h2>Create a New Issue (member poll)</h2>

<form action="/new" method="get">
<div><input type="submit" value="Create New"></div>
</form>

{% if success_msg %}
<div class="success_msg"><b>{{success_msg}}</b></div>
{% endif %}

<h2 style="margin-top:2em">Recently Created Public Issues</h2>
<table border=0 cellpadding=2 cellspacing=0 id="issues" width=100%>
<tr><th width=80%>Issue</th><th class="mid" width=10%>Votes</th><th class="mid" width=10%>Status</th></tr>
{% if issues %}
{% for issue in issues %}
<tr>
<td><a style="font-weight:normal" href="/issue/{{issue.key.id}}">{{issue.title|title}} ({{issue.visibility}})</a></td>
<td class="mid">{{issue.vote_count}}<td class="mid">{{issue.status}}</td>
</tr>
{% endfor %}
{% else %}
<td colspan=3 style="padding:6px"><i>No issues</i></td>
{% endif %}
</table>

<h3>Recent Votes</h3>
{% for issue in recent_voted %}
<a href="/issue/{{issue.key.id}}">{{issue.title}}</a></br>
{% endfor %}
{% if user %}
<h3>My Issues</h3>
{% if created_by %}
{% for issue in created_by %}
<a href="/issue/{{issue.key.id}}">{{issue.title}}</a></br>
{% endfor %}
{% else %}
You have not created any issues yet
{% endif %}
{% else %}
<p>This system may be used by any member of Hacker Dojo to create a poll for any reason.</p>
<input type=submit value=Login onclick='document.location.href="{{login_url}}"'/>
{% endif %}
-->

<p>&nbsp;</p>

{% endblock %}

0 comments on commit 84f2ac5

Please sign in to comment.