Esempio n. 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,
    })
Esempio n. 2
0
def render_remove_approve_button(version_or_language):
    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_waiting(version):
        return {}
    team = version.video.moderated_by

    return {"team": team, "version": version}
Esempio n. 3
0
def render_remove_approve_button(version_or_language):
    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_waiting(version):
        return {}
    team = version.video.moderated_by
     
    return {
        "team": team,
        "version": version
        }
Esempio n. 4
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,
    })