This commit is contained in:
parent
5140eafc51
commit
8d87105609
@ -8,13 +8,29 @@
|
|||||||
|
|
||||||
let surveyP = null;
|
let surveyP = null;
|
||||||
$: surveyP = getSharedSurvey(data.idsurvey, data.secret);
|
$: surveyP = getSharedSurvey(data.idsurvey, data.secret);
|
||||||
|
|
||||||
|
let max_responses = 0;
|
||||||
|
|
||||||
|
function calc_responses(responses) {
|
||||||
|
const len = responses.length;
|
||||||
|
if (max_responses < len) {
|
||||||
|
max_responses = len;
|
||||||
|
}
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#await surveyP then survey}
|
{#await surveyP then survey}
|
||||||
<div class="d-flex align-items-center">
|
<div class="d-flex align-items-center">
|
||||||
<h2>
|
<h2>
|
||||||
{survey.title}
|
{survey.title}
|
||||||
<small class="text-muted">Réponses</small>
|
<small class="text-muted">
|
||||||
|
Réponses
|
||||||
|
{#if max_responses > 0}
|
||||||
|
({max_responses})
|
||||||
|
{/if}
|
||||||
|
</small>
|
||||||
</h2>
|
</h2>
|
||||||
<SurveyBadge class="ms-2" {survey} />
|
<SurveyBadge class="ms-2" {survey} />
|
||||||
</div>
|
</div>
|
||||||
@ -26,10 +42,17 @@
|
|||||||
</div>
|
</div>
|
||||||
{:then questions}
|
{:then questions}
|
||||||
{#each questions as question (question.id)}
|
{#each questions as question (question.id)}
|
||||||
<h3>{question.title}</h3>
|
|
||||||
{#if question.kind == "text" || (data.exportview_list && question.kind.indexOf("list") == 0)}
|
{#if question.kind == "text" || (data.exportview_list && question.kind.indexOf("list") == 0)}
|
||||||
{#await question.getResponses(data.secret) then responses}
|
{#await question.getResponses(data.secret)}
|
||||||
{#each responses as response (response.id)}
|
<h3>{question.title}</h3>
|
||||||
|
{:then responses}
|
||||||
|
<h3>
|
||||||
|
{question.title}
|
||||||
|
<small class="text-muted float-end">
|
||||||
|
{calc_responses(responses)} réponses
|
||||||
|
</small>
|
||||||
|
</h3>
|
||||||
|
{#each calc_responses(responses) as response (response.id)}
|
||||||
<div class="card mb-2">
|
<div class="card mb-2">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<p class="card-text" style:white-space="pre-line">
|
<p class="card-text" style:white-space="pre-line">
|
||||||
|
Reference in New Issue
Block a user