This repository has been archived on 2024-08-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
redstoner.com/app/views/users/index.html.erb
MrYummy 44392c1df3 Added Searching Features
* Added Thread Search Feature

* Added User Search Feature

* Re-organized searching, added @mention support to author search
2017-05-29 00:10:58 +02:00

42 lines
1.4 KiB
Plaintext

<%= form_tag({controller: "users", action: "search_redirect"}, method: :post, style: "margin:0px;height:40px") do %>
<%= text_field_tag "search", nil, placeholder: "Search for a user", style: "margin:0px;height:40px;width:300px" %>
<%= submit_tag "Go", class: "btn blue", style: "margin:0px;height:40px;width:40px" %>
<%= hidden_field_tag "role", params[:role] %>
<% end %>
<h1>
<%
if params[:role] && !params[:badge]
text = "All '#{params[:role]}' users"
elsif params[:badge] && !params[:role]
text = "All '#{params[:badge]}' users"
elsif params[:role] && params[:badge]
text = "All '#{params[:role]}' and '#{params[:badge]}' users"
else
text = "All users"
end
text += " that contain '#{params[:search]}'" if params[:search]
%>
<%= title text %>
<% if params[:search] %>
(<%= @users.select {|u| u.name.downcase.include?(params[:search].downcase) || u.ign.downcase.include?(params[:search].downcase) }.size %>)
<% else %>
(<%= @count %>)
<% end %>
</h1>
<%= link_to "show all", users_path if params[:role] || params[:badge] %>
<div id="userlist">
<% @users.each do |u| %>
<div class="list-user">
<%= link_to(u.avatar(64), u) %>
<div class="detail">
<%= render partial: "users/username", locals: { user: u } %><br>
<i><%= u.ign %></i>
</div>
</div>
<% end %>
<%= paginate @users %>
</div>