def row(proposal): global_admin = authorization.has('global.admin') if not proposal: return "" return render_tile('/proposal/tiles.html', 'row', ProposalTile(proposal), proposal=proposal, cached=True, badgesglobal_admin=global_admin)
def select(selected, name='milestone'): options = [('--', _('(no milestone)'), selected is None)] for milestone in model.Milestone.all_future(): options.append((milestone.id, milestone.title, milestone == selected)) return render_tile('/milestone/tiles.html', 'select', None, options=options, name=name)
def show(comment, recurse=True, came_from=''): can_edit = can.comment.edit(comment) groups = sorted(c.user.groups if c.user else []) return render_tile('/comment/tiles.html', 'show', CommentTile(comment), comment=comment, cached=True, can_edit=can_edit, groups=groups, came_from=came_from, recurse=recurse, cache_csrf_token=token_id())
def widget(poll, cls="", deactivated=False, delegate_url=None): """ FIXME: fix caching. Poll objects don't change. Tallies are generated for every vote. Ask @pudo about this. Render a rating widget for an :class:`adhocracy.model.poll.Poll`. It is rendered based on the permission of the current user to vote for the poll. TODO: Add support for helpful tooltips for the voting buttons. *cls* (str) The type that will be rendered as css class in the widget. By default it is a small widget. Using 'big' will render a big one. *deactivated* Render the widget deactivated which does not show vote buttons or the current position of the user, but still the vote count. *delegate_url* (unicode or None) An URL if a delegate button should be shown beside the vote widget. If *None* (default) no button will be shown. """ t = PollTile(poll, deactivated, widget_class=cls) return render_tile( "/poll/tiles.html", "widget", t, poll=poll, user=c.user, widget_class=cls, delegate_url=delegate_url, deactivated=deactivated, cached=True, cache_csrf_token=token_id(), )
def list(topic, root=None, comments=None, variant=None, recurse=True, ret_url=''): if comments is None: comments = topic.comments return render_tile('/comment/tiles.html', 'list', tile=None, comments=comments, topic=topic, variant=variant, root=root, recurse=recurse, cached=False, ret_url=ret_url)
def list(topic, root=None, comments=None, variant=None, recurse=True, came_from=''): cached = c.user is None if comments is None: comments = topic.comments return render_tile('/comment/tiles.html', 'list', tile=None, comments=comments, topic=topic, variant=variant, root=root, recurse=recurse, cached=cached, came_from=came_from)
def row_inline(proposal): global_admin = authorization.has("global.admin") if not proposal: return "" return render_tile( "/proposal/tiles.html", "row_inline", ProposalTile(proposal), proposal=proposal, cached=False, badgesglobal_admin=global_admin, )
def select(selected, name='milestone'): options = [('--', _('(no milestone)'), selected is None)] all_future = model.Milestone.all_future(instance=c.instance) # Add the currently selected milestone if it is in the past # so it will be shown and won't be overwritten on save if (selected is not None) and (selected not in all_future): options.append((selected.id, selected.title, True)) for milestone in all_future: options.append((milestone.id, milestone.title, milestone == selected)) return render_tile('/milestone/tiles.html', 'select', None, options=options, name=name)
def select(selected, name='milestone'): options = [('--', None, _('(no milestone)'), selected is None)] if has('milestone.edit'): milestones = model.Milestone.all_q(instance=c.instance)\ .order_by(model.Milestone.time).all() else: milestones = model.Milestone.all_future_q(instance=c.instance)\ .order_by(model.Milestone.time).all() # Add the currently selected milestone if it is in the past # so it will be shown and won't be overwritten on save if (selected is not None) and (selected not in milestones): milestones.insert(0, selected) for milestone in milestones: options.append((milestone.id, milestone.time, milestone.title, milestone == selected)) return render_tile('/milestone/tiles.html', 'select', None, options=options, name=name)
def header(comment, tile=None, active='comment'): if tile is None: tile = CommentTile(comment) return render_tile('/comment/tiles.html', 'header', tile, comment=comment, active=active)
def user_row(decision): return render_tile('/decision/tiles.html', 'row', DecisionTile(decision), decision=decision, focus_scope=True)
def panel(proposal, tile): return render_tile('/proposal/tiles.html', 'panel', tile, proposal=proposal, cached=True)
def row(comment): return render_tile('/comment/tiles.html', 'row', CommentTile(comment), comment=comment)
def timeline(milestones): return render_tile('/milestone/tiles.html', 'timeline', None, milestones=milestones, cached=True)
def minimal(text, missing_translation=None): return render_tile('/text/tiles.html', 'minimal', TextTile(text), text=text, missing_translation=missing_translation)
def row(milestone): return render_tile('/milestone/tiles.html', 'row', MilestoneTile(milestone), milestone=milestone, cached=True)
def history_row(text): return render_tile('/text/tiles.html', 'history_row', TextTile(text), text=text)
def row(poll): return render_tile('/poll/tiles.html', 'row', PollTile(poll), poll=poll, user=c.user, cached=True)
def booth(poll): return render_tile('/poll/tiles.html', 'booth', PollTile(poll), poll=poll, user=c.user, cached=True)
def show(comment, recurse=True, ret_url=''): return render_tile('/comment/tiles.html', 'full', CommentTile(comment), comment=comment, comments=comment.topic.comments, recurse=recurse, ret_url=ret_url)
def panel(proposal, tile): return render_tile("/proposal/tiles.html", "panel", tile, proposal=proposal, cached=True)
def header(user, tile=None, active='activity', show_delete_user_button=False): if tile is None: tile = UserTile(user) return render_tile('/user/tiles.html', 'header', tile, user=user, active=active, show_delete_user_button=show_delete_user_button)
def sidebar(proposal, tile=None): if tile is None: tile = ProposalTile(proposal) return render_tile("/proposal/tiles.html", "sidebar", tile, proposal=proposal)
def show(comment, recurse=True, ret_url=''): can_edit = can.comment.edit(comment) groups = sorted(c.user.groups if c.user else []) return render_tile('/comment/tiles.html', 'show', CommentTile(comment), comment=comment, cached=True, can_edit=can_edit, groups=groups, ret_url=ret_url, recurse=recurse)
def row(revision): return render_tile('/comment/revision_tiles.html', 'row', RevisionTile(revision), revision=revision)
def booth(poll): return render_tile("/poll/tiles.html", "booth", PollTile(poll), poll=poll, user=c.user, cached=True)
def header(proposal, tile=None, active='goal'): if tile is None: tile = ProposalTile(proposal) return render_tile('/proposal/tiles.html', 'header', tile, proposal=proposal, active=active)
def row(poll): return render_tile("/poll/tiles.html", "row", PollTile(poll), poll=poll, user=c.user, cached=True)
def sidebar(proposal, tile=None): if tile is None: tile = ProposalTile(proposal) return render_tile('/proposal/tiles.html', 'sidebar', tile, proposal=proposal)
def outbound(delegation): return render_tile('/delegation/tiles.html', 'outbound', DelegationTile(delegation), delegation=delegation, user=c.user, cached=True)
def sidebar(delegateable, tile): return render_tile('/delegation/tiles.html', 'sidebar', tile=tile, delegateable=delegateable, user=c.user, cached=True)
def row(instance): return render_tile('/instance/tiles.html', 'row', InstanceTile(instance), instance=instance, user=c.user, cached=True)
def header(instance, tile=None, active='issues', no_panel=False): if tile is None: tile = InstanceTile(instance) return render_tile('/instance/tiles.html', 'header', tile, instance=instance, active=active, no_panel=no_panel)
def row(delegation): return render_tile('/delegation/tiles.html', 'row', DelegationTile(delegation), delegation=delegation)
def row(user): if not user: return "" return render_tile('/user/tiles.html', 'row', UserTile(user), user=user, instance=c.instance, cached=True)
def header(milestone, tile=None): if tile is None: tile = MilestoneTile(milestone) return render_tile('/milestone/tiles.html', 'header', tile, milestone=milestone)