Put button to add content next to its related form
This way the relationship between the two elements is more obvious. And since now the button and the form are siblings, it's easier to find one based on the other using CSS or JavaScript.
This commit is contained in:
@@ -2462,6 +2462,7 @@ table {
|
|||||||
|
|
||||||
.add-related-content {
|
.add-related-content {
|
||||||
display: block;
|
display: block;
|
||||||
|
margin-bottom: $line-height;
|
||||||
|
|
||||||
@include breakpoint(medium) {
|
@include breakpoint(medium) {
|
||||||
float: right;
|
float: right;
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
<button type="button" data-toggle="related_content" class="add-related-content">
|
||||||
|
<%= t("related_content.add") %>
|
||||||
|
</button>
|
||||||
|
|
||||||
<%= form_tag related_contents_path, method: :post, id: "related_content", class: "hide", "data-toggler": ".hide" do %>
|
<%= form_tag related_contents_path, method: :post, id: "related_content", class: "hide", "data-toggler": ".hide" do %>
|
||||||
<label><%= t("related_content.label") %></label>
|
<label><%= t("related_content.label") %></label>
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,8 @@
|
|||||||
<div class="related-content padding">
|
<div class="related-content padding">
|
||||||
|
|
||||||
<div class="margin-bottom">
|
<h2 class="inline-block">
|
||||||
<h2 class="inline-block">
|
<%= t("related_content.title") %> <span>(<%= relationable.relationed_contents.count %>)</span>
|
||||||
<%= t("related_content.title") %> <span>(<%= relationable.relationed_contents.count %>)</span>
|
</h2>
|
||||||
</h2>
|
|
||||||
<% if current_user %>
|
|
||||||
<button type="button" data-toggle="related_content" class="add-related-content">
|
|
||||||
<%= t("related_content.add") %>
|
|
||||||
</button>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% if current_user %>
|
<% if current_user %>
|
||||||
<%= render "relationable/form", relationable: relationable %>
|
<%= render "relationable/form", relationable: relationable %>
|
||||||
|
|||||||
Reference in New Issue
Block a user