Add show all vs. show diffs for upgrade packages

plus some related tweaks
This commit is contained in:
Lance Edgar 2017-08-12 22:38:23 -05:00
parent 24d89db025
commit 4b5e415147
4 changed files with 44 additions and 6 deletions

View file

@ -10,9 +10,6 @@ table.diff th,
table.diff td {
border-bottom: 1px solid Black;
border-right: 1px solid Black;
}
table.diff td {
padding: 2px 5px;
}

View file

@ -72,7 +72,7 @@ ${h.csrf_token(request)}
## % if form.creating and form.allow_successive_creates:
## ${h.submit('create_and_continue', form.successive_create_label)}
## % endif
${h.link_to("Cancel", form.cancel_url, class_='button')}
${h.link_to("Cancel", form.cancel_url, class_='button autodisable')}
</div>
% endif

View file

@ -1,6 +1,41 @@
## -*- coding: utf-8; -*-
<%inherit file="/master/view.mako" />
<%def name="extra_javascript()">
${parent.extra_javascript()}
<script type="text/javascript">
function show_packages(type) {
if (type == 'all') {
$('.showing .diffs').css('font-weight', 'normal');
$('table.diff tbody tr').show();
$('.showing .all').css('font-weight', 'bold');
} else if (type == 'diffs') {
$('.showing .all').css('font-weight', 'normal');
$('table.diff tbody tr:not(.diff)').hide();
$('.showing .diffs').css('font-weight', 'bold');
}
}
$(function() {
show_packages('diffs');
$('.showing .all').click(function() {
show_packages('all');
return false;
});
$('.showing .diffs').click(function() {
show_packages('diffs')
return false;
});
});
</script>
</%def>
${parent.body()}
% if not instance.executed and request.has_perm('{}.execute'.format(permission_prefix)):

View file

@ -40,7 +40,7 @@ from rattail.threads import Thread
from rattail.upgrades import get_upgrade_handler
from deform import widget as dfwidget
from webhelpers2.html import tags
from webhelpers2.html import tags, HTML
from tailbone.views import MasterView3 as MasterView
from tailbone.progress import SessionProgress, get_progress_session
@ -206,7 +206,13 @@ class UpgradeView(MasterView):
columns=["package", "old version", "new version"],
render_value=self.render_diff_value,
)
return diff.render_html()
showing = HTML.tag('div',
"showing: "
+ tags.link_to("all", '#', class_='all')
+ " / "
+ tags.link_to("diffs only", '#', class_='diffs'),
class_='showing')
return showing + diff.render_html()
except:
return "(not available for this upgrade)"