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 model value for the given field. This JS will be written as part of
the overall response, to be interpreted on the client side. 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): if isinstance(field.schema.typ, deform.FileData):
# TODO: don't recall why "always null" here? # TODO: don't recall why "always null" here?
return 'null' return 'null'

View file

@ -1,59 +1,3 @@
## -*- coding: utf-8; -*- ## -*- coding: utf-8; -*-
<%inherit file="/master/edit.mako" /> <%inherit file="/master/edit.mako" />
${parent.body()}
<%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>

View file

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