Modified:
/trunk/pirate-politics/ajaxapi/views.py
/trunk/pirate-politics/new_templates/_issue.html
/trunk/pirate-politics/new_templates/_rightcol.html
/trunk/pirate-politics/new_templates/_solution.html
/trunk/pirate-politics/new_templates/_sourcetags.html
/trunk/pirate-politics/new_templates/argument_detail.html
/trunk/pirate-politics/new_templates/base.html
/trunk/pirate-politics/new_templates/issue_detail.html
/trunk/pirate-politics/new_templates/issues.html
/trunk/pirate-politics/new_templates/login.html
/trunk/pirate-politics/new_templates/register.html
/trunk/pirate-politics/new_templates/solution_detail.html
/trunk/pirate-politics/new_templates/solutions.html
/trunk/pirate-politics/new_templates/submit_issue.html
/trunk/pirate-politics/new_templates/submit_nay_argument.html
/trunk/pirate-politics/new_templates/submit_solution.html
/trunk/pirate-politics/new_templates/submit_yea_argument.html
/trunk/pirate-politics/new_templates/user_profile.html
/trunk/pirate-politics/pirate_consensus/models.py
/trunk/pirate-politics/pirate_consensus/templatetags/consensustags.py
/trunk/pirate-politics/pirate_core/middleware.py
/trunk/pirate-politics/pirate_core/templatetags/pp_url.py
/trunk/pirate-politics/pirate_deliberation/templatetags/argumenttags.py
/trunk/pirate-politics/pirate_issues/callbacks.py
/trunk/pirate-politics/pirate_issues/models.py
/trunk/pirate-politics/pirate_issues/templatetags/issuetags.py
/trunk/pirate-politics/pirate_issues/templatetags/solutiontags.py
/trunk/pirate-politics/pirate_issues/templatetags/usertags.py
/trunk/pirate-politics/pirate_profile/models.py
/trunk/pirate-politics/pirate_profile/templatetags/profiletags.py
/trunk/pirate-politics/pirate_reputation/models.py
/trunk/pirate-politics/pirate_signals/models.py
/trunk/pirate-politics/pirate_sources/models.py
/trunk/pirate-politics/static/style.css
=======================================
--- /trunk/pirate-politics/ajaxapi/views.py Mon Jan 17 10:25:31 2011
+++ /trunk/pirate-politics/ajaxapi/views.py Fri Jan 21 16:05:49 2011
@@ -8,6 +8,10 @@
from django.shortcuts import get_object_or_404,redirect
from django.contrib.contenttypes.models import ContentType
+from pirate_signals.models import aso_rep_event,aso_rep_delete
+from pirate_reputation.models import ReputationDimension
+
+
def delete_source(request,object_id):
obj = get_object_or_404(URLSource,id=object_id)
obj.delete()
@@ -44,9 +48,18 @@
new_vote.save()
c =
UpDownVote.objects.filter(vote_type=vote_type,parent=consensus).count()
imgsrc = "/static/voteimgs/" + vote_str + "_arrow_acti.png"
+ #create reputation event for this vote_dict
+
+ user = consensus.content_object.user
+ if vote_type in [1,-1]:
aso_rep_event.send(sender=request.user, event_score=1, user=user,
initiator=request.user,
dimension=ReputationDimension.objects.get('vote'),related_object=new_vote)
+ elif vote_type == 0: aso_rep_event.send(sender=request.user,
event_score=-5, user=user, initiator=request.user,
dimension=ReputationDimension.objects.get('vote'),related_object=new_vote)
+
else: #if this user has already voted
vote_id = int(upd[0].vote_type)
if vote_type == vote_id: #if user clicked on same vote, delete
old vote
+ user = consensus.content_object.user
+ if vote_type in [1,-1]:
aso_rep_delete.send(sender=request.user, event_score=1, user=user,
initiator=request.user,
dimension=ReputationDimension.objects.get('vote'),related_object=upd[0])
+ elif vote_type == 0:
aso_rep_delete.send(sender=request.user, event_score=-5, user=user,
initiator=request.user,
dimension=ReputationDimension.objects.get('vote'),related_object=upd[0])
upd[0].delete()
c =
UpDownVote.objects.filter(vote_type=vote_id,parent=consensus).count()
else: #else do nothing.
=======================================
--- /trunk/pirate-politics/new_templates/_issue.html Tue Jan 18 11:59:15
2011
+++ /trunk/pirate-politics/new_templates/_issue.html Fri Jan 21 16:05:49
2011
@@ -27,6 +27,11 @@
<div class="bullet_verdict"></div> -->
</div>
<div class="issueback">
+ {% if not request.object %}
+ <div class="bullet3_">
+ {{ iss_obj.topic.text }}
+ </div>
+ {% endif %}
<a href="{% pp_url template='issue_detail.html' object=iss_obj %}">
{{iss_obj.name}} </a>
<div class="threecol">
@@ -36,7 +41,7 @@
{{ iss_obj.arguments }} argument{{
iss_obj.arguments|pluralize }}
</div>
<div class="col1">
- {{ iss_obj.solutions }} solution{{ iss_obj.solutions|
pluralize }}</a>
+ <a href="{% pp_url template='solutions.html' object=iss_obj
dimension=dimension %}">see {{ iss_obj.solutions }} solution{{
iss_obj.solutions|pluralize }}...</a>
</div>
<div class="col3">
{% get_comment_count
for iss_obj as comment_count %}
=======================================
--- /trunk/pirate-politics/new_templates/_rightcol.html Tue Jan 18 11:59:15
2011
+++ /trunk/pirate-politics/new_templates/_rightcol.html Fri Jan 21 16:05:49
2011
@@ -6,8 +6,23 @@
{% load solutiontags %}
{% load sourcetags %}
{% load tag_helpers %}
-
-
+{% load usertags %}
+
+ <ul class="d">
+ <div id="login" style="display:none; overflow:hidden; height:75px;">
+ {% pp_user_login_form POST=request.POST path=request.path
request=request %}
+ {{ pp_login.form.errors }}
+ <form method="post" action="">
+ <li>name: {{ pp_login.form.name }}</li>
+ <li>pass: {{ pp_login.form.password }}</li>
+ {{ pp_login.form.form_id}}
+ {% csrf_token %}
+ <li><input type="submit" class="button green"
value="Login"></li>
+ </form>
+ </div>
+ {% endpp_user_login_form %}
+ </ul>
+
{% if request.user.is_authenticated %}
<ul class="d">
<b>Recently Visited:</b>
=======================================
--- /trunk/pirate-politics/new_templates/_solution.html Tue Jan 18 11:59:15
2011
+++ /trunk/pirate-politics/new_templates/_solution.html Fri Jan 21 16:05:49
2011
@@ -32,10 +32,10 @@
<div class="colmid">
<div class="colleft">
<div class="col2">
- {{ iss_obj.arguments }} arguments{{
iss_obj.arguments|pluralize }}
+ {{ iss_obj.arguments }} argument{{
iss_obj.arguments|pluralize }}
</div>
<div class="col1">
- submitted by <a href="{% pp_url
template='user_profile.html'
object=iss_obj.user %}">{{iss_obj.user.username}}</a>
+ submitted by<a href="{% pp_url template='user_profile.html'
object=iss_obj.user %}">{{iss_obj.user.username}}</a>
</div>
<div class="col3">
{% get_comment_count
for iss_obj as comment_count %}
=======================================
--- /trunk/pirate-politics/new_templates/_sourcetags.html Mon Jan 17
12:38:36 2011
+++ /trunk/pirate-politics/new_templates/_sourcetags.html Fri Jan 21
16:05:49 2011
@@ -27,11 +27,11 @@
{% csrf_token %}
<input type="submit" class="button green"
value="Submit URL">
</form>
- </div>
+ </div> </div>
{% endpp_urlsource_form %}
- </div></div>
+ </div>
<div id="mydiv2" style="display:none; overflow:hidden;
height:50px;">
{% comment %}
@@ -50,9 +50,9 @@
</div>
-
+ {% else %}</div>
{% endifequal %}
-
+
{% pp_get_sources object=request.object %}
<ul>
{% for urlsource in pp_source.urlsource_list %}
@@ -72,6 +72,5 @@
-
-
- </div>
+
+
=======================================
--- /trunk/pirate-politics/new_templates/argument_detail.html Mon Jan 17
12:38:36 2011
+++ /trunk/pirate-politics/new_templates/argument_detail.html Fri Jan 21
16:05:49 2011
@@ -4,6 +4,8 @@
{% load argumenttags %}
{% load consensustags %}
{% load tag_helpers %}
+{% load comments %}
+{% load markup %}
{% block css %}
@@ -13,9 +15,7 @@
{% block content %}
<div class="stage">
<div class="issuemask">
- <div class="rightcol">
- {% include '_rightcol.html' %}
- </div>
+
<div class="pagehead">
@@ -24,30 +24,48 @@
<div class="issuebound">
-
- <div class="solution">
-
- {% pp_consensus_get object=request.object.id user=request.user %}
- {% include "_voting.html"%}
- {% endpp_consensus_get %}
- <h1>
- <div class="solutionback">
- {{request.object.name}}<h2> submitted by
{{request.object.user.username}} on {{request.object.pub_date}} </h2>
-
+ <div class="issue">
+ <div class="main">
+ {% pp_consensus_get object=request.object.id user=request.user %}
+
+ {% include '_voting.html' %}
+
+
+ {% ifequal request.object.user
request.user%}
+ <div class="bullet2_">
+ <ul><a href="{% pp_url
template='submit_solution.html' object=request.object %}" class='button
blue'>edit</a></ul>
+ </div>
+ {% endifequal %}
+
+{% get_comment_count for request.object as comment_count %}
+
+
+ <div class="issueback2">
+{{request.object.name}}<br>
+
+<div class="userinfo">submitted by <a href="{% pp_url
template='user_profile.html'
object=pp_solution.user%}">{{request.object.user.username}}</a>
{{request.object.submit_date|date:"(d/m/Y h:sA)"}} {% comment %}|
{{comment_count}} comment{{comment_count|pluralize}} {% endcomment %}|
interest:{{pp_consensus.consensus.interest|floatformat}}</div>
+
</div>
- </h1>
- </div>
- <div class="detail">
- <h2>{{request.object.arg_type.arg}} argument
details:</h2>
- {{request.object.text}}
-
- </div>
-
-
- {% include '_sourcetags.html' %}
- </div>
+
+
+
+
+ <div class="details">
+ {{request.object.text|markdown}}
+
+ </div>
+
+ {% include "_sourcetags.html" %}
+
+ </div>
+ </div>
+ <div class="rightcol">
+ {% include '_rightcol.html' %}
+ </div> </div>
</div>
</div>
+
+{% endpp_consensus_get %}
</div>
{% endblock content %}
</body>
=======================================
--- /trunk/pirate-politics/new_templates/base.html Mon Jan 17 17:42:07 2011
+++ /trunk/pirate-politics/new_templates/base.html Fri Jan 21 16:05:49 2011
@@ -1,5 +1,7 @@
{% load pp_url %}
{% load topictags %}
+{% load usertags %}
+{% load reputationtags %}
<!DOCTYPE html
@@ -77,13 +79,13 @@
<div id="header">
<div class="headtitle"><a STYLE="text-decoration:none" href="{% pp_url
template='issues.html' dimension='hot'%}">egalit.ar</a></div>
<ul>
- <li><a href="{% pp_url template='issues.html'
dimension='hot'%}">issues</a></li>
+ <li><a href="{% pp_url template='issues.html'
dimension='hot' %}">issues</a></li>
{% if request.user.is_authenticated %}
<li><a href="{% pp_url template='user_profile.html'
object=request.user%}">profile</a></li> {% else %}
<li><a href="/register.html">profile</a></li>
- {% endif %}
- <li><a href="/platform">platform</a></li>
+ {% endif %}
+ <li><a href="/platform">platform</a></li>
</ul>
</div>
<div id="mainContent">
@@ -93,38 +95,41 @@
<div class="colmid">
<div class="colleft">
<div class="col2">
- <ul>browse:
- <li><a STYLE="text-decoration:none" href="/hot/">hot</a></li> |
- <li><a STYLE="text-decoration:none"
href="/cont.html">controversial</a></li> |
- <li><a STYLE="text-decoration:none" href="/new.html">new </a></li>
+ {% block browser_bar %}
+ <ul>
+ <li><a STYLE="text-decoration:none" href="{% pp_url
template='issues.html' dimension='hot'%}">{% ifequal "hot"
request.dimension %}<b>hot</b>{% else %}hot{% endifequal %}</a></li> |
+ <li><a STYLE="text-decoration:none" href="{% pp_url
template='issues.html' dimension='cont'%}">{% ifequal "cont"
request.dimension %}<b>controversial</b>{% else %}controversial{%
endifequal %}</a></li> |
+ <li><a STYLE="text-decoration:none" href="{% pp_url
template='issues.html' dimension='new'%}">{% ifequal "new"
request.dimension %}<b>new</b>{% else %}new{% endifequal %}</a></li>
</ul>
+ {% endblock %}
</div>
<div class="col1">
- <ul>topic:
- {% pp_get_topic issue=request.object %}
- {% if pp_topic.topic and pp_topic.parent %}
- <li> {{pp_topic.parent}} </li> ->
- <li> {{pp_topic.topic}} </li>
- {% else %}
- {% if pp_topic.topic %}
- <li> {{pp_topic.topic}} </li>
- {% else %}
- <li> Browse Topics </li>
- {% endif %}
- {% endif %}
- {% endpp_get_topic %}
+ <ul>topics:
+ {% pp_get_topic_list %}
+ {% for topic in pp_topic.topic_list %}
+ {% if request.dimension %}
+ <a STYLE="text-decoration:none" href="{% pp_url
template='issues.html' object=topic dimension=request.dimension%}">{%
ifequal request.object.text topic.text %}<b>{{ topic }}</b>{% else %}{{
topic }}{% endifequal %}</a>
+ {% else %}
+ <a STYLE="text-decoration:none" href="{% pp_url
template='issues.html' object=topic dimension='hot'%}">{{ topic }}</a>
+ {% endif %}
+
+{% if not forloop.last %} | {% endif %}
+ {% endfor %}
+ {% endpp_get_topic_list %}
</ul>
</div>
<div class="col3">
{% if request.user.username %}
+ {% pp_get_reputation user=request.user %}
<ul>hello
<li> {{request.user.username}}</li> |
- <li>rep: 0</li> |
+ <li>rep: {{ pp_reputation.reputation }}</li> |
<li><a STYLE="text-decoration:none" href="/logout/">logout</a></li>
+ {% endpp_get_reputation %}
{% else %}
<ul>welcome:
- <li><a STYLE="text-decoration:none"
href="/register.html">register</a></li> |
- <li><a STYLE="text-decoration:none" href="/login.html">login</a></li>
+ <li><a STYLE="text-decoration:none"
href="/register.html">register</a></li> |
+ <li><a href="javascript:;"
onmousedown="toggleSlide('login');">login</a></li>
{% endif %}
</ul>
</div>
=======================================
--- /trunk/pirate-politics/new_templates/issue_detail.html Tue Jan 18
11:59:15 2011
+++ /trunk/pirate-politics/new_templates/issue_detail.html Fri Jan 21
16:05:49 2011
@@ -18,16 +18,18 @@
{% block css %}
<link rel="stylesheet" type="text/css" href="/static/style.css" />
{% endblock %}
+
+ {% block browser_bar %}
+ <ul>
+ <li><a STYLE="text-decoration:none" href="{% pp_url
template='issues.html' dimension='hot'%}">hot</a></li> |
+ <li><a STYLE="text-decoration:none" href="{% pp_url
template='issues.html' dimension='cont'%}">controversial</a></li> |
+ <li><a STYLE="text-decoration:none" href="{% pp_url
template='issues.html' dimension='new'%}">new </a></li>
+ </ul>
+ {% endblock %}
{% block content %}
<div class="stage">
<div class="issuemask">
-
- <div class="rightcol">
-
- {% include "_rightcol.html" %}
-
- </div>
<div class="issuebound">
@@ -40,16 +42,13 @@
<h1> {{ pp_consensus.interest|floatformat }}
</h1>
{% endpp_consensus_get %}
- </div>
- <div class="bullet_">
+ </div>
{% ifequal pp_issue.issue.user
request.user%}
+ <div class="bullet_">
<ul><a href="{% pp_url
template='submit_issue.html' object=pp_issue.issue %}" class='button
blue'>edit</a></ul>
-
+ </div>
{% endifequal %}
-
-
- </div>
- <div class="issueback">
+ <div class="issueback">
{{pp_issue.issue.name}}
<div class="threecol">
<div class="colmid">
@@ -58,7 +57,7 @@
{{pp_issue.issue.arguments}} arguments
</div>
<div class="col1">
- <a href="{% pp_url template='solutions.html'
object=pp_issue.issue %}"> {{ pp_issue.issue.solutions}} solutions</a>
+ <a href="{% pp_url template='solutions.html'
object=pp_issue.issue %}">see {{ pp_issue.issue.solutions}}
solution{{pp_issue.issue.solutions|pluralize}}...</a>
</div>
<div class="col3">
{% get_comment_count
for pp_issue.issue as comment_count %}
@@ -74,11 +73,15 @@
{{pp_issue.issue.text|markdown}}
{% include "_sourcetags.html" %}
-
- </div>
+ </div>
{% endpp_get_issue %}
- </div>
</div>
+ <div class="rightcol">
+
+ {% include "_rightcol.html" %}
+
+ </div>
+
</div>
</div>
</body>
=======================================
--- /trunk/pirate-politics/new_templates/issues.html Tue Jan 18 11:59:15
2011
+++ /trunk/pirate-politics/new_templates/issues.html Fri Jan 21 16:05:49
2011
@@ -16,24 +16,17 @@
{% endblock %}
{% block browser_bar %}
- <ul>issues:
- <li><a STYLE="text-decoration:none" href="{% pp_url
template='issues.html' dimension='hot'%}">hot</a></li> |
- <li><a STYLE="text-decoration:none" href="{% pp_url
template='issues.html' dimension='cont'%}">controversial</a></li> |
- <li><a STYLE="text-decoration:none" href="{% pp_url
template='issues.html' dimension='new'%}">new </a></li>
+ <ul>
+ <li><a STYLE="text-decoration:none" href="{% pp_url
template='issues.html' dimension='hot' object=request.object %}">{%
ifequal "hot" request.dimension %}<b>hot</b>{% else %}hot{%
endifequal %}</a></li> |
+ <li><a STYLE="text-decoration:none" href="{% pp_url
template='issues.html' dimension='cont' object=request.object %}">{%
ifequal "cont" request.dimension %}<b>controversial</b>{%
else %}controversial{% endifequal %}</a></li> |
+ <li><a STYLE="text-decoration:none" href="{% pp_url
template='issues.html' dimension='new' object=request.object %}">{%
ifequal "new" request.dimension %}<b>new</b>{% else %}new{%
endifequal %}</a></li>
</ul>
{% endblock %}
{% block content %}
<div class="stage">
<div class="issuemask">
- <div class="rightcol">
- {% if request.user.is_authenticated %}
- <ul><a href="{% pp_url template='submit_issue.html' %}"
class='button blue'>Submit Issue</a></ul>
- {% else %}
-<ul><a href="{% pp_url template='register.html' %}" class='button
blue'>Submit Issue</a></ul>
- {% endif %}
- {% include '_rightcol.html' %}
- </div>
+
<div class="issuebound">
{% if request.dimension%}
@@ -41,8 +34,13 @@
{% for iss_obj in pp_issue.issue_list %}
- {% include '_issue.html' %}
-
+ {% include '_issue.html' %} <br>
+
+
+ {% empty %}
+ <div class="pagehead">
+ There doesn't seem to be anything here yet.
+ </div>
{% endfor %}
{% endpp_get_issue_list %}
@@ -51,12 +49,24 @@
{% for iss_obj in pp_issue.issue_list %}
- {% include '_issue.html' %}
-
+ {% include '_issue.html' %} <br>
+
+ {% empty %}
+ <div class="pagehead">
+ There doesn't seem to be anything here yet.
+ </div>
{% endfor %}
{% endpp_get_issue_list %}
{% endif %}
</div>
+ <div class="rightcol">
+ {% if request.user.is_authenticated %}
+ <ul>{% if request.object %}<a href="{% pp_url
template='submit_issue.html' object=request.object %}" class='button
blue'>Submit Issue</a>{% endif %}</ul>
+ {% else %}
+<ul><a href="{% pp_url template='register.html' %}" class='button
blue'>Submit Issue</a></ul>
+ {% endif %}
+ {% include '_rightcol.html' %}
+ </div>
</div>
</div>
{% endblock content %}
=======================================
--- /trunk/pirate-politics/new_templates/login.html Mon Jan 17 12:38:36 2011
+++ /trunk/pirate-politics/new_templates/login.html Fri Jan 21 16:05:49 2011
@@ -14,11 +14,11 @@
{{ pp_login.form.errors }}
<form method="post" action="">
- Name:{{ pp_login.form.name }}<br>
- Pass:{{ pp_login.form.password }}<br>
+ name:{{ pp_login.form.name }}
+ ass:{{ pp_login.form.password }}
{{ pp_login.form.form_id}}
{% csrf_token %}
- <input type="submit" value="Submit">
+ <input type="submit" class="small button green" value="Login">
</form>
</div>
{% endpp_user_login_form %}
=======================================
--- /trunk/pirate-politics/new_templates/register.html Tue Jan 18 11:59:15
2011
+++ /trunk/pirate-politics/new_templates/register.html Fri Jan 21 16:05:49
2011
@@ -26,7 +26,7 @@
{{ pp_login.form.email }}<br><br>
{{ pp_login.form.form_id}}
{% csrf_token %}
- <input type="submit" class="button green" value="Submit">
+ <input type="submit" class="button green" value="Register">
<div class="error">{{pp_login.errors}}<br>{{ pp_login.form.errors
}}</div>
</form>
</div>
=======================================
--- /trunk/pirate-politics/new_templates/solution_detail.html Tue Jan 18
11:59:15 2011
+++ /trunk/pirate-politics/new_templates/solution_detail.html Fri Jan 21
16:05:49 2011
@@ -20,12 +20,12 @@
{% endblock %}
{% block browser_bar %}
- <ul>solutions:
- <li><a STYLE="text-decoration:none" href="{% pp_url
template='solutions.html' dimension='hot'
object=request.object %}">hot</a></li> |
- <li><a STYLE="text-decoration:none" href="{% pp_url
template='solutions.html' dimension='cont'
object=request.object %}">controversial</a></li> |
- <li><a STYLE="text-decoration:none" href="{% pp_url
template='solutions.html' dimension='new' object=request.object %}">new
</a></li>
+ <ul>
+ <li><a STYLE="text-decoration:none" href="{% pp_url
template='solutions.html' dimension='hot'
object=request.object.issue %}">hot</a></li> |
+ <li><a STYLE="text-decoration:none" href="{% pp_url
template='solutions.html' dimension='cont'
object=request.object.issue %}">controversial</a></li> |
+ <li><a STYLE="text-decoration:none" href="{% pp_url
template='solutions.html' dimension='new'
object=request.object.issue %}">new </a></li>
</ul>
- {% endblock %}
+{% endblock %}
@@ -34,11 +34,7 @@
<div class="stage">
<div class="issuemask">
- <div class="rightcol">
-
- {% include "_rightcol.html" %}
-
- </div>
+
<div class="issuebound">
@@ -49,26 +45,25 @@
<div class="issue">
<div class="main">
- <div class="bullet2">
{% include '_voting.html' %}
- </div>
-
- <div class="bullet2_">
+
+
{% ifequal pp_solution.solution.user
request.user%}
+ <div class="bullet2_">
<ul><a href="{% pp_url
template='submit_solution.html' object=pp_solution.solution %}"
class='button blue'>edit</a></ul>
-
+ </div>
{% endifequal %}
{% get_comment_count for request.object as comment_count %}
- </div>
+
<div class="issueback2">
{{pp_solution.solution.name}}<br>
-<div class="userinfo">submitted by <a href="{% pp_url
template='user_profile.html'
object=pp_solution.user%}">{{pp_solution.solution.user.username}}</a>
{{pp_solution.solution.submit_date|date:"(d/m/Y h:sA)"}} |
{{comment_count}} comment{{comment_count|pluralize}} |
interest:{{pp_consensus.consensus.interest|floatformat}}</div>
+<div class="userinfo">submitted by <a href="{% pp_url
template='user_profile.html'
object=pp_solution.user%}">{{pp_solution.solution.user.username}}</a>
{{pp_solution.solution.submit_date|date:"(d/m/Y h:sA)"}} {% comment %}|
{{comment_count}} comment{{comment_count|pluralize}} {% endcomment %}|
interest:{{pp_consensus.consensus.interest|floatformat}}</div>
</div>
- </div>
+
@@ -79,6 +74,7 @@
{% include "_sourcetags.html" %}
+ </div>
<div class="argument">
@@ -121,7 +117,7 @@
<div class="nay_argument">
<h1>Nay Arguments
-{% if request.user.is_authenticated %}pluralize
+{% if request.user.is_authenticated %}
<a href="{% pp_url template='submit_nay_argument.html'
object=pp_solution.solution %}">+</a>
{% endif %}</h1>
<ul>
@@ -139,18 +135,18 @@
{% endfor %}
{% endpp_get_argument_list %}
-
- </ul>
-
-
- {% endpp_consensus_get %}
- {% endpp_get_solution %}
- </div>
- </div>
- </div>
- {% render_comment_list for request.object %}
- {% render_comment_form for request.object %}
- </div>
+ </ul>
+ {% endpp_consensus_get %}
+ {% endpp_get_solution %}
+ </div>
+
+ </div></div>
+ <div class="rightcol">
+
+ {% include "_rightcol.html" %}
+
+
+ </div>
</div> </div>
</div>
</body>
=======================================
--- /trunk/pirate-politics/new_templates/solutions.html Tue Jan 18 11:59:15
2011
+++ /trunk/pirate-politics/new_templates/solutions.html Fri Jan 21 16:05:49
2011
@@ -13,30 +13,20 @@
{% endblock %}
{% block browser_bar %}
- <ul>issues:
- <li><a STYLE="text-decoration:none" href="{% pp_url
template='solutions.html' dimension='hot'%}">hot</a></li> |
- <li><a STYLE="text-decoration:none" href="{% pp_url
template='solutions.html' dimension='cont'%}">controversial</a></li> |
- <li><a STYLE="text-decoration:none" href="{% pp_url
template='solutions.html' dimension='new'%}">new </a></li>
+ <ul>
+ <li><a STYLE="text-decoration:none" href="{% pp_url
template='solutions.html' dimension='hot' object=request.object %}">{%
ifequal "hot" request.dimension %}<b>hot</b>{% else %}hot{%
endifequal %}</a></li> |
+ <li><a STYLE="text-decoration:none" href="{% pp_url
template='solutions.html' dimension='cont' object=request.object %}">{%
ifequal "cont" request.dimension %}<b>controversial</b>{%
else %}controversial{% endifequal %}</a></li> |
+ <li><a STYLE="text-decoration:none" href="{% pp_url
template='solutions.html' dimension='new' object=request.object %}">{%
ifequal "new" request.dimension %}<b>new</b>{% else %}new{%
endifequal %}</a></li>
</ul>
{% endblock %}
{% block content %}
<div class="stage">
<div class="issuemask">
-
- <div class="rightcol">
- {% if request.user.is_authenticated %}
- <ul><a href="{% pp_url template='submit_solution.html'
object=request.object %}" class='button blue'>Submit Solution</a></ul>
- {% else %}
-<ul><a href="{% pp_url template='register.html' %}" class='button
blue'>Submit Solution</a></ul>
- {% endif %}
- {% include '_rightcol.html' %}
+ <div class="pagehead">
+ Solutions for {{request.object.name}}
</div>
- <div class="pagehead">
-
- </div>
-
- <div class="issuebound">
+ <div class="issuebound">
{% if request.dimension %}
@@ -45,7 +35,11 @@
{%for iss_obj in pp_solution.solution_list%}
- {% include '_solution.html' %}
+ {% include '_solution.html' %}<br>
+
+ {% empty %}
+ <br>
+ No solutions yet! Add a solution.
{% endfor %}
@@ -57,13 +51,24 @@
{%for iss_obj in pp_solution.solution_list%}
- {% include '_solution.html' %}
-
+ {% include '_solution.html' %}<br>
+ {% empty %}
+ <br>
+ No solutions yet! Add a solution.
{% endfor %}
{% endpp_get_solution_list %}
- {% endif %}
+ {% endif %}
+
</div>
+ <div class="rightcol">
+ {% if request.user.is_authenticated %}
+ <ul><a href="{% pp_url template='submit_solution.html'
object=request.object %}" class='button blue'>Submit Solution</a></ul>
+ {% else %}
+<ul><a href="{% pp_url template='register.html' %}" class='button
blue'>Submit Solution</a></ul>
+ {% endif %}
+ {% include '_rightcol.html' %}
+ </div>
</div>
</div>
{% endblock content %}
=======================================
--- /trunk/pirate-politics/new_templates/submit_issue.html Mon Jan 17
12:38:36 2011
+++ /trunk/pirate-politics/new_templates/submit_issue.html Fri Jan 21
16:05:49 2011
@@ -11,14 +11,11 @@
<div class="stage">
<div class="issuemask">
- <div class="rightcol">
- {% include "_rightcol.html" %}
-
- </div>
+ <div class="submissionbound">
{% if request.object %}
-{% pp_issue_form POST=request.POST path=request.path request=request
issue=request.object %}
- <div id = "add">
- <h2>Edit Issue</h2>
+{% pp_issue_form POST=request.POST path=request.path request=request
topic=request.object %}
+ <div class="add">
+ <h2>Create Issue with topic {{request.object.text }}</h2>
{{ pp_issue.form.errors }}
<form method="post" action="">
Name: <br>{{ pp_issue.form.name }}<br>
@@ -31,7 +28,7 @@
{% endpp_issue_form %}
{% else %}
{% pp_issue_form POST=request.POST path=request.path request=request %}
- <div id = "add">
+ <div class="add">
<h2>Submit a New Issue</h2>
{{ pp_issue.form.errors }}
<form method="post" action="">
@@ -44,6 +41,13 @@
</div>
{% endpp_issue_form %}
{% endif %}
+ {% include '_tutorial.html' %}
+ </div>
+ <div class="rightcol">
+ {% include "_rightcol.html" %}
+
+ </div>
+
</div></div>
=======================================
--- /trunk/pirate-politics/new_templates/submit_nay_argument.html Mon Jan
17 12:38:36 2011
+++ /trunk/pirate-politics/new_templates/submit_nay_argument.html Fri Jan
21 16:05:49 2011
@@ -10,22 +10,25 @@
<div class="stage">
<div class="issuemask">
- <div class="rightcol">
- {% include "_rightcol.html" %}
-
- </div>
-
+ <div class="submissionbound">
{% pp_argument_form POST=request.POST path=request.path
object=request.object request=request arg_type='nay' %}
- <div id = "add">
+ <div class="add">
<h2>Submit a new Nay argument for <br>{{request.object.name}}</h2>
{{ pp_argumentation.form.errors }}
<form method="post" action="">
- {{ pp_argumentation.form.as_p }}
+ Name:<br>{{ pp_argumentation.form.name }}<br>
+ Argument:<br> {{ pp_argumentation.form.text }}
{{ pp_argumentation.form.form_id}}
{% csrf_token %}
<input type="submit" class="button green" value="Submit Nay" />
</form>
</div>
+ {% include '_tutorial.html' %}
+ </div>
+ <div class="rightcol">
+ {% include "_rightcol.html" %}
+
+ </div>
</div></div>
{% endpp_argument_form %}
=======================================
--- /trunk/pirate-politics/new_templates/submit_solution.html Mon Jan 17
12:38:36 2011
+++ /trunk/pirate-politics/new_templates/submit_solution.html Fri Jan 21
16:05:49 2011
@@ -11,13 +11,9 @@
<div class="stage">
<div class="issuemask">
- <div class="rightcol">
- {% include "_rightcol.html" %}
-
- </div>
-
+ <div class="submissionbound">
{% pp_solution_form POST=request.POST path=request.path
issue=request.object request=request %}
- <div id = "add">
+ <div class="add">
<h2>Submit a new solution for: <br>{{request.object.name}}</h2>
{{ pp_solution.form.errors }}
<form method="post" action="">
@@ -28,6 +24,13 @@
<input type="submit" class="button green" value="Submit Solution" />
</form>
</div>
+ {% include '_tutorial.html' %}
+ </div>
+
+ <div class="rightcol">
+ {% include "_rightcol.html" %}
+
+ </div>
</div></div>
{% endpp_solution_form %}
=======================================
--- /trunk/pirate-politics/new_templates/submit_yea_argument.html Mon Jan
17 12:38:36 2011
+++ /trunk/pirate-politics/new_templates/submit_yea_argument.html Fri Jan
21 16:05:49 2011
@@ -10,23 +10,25 @@
<div class="stage">
<div class="issuemask">
- <div class="rightcol">
- {% include "_rightcol.html" %}
-
- </div>
-
+ <div class="submissionbound">
+ <h2>Submit a new Yea argument for: <br>{{request.object.name}}</h2>
{% pp_argument_form POST=request.POST path=request.path
object=request.object request=request arg_type='yea' %}
- <div id = "add">
- <h2>Submit a new Yea argument for <br>{{request.object.name}}</h2>
+ <div class="add">
{{ pp_argumentation.form.errors }}
<form method="post" action="">
Name: <br>{{ pp_argumentation.form.name }}<br>
- Text: <br>{{ pp_argumentation.form.text }}
+ Argument: <br>{{ pp_argumentation.form.text }}<br>
{{ pp_argumentation.form.form_id}}
{% csrf_token %}
<input type="submit" class="button green" value="Submit Yea" />
</form>
</div>
+ {% include '_tutorial.html' %}
+</div>
+
+ <div class="rightcol">
+ {% include "_rightcol.html" %}
+
</div></div>
{% endpp_argument_form %}
=======================================
--- /trunk/pirate-politics/new_templates/user_profile.html Mon Jan 17
12:38:36 2011
+++ /trunk/pirate-politics/new_templates/user_profile.html Fri Jan 21
16:05:49 2011
@@ -3,6 +3,8 @@
{% load pp_url %}
{% load argumenttags %}
{% load profiletags %}
+{% load topictags %}
+{% load reputationtags %}
{% block css %}
@@ -12,17 +14,7 @@
{% block content %}
<div class="stage">
<div class="issuemask">
- <div class="rightcol">
- <!-- <ul><a href="{% pp_url
template='submit_solution.html' %}"><img src="/static/submit_solution.png"
/></a></ul> -->
- <ul>Events:
- <li>TBA</li>
- </ul>
- <ul>Recently Visited:
- <li>Link 1</li>
- <li>Link 2</li>
- </ul>
-
- </div>
+
<div class="pagehead">
@@ -30,13 +22,14 @@
{% pp_get_user_profile user=request.object %}
- <div class="issuebound">
-
- {% if pp_profile.profile %}
- <h1>{{pp_profile.user.username}}:</h2>
-
-
- Date of Birth: {{pp_profile.profile.birth_date}}<br>
+ <div class="submissionbound">
+
+
+ {% pp_get_reputation user=request.object %}
+
<h2>{{request.object.username}}:{{pp_reputation.reputation}}</h2>
+ {% endpp_get_reputation %}
+ {% if pp_profile.profile %}
+ Date of Birth: {{pp_profile.profile.birth_date|
date:"m/d/Y"}}<br><br>
Bio: {{pp_profile.profile.bio}}
{% else %}
@@ -48,29 +41,46 @@
{{ pp_profile.form.errors }}
<form method="post" action="">
Birth Date:<br>
- {{ pp_profile.form.birth_date}}
+ {{ pp_profile.form.birth_date}} <font size="-1">use
format: MM/DD/YYYY</font>
<br>
Biography:<br>
{{ pp_profile.form.bio}}
{{ pp_profile.form.form_id}}
{% csrf_token %}
- <input type="submit" value="Submit">
+ <input type="submit" class="button green"
value="Submit">
</form>
</div>
{% endpp_profile_form %}
-
{% endif %}
{% endifequal %}
{% endif %}
-
- <h3>Reputation Reports:</h3>
-
- <h3>Recent Activity:</h3>
+ {% if request.user.is_staff %}
+ <hr>
+ <h3> Staff Control Panel </h3>
+ {% pp_topic_form POST=request.POST path=request.path %}
+ <b>Add Topic (Use at discretion) </b><br>
+ <div id = "add">
+ {{ pp_topic.form.errors }}
+ <form method="post" action="">
+ {{ pp_topic.form.as_p}}
+ {{ pp_topic.form.form_id}}
+ {% csrf_token %}
+ <input type="submit" class="button green"
value="Submit">
+ </form>
+ </div>
+
+ {% endpp_topic_form %}
+ {% endif %}
{% endpp_get_user_profile %}
</div>
+<div class="rightcol">
+ <!-- <ul><a href="{% pp_url
template='submit_solution.html' %}"><img src="/static/submit_solution.png"
/></a></ul> -->
+ {% include '_rightcol.html' %}
+
+ </div>
</div>
</div>
</div>
=======================================
--- /trunk/pirate-politics/pirate_consensus/models.py Wed Jan 5 13:39:26
2011
+++ /trunk/pirate-politics/pirate_consensus/models.py Fri Jan 21 16:05:49
2011
@@ -19,6 +19,9 @@
votes = models.IntegerField(default = 0)
interest = models.FloatField(default=0.0)
controversy = models.FloatField(default=0.0)
+
+ def __unicode__(self):
+ return str(self.content_type) + ':' + str(self.object_pk)
#This is the basic voting object utilized within Reddit-like consensus
class UpDownVote(models.Model):
=======================================
--- /trunk/pirate-politics/pirate_consensus/templatetags/consensustags.py
Wed Jan 5 13:39:26 2011
+++ /trunk/pirate-politics/pirate_consensus/templatetags/consensustags.py
Fri Jan 21 16:05:49 2011
@@ -28,8 +28,8 @@
"to it assigned to the 'object=' argument,
and that the str "
"be assigned the string value 'consensus.")
user = kwargs.pop('user', None)
-
- namespace['consensus'] =
get_object_or_404(Consensus,object_pk=object_pk)
+
+ namespace['consensus'] = Consensus.objects.get(object_pk=object_pk)
namespace['upvotes'] = UpDownVote.objects.filter(vote_type=1,parent=
namespace['consensus']).count()
namespace['downvotes'] =
UpDownVote.objects.filter(vote_type=-1,parent=
namespace['consensus']).count()
namespace['neutvotes'] = UpDownVote.objects.filter(vote_type=0,parent=
namespace['consensus']).count()
=======================================
--- /trunk/pirate-politics/pirate_core/middleware.py Mon Jan 17 10:25:31
2011
+++ /trunk/pirate-politics/pirate_core/middleware.py Fri Jan 21 16:05:49
2011
@@ -33,9 +33,10 @@
if dim is not None:
request.dimension = dim
-
+
request_path = request.get_full_path()
- if request_path != '/favicon.ico' and
request.path[:8] != '/submit':
+ name = request_path
+ if request_path != '/favicon.ico' and
request_path[0:7] != '/submit' and request_path != '/vote/':
try:
if request.session['currently_visiting'] != request_path:
try:
@@ -45,20 +46,36 @@
if len(visit_list) >= 8:
try: visit_list.pop(0)
except: pass #no visit_list
- try: #if content type is issue and dimension, then
list of solutions
- name = request.object.name
+ try: #name logic goes here
+ #you have request.object and content_type
+ if obj_id == None:
+ try: name = "all " + request.dimension + "
issues"
+ except: name = "all hot issues"
+ elif request_path[0:4] == '/use':
+ name = str(request.object.username).lower()
+ " profile"
+ elif str(content_type) == u'issue' and
request_path[0:4] == '/sol':
+ try: name = request.dimension + " " +
str(request.object.name).lower() + " solutions"
+ except: name = "hot " +
str(request.object.name).lower() + " solutions"
+ elif str(content_type) == u'topic' and
request_path[0:4] == '/iss':
+ try: name = request.dimension + " " +
str(request.object.text).lower() + " issues"
+ except: name = "hot " +
str(request.object.text).lower() + "issues"
+ elif str(content_type) == u'issue' and
request_path[0:4] == '/iss':
+ name = "iss. detail: " +
str(request.object.name).lower()
+ elif str(content_type) == u'solution' and
request.path[0:4] == '/sol':
+ name = "sol. detail: " +
str(request.object.name).lower()
+ elif str(content_type) == u'argument' and
request.path[0:4] == '/arg':
+ name = "arg. detail: " +
str(request.object.name).lower()
except:
- try:
- name = request.dimension
- except:
- try: name =
request.session['currently_visiting']
- except KeyError: name = "NA"
- try: visit_list.append((name,
request.session['currently_visiting']))
+ try: name = request_path
+ except KeyError: name = "NA"
+ try: visit_list.append((name, request_path))
except KeyError: pass #first visit
request.session['last_visited'] = visit_list
except KeyError: pass
- if request_path != '/favicon.ico':
request.session['currently_visiting'] = request_path
+ if request_path != '/favicon.ico' and
request_path[:8] != '/submit' and request_path != '/vote/':
+ request.session['currently_visiting'] = request_path
+
class AddToBuiltinsMiddleware(object):
def process_request(self, request):
# This adds all tags registered separately through native_tags to
the builtins
=======================================
--- /trunk/pirate-politics/pirate_core/templatetags/pp_url.py Thu Jan 13
13:59:30 2011
+++ /trunk/pirate-politics/pirate_core/templatetags/pp_url.py Fri Jan 21
16:05:49 2011
@@ -89,7 +89,10 @@
rev_kwargs['start'] = start
rev_kwargs['end'] = end
- output = get_reverse(pattern, kwargs, **rev_kwargs)
+ if dimension is not None:
+ output = get_reverse(pattern, kwargs, dimension=dimension,
**rev_kwargs)
+ else:
+ output = get_reverse(pattern, kwargs, **rev_kwargs)
elif start is not None and end is not None:
output = get_reverse(pattern, kwargs, start=start, end=end)
=======================================
--- /trunk/pirate-politics/pirate_deliberation/templatetags/argumenttags.py
Tue Jan 11 02:15:49 2011
+++ /trunk/pirate-politics/pirate_deliberation/templatetags/argumenttags.py
Fri Jan 21 16:05:49 2011
@@ -131,7 +131,7 @@
object_pk=obj_pk)
if is_new: #if this is a new issue/consensus, send signal for
reputation
- aso_rep_event.send(sender=new_arg,event_score=50,
user=new_arg.user,
dimension=ReputationDimension.objects.get('add_argument'))
+ aso_rep_event.send(sender=new_arg,event_score=4,
user=new_arg.user,
dimension=ReputationDimension.objects.get('add_argument'))
new_arg.parent.arguments += 1
new_arg.parent.issue.arguments +=1
new_arg.parent.issue.save()
@@ -159,5 +159,7 @@
form_id = forms.CharField(widget=forms.HiddenInput(),
initial="pp_argument_form")
text = forms.CharField(widget=forms.Textarea)
- name = forms.CharField(widget=forms.TextInput(), initial="")
-
+ name = forms.CharField(label="name", max_length=32,
+ widget=forms.TextInput(
+ attrs={'size':'50', 'class':'inputText'}))
+
=======================================
--- /trunk/pirate-politics/pirate_issues/callbacks.py Tue Jan 18 11:59:15
2011
+++ /trunk/pirate-politics/pirate_issues/callbacks.py Fri Jan 21 16:05:49
2011
@@ -3,5 +3,5 @@
#Updates the issue.comments for each comment being posted
def update_issue_comment_count(sender, comment, request, **kwargs):
- aso_rep_event.send(sender = sender,event_score=50, user=comment.user,
dimension=ReputationDimension.objects.get('add_comment'))
-
+ aso_rep_event.send(sender = sender,event_score=1, user=comment.user,
dimension=ReputationDimension.objects.get('add_comment'))
+
=======================================
--- /trunk/pirate-politics/pirate_issues/models.py Tue Jan 18 11:59:15 2011
+++ /trunk/pirate-politics/pirate_issues/models.py Fri Jan 21 16:05:49 2011
@@ -46,7 +46,7 @@
verbose_name = _('issue')
def __unicode__(self):
- return self.text[0:10]
+ return self.name
def taggable(self):
return True
=======================================
--- /trunk/pirate-politics/pirate_issues/templatetags/issuetags.py Mon Jan
17 10:25:31 2011
+++ /trunk/pirate-politics/pirate_issues/templatetags/issuetags.py Fri Jan
21 16:05:49 2011
@@ -193,7 +193,7 @@
#consensus_list = Consensus.objects.filter(content_type__name =
u'issue')
consensus_list = Consensus.objects.all()
-
+ issue_list = Issue.objects.all()
adjust_for_range = True
if not rng: #need to add a range if not specified.
@@ -201,32 +201,29 @@
if topic and isinstance(topic, Topic): #filter by topic
issue_list = issue_list.filter(topic__id=topic.id)
- try: consensus_list.filter(content_object__topic__id=topic.id)
- except: pass #for there are no issues?
if dimension: #filter by ranking dimension
if dimension == "new":
- issue_list = Issue.objects.all()
- issue_list = issue_list.order_by('-submit_date')
+ order_by = '-submit_date'
elif dimension == "hot":
- consensus_list = consensus_list.order_by('-interest')
- issue_list = []
- for i in consensus_list:
- if i.content_type.name == u'issue':
- issue_list.append(i.content_object)
-
- #try: issue_list = [ con.content_object for con in
consensus_list.order_by('-interest')[rng[0]:rng[1]] ]
- #except: pass
- elif dimension == "top":
- issue_list = [ con.content_object for con in
consensus_list.order_by('-votes')[rng[0]:rng[1]] ]
- adjust_for_range = False
+ order_by = '-interest'
elif dimension == "cont":
- try: issue_list = [ con.content_object for con in
consensus_list.order_by('-controversy')[rng[0]:rng[1]] ]
- except: issue_list = []
- elif dimension == "numc":
- issue_list = issue_list.order_by('-comments')
- else:
+ order_by = '-controversy'
+ elif dimension == "top":
+ order_by = '-votes'
+
+ consensus_list = consensus_list.order_by(order_by)
+ issue_list = []
+ for i in consensus_list:
+ if i.content_type.name == u'issue':
+ if topic and isinstance(topic, Topic):
+ if i.content_object.topic == topic:
+ issue_list.append(i.content_object)
+ elif not isinstance(topic, Topic):
+ issue_list.append(i.content_object)
+
+ else: #catch all for no dimension grabs new objects
issue_list = issue_list.order_by('-submit_date')
if adjust_for_range: #filter for rng
@@ -284,11 +281,8 @@
object_pk=obj_pk)
if is_new: #if this is a new issue/consensus, send signal for
reputation
- aso_rep_event.send(sender=issue,event_score=50,
user=issue.user, dimension=ReputationDimension.objects.get('add_issue'))
- load = "{% load pp_url %}"
- ts = "{% pp_url template='issue_detail.html' object=issue %}"
- path = template.Template(load +
ts).render(template.Context({'issue':issue}))
- raise HttpRedirectException(HttpResponseRedirect(path))
+ aso_rep_event.send(sender=issue,event_score=3,
user=issue.user, dimension=ReputationDimension.objects.get('add_issue'))
+ raise
HttpRedirectException(HttpResponseRedirect(issue.get_absolute_url()))
else: form = IssueForm() if issue is None else
IssueForm(instance=issue)
=======================================
--- /trunk/pirate-politics/pirate_issues/templatetags/solutiontags.py Mon
Jan 17 10:25:31 2011
+++ /trunk/pirate-politics/pirate_issues/templatetags/solutiontags.py Fri
Jan 21 16:05:49 2011
@@ -69,7 +69,7 @@
context.push()
namespace = get_namespace(context)
- #user = kwargs.pop('user', None)
+ #user = kwargs.pop('user', None) solution_list =
solution_list.filter(issue__id=issue.id)
dimension = kwargs.pop('dimension',None)
issue = kwargs.pop('issue', None)
rng = kwargs.pop('rng',None)
@@ -94,27 +94,34 @@
if issue and isinstance(issue, Issue):
solution_list = solution_list.filter(issue__id=issue.id)
-
- if dimension: #filter by ranking dimension
+ topic = issue.topic
+
+ elif issue and isinstance(issue, Solution):
+ solution_list = solution_list.filter(issue__id=issue.issue.id)
+ topic = issue.issue.topic
+
+ #TODO: OPTIMIZE THIS!!!
+ if dimension: #filter by ranking dimension, iterating through every
consensus object, need to find a way optimize
if dimension == "new":
- solution_list = solution_list.order_by('-submit_date')
+ order_by = '-submit_date'
elif dimension == "hot":
- consensus_list = consensus_list.order_by('-interest')
- solution_list2 = []
- for i in consensus_list:
- if i.content_type.name == u'solution' and i.content_object
in solution_list:
- solution_list2.append(i.content_object)
- solution_list = solution_list2
- adjust_for_range = False
+ order_by = '-interest'
elif dimension == "cont":
- consensus_list = consensus_list.order_by('-controversy')
- solution_list = []
- for i in consensus_list:
- if i.content_type.name == u'solution':
- solution_list2.append(i.content_object)
- elif dimension == "numc":
- solution_list = solution_list.order_by('-comments')
- else:
+ order_by = '-controversy'
+ elif dimension == "top":
+ order_by = '-votes'
+
+ consensus_list = consensus_list.order_by(order_by)
+ solution_list = []
+ for i in consensus_list:
+ if i.content_type.name == u'solution':
+ if topic and isinstance(topic, Topic):
+ if i.content_object.issue.topic == topic and
i.content_object.issue == issue:
+ solution_list.append(i.content_object)
+ elif not isinstance(topic, Topic):
+ solution_list.append(i.content_object)
+
+ else: #catch all for no dimension grabs new objects
solution_list = solution_list.order_by('-submit_date')
if adjust_for_range: #filter for rng
@@ -168,13 +175,13 @@
object_pk=obj_pk)
if is_new: #if this is a new issue/consensus, send signal for
reputation
- aso_rep_event.send(sender=new_sol,event_score=25,
user=new_sol.user,
dimension=ReputationDimension.objects.get('add_solution'))
+ aso_rep_event.send(sender=new_sol,event_score=5,
user=new_sol.user,
dimension=ReputationDimension.objects.get('add_solution'))
issue.solutions = issue.solutions+1
issue.save()
raise
HttpRedirectException(HttpResponseRedirect(new_sol.get_absolute_url()))
load = "{% load pp_url %}"
- ts = "{% pp_url template='issue_detail_2.html' object=issue %}"
+ ts = "{% pp_url template='issue_detail.html' object=issue %}"
path = template.Template(load +
ts).render(template.Context({'issue':issue}))
raise HttpRedirectException(HttpResponseRedirect(path))
else:
=======================================
--- /trunk/pirate-politics/pirate_issues/templatetags/usertags.py Tue Jan
18 11:59:15 2011
+++ /trunk/pirate-politics/pirate_issues/templatetags/usertags.py Fri Jan
21 16:05:49 2011
@@ -140,3 +140,4 @@
class Meta:
model = Login
form_id = forms.CharField(widget=forms.HiddenInput(),
initial="pp_user_login_form")
+ password =
forms.CharField(label=_(u'Password'),widget=forms.PasswordInput(render_value=False))
=======================================
--- /trunk/pirate-politics/pirate_profile/models.py Tue Jan 11 02:15:49 2011
+++ /trunk/pirate-politics/pirate_profile/models.py Fri Jan 21 16:05:49 2011
@@ -13,5 +13,6 @@
def get_absolute_url(self):
content_type = ContentType.objects.get_for_model(self.__class__)
- path = template_for_model(str(content_type)) + "?_t=" +
str(content_type.pk) + "&_o=" + str(self.pk)
+ content_type2 = ContentType.objects.get_for_model(self.user)
+ path = template_for_model(str(content_type)) + "?_t=" +
str(content_type2.pk) + "&_o=" + str(self.user.pk)
return path
=======================================
--- /trunk/pirate-politics/pirate_profile/templatetags/profiletags.py Tue
Jan 11 02:15:49 2011
+++ /trunk/pirate-politics/pirate_profile/templatetags/profiletags.py Fri
Jan 21 16:05:49 2011
@@ -16,13 +16,14 @@
get_namespace = namespace_get('pp_profile')
-
@block
def pp_get_user_profile(context, nodelist, *args, **kwargs):
'''
This block tag can create or process forms to get tags.
Usage is as follows:
-
+ {% pp_get_user_profile user=requet.object %}
+ Do stuff with {{ pp_profile.user }} and {{ pp_profile.profile }}.
+ {% endpp_get_user_profile %}
'''
context.push()
@@ -36,6 +37,12 @@
profile = Profile.objects.get(user=user)
except:
profile = None
+ elif user is not None and isinstance(user, Profile):
+ profile = user
+ user = profile.user
+ else:
+ profile = None
+ user = None
namespace['user'] = user
namespace['profile'] = profile
=======================================
--- /trunk/pirate-politics/pirate_reputation/models.py Thu Dec 2 14:31:17
2010
+++ /trunk/pirate-politics/pirate_reputation/models.py Fri Jan 21 16:05:49
2011
@@ -6,7 +6,7 @@
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
-from pirate_signals.models import aso_rep_event
+from pirate_signals.models import aso_rep_event,aso_rep_delete
#event_registered = Signal(providing_args=["","",""])
@@ -47,16 +47,18 @@
#here aggregation == None
elif reputation_count == 0:
- aggregations = self.filter(user=user, dimension=None,
aggregation=None)
- try: aggregation_count = len(list(aggregations))
- except: aggregation_count = 0
-
- if aggregation_count == 1:
- aggregation = aggregations[0]
- elif aggregation_count == 0:
- aggregation = self.model(user=user, dimension=None)
- else:
- raise ValueError("More than one aggregating reputation
found for user.")
+ #aggregations are disabled until we can find a better way to
use ite
+ aggregation = None
+
+ #aggregations = self.filter(user=user, dimension=None,
aggregation=None)
+ #aggregation_count = len(list(aggregations))
+
+ #if aggregation_count == 1:
+ # aggregation = aggregations[0]
+ #elif aggregation_count == 0:
+ # aggregation = self.model(user=user, dimension=None)
+ #else:
+ # raise ValueError("More than one aggregating reputation
found for user.")
reputation = self.model(user=user, dimension=dimension,
aggregation=aggregation)
else:
@@ -73,7 +75,8 @@
initiator, aggregation)
aggregation.score += aggreg_delta
aggregation.save()
-
+ else: aggreg_delta = None
+
initiator = user if initiator is None else initiator
if related_object is not None:
@@ -88,7 +91,6 @@
aggregation_delta=aggreg_delta,
dimension=dimension,
initiator=initiator,
object_id=obj_id,
content_type=content_type)
- ##TODO: why doesn't this work?
#related_object=related_object)
reputation_event.save()
@@ -120,6 +122,9 @@
modified_dt = models.DateTimeField(auto_now=True)
objects = DimensionManager()
+
+ def __unicode__(self):
+ return self.name
class Reputation(models.Model):
@@ -167,10 +172,9 @@
return super(ReputationEvent, self).save()
raise SuspiciousOperation("A ReputationEvent cannot be modified
after it is created.")
-
-admin.site.register(ReputationDimension)
-admin.site.register(ReputationEvent)
admin.site.register(Reputation)
+admin.site.register(ReputationEvent)
+admin.site.register(ReputationDimension)
###Cannot import from pirate_reputation.models from
pirate_reputation.callbacks?
@@ -180,9 +184,27 @@
def register_reputation_event(event_score, user, **kwargs):
#first check **kwargs for non-mandatory arguments
dimension= kwargs.get('dimension', None)
- Reputation.objects.register_event(event_score, user, dimension)
+ initiator=kwargs.get('initiator',None)
+ related_object = kwargs.get('related_object',None)
+ Reputation.objects.register_event(event_score, user, dimension,
initiator=initiator, related_object=related_object)
+
+def delete_reputation_event(event_score, user, **kwargs):
+ #first check **kwargs for non-mandatory arguments
+ dimension= kwargs.get('dimension', None)
+ initiator=kwargs.get('initiator',None)
+ related_object = kwargs.get('related_object',None)
+ obj_id = related_object.pk
+ content_type = ContentType.objects.get_for_model(related_object)
+
+ rep = ReputationEvent.objects.get(user=user, dimension=dimension,
initiator=initiator, object_id=obj_id,content_type=content_type)
+ rep.delete()
+ rep_obj = Reputation.objects.get(user=user, dimension=dimension)
+ rep_obj.score -= event_score
+ rep_obj.save()
####SIGNAL RELATED
-aso_rep_event.connect(register_reputation_event)
-
+aso_rep_event.connect(register_reputation_event)
+aso_rep_delete.connect(delete_reputation_event)
+
+
=======================================
--- /trunk/pirate-politics/pirate_signals/models.py Mon Nov 8 17:53:26 2010
+++ /trunk/pirate-politics/pirate_signals/models.py Fri Jan 21 16:05:49 2011
@@ -2,5 +2,6 @@
import django.dispatch
aso_rep_event =
django.dispatch.Signal(providing_args=["event_score", "user"])
+aso_rep_delete =
django.dispatch.Signal(providing_args=["event_score", "user"])
=======================================
--- /trunk/pirate-politics/pirate_sources/models.py Tue Jan 11 02:15:49 2011
+++ /trunk/pirate-politics/pirate_sources/models.py Fri Jan 21 16:05:49 2011
@@ -18,7 +18,7 @@
user = models.ForeignKey(User)
class IMGSource(models.Model):
- img = models.ImageField(upload_to="/uploads")
+ #img = models.ImageField(upload_to="/uploads")
submit_date = models.DateTimeField(_('date/time submitted'),
auto_now_add=True)
content_type = models.ForeignKey(ContentType,
verbose_name=_('content type'),
=======================================
--- /trunk/pirate-politics/static/style.css Tue Jan 18 11:59:15 2011
+++ /trunk/pirate-politics/static/style.css Fri Jan 21 16:05:49 2011
@@ -87,19 +87,31 @@
.add {
- float:center;
+ float:left;
position:relative;
+ width:60%;
+}
+
+.tutorial {
+ font-size:80%;
+ float:right;
+ width:35%;
+}
+
+.voting {
+ bottom:100px;
+ width:40px;
+ height:90px;
}
.pagehead {
- top:20px;
- right:135px;
position:relative; /* This fixes the IE7 overflow hidden bug */
float:left;
+ width:68%;
font-size:140%; /* width of whole page */
font-weight:bold;
- padding-bottom:20px; top:-5px;
overflow:hidden;
+
}
.stage {
@@ -107,12 +119,11 @@
position:relative;
/*border:3px solid red;*/
float:left;
- margin:0;
}
.issuemask {
- position:relative;
- width:90%;
+ position:absolute;
+ width:100%;
/*position:left;*/
float:left;
/*border:2px dashed #67A3E4;*/
@@ -121,17 +132,23 @@
.issuebound {
position:relative;
- width:75%;
+ width:68%;
/*position:left;*/
- left:-15%;
float:left;
/*border:2px dashed #67A3E4;*/
}
+.submissionbound {
+ position:relative;
+ width:60%;
+ /*position:left;*/
+ float:left;
+ /*border:2px dashed #67A3E4;*/
+ }
+
.issuecol {
position:relative;
- width:71%;
- left:-30%;
+ width:100%;
float:left;
/*border:1px solid #2D167B;*/
overflow:hidden;
@@ -139,8 +156,7 @@
.rightcol {
position:relative;
- width:24%;
- left:83%;
+ width:32%;
float:left;
overflow:hidden;
color:black;
@@ -181,21 +197,21 @@
.upvote {
margin:0px 0px 0px 0px;
position:relative;
- bottom:-35px;
+
overflow:visible;
}
.downvote {
margin:0px 0px 0px 0px;
position:relative;
- bottom:-45px;
+
overflow:visible;
}
.irrvote {
margin:0px 0px 0px 0px;
position:relative;
- bottom:-40px;
+
overflow:visible;
}
@@ -207,6 +223,7 @@
bottom:+2px;
overflow:visible;
}
+
.argument ul{
list-style-type:none;
@@ -230,25 +247,22 @@
position:relative;
width:49%;
float:left;
- /*border:1px solid #2D167B;*/
overflow:hidden;
}
.argument .nay_argument {
position:relative;
- width:50%;
+ width:49%;
float:right;
- /*border:1px solid #F4CE22;*/
overflow:hidden;
}
.issue {
position:relative;
- /*width:94%;*/
+ width:100%;
color:black;
/*background: url('Bullet.png') no-repeat scroll;*/
/*background-color:#d3d9df;*/
- margin:1.5em 2em 1.2em 0em;
/*overflow:hidden;*/
/*border:1px dashed black;*/
}
@@ -256,8 +270,10 @@
.issue .issueback {
position:absolute;
- width:100%;
- top:-5px;
+ width:90%;
+ top:-20px;
+ margin-top:10px;
+ left:60px;
font-size:150%;
font-style:bold;
min-width:20%;
@@ -278,10 +294,11 @@
}
.issue .issueback2 {
+ float:right;
position:absolute;
- width:100%;
- top:18px;
- left:-10px;
+ width:90%;
+ top:10px;
+ left:50px;
font-size:150%;
font-style:bold;
min-width:20%;
@@ -352,15 +369,11 @@
.issue .bullet {
position:relative;
- left:-60px;
- bottom:-5px;
overflow:visible;
}
.issue .bullet2 {
position:relative;
- left:-60px;
- bottom:30px;
overflow:visible;
}
@@ -372,7 +385,7 @@
.bullet_ {
font-size:75%;
position:absolute;
- top:+55px;
+ top:+40px;
left:-90px;
padding:0px 0px 0px 0px;
margin:30px 10px 0px 0px;
@@ -387,32 +400,16 @@
margin:10px 10px 0px 0px;
}
-.add_tag {
- font-size:20%;
- }
-
-.issue h1 .bullet_daylight {
- position:relative;
- left:+325%;
- bottom:+65px;
- overflow:visible;
- }
-
-.bullet_verdict {
- width:40px;
- height:40px;
- background: url('Verdict.png') no-repeat scroll;
- color:black;
+.bullet3_ {
+ font-size:75%;
+ position:absolute;
padding:0px 0px 0px 0px;
- margin:0px 0px 0px 0px;
- overflow:visible;
+ left:+82%;
+ top:-20%;
}
-.issue h1 .bullet_verdict {
- position:relative;
- left:+400%;
- bottom:+105px;
- overflow:visible;
+.add_tag {
+ font-size:20%;
}
.threecol {
@@ -526,8 +523,6 @@
}
/* BUTTONS */
-
-
.button {
padding: 5px 10px;
display: inline;