Community Survey 2025 improvements

This commit is contained in:
Jeremy Ruston
2025-07-26 21:37:53 +01:00
parent 8611d06eb9
commit d7c86a6721
5 changed files with 72 additions and 31 deletions
@@ -0,0 +1,54 @@
title: $:/Community Survey 2025/Definitions
tags: $:/tags/Global
\procedure survey-2025-display-answer(answerTitle,answerField)
<li class="interview-answer">
<$link to=<<answerTitle>>>
<$text text={{{ [<answerTitle>get<answerField>] }}}/>
</$link>
</li>
\end survey-2025-display-answer
\procedure survey-2025-list-answers(answerTitle)
<div class="interview-answers">
<table class="tc-view-field-table">
<tbody>
<tr>
<th style="width:50%;">Question</th>
<th style="width:50%;">Answer</th>
</tr>
<$list filter="[all[current]fields[]sort[title]] -text -title -tags" template="$:/core/ui/TiddlerFieldTemplate" variable="listItem"/>
</tbody>
</table>
</div>
\end survey-2025-list-answers
\procedure survey-2025-list-questions()
<$let stateBase=<<qualify "$:/state/survey-2025/">>>
<div class="interview">
<$list filter="[tag[Community Survey 2025]fields[]sort[]] -tags -title">
<$let state={{{ [<stateBase>addsuffix<currentTiddler>] }}}>
<h1>
<$button class="tc-btn-invisible" style="text-align:left;">
<$action-setfield $tiddler=<<state>> $field="text" $value={{{ [<state>get[text]match[yes]then[no]else[yes]] }}}/>
<%if [<state>get[text]match[yes]] %>
{{$:/core/images/chevron-down}}
<%else%>
{{$:/core/images/chevron-right}}
<%endif%>
<$text text=<<currentTiddler>>/>
</$button>
</h1>
<%if [<state>get[text]match[yes]] %>
<ol>
<$list filter="[tag[Community Survey 2025]]" variable="answerTitle">
<$transclude $variable="survey-2025-display-answer" answerTitle=<<answerTitle>> answerField=<<currentTiddler>>/>
</$list>
</ol>
<%endif%>
</$let>
</$list>
</div>
</$let>
\end survey-2025-list-questions
@@ -1,31 +1,5 @@
title: TiddlyWiki Community Survey (2025)
The survey result XLSX file can be downloaded from https://ec.europa.eu/eusurvey/publication/tiddlywiki-users-2025. Drag and drop the file here to import it into TiddlyWiki.
<$let stateBase=<<qualify "$:/state/survey-2025/">>>
<div class="interview">
<$list filter="[tag[Community Survey 2025]fields[]sort[]] -tags -title">
<$let state={{{ [<stateBase>addsuffix<currentTiddler>] }}}>
<h1>
<$button class="tc-btn-invisible">
<$action-setfield $tiddler=<<state>> $field="text" $value={{{ [<state>get[text]match[yes]then[no]else[yes]] }}}/>
<%if [<state>get[text]match[yes]] %>
{{$:/core/images/chevron-down}}
<%else%>
{{$:/core/images/chevron-right}}
<%endif%>
</$button>
<$link to=<<currentTiddler>>>
<$text text=<<currentTiddler>>/>
</$link>
</h1>
<%if [<state>get[text]match[yes]] %>
<$list filter="[tag[Community Survey 2025]]" variable="answer">
<div class="interview-answer">
<$transclude $tiddler=<<answer>> $field=<<currentTiddler>> $mode="block" />
</div>
</$list>
<%endif%>
</$let>
</$list>
</div>
</$let>
<<survey-2025-list-questions>>
@@ -0,0 +1,8 @@
title: $:/Community Survey 2025/ViewTemplate
tags: $:/tags/ViewTemplate
<%if [<currentTiddler>tag[Community Survey 2025]] %>
<$transclude $variable="survey-2025-list-answers" answerTitle=<<currentTiddler>>/>
<%endif%>
@@ -1,7 +1,7 @@
created: 20250711121107617
import-spec-role: row
import-row-type: by-column
list: [[$:/_importspec/Community Survey 2025/Content/Row/title]]
import-title-template: Community Survey 2025 Answer $autoindex$
modified: 20250711121107617
tags:
title: $:/_importspec/Community Survey 2025/Content/Row
+7 -2
View File
@@ -92,12 +92,17 @@ XLSXImporter.prototype.processRow = function(rowImportSpecTitle) {
// Save the tiddler if not skipped
if(!this.skipTiddler) {
if(!this.tiddlerFields.title) {
this.tiddlerFields.title = "Imported " + $tw.utils.pad(this.nextAutoTitle++,5);
var titleTemplate = this.rowImportSpec.fields["import-title-template"] || "Imported $autoindex$";
this.tiddlerFields.title = this.wiki.getSubstitutedText(titleTemplate,$tw.rootWidget,{
substitutions: [
{name: "autoindex", value: $tw.utils.pad(this.nextAutoTitle++,5)}
]
});
}
if(this.applyTags) {
this.tiddlerFields.tags = this.applyTags;
}
this.results.push(this.tiddlerFields);
this.results.push(this.tiddlerFields);
}
}
};