Skip to content

Commit

Permalink
collapsible group
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinRiese committed Dec 1, 2023
1 parent 4185ea6 commit 6a27713
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,17 @@ hqDefine("cloudcare/js/formplayer/menus/views/query", function () {
childViewOptions: function () {
return {parentView: this.options.parentView};
},

initialize: function (options) {
console.log('groupedQueryView');
},

templateContext: function () {
return {
groupName: this.options.groupName,
groupKey: this.options.groupKey,
};
},
});

var QueryListView = Marionette.CollectionView.extend({

Check failure on line 473 in corehq/apps/cloudcare/static/cloudcare/js/formplayer/menus/views/query.js

View workflow job for this annotation

GitHub Actions / Lint Javascript

'options' is defined but never used
Expand All @@ -478,7 +486,14 @@ hqDefine("cloudcare/js/formplayer/menus/views/query", function () {

if (child.has("groupName")) {
const childList = new Backbone.Collection(child.get('displays'));
options = _.extend({collection: childList}, childViewOptions);
options = _.extend(
{
collection: childList,
groupName: child.get('groupName'),
groupKey: child.get('groupKey'),
},
childViewOptions
);
} else {
options = _.extend({model: child}, childViewOptions);
}
Expand Down
5 changes: 4 additions & 1 deletion corehq/apps/cloudcare/templates/formplayer/query_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ <h2 tabindex="0"><%- title %></h2>
</script>

<script type="text/template" id="query-view-group-template">
<table class="table table-hover table-striped table-bordered" role="presentation">
<div data-toggle="collapse" data-target="#group-<%- groupKey %>" aria-expanded="true" aria-controls="group-<%- groupKey %>">
<%- groupName %>
</div>
<table id="group-<%- groupKey %>" class="table table-hover table-striped table-bordered" role="presentation">
<tbody id="query-properties">
</tbody>
</table>
Expand Down

0 comments on commit 6a27713

Please sign in to comment.