aliases/implications: add » links to name fields.
Add » links to the antecedent and consequent name fields. These links let you find all tags aliased or implied to or from a given tag. For implications, this is a deep search (includes indirectly implied tags).
This commit is contained in:
@@ -48,6 +48,24 @@ class TagImplication < TagRelationship
|
||||
end
|
||||
end
|
||||
|
||||
concerning :SearchMethods do
|
||||
class_methods do
|
||||
def search(params)
|
||||
q = super
|
||||
|
||||
if params[:implied_from].present?
|
||||
q = q.where(id: ancestors_of(params[:implied_from]).select(:id))
|
||||
end
|
||||
|
||||
if params[:implied_to].present?
|
||||
q = q.where(id: descendants_of(params[:implied_to]).select(:id))
|
||||
end
|
||||
|
||||
q
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module ValidationMethods
|
||||
def absence_of_circular_relation
|
||||
return if is_rejected?
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
<%= table_for tag_aliases, width: "100%" do |t| %>
|
||||
<% t.column "From", width: "25%" do |tag_alias| %>
|
||||
<%= link_to tag_alias.antecedent_name, posts_path(tags: tag_alias.antecedent_name), class: tag_class(tag_alias.antecedent_tag) %>
|
||||
<%= link_to "»", tag_aliases_path(search: { antecedent_name_ilike: tag_alias.antecedent_name }) %>
|
||||
<span class="count"><%= tag_alias.antecedent_tag&.post_count.to_i %></span>
|
||||
<% end %>
|
||||
<% t.column "To", width: "25%" do |tag_alias| %>
|
||||
<%= link_to tag_alias.consequent_name, posts_path(tags: tag_alias.consequent_name), class: tag_class(tag_alias.consequent_tag) %>
|
||||
<%= link_to "»", tag_aliases_path(search: { consequent_name_ilike: tag_alias.consequent_name }) %>
|
||||
<span class="count"><%= tag_alias.consequent_tag&.post_count.to_i %></span>
|
||||
<% end %>
|
||||
<% t.column "Reference", width: "10%" do |tag_alias| %>
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
<%= table_for tag_implications, width: "100%" do |t| %>
|
||||
<% t.column "From", width: "25%" do |tag_implication| %>
|
||||
<%= link_to tag_implication.antecedent_name, posts_path(tags: tag_implication.antecedent_name), class: tag_class(tag_implication.antecedent_tag) %>
|
||||
<%= link_to "»", tag_implications_path(search: { implied_from: tag_implication.antecedent_name }) %>
|
||||
<span class="count"><%= tag_implication.antecedent_tag&.post_count.to_i %></span>
|
||||
<% end %>
|
||||
<% t.column "To", width: "25%" do |tag_implication| %>
|
||||
<%= link_to tag_implication.consequent_name, posts_path(tags: tag_implication.consequent_name), class: tag_class(tag_implication.consequent_tag) %>
|
||||
<%= link_to "»", tag_implications_path(search: { implied_to: tag_implication.consequent_name }) %>
|
||||
<span class="count"><%= tag_implication.consequent_tag&.post_count.to_i %></span>
|
||||
<% end %>
|
||||
<% t.column "Reference", width: "10%" do |tag_implication| %>
|
||||
<% t.column "Topic", width: "10%" do |tag_implication| %>
|
||||
<% if tag_implication.forum_topic_id %>
|
||||
<%= link_to tag_implication.forum_topic_id, forum_topic_path(tag_implication.forum_topic_id) %>
|
||||
<%= link_to "topic ##{tag_implication.forum_topic_id}", forum_topic_path(tag_implication.forum_topic_id) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% t.column "Approver", width: "15%" do |tag_implication| %>
|
||||
|
||||
Reference in New Issue
Block a user