adds admin interface for poll questions
This commit is contained in:
@@ -35,6 +35,14 @@
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<% if feature?(:polls) %>
|
||||
<li <%= "class=active" if controller_name == "poll_questions" %>>
|
||||
<%= link_to admin_questions_path do %>
|
||||
<span class="icon-checkmark-circle"></span><%= t("admin.menu.poll_questions") %>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<li <%= "class=active" if controller_name == "banners" %>>
|
||||
<%= link_to admin_banners_path do %>
|
||||
<span class="icon-eye"></span><%= t("admin.menu.banner") %>
|
||||
|
||||
43
app/views/admin/poll/questions/_form.html.erb
Normal file
43
app/views/admin/poll/questions/_form.html.erb
Normal file
@@ -0,0 +1,43 @@
|
||||
<%= form_for(@question, url: form_url) do |f| %>
|
||||
|
||||
<%= render 'shared/errors', resource: @question %>
|
||||
|
||||
<%= f.hidden_field :proposal_id %>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= f.text_field :title, maxlength: Poll::Question.title_max_length %>
|
||||
|
||||
<%= f.text_field :question, maxlength: Poll::Question.question_max_length %>
|
||||
|
||||
<%= f.text_field :valid_answers %>
|
||||
|
||||
<%= f.text_area :summary, rows: 4, maxlength: 200 %>
|
||||
|
||||
<div class="ckeditor">
|
||||
<%= f.cktext_area :description,
|
||||
maxlength: Poll::Question.description_max_length,
|
||||
ckeditor: { language: I18n.locale } %>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<%= f.collection_check_boxes(:geozone_ids, @geozones, :id, :name) do |b| %>
|
||||
<div class="small-6 medium-3 column">
|
||||
<%= b.label do %>
|
||||
<%= b.check_box + b.text %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<%# TODO include all link %>
|
||||
|
||||
<div class="row">
|
||||
<div class="actions small-12 medium-4 column margin-top">
|
||||
<%= f.submit(class: "button expanded", value: t("shared.save")) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
5
app/views/admin/poll/questions/edit.html.erb
Normal file
5
app/views/admin/poll/questions/edit.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<%= render "shared/back_link" %>
|
||||
|
||||
<h2><%= t("admin.questions.edit.title") %></h2>
|
||||
|
||||
<%= render "form", form_url: admin_question_path(@question) %>
|
||||
22
app/views/admin/poll/questions/index.html.erb
Normal file
22
app/views/admin/poll/questions/index.html.erb
Normal file
@@ -0,0 +1,22 @@
|
||||
<h2 class="inline-block"><%= t('admin.questions.index.title') %></h2>
|
||||
|
||||
<%= link_to t('admin.questions.index.create'), new_admin_question_path,
|
||||
class: "button success float-right" %>
|
||||
|
||||
<% if @questions.count == 0 %>
|
||||
<div class="callout primary">
|
||||
<%= t('admin.questions.index.no_questions') %>
|
||||
</div>
|
||||
<% else %>
|
||||
<table>
|
||||
<% @questions.each do |question| %>
|
||||
<tr id="<%= dom_id(question) %>">
|
||||
<td><%= link_to question.title, question_path(question) %></td>
|
||||
<td class="text-right">
|
||||
<%= link_to t('shared.edit'), edit_admin_question_path(question), class: "button hollow" %>
|
||||
<%= link_to t('shared.delete'), admin_question_path(question), class: "button hollow alert", method: :delete %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
<% end %>
|
||||
5
app/views/admin/poll/questions/new.html.erb
Normal file
5
app/views/admin/poll/questions/new.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<%= render "shared/back_link" %>
|
||||
|
||||
<h2><%= t("admin.questions.new.title") %></h2>
|
||||
|
||||
<%= render "form", form_url: admin_questions_path %>
|
||||
Reference in New Issue
Block a user