Skip to content

Commit

Permalink
shows unit either in row title or as a caption
Browse files Browse the repository at this point in the history
  • Loading branch information
smirolo committed Nov 27, 2024
1 parent ee254b2 commit 0b245b6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 8 additions & 2 deletions djaopsp/static/js/assess-vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -925,11 +925,17 @@ Vue.component('scorecard', {
},
getCaptionTitle: function(row) {
var vm = this;
var captionUnit = null;
var practices = vm.getEntries(row.slug);
for( var idx = 0; idx < practices.length; ++idx ) {
return vm.getPrimaryUnit(practices[idx]).title;
const unit = vm.getPrimaryUnit(practices[idx]);
if( captionUnit && captionUnit.slug != unit.slug ) {
captionUnit = null;
break;
}
captionUnit = unit;
}
return "";
return captionUnit ? captionUnit.title : "";
},
getNbRespondents: function(practice) {
var vm = this;
Expand Down
5 changes: 3 additions & 2 deletions djaopsp/templates/app/scorecard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ <h2>{{sample.campaign.title}}</h2>
</div>{# /.row #}

{# different layout for differnt type of questions. #}
<div v-if="isDataMetricsHeader(practice)" :class="practiceStyle(practice)">
<div :class="practiceStyle(practice)"
v-if="isDataMetricsHeader(practice)">
<table class="table table-bordered table-striped">
<tr class="text-end">
<th></th>
Expand All @@ -342,7 +343,7 @@ <h2>{{sample.campaign.title}}</h2>
</th>
</tr>
<tr v-for="total in getEntries(practice.slug)">
<th>[[total.title]]</th>
<th>[[total.title]] <span v-if="!getCaptionTitle(practice)">([[getPrimaryUnit(total).title]])</span></th>
<td class="text-end"
v-for="year in getColHeaders(practice)">
[[getColValue(total, year)]]
Expand Down

0 comments on commit 0b245b6

Please sign in to comment.