scinote-web/app/views/search/results/partials/_result_text.html.erb

35 lines
1 KiB
Plaintext
Raw Normal View History

2016-07-28 19:29:26 +08:00
<% target = nil if local_assigns[:target].nil? %>
2016-02-12 23:52:43 +08:00
<% query ||= nil %>
2016-07-21 19:11:15 +08:00
<% text = query.present? ? highlight(result.name, query.strip.split(/\s+/)) : result.name %>
2016-02-12 23:52:43 +08:00
<% if result.archived? %>
<span class="label label-warning"><%=t "search.index.archived" %></span>
<% if can_view_module_archive(result.my_module) %>
2016-07-21 19:11:15 +08:00
<% if target == :comment %>
<%= link_to archive_my_module_path(result.my_module, ctarget: "result-panel-#{result.id}") do %>
<%= text %>
<% end %>
<% else %>
2016-02-12 23:52:43 +08:00
<a href="<%= archive_my_module_path(result.my_module) %>">
<%= text %>
</a>
2016-07-21 19:11:15 +08:00
<% end %>
2016-02-12 23:52:43 +08:00
<% else %>
<%= text %>
<% end %>
<% else %>
<% if can_view_results_in_module(result.my_module) %>
2016-07-21 19:11:15 +08:00
<% if target == :comment %>
<%= link_to results_my_module_path(result.my_module, ctarget: "result-panel-#{result.id}") do %>
<%= text %>
<% end %>
<% else %>
2016-02-12 23:52:43 +08:00
<a href="<%= results_my_module_path(result.my_module) %>">
<%= text %>
</a>
2016-07-21 19:11:15 +08:00
<% end %>
2016-02-12 23:52:43 +08:00
<% else %>
<%= text %>
<% end %>
2016-07-21 19:11:15 +08:00
<% end %>