From 25860344debe7748d19bf86cfb68b9121c909440 Mon Sep 17 00:00:00 2001 From: "Jonathan S. Katz" Date: Sat, 22 Dec 2018 11:35:31 -0500 Subject: [PATCH] Remove inline styles from feature matrix generator. This moves the HTML code generated for the filters into the Django template, instead of the JavaScript portion. --- media/css/main.css | 3 +++ media/js/featurematrix.js | 21 --------------------- pgweb/featurematrix/views.py | 4 ++-- templates/featurematrix/featurematrix.html | 11 ++++++++++- 4 files changed, 15 insertions(+), 24 deletions(-) diff --git a/media/css/main.css b/media/css/main.css index 44cc4e3f..7b11456a 100644 --- a/media/css/main.css +++ b/media/css/main.css @@ -1222,6 +1222,9 @@ input.featurematrix_version { input.featurematrix_version:last-child { margin-right: 0; } +hr#featurematrix_version_divider { + margin: 0; +} td.fm_no { background-color: #ffdddd !important; } diff --git a/media/js/featurematrix.js b/media/js/featurematrix.js index f82c4da2..13dd1837 100644 --- a/media/js/featurematrix.js +++ b/media/js/featurematrix.js @@ -2,27 +2,6 @@ * Filter feature matrix */ $(document).ready(function(){ - var eol_versions = $('#feature-matrix-filter').data('eol').split(','); - - // Create form to contain filter checkboxes - $('#feature-matrix-filter').html('
Filter by version
'); - - // Generate a list of versions based on table column headers - $('table tr:first th').not('th:nth-child(1)').each(function(){ - var version_class = $(this).text().replace('.', ''); - - // Only mark a box as checked if no in the EOL list - var checked = (eol_versions.indexOf($(this).text()) == -1 ? 'checked="checked"' : ''); - - $('form#featurematrix_version_filter').append(' '); - }); - - // Add a checkbox to hide rows where all values are the same between - // displayed versions. Default: checked. - $('form#featurematrix_version_filter').append('
'); - // Show/hide column based on whether supplied checkbox is checked. function filter_version(checkbox) { diff --git a/pgweb/featurematrix/views.py b/pgweb/featurematrix/views.py index c9da0307..bd445390 100644 --- a/pgweb/featurematrix/views.py +++ b/pgweb/featurematrix/views.py @@ -23,10 +23,10 @@ def root(request): if currentgroup: groups.append(currentgroup) - eol_versions = [v.tree for v in Version.objects.filter(supported=False, testing=False)] + versions = Version.objects.filter(tree__gte='8.1').order_by('-tree') return render_pgweb(request, 'about', 'featurematrix/featurematrix.html', { 'groups': groups, - 'eol_versions': eol_versions, + 'versions': versions, }) def detail(request, featureid): diff --git a/templates/featurematrix/featurematrix.html b/templates/featurematrix/featurematrix.html index 492e78da..81711cf9 100644 --- a/templates/featurematrix/featurematrix.html +++ b/templates/featurematrix/featurematrix.html @@ -22,7 +22,16 @@ the text.
-
+
+
Filter by version
+ {% for version in versions %} + + + {% endfor %} +
+ +
+
{% for group in groups %} -- 2.39.5