From 122d83b4c055fdc676284040cc557a6add9b8773 Mon Sep 17 00:00:00 2001 From: siddhpant <25429745+siddhpant@users.noreply.github.com> Date: Sat, 9 Feb 2019 12:37:14 +0530 Subject: [PATCH] Add GitHub ribbons Closes #24 --- community/settings.py | 4 ++++ community/templatetags/__init__.py | 0 community/templatetags/ribbon_link.py | 12 ++++++++++++ templates/activity.html | 1 + templates/contributors.html | 1 + templates/gamification.html | 1 + templates/index.html | 1 + templates/meta_review.html | 1 + templates/model.html | 1 + templates/model/templates/base.html | 1 + templates/openhub.html | 1 + templates/ribbon.html | 14 ++++++++++++++ 12 files changed, 38 insertions(+) create mode 100644 community/templatetags/__init__.py create mode 100644 community/templatetags/ribbon_link.py create mode 100644 templates/ribbon.html diff --git a/community/settings.py b/community/settings.py index fa375669..81c2da61 100644 --- a/community/settings.py +++ b/community/settings.py @@ -104,6 +104,10 @@ 'django.template.context_processors.request', 'django.contrib.messages.context_processors.messages', ], + + 'libraries':{ + 'ribbon_link': 'community.templatetags.ribbon_link', + }, }, }, ] diff --git a/community/templatetags/__init__.py b/community/templatetags/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/community/templatetags/ribbon_link.py b/community/templatetags/ribbon_link.py new file mode 100644 index 00000000..62d095f3 --- /dev/null +++ b/community/templatetags/ribbon_link.py @@ -0,0 +1,12 @@ +from django import template +from community.git import get_remote_url + + +register = template.Library() + + +@register.simple_tag +def get_ribbon_link(): + url = get_remote_url() + link = 'https://' + url.resource + '/' + url.pathname + return link diff --git a/templates/activity.html b/templates/activity.html index a16da76f..e793b3ff 100644 --- a/templates/activity.html +++ b/templates/activity.html @@ -13,6 +13,7 @@ + {% include 'ribbon.html' %}

Community Activity



diff --git a/templates/contributors.html b/templates/contributors.html index 32abe1a6..84e4acbb 100644 --- a/templates/contributors.html +++ b/templates/contributors.html @@ -9,6 +9,7 @@ Contributors Data + {% include 'ribbon.html' %}

Details of all the contributors