Allow override of version diff for master views
and misc. other tweaks
This commit is contained in:
parent
ec8a8d5ddc
commit
f70772fabc
|
@ -574,7 +574,7 @@
|
||||||
</b-field>
|
</b-field>
|
||||||
|
|
||||||
<b-field label="Unit Size">
|
<b-field label="Unit Size">
|
||||||
<span>{{ productSize }}</span>
|
<span>{{ productSize || '' }}</span>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
|
||||||
<b-field label="Case Size">
|
<b-field label="Case Size">
|
||||||
|
@ -734,7 +734,7 @@
|
||||||
<b-field grouped>
|
<b-field grouped>
|
||||||
<b-field label="Product" horizontal>
|
<b-field label="Product" horizontal>
|
||||||
<span :class="productIsKnown ? null : 'has-text-success'">
|
<span :class="productIsKnown ? null : 'has-text-success'">
|
||||||
{{ productIsKnown ? productDisplay : pendingProduct.brand_name + ' ' + pendingProduct.description + ' ' + pendingProduct.size }}
|
{{ productIsKnown ? productDisplay : (pendingProduct.brand_name || '') + ' ' + (pendingProduct.description || '') + ' ' + (pendingProduct.size || '') }}
|
||||||
</span>
|
</span>
|
||||||
</b-field>
|
</b-field>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
@ -761,7 +761,7 @@
|
||||||
:class="productPriceNeedsConfirmation ? 'has-background-warning' : ''"
|
:class="productPriceNeedsConfirmation ? 'has-background-warning' : ''"
|
||||||
% endif
|
% endif
|
||||||
>
|
>
|
||||||
{{ productIsKnown ? productUnitPriceDisplay : '$' + pendingProduct.regular_price_amount }}
|
{{ productIsKnown ? productUnitPriceDisplay : (pendingProduct.regular_price_amount ? '$' + pendingProduct.regular_price_amount : '') }}
|
||||||
</span>
|
</span>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
<nav class="panel">
|
<nav class="panel">
|
||||||
<p class="panel-heading">Cross-Reference</p>
|
<p class="panel-heading">Cross-Reference</p>
|
||||||
<div class="panel-block buttons">
|
<div class="panel-block buttons">
|
||||||
<div style="display: flex; flex-direction: column;">
|
<div style="display: flex; flex-direction: column; gap: 0.5rem;">
|
||||||
% for button in xref_buttons:
|
% for button in xref_buttons:
|
||||||
${button}
|
${button}
|
||||||
% endfor
|
% endfor
|
||||||
|
|
|
@ -1441,8 +1441,8 @@ class MasterView(View):
|
||||||
changed_raw = app.render_datetime(app.localtime(txn.issued_at, from_utc=True))
|
changed_raw = app.render_datetime(app.localtime(txn.issued_at, from_utc=True))
|
||||||
changed_ago = app.render_time_ago(app.make_utc() - txn.issued_at)
|
changed_ago = app.render_time_ago(app.make_utc() - txn.issued_at)
|
||||||
|
|
||||||
changed_by = str(txn.user)
|
changed_by = str(txn.user or '')
|
||||||
if self.request.has_perm('users.view'):
|
if self.request.has_perm('users.view') and txn.user:
|
||||||
changed_by = tags.link_to(changed_by, self.request.route_url('users.view', uuid=txn.user.uuid))
|
changed_by = tags.link_to(changed_by, self.request.route_url('users.view', uuid=txn.user.uuid))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -4961,10 +4961,16 @@ class MasterView(View):
|
||||||
def make_diff(self, old_data, new_data, **kwargs):
|
def make_diff(self, old_data, new_data, **kwargs):
|
||||||
return diffs.Diff(old_data, new_data, **kwargs)
|
return diffs.Diff(old_data, new_data, **kwargs)
|
||||||
|
|
||||||
|
def get_version_diff_factory(self, **kwargs):
|
||||||
|
if hasattr(self, 'version_diff_factory'):
|
||||||
|
return self.version_diff_factory
|
||||||
|
return diffs.VersionDiff
|
||||||
|
|
||||||
def make_version_diff(self, version, *args, **kwargs):
|
def make_version_diff(self, version, *args, **kwargs):
|
||||||
if 'title' not in kwargs:
|
if 'title' not in kwargs:
|
||||||
kwargs['title'] = self.title_for_version(version)
|
kwargs['title'] = self.title_for_version(version)
|
||||||
return diffs.VersionDiff(version, *args, **kwargs)
|
factory = self.get_version_diff_factory()
|
||||||
|
return factory(version, *args, **kwargs)
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
# Configuration Views
|
# Configuration Views
|
||||||
|
|
Loading…
Reference in a new issue