More Buefy tweaks, for file upload, and "edit batch" generally

This commit is contained in:
Lance Edgar 2019-06-08 14:26:33 -05:00
parent 7224be9de2
commit 3f6d5daa1e
3 changed files with 14 additions and 73 deletions

View file

@ -766,10 +766,6 @@ class Form(object):
model value for the given field. This JS will be written as part of
the overall response, to be interpreted on the client side.
"""
if isinstance(field.schema.typ, colander.Date):
# TODO: don't recall why "always null" here?
return 'null'
if isinstance(field.schema.typ, deform.FileData):
# TODO: don't recall why "always null" here?
return 'null'

View file

@ -1,59 +1,3 @@
## -*- coding: utf-8; -*-
<%inherit file="/master/edit.mako" />
<%def name="extra_javascript()">
${parent.extra_javascript()}
${h.javascript_link(request.static_url('tailbone:static/js/tailbone.batch.js'))}
<script type="text/javascript">
$(function() {
$('#save-refresh').click(function() {
var form = $(this).parents('form');
form.append($('<input type="hidden" name="refresh" value="true" />'));
form.submit();
});
});
</script>
</%def>
<%def name="extra_styles()">
${parent.extra_styles()}
<style type="text/css">
.grid-wrapper {
margin-top: 10px;
}
</style>
</%def>
<%def name="buttons()">
<div class="buttons">
% if master.refreshable:
${h.submit('save-refresh', "Save & Refresh Data")}
% endif
% if not batch.executed and request.has_perm('{}.execute'.format(permission_prefix)):
<button type="button" id="execute-batch"${'' if execute_enabled else ' disabled="disabled"'}>${execute_title}</button>
% endif
</div>
</%def>
<%def name="grid_tools()">
% if not batch.executed:
<p>${h.link_to("Delete all rows matching current search", url('{}.delete_rows'.format(route_prefix), uuid=batch.uuid))}</p>
% endif
</%def>
<div style="display: flex; justify-content: space-between;">
<div class="form-wrapper">
${form.render()|n}
</div>
<ul id="context-menu">
${self.context_menu_items()}
</ul>
</div>
${parent.body()}

View file

@ -24,19 +24,20 @@
</div>
<div tal:condition="use_buefy"
tal:define="vmodel vmodel|'field_model_' + field_name;"
tal:omit-tag="">
tal:define="vmodel vmodel|'field_model_' + field_name;">
${field.start_mapping()}
<b-upload name="upload"
v-model="${vmodel}">
<a class="button is-primary">
<b-icon pack="fas" icon="upload"></b-icon>
<span>Click to upload</span>
</a>
</b-upload>
<span class="file-name" v-if="${vmodel}">
{{ ${vmodel}.name }}
</span>
<b-field class="file">
<b-upload name="upload"
v-model="${vmodel}">
<a class="button is-primary">
<b-icon pack="fas" icon="upload"></b-icon>
<span>Click to upload</span>
</a>
</b-upload>
<span class="file-name" v-if="${vmodel}">
{{ ${vmodel}.name }}
</span>
</b-field>
${field.end_mapping()}
</div>