Reload form with same data

This commit is contained in:
ricola 2025-12-04 02:04:36 +01:00
parent 78abcce758
commit f8b5f80823
2 changed files with 4 additions and 2 deletions

View file

@ -316,6 +316,8 @@ get '/votes/:id/edit' do
find_vote
require_organizer
require_draft_vote
params[:title] = @vote.title
params[:description] = @vote.description
erb :votes_edit_description
end

View file

@ -11,11 +11,11 @@
<form action="/votes/<%= @vote.secure_id %>/edit" method="post">
<div class="mb-3">
<label for="title" class="form-label"><%= _("Title") %></label>
<input type="text" name="title" value="<%= @vote.title %>" class="form-control">
<input type="text" name="title" value="<%= params[:title] %>" class="form-control">
</div>
<div class="mb-3">
<label for="description" class="form-label"><%= _("Description") %></label>
<textarea type="text" name="description" class="form-control"><%= @vote.description %></textarea>
<textarea type="text" name="description" class="form-control"><%= params[:description] %></textarea>
</div>
<button type="submit" class="btn btn-primary"><%= _("Save") %></button>
</form>