Move editing the vote description to a dedicated page
So that /votes/:id remains a preview page, even for organizers.
This commit is contained in:
parent
888dcc1a99
commit
be9c415048
5 changed files with 12078 additions and 12 deletions
12048
public/bootstrap.css
vendored
Normal file
12048
public/bootstrap.css
vendored
Normal file
File diff suppressed because it is too large
Load diff
10
vedia.rb
10
vedia.rb
|
|
@ -298,6 +298,14 @@ get '/votes/:id' do
|
|||
end
|
||||
end
|
||||
|
||||
get '/votes/:id/edit' do
|
||||
require_login
|
||||
find_vote
|
||||
require_organizer
|
||||
require_draft_vote
|
||||
erb :votes_edit_description
|
||||
end
|
||||
|
||||
post '/votes/:id/edit' do
|
||||
require_login
|
||||
find_vote
|
||||
|
|
@ -306,7 +314,7 @@ post '/votes/:id/edit' do
|
|||
@vote.title = params[:title]
|
||||
@vote.description = params[:description]
|
||||
@vote.save
|
||||
erb :votes_edit
|
||||
redirect '/votes/' + @vote.secure_id
|
||||
end
|
||||
|
||||
post '/votes/:id/candidates' do
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
<title>Vedia</title>
|
||||
<script src="/chartkick.js"></script>
|
||||
<script src="/Chart.bundle.js"></script>
|
||||
<link rel="stylesheet" href="/bootstrap.css">
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
</head>
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -1,15 +1,11 @@
|
|||
<h1><%= _("Edit draft vote") %></h1>
|
||||
<h1><%= @vote.title %></h1>
|
||||
|
||||
<form action="/votes/<%= @vote.secure_id %>/edit" method="post">
|
||||
<p>
|
||||
<label for="title"><%= _("Title") %></label>
|
||||
<input type="text" name="title" value="<%= @vote.title %>">
|
||||
</p>
|
||||
<p>
|
||||
<label for="description"><%= _("Description") %></label>
|
||||
<textarea type="text" name="description"><%= @vote.description %></textarea>
|
||||
</p>
|
||||
<button type="submit"><%= _("Save") %></button>
|
||||
<p>Draft</p>
|
||||
|
||||
<%= markdown(@vote.description) %>
|
||||
|
||||
<form action="/votes/<%= @vote.secure_id %>/edit" method="get">
|
||||
<button type="submit"><%= _("Edit") %></button>
|
||||
</form>
|
||||
|
||||
<h2><%= _("Candidates") %></h2>
|
||||
|
|
|
|||
13
views/votes_edit_description.erb
Normal file
13
views/votes_edit_description.erb
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<h1><%= _("Edit vote description") %></h1>
|
||||
|
||||
<form action="/votes/<%= @vote.secure_id %>/edit" method="post">
|
||||
<p>
|
||||
<label for="title"><%= _("Title") %></label>
|
||||
<input type="text" name="title" value="<%= @vote.title %>">
|
||||
</p>
|
||||
<p>
|
||||
<label for="description"><%= _("Description") %></label>
|
||||
<textarea type="text" name="description"><%= @vote.description %></textarea>
|
||||
</p>
|
||||
<button type="submit"><%= _("Save") %></button>
|
||||
</form>
|
||||
Loading…
Add table
Add a link
Reference in a new issue