diff --git a/tailbone/forms/core.py b/tailbone/forms/core.py
index 5d1ef763..1aea1d7d 100644
--- a/tailbone/forms/core.py
+++ b/tailbone/forms/core.py
@@ -341,7 +341,7 @@ class Form(object):
def __init__(self, fields=None, schema=None, request=None, mobile=False, readonly=False, readonly_fields=[],
model_instance=None, model_class=None, appstruct=UNSPECIFIED, nodes={}, enums={}, labels={}, renderers=None,
hidden={}, widgets={}, defaults={}, validators={}, required={}, helptext={}, focus_spec=None,
- action_url=None, cancel_url=None, use_buefy=None):
+ action_url=None, cancel_url=None, use_buefy=None, component='tailbone-form'):
self.fields = None
if fields is not None:
@@ -377,6 +377,12 @@ class Form(object):
self.action_url = action_url
self.cancel_url = cancel_url
self.use_buefy = use_buefy
+ self.component = component
+
+ @property
+ def component_studly(self):
+ words = self.component.split('-')
+ return ''.join([word.capitalize() for word in words])
def __contains__(self, item):
return item in self.fields
diff --git a/tailbone/static/js/tailbone.buefy.form.js b/tailbone/static/js/tailbone.buefy.form.js
deleted file mode 100644
index c63868ac..00000000
--- a/tailbone/static/js/tailbone.buefy.form.js
+++ /dev/null
@@ -1,10 +0,0 @@
-
-let TailboneForm = {
- template: '#tailbone-form-template',
- methods: {}
-}
-
-let FormPage = {
- template: '#form-page-template',
- methods: {}
-}
diff --git a/tailbone/templates/batch/view.mako b/tailbone/templates/batch/view.mako
index c31d2a9d..63ac6bd4 100644
--- a/tailbone/templates/batch/view.mako
+++ b/tailbone/templates/batch/view.mako
@@ -32,6 +32,7 @@
<%def name="extra_styles()">
${parent.extra_styles()}
+ % if not use_buefy:
+ % endif
%def>
<%def name="buttons()">
${self.leading_buttons()}
${refresh_button()}
- ${execute_button()}
%def>
@@ -86,38 +87,9 @@
%def>
-<%def name="execute_button()">
- % if not batch.executed and request.has_perm('{}.execute'.format(permission_prefix)):
-
- % if use_buefy:
- % if master.has_execution_options(batch):
- ## TODO: this doesn't work yet
- ${execute_submit_button()}
- % else:
- ${execute_form.render_deform(buttons=capture(execute_submit_button))|n}
- % endif
-
- % else:
- ## no buefy, do legacy thing
-
- ${execute_title}
-
- % endif
- % endif
-
-%def>
-
<%def name="object_helpers()">
${self.render_status_breakdown()}
+ ${self.render_execute_helper()}
%def>
<%def name="render_status_breakdown()">
@@ -144,31 +116,101 @@
% endif
%def>
+<%def name="render_execute_helper()">
+
+
Batch Execution
+
+ % if batch.executed:
+
+ Batch was executed
+ ${h.pretty_datetime(request.rattail_config, batch.executed)}
+ by ${batch.executed_by}
+
+ % elif master.handler.executable(batch):
+ % if request.has_perm('{}.execute'.format(permission_prefix)):
+
Batch has not yet been executed.
+ % if use_buefy:
+ % if master.has_execution_options(batch):
+ ## TODO: this doesn't work yet
+ ${self.execute_submit_button()}
+ % else:
+
+ % endif
+ % else:
+ ## no buefy, do legacy thing
+
+ ${execute_title}
+
+ % endif
+ % else:
+
TODO: batch *may* be executed, but not by *you*
+ % endif
+ % else:
+
TODO: batch cannot be executed..?
+ % endif
+
+
+%def>
+
<%def name="render_form()">
## TODO: should use self.render_form_buttons()
## ${form.render(form_id='batch-form', buttons=capture(self.render_form_buttons))|n}
${form.render(form_id='batch-form', buttons=capture(buttons))|n}
%def>
+<%def name="render_this_page()">
+ ${parent.render_this_page()}
+ % if not use_buefy:
+ % if master.handler.executable(batch) and request.has_perm('{}.execute'.format(permission_prefix)):
+
+ ${execute_form.render_deform(form_kwargs={'name': 'batch-execution'}, buttons=False)|n}
+
+ % endif
+ % endif
+%def>
-${self.render_form_complete()}
+<%def name="render_this_page_buefy()">
+ % if use_buefy and master.handler.executable(batch) and request.has_perm('{}.execute'.format(permission_prefix)):
+ ## TODO: stop using |n filter
+ ${execute_form.render_deform(buttons=capture(execute_submit_button))|n}
+ % endif
+ ${parent.render_this_page_buefy()}
+%def>
-% if use_buefy:
-
- ## TODO: stop using |n filter
- ${rows_grid.render_buefy(allow_save_defaults=False, tools=rows_grid_tools)|n}
-
-
-
- ${self.make_tailbone_form_app()}
- ${self.make_tailbone_grid_app()}
-% else:
- ## no buefy, so do the traditional thing
- ${rows_grid|n}
-% endif
+<%def name="declare_page_vars()">
+ ${parent.declare_page_vars()}
+ % if not batch.executed and request.has_perm('{}.execute'.format(permission_prefix)):
+
+ % endif
+%def>
+
+<%def name="finalize_page_components()">
+ ${parent.finalize_page_components()}
+ % if not batch.executed and request.has_perm('{}.execute'.format(permission_prefix)):
+
+ % endif
+%def>
+
+
+${parent.body()}
diff --git a/tailbone/templates/form.mako b/tailbone/templates/form.mako
index 3de2350b..0c541375 100644
--- a/tailbone/templates/form.mako
+++ b/tailbone/templates/form.mako
@@ -1,7 +1,5 @@
## -*- coding: utf-8; -*-
-<%inherit file="/base.mako" />
-
-<%def name="context_menu_items()">%def>
+<%inherit file="/page.mako" />
<%def name="object_helpers()">%def>
@@ -17,36 +15,15 @@
%def>
-<%def name="render_form_complete()">
- % if use_buefy:
- ${self.render_form()}
-
-
-
-
- % else:
+<%def name="render_this_page()">
- ${self.render_form()}
+ % if use_buefy:
+ ${self.render_buefy_form()}
+ % else:
+ ${self.render_form()}
+ % endif
@@ -60,33 +37,41 @@
+%def>
+
+<%def name="render_this_page_buefy()">
+ % if form is not Underined:
+ ${self.render_form()}
+ % endif
+ ${parent.render_this_page_buefy()}
+%def>
+
+<%def name="declare_page_vars()">
+ ${parent.declare_page_vars()}
+ % if form is not Undefined:
+
% endif
%def>
-<%def name="modify_tailbone_form()">
- ## NOTE: if you override this, must use
+
+ % endif
%def>
-${self.render_form_complete()}
-
-% if use_buefy:
- ${self.make_tailbone_form_app()}
-% endif
+${parent.body()}
diff --git a/tailbone/templates/forms/deform_buefy.mako b/tailbone/templates/forms/deform_buefy.mako
index f49b5dc9..b5f17b84 100644
--- a/tailbone/templates/forms/deform_buefy.mako
+++ b/tailbone/templates/forms/deform_buefy.mako
@@ -1,6 +1,6 @@
## -*- coding: utf-8; -*-
-
% endif
- % endif
- % if master.has_rows:
- % if use_buefy:
- ${h.javascript_link(request.static_url('tailbone:static/js/tailbone.buefy.grid.js') + '?ver={}'.format(tailbone.__version__))}
- % else:
-
+ % if master.has_rows:
+
% endif
% endif
%def>
@@ -85,45 +81,36 @@
${rows_grid_tools}
%def>
-<%def name="modify_tailbone_grid()">
- ## NOTE: if you override this, must use
+ ${parent.make_this_page_app()}
%def>
-${self.render_form_complete()}
-
-% if master.has_rows:
- % if use_buefy:
-
- ## TODO: stop using |n filter
- ${rows_grid.render_buefy(allow_save_defaults=False, tools=capture(self.render_row_grid_tools))|n}
-
-
-
-
-
- ${self.make_tailbone_grid_app()}
- % else:
- ## no buefy, so do the traditional thing
- ${rows_grid|n}
- % endif
-% endif
-
-% if use_buefy:
- ${self.make_tailbone_form_app()}
-% endif
+${parent.body()}
diff --git a/tailbone/templates/page.mako b/tailbone/templates/page.mako
index 03c8e7ce..3d1407ca 100644
--- a/tailbone/templates/page.mako
+++ b/tailbone/templates/page.mako
@@ -6,49 +6,36 @@
<%def name="page_content()">%def>
<%def name="render_this_page()">
- % if use_buefy:
+
-
+<%def name="render_this_page_buefy()">
+
-
-
-
-
- % else:
- ## legacy / not buefy
-
-
-
-
- ${self.page_content()}
-
-
-
-
-
-
- % endif
+
+
+
%def>
<%def name="modify_this_page()">
## NOTE: if you override this, must use
+%def>
+<%def name="finalize_page_components()">
+ ## NOTE: if you override this, must use
+
+
-
-
+
+
+ ${self.object_helpers()}
+
+
+
+
+
+ % if use_buefy:
+
% else:
- ## legacy / not buefy
-
-
-
-
+
% endif
%def>
-<%def name="modify_tailbone_form()">
+<%def name="modify_this_page()">