github activity: allow sorting by an arbitrary attribute (GITHUB_SORT_ATTRIBUTE) and ascending/descending (GITHUB_SORT_DESCENDING)

This commit is contained in:
Jan Müller
2013-11-23 22:06:59 +01:00
parent 7ef242b758
commit 18024acc4c
3 changed files with 24 additions and 10 deletions

View File

@@ -12,6 +12,18 @@
{% set GITHUB_SKIP_FORK = "false" %}
{% endif %}
{% endif %}
{% if GITHUB_SORT_ATTRIBUTE is not defined %}
{% set GITHUB_SORT_ATTRIBUTE = "pushed_at" %}
{% endif %}
{% if GITHUB_SORT_DESCENDING is not defined %}
{% set GITHUB_SORT_DESCENDING = "true" %}
{% else %}
{% if GITHUB_SORT_DESCENDING %}
{% set GITHUB_SORT_DESCENDING = "true" %}
{% else %}
{% set GITHUB_SORT_DESCENDING = "false" %}
{% endif %}
{% endif %}
<section>
<ul class="list-group list-group-flush">
@@ -37,7 +49,9 @@
user: '{{ GITHUB_USER }}',
count: {{ GITHUB_REPO_COUNT }},
skip_forks: {{ GITHUB_SKIP_FORK }},
target: '#gh_repos'
target: '#gh_repos',
sort_attribute: '{{ GITHUB_SORT_ATTRIBUTE }}',
sort_descending: {{ GITHUB_SORT_DESCENDING }}
});
});
</script>