diff --git a/tailbone/grids/core.py b/tailbone/grids/core.py index 643c366f..0775f5ce 100644 --- a/tailbone/grids/core.py +++ b/tailbone/grids/core.py @@ -1116,6 +1116,11 @@ class Grid(object): value = "" row[name] = six.text_type(value) + # maybe add UUID for convenience + if 'uuid' not in self.columns: + if hasattr(rowobj, 'uuid'): + row['uuid'] = rowobj.uuid + # set action URL(s) for row, as needed self.set_action_urls(row, rowobj, i) diff --git a/tailbone/templates/grids/buefy.mako b/tailbone/templates/grids/buefy.mako index adc06dd2..2e3bc420 100644 --- a/tailbone/templates/grids/buefy.mako +++ b/tailbone/templates/grids/buefy.mako @@ -84,6 +84,13 @@ :loading="loading" :row-class="getRowClass" + % if grid.checkboxes: + checkable + :checked-rows.sync="checkedRows" + ## TODO: definitely will be wanting this... + ## :is-row-checkable="" + % endif + :default-sort="[sortField, sortOrder]" backend-sorting @sort="onSort" @@ -161,6 +168,8 @@ sortField: '${grid.sortkey}', sortOrder: '${grid.sortdir}', rowStatusMap: ${json.dumps(grid_data['row_status_map'])|n}, + ## TODO: should be dumping json from server here + checkedRows: [], % if grid.pageable: % if static_data: @@ -307,6 +316,14 @@ if (confirm("You are about to delete " + this.total + " ${grid.model_title_plural}.\n\nAre you sure?")) { event.target.form.submit() } + }, + + checkedRowUUIDs() { + var uuids = []; + for (var row of this.$data.checkedRows) { + uuids.push(row.uuid) + } + return uuids } } diff --git a/tailbone/templates/master/index.mako b/tailbone/templates/master/index.mako index 5c30a6f4..28ac7da7 100644 --- a/tailbone/templates/master/index.mako +++ b/tailbone/templates/master/index.mako @@ -134,10 +134,24 @@ ## merge 2 objects % if master.mergeable and request.has_perm('{}.merge'.format(permission_prefix)): + ${h.form(url('{}.merge'.format(route_prefix)), name='merge-things', class_='control')} ${h.csrf_token(request)} - ${h.hidden('uuids')} - + % if use_buefy: + + + Merge 2 ${model_title_plural} + + % else: + ${h.hidden('uuids')} + + % endif ${h.end_form()} % endif diff --git a/tailbone/templates/master/merge.mako b/tailbone/templates/master/merge.mako index f7bd50ed..a2ba8e4c 100644 --- a/tailbone/templates/master/merge.mako +++ b/tailbone/templates/master/merge.mako @@ -3,8 +3,9 @@ <%def name="title()">Merge 2 ${model_title_plural} -<%def name="head_tags()"> - ${parent.head_tags()} +<%def name="extra_javascript()"> + ${parent.extra_javascript()} + % if not use_buefy: + % endif + + +<%def name="extra_styles()"> + ${parent.extra_styles()}