[Tags] Use template for MetaSearch relation tables

This commit is contained in:
faucet 2023-07-11 10:44:38 +01:00
parent 024f195858
commit 8b91156b97
No known key found for this signature in database

View File

@ -47,34 +47,7 @@
<% if @meta_search.tag_aliases.blank? %>
<p>No results</p>
<% else %>
<table class="striped">
<thead>
<tr>
<th>From</th>
<th>To</th>
<th></th>
</tr>
</thead>
<tbody>
<% @meta_search.tag_aliases.each do |tag_alias| %>
<tr>
<td><%= tag_alias.antecedent_name %></td>
<td><%= tag_alias.consequent_name %></td>
<td>
<%= link_to "Show", tag_alias_path(tag_alias) %>
<% if tag_alias.deletable_by?(CurrentUser.user) %>
| <%= link_to "Delete", tag_alias_path(tag_alias), :method => :delete, :data => {:confirm => "Are you sure you want to delete this alias?"} %>
<% end %>
<% if CurrentUser.is_admin? && tag_alias.is_pending? %>
| <%= link_to "Approve", approve_tag_alias_path(tag_alias), :method => :post %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= render "tag_relationships/listing", tag_relations: @meta_search.tag_aliases %>
<% end %>
</section>
@ -83,33 +56,7 @@
<% if @meta_search.tag_implications.blank? %>
<p>No results</p>
<% else %>
<table class="striped">
<thead>
<tr>
<th>From</th>
<th>To</th>
<th></th>
</tr>
</thead>
<tbody>
<% @meta_search.tag_implications.each do |tag_implication| %>
<tr>
<td><%= tag_implication.antecedent_name %></td>
<td><%= tag_implication.consequent_name %></td>
<td>
<%= link_to "Show", tag_implication_path(tag_implication) %>
<% if tag_implication.deletable_by?(CurrentUser.user) %>
| <%= link_to "Delete", tag_implication_path(tag_implication), :method => :delete, :data => {:confirm => "Are you sure you want to delete this implication?"} %>
<% end %>
<% if CurrentUser.user.is_admin? && tag_implication.is_pending? %>
| <%= link_to "Approve", approve_tag_implication_path(tag_implication), :method => :post %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= render "tag_relationships/listing", tag_relations: @meta_search.tag_implications %>
<% end %>
</section>
</div>