| Line | |
|---|
| 1 | import cgi |
|---|
| 2 | |
|---|
| 3 | from pylons.i18n import _ |
|---|
| 4 | |
|---|
| 5 | from .. import democracy |
|---|
| 6 | from .. import helpers as h |
|---|
| 7 | from ..auth import authorization as auth |
|---|
| 8 | |
|---|
| 9 | from util import render_tile, BaseTile |
|---|
| 10 | |
|---|
| 11 | class DecisionTile(BaseTile): |
|---|
| 12 | |
|---|
| 13 | def __init__(self, decision): |
|---|
| 14 | self.decision = decision |
|---|
| 15 | self.poll = decision.poll |
|---|
| 16 | |
|---|
| 17 | @property |
|---|
| 18 | def topic(self): |
|---|
| 19 | if self.poll.action == self.poll.SELECT and self.poll.selection: |
|---|
| 20 | text = self.poll.selection.page.variant_head(self.poll.variant) |
|---|
| 21 | variant_link = "<a href='%s'><code>%s</code></a>" % (h.text.url(text), cgi.escape(title.variant_name)) |
|---|
| 22 | page_link = h.page.link(self.poll.scope) |
|---|
| 23 | return _("variant %(variant)s of %(page)s") % dict(variant=variant_link, page=page_link) |
|---|
| 24 | else: |
|---|
| 25 | return h.delegateable.link(self.poll.scope) |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | def scope_row(decision): |
|---|
| 29 | return render_tile('/decision/tiles.html', 'row', DecisionTile(decision), |
|---|
| 30 | decision=decision, focus_user=True) |
|---|
| 31 | |
|---|
| 32 | def user_row(decision): |
|---|
| 33 | return render_tile('/decision/tiles.html', 'row', DecisionTile(decision), |
|---|
| 34 | decision=decision, focus_scope=True) |
|---|
| 35 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.