Extract partial to render flag actions

The main obstacle to extract this partial was probably the paths for the
flag and unflag actions.

Now that we use Rails 5.1 `resolve` method to handle nested resources,
we can use `polymorphic_path`.

Also note the code is a bit ugly because comments render a divider. We
should probably use a CSS border instead.

Co-Authored-By: taitus <sebastia.roig@gmail.com>
This commit is contained in:
Javi Martín
2020-03-20 19:58:17 +01:00
parent bd7beed8a1
commit 31b65679c3
17 changed files with 39 additions and 119 deletions

View File

@@ -21,8 +21,8 @@
<%= link_to t("debates.show.comments", count: @debate.comments_count), "#comments" %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="js-flag-actions">
<%= render "debates/flag_actions", debate: @debate %>
</span>
<%= render "shared/flag_actions", flaggable: @debate %>
</span>
</div>
<%= auto_link_already_sanitized_html wysiwyg(@debate.description) %>