Add support for general "view click handler" for <b-table>
element
plus some other tweaks for sake of revision history in profile view
This commit is contained in:
parent
069ccab0ae
commit
c09437880f
|
@ -964,6 +964,24 @@ class Grid(object):
|
||||||
context['data_prop'] = data_prop
|
context['data_prop'] = data_prop
|
||||||
if 'grid_columns' not in context:
|
if 'grid_columns' not in context:
|
||||||
context['grid_columns'] = self.get_buefy_columns()
|
context['grid_columns'] = self.get_buefy_columns()
|
||||||
|
|
||||||
|
# locate the 'view' action
|
||||||
|
# TODO: this should be easier, and/or moved elsewhere?
|
||||||
|
view = None
|
||||||
|
for action in self.main_actions:
|
||||||
|
if action.key == 'view':
|
||||||
|
view = action
|
||||||
|
break
|
||||||
|
if not view:
|
||||||
|
for action in self.more_actions:
|
||||||
|
if action.key == 'view':
|
||||||
|
view = action
|
||||||
|
break
|
||||||
|
|
||||||
|
context['view_click_handler'] = None
|
||||||
|
if view and view.click_handler:
|
||||||
|
context['view_click_handler'] = view.click_handler
|
||||||
|
|
||||||
return render(template, context)
|
return render(template, context)
|
||||||
|
|
||||||
def get_filters_sequence(self):
|
def get_filters_sequence(self):
|
||||||
|
|
|
@ -4,13 +4,26 @@
|
||||||
icon-pack="fas"
|
icon-pack="fas"
|
||||||
striped
|
striped
|
||||||
hoverable
|
hoverable
|
||||||
narrowed>
|
narrowed
|
||||||
|
% if vshow is not Undefined and vshow:
|
||||||
|
v-show="${vshow}"
|
||||||
|
% endif
|
||||||
|
% if loading is not Undefined and loading:
|
||||||
|
:loading="${loading}"
|
||||||
|
% endif
|
||||||
|
>
|
||||||
|
|
||||||
<template slot-scope="props">
|
<template slot-scope="props">
|
||||||
% for column in grid_columns:
|
% for column in grid_columns:
|
||||||
<b-table-column field="${column['field']}" label="${column['label']}" ${'sortable' if column['sortable'] else ''}>
|
<b-table-column field="${column['field']}" label="${column['label']}" ${'sortable' if column['sortable'] else ''}>
|
||||||
% if grid.is_linked(column['field']):
|
% if grid.is_linked(column['field']):
|
||||||
<a :href="props.row._action_url_view" v-html="props.row.${column['field']}"></a>
|
<a :href="props.row._action_url_view"
|
||||||
|
v-html="props.row.${column['field']}"
|
||||||
|
% if view_click_handler:
|
||||||
|
@click.prevent="${view_click_handler}"
|
||||||
|
% endif
|
||||||
|
>
|
||||||
|
</a>
|
||||||
% else:
|
% else:
|
||||||
<span v-html="props.row.${column['field']}"></span>
|
<span v-html="props.row.${column['field']}"></span>
|
||||||
% endif
|
% endif
|
||||||
|
@ -49,4 +62,14 @@
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
% if show_footer is not Undefined and show_footer:
|
||||||
|
<template slot="footer">
|
||||||
|
<b-field grouped position="is-right">
|
||||||
|
<span class="control">
|
||||||
|
{{ ${data_prop}.length.toLocaleString('en') }} records
|
||||||
|
</span>
|
||||||
|
</b-field>
|
||||||
|
</template>
|
||||||
|
% endif
|
||||||
|
|
||||||
</b-table>
|
</b-table>
|
||||||
|
|
Loading…
Reference in a new issue