Add controllers/views for Poll::Question::Answer::Video

This commit is contained in:
Angel Perez
2017-10-05 12:34:20 -04:00
parent 5f6d218a15
commit 5862eea516
17 changed files with 236 additions and 10 deletions

View File

@@ -0,0 +1,21 @@
<%= form_for(@video, url: form_url) do |f| %>
<%= render 'shared/errors', resource: @video %>
<%= f.hidden_field :answer_id, value: @video.answer_id || @answer.id %>
<div class="row">
<div class="small-12 column">
<%= f.text_field :title %>
<%= f.text_field :url %>
<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 %>

View File

@@ -0,0 +1,9 @@
<%= back_link_to %>
<h2>
<%= t("admin.answers.videos.edit.title") %>
</h2>
<div class="poll-question-answer-video-form">
<%= render "form", form_url: admin_video_path(@video) %>
</div>

View File

@@ -0,0 +1,47 @@
<%= back_link_to admin_question_path(@answer.question_id) %>
<div class="clear"></div>
<h2 class="inline-block">
<%= t("admin.answers.videos.index.title") %>
</h2>
<%= link_to t("admin.answers.videos.index.add_video"),
new_admin_answer_video_path,
class: "button success float-right" %>
<div>
<table>
<thead>
<tr>
<th><%= t("admin.answers.videos.index.video_title") %></th>
<th><%= t("admin.answers.videos.index.video_url") %></th>
<th class="text-right">
<%= t("admin.actions.actions") %>
</th>
</tr>
</thead>
<tbody>
<% @answer.videos.each do |video| %>
<tr id="<%= dom_id(video) %>" class="poll_question_answer_video">
<td><%= video.title %></td>
<td><%= link_to "#{video.url}", video.url %></td>
<td class="text-right">
<%= link_to t("shared.edit"),
edit_admin_video_path(video),
class: "button hollow" %>
<%= link_to t("shared.delete"),
admin_video_path(video),
class: "button hollow alert",
method: :delete %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,9 @@
<%= back_link_to admin_answer_videos_path(@answer) %>
<h2>
<%= t('admin.answers.videos.new.title') %>
</h2>
<div class="poll-question-answer-video-form">
<%= render "form", form_url: admin_answer_videos_path %>
</div>

View File

@@ -24,13 +24,13 @@
<%= link_to @question.author.name, user_path(@question.author) %>
</p>
<table cellspacing="0" cellpadding="0">
<table>
<thead>
<tr>
<th colspan="1" scope="col">
<th>
<%= t('admin.questions.show.valid_answers') %>
</th>
<th colspan="2" scope="col">
<th colspan="2">
<%= link_to t("admin.questions.show.add_answer"),
new_admin_question_answer_path(@question),
class: "button hollow float-right" %>
@@ -38,9 +38,9 @@
</tr>
<tr>
<th scope="col"><%= t("admin.questions.show.answers.title") %></th>
<th scope="col"><%= t("admin.questions.show.answers.description") %></th>
<th scope="col"><%= t("admin.questions.show.answers.videos") %></th>
<th><%= t("admin.questions.show.answers.title") %></th>
<th><%= t("admin.questions.show.answers.description") %></th>
<th><%= t("admin.questions.show.answers.videos") %></th>
</tr>
</thead>
@@ -49,7 +49,9 @@
<tr id="<%= dom_id(answer) %>" class="poll_question_answer">
<td><%= answer.title %></td>
<td><%= answer.description %></td>
<td><%= link_to t("admin.questions.show.answers.video_list", count: 0), "#" %></td>
<td><%= link_to t("admin.questions.show.answers.video_list",
count: answer.videos.count),
admin_answer_videos_path(answer) %></td>
</tr>
<% end %>
</tbody>