Пример #1
0
def render_moderation_togggle_button(version):
    approved = version.moderation_status == APPROVED
    label = ""

    if is_approved(version):
        template_name = "moderation/_reject_button.html"
        label = _("Unapprove")
        url = reverse("moderation:revision-reject",
                      kwargs={
                          'team_id': version.video.moderated_by_id,
                          "version_id": version.pk
                      })
    elif is_rejected(version):
        template_name = "moderation/_approve_button.html"
        label = _("Approve")
        url = reverse("moderation:revision-approve",
                      kwargs={
                          'team_id': version.video.moderated_by_id,
                          "version_id": version.pk
                      })
    elif is_waiting(version):
        template_name = "moderation/_approve_button.html"
        label = _("Approve")
        url = reverse("moderation:revision-approve",
                      kwargs={
                          'team_id': version.video.moderated_by_id,
                          "version_id": version.pk
                      })

    return render_to_string(template_name, {
        "label": label,
        "url": url,
    })
Пример #2
0
def render_reject_button(version_or_language, label=None, confirms=False):
    if isinstance(version_or_language, SubtitleVersion):
        version = version_or_language
    elif isinstance(version_or_language, SubtitleLanguage):
        version = version_or_language.latest(public_only=False)
    if is_rejected(version):
       return {}

    team = version.video.moderated_by
    url = reverse("moderation:revision-reject", kwargs={
            'team_id':team.pk,
            "version_id": version.pk,
        })
    return {
        "team": team,
        "version": version,
        "label": label or "Decline revision",
        "confirms": confirms,
        "url": url,
       } 
Пример #3
0
def render_moderation_togggle_button(version):
    approved = version.moderation_status == APPROVED
    label = ""
    
    if is_approved(version):
        template_name = "moderation/_reject_button.html"
        label = _("Unapprove")
        url = reverse("moderation:revision-reject", kwargs={'team_id':version.video.moderated_by_id, "version_id":version.pk})
    elif is_rejected(version):
        template_name = "moderation/_approve_button.html"
        label = _("Approve")
        url = reverse("moderation:revision-approve", kwargs={'team_id':version.video.moderated_by_id, "version_id":version.pk})
    elif is_waiting(version):
        template_name = "moderation/_approve_button.html"
        label = _("Approve")
        url = reverse("moderation:revision-approve", kwargs={'team_id':version.video.moderated_by_id, "version_id":version.pk})
        
    return render_to_string(template_name, {
            "label": label,
            "url" : url,
    })
Пример #4
0
def render_reject_button(version_or_language, label=None, confirms=False):
    if isinstance(version_or_language, SubtitleVersion):
        version = version_or_language
    elif isinstance(version_or_language, SubtitleLanguage):
        version = version_or_language.latest(public_only=False)
    if is_rejected(version):
        return {}

    team = version.video.moderated_by
    url = reverse("moderation:revision-reject",
                  kwargs={
                      'team_id': team.pk,
                      "version_id": version.pk,
                  })
    return {
        "team": team,
        "version": version,
        "label": label or "Decline revision",
        "confirms": confirms,
        "url": url,
    }