mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-24 18:21:22 +00:00
Merged in changes from https://github.com/taekwonjoe01/ensl.org
This commit is contained in:
parent
40fc1b036d
commit
8cafeae030
9 changed files with 28 additions and 5 deletions
|
@ -27,6 +27,7 @@ class PostsController < ApplicationController
|
|||
if @post.save
|
||||
flash[:notice] = t(:posts_create)
|
||||
format.js { render }
|
||||
format.html { return_to }
|
||||
else
|
||||
format.html { render :new }
|
||||
end
|
||||
|
|
|
@ -66,8 +66,11 @@ class ServersController < ApplicationController
|
|||
|
||||
def destroy
|
||||
raise AccessError unless @server.can_destroy? cuser
|
||||
@server.destroy
|
||||
redirect_to(servers_url)
|
||||
|
||||
if @server.destroy
|
||||
flash[:notice] = t(:server_destroy)
|
||||
redirect_to servers_url
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -2,7 +2,7 @@ class TeamsController < ApplicationController
|
|||
before_filter :get_team, only: [:show, :edit, :update, :destroy, :recover]
|
||||
|
||||
def index
|
||||
@teams = Team.with_teamers_num(0).ordered
|
||||
@teams = Team.search(params[:search]).paginate(per_page: 40, page: params[:page]).with_teamers_num(0).ordered
|
||||
end
|
||||
|
||||
def show
|
||||
|
|
|
@ -88,6 +88,10 @@ class Team < ActiveRecord::Base
|
|||
founder.update_attribute :team_id, self.id
|
||||
end
|
||||
|
||||
def self.search(search)
|
||||
search ? where("LOWER(name) LIKE LOWER(?)", "%#{search}%") : scoped
|
||||
end
|
||||
|
||||
def destroy
|
||||
if matches.count > 0
|
||||
update_attribute :active, false
|
||||
|
|
|
@ -280,6 +280,6 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def self.search(search)
|
||||
search ? where('username LIKE ?', "%#{search}%") : scoped
|
||||
search ? where("LOWER(username) LIKE LOWER(?) OR steamid LIKE ?", "%#{search}%", "%#{search}%") : scoped
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
<% if @server.can_update? cuser %>
|
||||
<%= link_to 'Edit Server', edit_server_path(@server), class: 'button' %>
|
||||
<%= link_to 'Delete Server', @server, confirm: 'Are you sure?', method: :delete, class: 'button' %>
|
||||
<% if @server.domain == Server::DOMAIN_HLTV %>
|
||||
<%= link_to 'Default Record', action: "default", id: @server, class: 'button' %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,5 +1,17 @@
|
|||
<h1>Listing teams</h1>
|
||||
<p>Teams with no current members are not displayed.</p>
|
||||
<p>Search for teams by name:</p>
|
||||
|
||||
<%= form_tag(teams_path, method: 'get', class: 'square search') do %>
|
||||
<%= hidden_field_tag :direction, params[:direction] %>
|
||||
<%= hidden_field_tag :sort, params[:sort] %>
|
||||
<div class="fields query">
|
||||
<%= text_field_tag :search, params[:search] %>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<%= submit_tag "Search", name: nil %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div id="teams">
|
||||
<%= render partial: 'list', locals: { teams: @teams } %>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<h1>Listing Users</h1>
|
||||
<p>Search for users by name or Steam ID:</p>
|
||||
|
||||
<%= form_tag(users_path, method: 'get', class: 'square search') do %>
|
||||
<%= hidden_field_tag :direction, params[:direction] %>
|
||||
|
|
|
@ -64,7 +64,8 @@ en:
|
|||
predictions_create: "Prediction was successfully created."
|
||||
servers_updated: "Servers updated."
|
||||
servers_create: "Server was successfully created."
|
||||
servers_update: "Server was successfully update."
|
||||
servers_update: "Server was successfully updated."
|
||||
server_destroy: "Server was removed successfully."
|
||||
invalid_message: "Invalid message."
|
||||
sites_create: "Site was successfully created."
|
||||
sites_update: "Site was successfully updated."
|
||||
|
|
Loading…
Reference in a new issue