mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: poll ensure ranked choice results can handle options with rich text and links (#28195)
cf. https://meta.discourse.org/t/links-in-ranked-choice-polls-do-not-render-correctly-in-results-view/319098
This commit is contained in:
parent
c4428715b5
commit
c95f9dbf34
@ -1,13 +1,16 @@
|
|||||||
import Component from "@glimmer/component";
|
import Component from "@glimmer/component";
|
||||||
|
import { htmlSafe } from "@ember/template";
|
||||||
import i18n from "discourse-common/helpers/i18n";
|
import i18n from "discourse-common/helpers/i18n";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default class PollResultsRankedChoiceComponent extends Component {
|
export default class PollResultsRankedChoiceComponent extends Component {
|
||||||
get rankedChoiceWinnerText() {
|
get rankedChoiceWinnerText() {
|
||||||
return I18n.t("poll.ranked_choice.winner", {
|
return htmlSafe(
|
||||||
|
I18n.t("poll.ranked_choice.winner", {
|
||||||
count: this.args.rankedChoiceOutcome.round_activity.length,
|
count: this.args.rankedChoiceOutcome.round_activity.length,
|
||||||
winner: this.args.rankedChoiceOutcome.winning_candidate.html,
|
winner: this.args.rankedChoiceOutcome.winning_candidate.html,
|
||||||
});
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
get rankedChoiceTiedText() {
|
get rankedChoiceTiedText() {
|
||||||
@ -33,7 +36,7 @@ export default class PollResultsRankedChoiceComponent extends Component {
|
|||||||
{{#if round.majority}}
|
{{#if round.majority}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{round.round}}</td>
|
<td>{{round.round}}</td>
|
||||||
<td>{{round.majority.html}}</td>
|
<td>{{htmlSafe round.majority.html}}</td>
|
||||||
<td>{{i18n "poll.ranked_choice.none"}}</td>
|
<td>{{i18n "poll.ranked_choice.none"}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{else}}
|
{{else}}
|
||||||
@ -42,7 +45,7 @@ export default class PollResultsRankedChoiceComponent extends Component {
|
|||||||
<td>{{i18n "poll.ranked_choice.none"}}</td>
|
<td>{{i18n "poll.ranked_choice.none"}}</td>
|
||||||
<td>
|
<td>
|
||||||
{{#each round.eliminated as |eliminated|}}
|
{{#each round.eliminated as |eliminated|}}
|
||||||
{{eliminated.html}}
|
{{htmlSafe eliminated.html}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -59,9 +62,9 @@ export default class PollResultsRankedChoiceComponent extends Component {
|
|||||||
>{{this.rankedChoiceTiedText}}</span>
|
>{{this.rankedChoiceTiedText}}</span>
|
||||||
<ul class="poll-results-ranked-choice-tied-candidates">
|
<ul class="poll-results-ranked-choice-tied-candidates">
|
||||||
{{#each @rankedChoiceOutcome.tied_candidates as |tied_candidate|}}
|
{{#each @rankedChoiceOutcome.tied_candidates as |tied_candidate|}}
|
||||||
<li
|
<li class="poll-results-ranked-choice-tied-candidate">{{htmlSafe
|
||||||
class="poll-results-ranked-choice-tied-candidate"
|
tied_candidate.html
|
||||||
>{{tied_candidate.html}}</li>
|
}}</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
{{else}}
|
{{else}}
|
||||||
|
Loading…
Reference in New Issue
Block a user