Fix merge feature for master index grid

at least, for Vue.js / buefy theme
This commit is contained in:
Lance Edgar 2019-11-08 16:02:21 -06:00
parent 0877cfc3c9
commit c70dedd94f

View file

@ -34,7 +34,7 @@
% endif % endif
% if master.mergeable and request.has_perm('{}.merge'.format(permission_prefix)): % if master.mergeable and master.has_perm('merge'):
$('form[name="merge-things"] button').button('option', 'disabled', $('.grid').gridcore('count_selected') != 2); $('form[name="merge-things"] button').button('option', 'disabled', $('.grid').gridcore('count_selected') != 2);
@ -266,29 +266,6 @@
% endif % endif
</%def> </%def>
<%def name="modify_this_page_vars()">
${parent.modify_this_page_vars()}
<script type="text/javascript">
% if master.mergeable and request.has_perm('{}.merge'.format(permission_prefix)):
TailboneGridData.mergeFormButtonText = "Merge 2 ${model_title_plural}"
TailboneGridData.mergeFormSubmitting = false
TailboneGrid.methods.submitMergeForm = function() {
this.mergeFormSubmitting = true
this.mergeFormButtonText = "Working, please wait..."
}
% endif
% if master.deletable and request.has_perm('{}.delete'.format(permission_prefix)) and master.delete_confirm == 'simple':
ThisPage.methods.deleteObject = function(url) {
if (confirm("Are you sure you wish to delete this ${model_title}?")) {
let form = this.$refs.deleteObjectForm
form.action = url
form.submit()
}
}
% endif
</script>
</%def>
<%def name="make_this_page_component()"> <%def name="make_this_page_component()">
${parent.make_this_page_component()} ${parent.make_this_page_component()}
<script type="text/javascript"> <script type="text/javascript">
@ -315,6 +292,17 @@
${parent.modify_this_page_vars()} ${parent.modify_this_page_vars()}
<script type="text/javascript"> <script type="text/javascript">
## delete single object
% if master.deletable and master.has_perm('delete') and master.delete_confirm == 'simple':
ThisPage.methods.deleteObject = function(url) {
if (confirm("Are you sure you wish to delete this ${model_title}?")) {
let form = this.$refs.deleteObjectForm
form.action = url
form.submit()
}
}
% endif
## enable / disable selected objects ## enable / disable selected objects
% if master.supports_set_enabled_toggle and master.has_perm('enable_disable_set'): % if master.supports_set_enabled_toggle and master.has_perm('enable_disable_set'):
@ -407,6 +395,17 @@
this.$refs.delete_selected_form.submit() this.$refs.delete_selected_form.submit()
} }
% endif % endif
% if master.mergeable and master.has_perm('merge'):
TailboneGridData.mergeFormButtonText = "Merge 2 ${model_title_plural}"
TailboneGridData.mergeFormSubmitting = false
TailboneGrid.methods.submitMergeForm = function() {
this.mergeFormSubmitting = true
this.mergeFormButtonText = "Working, please wait..."
}
% endif
</script> </script>
</%def> </%def>