Пример #1
0
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)
Пример #2
0
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)
Пример #3
0
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())
Пример #4
0
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(),
    )
Пример #5
0
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)
Пример #6
0
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)
Пример #7
0
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,
    )
Пример #8
0
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)
Пример #9
0
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)
Пример #10
0
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)
Пример #11
0
def user_row(decision):
    return render_tile('/decision/tiles.html', 'row', DecisionTile(decision),
                       decision=decision, focus_scope=True)
Пример #12
0
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)
Пример #13
0
def panel(proposal, tile):
    return render_tile('/proposal/tiles.html', 'panel', tile,
                       proposal=proposal, cached=True)
Пример #14
0
def row(comment):
    return render_tile('/comment/tiles.html',
                       'row',
                       CommentTile(comment),
                       comment=comment)
Пример #15
0
def timeline(milestones):
    return render_tile('/milestone/tiles.html', 'timeline',
                       None, milestones=milestones, cached=True)
Пример #16
0
def panel(proposal, tile):
    return render_tile('/proposal/tiles.html',
                       'panel',
                       tile,
                       proposal=proposal,
                       cached=True)
Пример #17
0
def minimal(text, missing_translation=None):
    return render_tile('/text/tiles.html',
                       'minimal',
                       TextTile(text),
                       text=text,
                       missing_translation=missing_translation)
Пример #18
0
def timeline(milestones):
    return render_tile('/milestone/tiles.html',
                       'timeline',
                       None,
                       milestones=milestones,
                       cached=True)
Пример #19
0
def row(milestone):
    return render_tile('/milestone/tiles.html',
                       'row',
                       MilestoneTile(milestone),
                       milestone=milestone,
                       cached=True)
Пример #20
0
def history_row(text):
    return render_tile('/text/tiles.html',
                       'history_row',
                       TextTile(text),
                       text=text)
Пример #21
0
def row(poll):
    return render_tile('/poll/tiles.html', 'row',
                        PollTile(poll), poll=poll, user=c.user, cached=True)
Пример #22
0
def booth(poll):
    return render_tile('/poll/tiles.html', 'booth',
                        PollTile(poll), poll=poll, user=c.user, cached=True)
Пример #23
0
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)
Пример #24
0
def panel(proposal, tile):
    return render_tile("/proposal/tiles.html", "panel", tile, proposal=proposal, cached=True)
Пример #25
0
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)
Пример #26
0
def sidebar(proposal, tile=None):
    if tile is None:
        tile = ProposalTile(proposal)
    return render_tile("/proposal/tiles.html", "sidebar", tile, proposal=proposal)
Пример #27
0
def user_row(decision):
    return render_tile('/decision/tiles.html',
                       'row',
                       DecisionTile(decision),
                       decision=decision,
                       focus_scope=True)
Пример #28
0
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)
Пример #29
0
def row(revision):
    return render_tile('/comment/revision_tiles.html', 'row',
                       RevisionTile(revision), revision=revision)
Пример #30
0
def booth(poll):
    return render_tile("/poll/tiles.html", "booth", PollTile(poll), poll=poll, user=c.user, cached=True)
Пример #31
0
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)
Пример #32
0
def row(poll):
    return render_tile("/poll/tiles.html", "row", PollTile(poll), poll=poll, user=c.user, cached=True)
Пример #33
0
def sidebar(proposal, tile=None):
    if tile is None:
        tile = ProposalTile(proposal)
    return render_tile('/proposal/tiles.html', 'sidebar', tile,
                       proposal=proposal)
Пример #34
0
def outbound(delegation):
    return render_tile('/delegation/tiles.html', 'outbound',
                       DelegationTile(delegation), delegation=delegation,
                       user=c.user, cached=True)
Пример #35
0
def sidebar(delegateable, tile):
    return render_tile('/delegation/tiles.html', 'sidebar',
                       tile=tile, delegateable=delegateable,
                       user=c.user, cached=True)
Пример #36
0
def row(instance):
    return render_tile('/instance/tiles.html', 'row', InstanceTile(instance),
                       instance=instance, user=c.user, cached=True)
Пример #37
0
def row(comment):
    return render_tile('/comment/tiles.html', 'row', CommentTile(comment),
                       comment=comment)
Пример #38
0
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)
Пример #39
0
def row(delegation):
    return render_tile('/delegation/tiles.html', 'row',
                       DelegationTile(delegation), delegation=delegation)
Пример #40
0
def row(milestone):
    return render_tile('/milestone/tiles.html', 'row',
                       MilestoneTile(milestone),
                       milestone=milestone, cached=True)
Пример #41
0
def row(user):
    if not user:
        return ""
    return render_tile('/user/tiles.html', 'row', UserTile(user),
                       user=user, instance=c.instance, cached=True)
Пример #42
0
def header(milestone, tile=None):
    if tile is None:
        tile = MilestoneTile(milestone)
    return render_tile('/milestone/tiles.html', 'header',
                       tile, milestone=milestone)
Пример #43
0
def booth(poll):
    return render_tile('/poll/tiles.html', 'booth',
                        PollTile(poll), poll=poll, user=c.user, cached=True)
Пример #44
0
def header(milestone, tile=None):
    if tile is None:
        tile = MilestoneTile(milestone)
    return render_tile('/milestone/tiles.html', 'header',
                       tile, milestone=milestone)