Render descriptions as Markdown

This commit is contained in:
ricola 2025-09-27 18:57:36 +02:00
parent 4593bf2b2a
commit fa1a58bea2
10 changed files with 41 additions and 12 deletions

View file

@ -2,6 +2,11 @@
color: red;
}
textarea {
width: 80em;
height: 20em;
}
<% settings.values.each do |v| %>
.value-<%= v[:id] %> {
background: <%= v[:color] %>;

View file

@ -7,7 +7,7 @@
</p>
<p>
<label for="description"><%= _("Description") %></label>
<input type="text" name="description" value="<%= @vote.description %>">
<textarea type="text" name="description"><%= @vote.description %></textarea>
</p>
<button type="submit"><%= _("Save") %></button>
</form>
@ -16,7 +16,7 @@
<% @vote.candidates.each do |candidate| %>
<h3><%= candidate.name %></h3>
<p><%= candidate.description %></p>
<%= markdown(candidate.description) %>
<form action="/votes/<%= @vote.secure_id %>/candidates/<%= candidate.id %>/delete" method="post">
<button type="submit"><%= _("Delete") %></button>
</form>
@ -31,7 +31,7 @@
</p>
<p>
<label for="description"><%= _("Description") %></label>
<input type="text" name="description">
<textarea type="text" name="description"></textarea>
</p>
<button type="submit"><%= _("Add candidate") %></button>
</form>

View file

@ -7,7 +7,7 @@
</p>
<p>
<label for="description"><%= _("Description") %></label>
<input type="text" name="description">
<textarea type="text" name="description"></textarea>
</p>
<button type="submit"><%= _("Create new vote") %></button>
</form>

View file

@ -18,11 +18,11 @@ opening it.") %></p>
<h2><%= @vote.title %></h2>
<p><%= @vote.description %></p>
<%= markdown(@vote.description) %>
<h2><%= _("Candidates") %></h2>
<% @vote.candidates.each do |candidate| %>
<h3><%= candidate.name %></h3>
<p><%= candidate.description %></p>
<%= markdown(candidate.description) %>
<% end %>

View file

@ -4,7 +4,7 @@
<p><%= _("Closing date: %{date}" % { date: format_date_and_time(@vote.expire_on) }) %></p>
<% end %>
<p><%= @vote.description %></p>
<%= markdown(@vote.description) %>
<% unless @vote.ratings.blank? %>

View file

@ -1,6 +1,6 @@
<h1><%= @vote.title %> <%= _("(Draft)") %></h1>
<p><%= @vote.description %></p>
<%= markdown(@vote.description) %>
<h2><%= _("Organizers") %></h2>
@ -14,5 +14,5 @@
<% @vote.candidates.each do |candidate| %>
<h3><%= candidate.name %></h3>
<p><%= candidate.description %></p>
<%= markdown(candidate.description) %>
<% end %>

View file

@ -4,7 +4,7 @@
<p><%= _("Closing date: %{date}" % { date: format_date_and_time(@vote.expire_on) }) %></p>
<% end %>
<p><%= @vote.description %></p>
<%= markdown(@vote.description) %>
<h2><%= _("Your ratings") %></h2>
@ -14,8 +14,8 @@
<% rating = @vote.ratings.find { |rating| rating.user == current_user and rating.candidate == candidate } %>
<% value = rating ? rating.value : 0 %>
<li>
<p><%= candidate.name %></p>
<p><%= candidate.description %></p>
<p><b><%= candidate.name %></b></p>
<%= markdown(candidate.description) %>
<ul>
<% settings.values.reverse.each do |v| %>
<li><input type="radio" name="<%= candidate.id %>" id="<%= candidate.id %>-<%= v[:id] %>" value="<%= v[:id] %>" <% if value == v[:id] %>checked<% end %>><label for="<%= candidate.id %>-<%= v[:id] %>" class="value-<%= v[:id] %>"><%= v[:label] %></label></li>