adds admin search/add/remove question to poll
This commit is contained in:
@@ -11,9 +11,9 @@
|
||||
<td><%= link_to question.title, admin_question_path(question) %></td>
|
||||
<td class="text-right">
|
||||
<%= link_to t('admin.polls.show.remove_question'),
|
||||
admin_question_path(question),
|
||||
remove_question_admin_poll_path(poll_id: @poll.id, question_id: question.id),
|
||||
class: "button hollow alert",
|
||||
method: :delete %>
|
||||
method: :patch %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
14
app/views/admin/poll/polls/_search_questions.html.erb
Normal file
14
app/views/admin/poll/polls/_search_questions.html.erb
Normal file
@@ -0,0 +1,14 @@
|
||||
<%= form_tag(search_questions_admin_poll_path(@poll), method: :get, remote: true) do |f| %>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= text_field_tag :search,
|
||||
@search,
|
||||
placeholder: t("admin.shared.poll_questions_search.placeholder"), id: "search-questions" %>
|
||||
</div>
|
||||
<div class="form-inline small-12 medium-3 column end">
|
||||
<%= submit_tag t("admin.shared.poll_questions_search.button"), class: "button" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div id="search-questions-results"></div>
|
||||
@@ -0,0 +1,25 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3"><%= @questions.blank? ? t('admin.polls.show.no_search_results') : t('admin.polls.show.search_results') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @questions.each do |question| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= question.title %>
|
||||
</td>
|
||||
<td>
|
||||
<%= question.summary %>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<%= link_to t("admin.polls.show.add_question"),
|
||||
add_question_admin_poll_path(poll_id: @poll.id, question_id: question.id),
|
||||
method: :patch,
|
||||
class: "button hollow" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
1
app/views/admin/poll/polls/search_questions.js.erb
Normal file
1
app/views/admin/poll/polls/search_questions.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
$("#search-questions-results").html("<%= j render 'search_questions_results' %>");
|
||||
@@ -11,6 +11,7 @@
|
||||
<%= render "filter_subnav" %>
|
||||
|
||||
<div class="tabs-panel is-active" id="tab-questions">
|
||||
<%= render "search_questions" %>
|
||||
<%= render "questions" %>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user