From 8e7e52101ccee778bb09cd6ed73b4e404abaeef2 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Wed, 12 Aug 2020 17:52:52 +0200 Subject: [PATCH] Add explicit links to git history for policies We don't do this for all pages, but specifically for policies that already included the "Last update", it's friendly to have a link to the full set of changes. We still lave the "Last updated" field as manually updated, because we don't want to update that one if we just fix a typo or similar, it should be reserved for when we make acstual content updates to a policy. This creates and uses a specific template tag to automate the creation of the links (that can of course be used elsewhere as well if needed). --- pgweb/core/templatetags/pgfilters.py | 6 ++++++ templates/pages/about/policies/coc.html | 3 ++- templates/pages/about/policies/coc_committee.html | 3 ++- templates/pages/about/policies/funds-group.html | 3 ++- templates/pages/about/policies/news-and-events.html | 3 ++- templates/pages/about/policies/planet-postgresql.html | 3 ++- templates/pages/about/policies/privacy.html | 3 ++- templates/pages/about/policies/project-name.html | 3 ++- templates/pages/about/policies/services-and-hosting.html | 3 ++- templates/pages/about/policies/sponsorship.html | 3 ++- templates/pages/about/policies/trademarks.html | 5 +++-- templates/pages/about/policies/twitter.html | 3 ++- 12 files changed, 29 insertions(+), 12 deletions(-) diff --git a/pgweb/core/templatetags/pgfilters.py b/pgweb/core/templatetags/pgfilters.py index 3ff4c4ef..4fa2d89d 100644 --- a/pgweb/core/templatetags/pgfilters.py +++ b/pgweb/core/templatetags/pgfilters.py @@ -1,5 +1,6 @@ from django.template.defaultfilters import stringfilter from django import template +from django.utils.safestring import mark_safe import json @@ -80,3 +81,8 @@ def release_notes_pg_minor_version(minor_version, major_version): if str(major_version) in ['0', '1']: return str(minor_version)[2:4] return minor_version + + +@register.simple_tag(takes_context=True) +def git_changes_link(context): + return mark_safe('View change history.'.format(context.template_name)) diff --git a/templates/pages/about/policies/coc.html b/templates/pages/about/policies/coc.html index 829289f3..c9b709d2 100644 --- a/templates/pages/about/policies/coc.html +++ b/templates/pages/about/policies/coc.html @@ -1,4 +1,5 @@ {%extends "base/page.html"%} +{%load pgfilters%} {%block title%}Code of Conduct{%endblock%} {%block contents%} @@ -6,7 +7,7 @@

Code of Conduct

-

Last updated: August 18, 2018

+

Last updated: August 18, 2018. {%git_changes_link%}

Introduction

diff --git a/templates/pages/about/policies/coc_committee.html b/templates/pages/about/policies/coc_committee.html index 26d5f7da..7b0f6c6a 100644 --- a/templates/pages/about/policies/coc_committee.html +++ b/templates/pages/about/policies/coc_committee.html @@ -1,10 +1,11 @@ {%extends "base/page.html"%} +{%load pgfilters%} {%block title%}Code of Conduct Committee{%endblock%} {%block contents%}

Code of Conduct Committee

-

Last updated: October 17, 2019

+

Last updated: October 17, 2019. {%git_changes_link%}

Contact

diff --git a/templates/pages/about/policies/funds-group.html b/templates/pages/about/policies/funds-group.html index 56d3b722..196f423a 100644 --- a/templates/pages/about/policies/funds-group.html +++ b/templates/pages/about/policies/funds-group.html @@ -1,10 +1,11 @@ {%extends "base/page.html"%} +{%load pgfilters%} {%block title%}Funds Group{%endblock%} {%block contents%}

PostgreSQL Funds Group

-

Last updated: March 1, 2019

+

Last updated: March 1, 2019. {%git_changes_link%}

Charter

diff --git a/templates/pages/about/policies/news-and-events.html b/templates/pages/about/policies/news-and-events.html index cb7b422f..a8dc6331 100644 --- a/templates/pages/about/policies/news-and-events.html +++ b/templates/pages/about/policies/news-and-events.html @@ -1,10 +1,11 @@ {%extends "base/page.html"%} +{%load pgfilters%} {%block title%}News and Events Approval Policy{%endblock%} {%block contents%}

News and Events Approval Policy

-

Last updated: March 29, 2018

+

Last updated: March 29, 2018. {%git_changes_link%}

Policies for Approving News & Events & pgsql-announce

diff --git a/templates/pages/about/policies/planet-postgresql.html b/templates/pages/about/policies/planet-postgresql.html index b9436d4a..523f6d76 100644 --- a/templates/pages/about/policies/planet-postgresql.html +++ b/templates/pages/about/policies/planet-postgresql.html @@ -1,10 +1,11 @@ {%extends "base/page.html"%} +{%load pgfilters%} {%block title%}Planet PostgreSQL{%endblock%} {%block contents%}

Planet PostgreSQL

-

Last updated: October 12, 2016

+

Last updated: October 12, 2016. {%git_changes_link%}

Planet PostgreSQL is a blog aggregation service run by the PostgreSQL community. In addition to the main diff --git a/templates/pages/about/policies/privacy.html b/templates/pages/about/policies/privacy.html index 75046b35..26fe1766 100644 --- a/templates/pages/about/policies/privacy.html +++ b/templates/pages/about/policies/privacy.html @@ -1,9 +1,10 @@ {%extends "base/page.html"%} +{%load pgfilters%} {%block title%}Privacy Policy{%endblock%} {%block contents%}

Privacy Policy

-

Last updated: December 10, 2012

+

Last updated: December 10, 2012. {%git_changes_link%}

When you visit our website, our servers automatically log your IP address and/or host name.

diff --git a/templates/pages/about/policies/project-name.html b/templates/pages/about/policies/project-name.html index 8e2c0745..1e7115d8 100644 --- a/templates/pages/about/policies/project-name.html +++ b/templates/pages/about/policies/project-name.html @@ -1,10 +1,11 @@ {%extends "base/page.html"%} +{%load pgfilters%} {%block title%}Project Name{%endblock%} {%block contents%}

Project Name

-

Last updated: July 5, 2018

+

Last updated: July 5, 2018. {%git_changes_link%}

"PostgreSQL" versus "Postgres"

diff --git a/templates/pages/about/policies/services-and-hosting.html b/templates/pages/about/policies/services-and-hosting.html index bcb5cf22..08387b1d 100644 --- a/templates/pages/about/policies/services-and-hosting.html +++ b/templates/pages/about/policies/services-and-hosting.html @@ -1,11 +1,12 @@ {%extends "base/page.html"%} +{%load pgfilters%} {%block title%}Professional Services and Hosting Approval Policy{%endblock%} {%block contents%}

Professional Services and Hosting Approval Policy

-

Last updated: May 19, 2012

+

Last updated: May 19, 2012. {%git_changes_link%}

Policies for Approving Professional Services and Hosting Services

diff --git a/templates/pages/about/policies/sponsorship.html b/templates/pages/about/policies/sponsorship.html index d5a8e102..fae86bad 100644 --- a/templates/pages/about/policies/sponsorship.html +++ b/templates/pages/about/policies/sponsorship.html @@ -1,10 +1,11 @@ {%extends "base/page.html"%} +{%load pgfilters%} {%block title%}Sponsoring{%endblock%} {%block contents%}

PostgreSQL Sponsorship

-

Last updated: June 1, 2018

+

Last updated: June 1, 2018. {%git_changes_link%}

Sponsorship levels

diff --git a/templates/pages/about/policies/trademarks.html b/templates/pages/about/policies/trademarks.html index 96307b6a..f4d8d6d6 100644 --- a/templates/pages/about/policies/trademarks.html +++ b/templates/pages/about/policies/trademarks.html @@ -1,10 +1,11 @@ {%extends "base/page.html"%} -{%block title%}Trademark Policy{%endblock%} +{%load pgfilters%} +'{%block title%}Trademark Policy{%endblock%} {%block contents%}

Trademark Policy

-

Last updated: August 28, 2018

+

Last updated: August 28, 2018. {%git_changes_link%}

Policy

diff --git a/templates/pages/about/policies/twitter.html b/templates/pages/about/policies/twitter.html index b17c2e45..8743bfcf 100644 --- a/templates/pages/about/policies/twitter.html +++ b/templates/pages/about/policies/twitter.html @@ -1,10 +1,11 @@ {%extends "base/page.html"%} +{%load pgfilters%} {%block title%}@postgresql Twitter Account Policy{%endblock%} {%block contents%}

@postgresql Twitter Account Policy

-

Last updated: January 19, 2018

+

Last updated: January 19, 2018. {%git_changes_link%}

This policy applies to the manual use of the @postgresql Twitter account.

-- 2.39.5