mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-24 03:21:17 +00:00
Fixed formatting and ruby hash syntax
This commit is contained in:
parent
ed43a36e9d
commit
e7c39a4673
42 changed files with 170 additions and 166 deletions
1
Gemfile
1
Gemfile
|
@ -38,6 +38,7 @@ group :development do
|
|||
gem 'capistrano-rails', '~> 1.1'
|
||||
gem 'capistrano3-unicorn', '~> 0.1.1'
|
||||
gem 'annotate', '~> 2.6.2'
|
||||
gem 'quiet_assets'
|
||||
end
|
||||
|
||||
group :test do
|
||||
|
|
|
@ -147,6 +147,8 @@ GEM
|
|||
pry-debugger (0.2.2)
|
||||
debugger (~> 1.3)
|
||||
pry (~> 0.9.10)
|
||||
quiet_assets (1.0.2)
|
||||
railties (>= 3.1, < 5.0)
|
||||
rack (1.4.5)
|
||||
rack-cache (1.2)
|
||||
rack (>= 0.4)
|
||||
|
@ -275,6 +277,7 @@ DEPENDENCIES
|
|||
oj (~> 2.5.5)
|
||||
poltergeist (~> 1.5.0)
|
||||
pry-debugger (~> 0.2.2)
|
||||
quiet_assets
|
||||
rails (~> 3.2.17)
|
||||
rmagick (~> 2.13.2)
|
||||
rspec-rails (~> 2.14.1)
|
||||
|
|
|
@ -64,5 +64,5 @@ Create the `.env` file with the appropriate credentials.
|
|||
# Deployment
|
||||
|
||||
Use capistrano to deploy:
|
||||
|
||||
|
||||
bundle exec cap production deploy
|
|
@ -1,3 +1,3 @@
|
|||
class Api::V1::BaseController < ActionController::Base
|
||||
respond_to :json
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,4 +2,4 @@ class Api::V1::UsersController < Api::V1::BaseController
|
|||
def index
|
||||
respond_with Api::V1::UsersCollection.as_json
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class ArticlesController < ApplicationController
|
||||
before_filter :get_article, :only => [:show, :edit, :update, :cleanup, :destroy]
|
||||
before_filter :get_article, only: [:show, :edit, :update, :cleanup, :destroy]
|
||||
|
||||
def index
|
||||
@categories = Category.ordered.nospecial.domain Category::DOMAIN_ARTICLES
|
||||
|
@ -49,7 +49,7 @@ class ArticlesController < ApplicationController
|
|||
flash[:notice] = t(:articles_create)
|
||||
redirect_to @article
|
||||
else
|
||||
render :action => "new"
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -59,7 +59,7 @@ class ArticlesController < ApplicationController
|
|||
flash[:notice] = t(:articles_update)
|
||||
redirect_to @article
|
||||
else
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class BansController < ApplicationController
|
||||
before_filter :get_ban, :only => [:show, :edit, :update, :destroy]
|
||||
before_filter :get_ban, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@bans = Ban.ordered
|
||||
|
@ -29,7 +29,7 @@ class BansController < ApplicationController
|
|||
flash[:notice] = t(:bans_create)
|
||||
redirect_to(@ban)
|
||||
else
|
||||
render :action => "new"
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -39,7 +39,7 @@ class BansController < ApplicationController
|
|||
flash[:notice] = t(:bans_update)
|
||||
redirect_to(@ban)
|
||||
else
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class BracketsController < ApplicationController
|
||||
before_filter :get_bracket, :only => [:show, :edit, :update, :destroy]
|
||||
before_filter :get_bracket, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def edit
|
||||
raise AccessError unless @bracket.can_update? cuser
|
||||
|
@ -23,7 +23,7 @@ class BracketsController < ApplicationController
|
|||
flash[:notice] = t(:brackets_update)
|
||||
end
|
||||
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
class CategoriesController < ApplicationController
|
||||
before_filter :get_category, :except => [:index, :new, :create]
|
||||
before_filter :get_category, except: [:index, :new, :create]
|
||||
|
||||
def show
|
||||
if [Category::DOMAIN_ARTICLES, Category::DOMAIN_NEWS].include? @category.domain
|
||||
@articles = Article.with_comments.ordered.limited.nodrafts.category params[:id]
|
||||
Category.find(params[:id]).read_by! cuser if cuser
|
||||
render :partial => "articles/article", :collection => @articles.to_a
|
||||
render partial: 'articles/article', collection: @articles.to_a
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class ChallengesController < ApplicationController
|
||||
before_filter :get_challenge, :only => ['show', 'edit', 'update', 'destroy']
|
||||
before_filter :get_challenge, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@challenges = Challenge.all
|
||||
|
@ -14,7 +14,7 @@ class ChallengesController < ApplicationController
|
|||
c.destroy
|
||||
end
|
||||
|
||||
render :text => t(:challenges_cleared)
|
||||
render text: t(:challenges_cleared)
|
||||
end
|
||||
|
||||
def new
|
||||
|
@ -34,7 +34,7 @@ class ChallengesController < ApplicationController
|
|||
flash[:notice] = t(:challenges_create)
|
||||
redirect_to @challenge
|
||||
else
|
||||
render :action => "new"
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -56,7 +56,7 @@ class ChallengesController < ApplicationController
|
|||
flash[:notice] = t(:challenges_update)
|
||||
end
|
||||
|
||||
render :action => "show"
|
||||
render :show
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class CommentsController < ApplicationController
|
||||
before_filter :get_comment, :only => [:raw, 'edit', 'update', 'destroy']
|
||||
before_filter :get_comment, only: [:raw, :edit, :update, :destroy]
|
||||
respond_to :html, :js
|
||||
|
||||
def index
|
||||
|
@ -7,8 +7,8 @@ class CommentsController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
@comments = Comment.recent5.all :conditions => {:commentable_id => params[:id2], :commentable_type => params[:id]}
|
||||
render :partial => 'list', :layout => false
|
||||
@comments = Comment.recent5.all conditions: {commentable_id: params[:id2], commentable_type: params[:id]}
|
||||
render partial: 'list', layout: false
|
||||
end
|
||||
|
||||
def edit
|
||||
|
@ -23,7 +23,7 @@ class CommentsController < ApplicationController
|
|||
respond_to do |format|
|
||||
if @comment.save
|
||||
flash[:notice] = t(:comments_create)
|
||||
format.js { render }
|
||||
format.js { render }
|
||||
else
|
||||
flash[:error] = t(:comments_invalid) + @comment.errors.full_messages.to_s
|
||||
format.html { redirect_to(:back)}
|
||||
|
@ -37,7 +37,7 @@ class CommentsController < ApplicationController
|
|||
flash[:notice] = t(:comments_update)
|
||||
return_to
|
||||
else
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class ContestersController < ApplicationController
|
||||
before_filter :get_contester, :only => ['show', 'edit', 'update', :recover, :destroy, :recalc]
|
||||
before_filter :get_contester, only: [:show, :edit, :update, :recover, :destroy, :recalc]
|
||||
|
||||
def show
|
||||
@matches = Match.future.unfinished.ordered.of_contester @contester
|
||||
|
@ -38,7 +38,7 @@ class ContestersController < ApplicationController
|
|||
flash[:notice] = t(:contests_contester_update)
|
||||
redirect_to @contester
|
||||
else
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
class ContestsController < ApplicationController
|
||||
before_filter :get_contest, :only => ['show', 'edit', 'update', 'destroy', 'del_map', 'scores', 'recalc']
|
||||
before_filter :get_contest, only: [:show, :edit, :update, :destroy, :del_map, :scores, :recalc]
|
||||
|
||||
def index
|
||||
#@contests = Contest.all
|
||||
# @contests = Contest.all
|
||||
@contests_active = Contest.active
|
||||
@contests_inactive = Contest.inactive
|
||||
end
|
||||
|
@ -60,7 +60,7 @@ class ContestsController < ApplicationController
|
|||
flash[:notice] = t(:contests_create)
|
||||
redirect_to @contest
|
||||
else
|
||||
render :action => "new"
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -71,11 +71,11 @@ class ContestsController < ApplicationController
|
|||
flash[:notice] = t(:contests_update)
|
||||
redirect_to @contest
|
||||
else
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
elsif params[:commit] == "Add map"
|
||||
@contest.maps << Map.find(params[:map])
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
elsif params[:commit] == "Add team"
|
||||
contester = Contester.new
|
||||
contester.team = Team.find params[:team]
|
||||
|
@ -86,14 +86,14 @@ class ContestsController < ApplicationController
|
|||
else
|
||||
@contest.errors.add_to_base contester.errors.full_messages.to_s
|
||||
end
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def del_map
|
||||
raise AccessError unless @contest.can_update? cuser
|
||||
@contest.maps.delete(Map.find(params[:id2]))
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class DataFilesController < ApplicationController
|
||||
before_filter :get_file, :only => ['show', 'edit', 'update', 'destroy', 'rate', :addFile, :delFile]
|
||||
before_filter :get_file, only: [:show, :edit, :update, :destroy, :rate, :addFile, :delFile]
|
||||
|
||||
def show
|
||||
end
|
||||
|
@ -41,7 +41,7 @@ class DataFilesController < ApplicationController
|
|||
redirect_to @file
|
||||
end
|
||||
else
|
||||
render :action => "new"
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -51,7 +51,7 @@ class DataFilesController < ApplicationController
|
|||
flash[:notice] = t(:files_update)
|
||||
redirect_to(@file)
|
||||
else
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -94,7 +94,7 @@ class DataFilesController < ApplicationController
|
|||
@result << file.to_s + "<br />"
|
||||
end
|
||||
end
|
||||
render :text => @result, :layout => true
|
||||
render text: @result, layout: true
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
class DirectoriesController < ApplicationController
|
||||
before_filter :get_directory, :except => [:new, :create]
|
||||
before_filter :get_directory, except: [:new, :create]
|
||||
|
||||
def show
|
||||
if @directory.hidden
|
||||
@files = @directory.files
|
||||
render :partial => "data_files/list", :layout => true
|
||||
render partial: 'data_files/list', layout: true
|
||||
else
|
||||
@directories = Directory.ordered.filtered.all :conditions => {:parent_id => 1}
|
||||
@directories = Directory.ordered.filtered.all conditions: { parent_id: 1 }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ class DirectoriesController < ApplicationController
|
|||
|
||||
def refresh
|
||||
@directory.process_dir
|
||||
render :text => t(:directories_update)
|
||||
render text: t(:directories_update)
|
||||
end
|
||||
|
||||
def create
|
||||
|
@ -33,7 +33,7 @@ class DirectoriesController < ApplicationController
|
|||
flash[:notice] = t(:directories_create)
|
||||
redirect_to(@directory)
|
||||
else
|
||||
render :action => "new"
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -43,7 +43,7 @@ class DirectoriesController < ApplicationController
|
|||
flash[:notice] = t(:directories_update)
|
||||
redirect_to @directory
|
||||
else
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class ForumsController < ApplicationController
|
||||
before_filter :get_forum, :only => [:show, :edit, :update, :up, :down, :destroy]
|
||||
before_filter :get_forum, only: [:show, :edit, :update, :up, :down, :destroy]
|
||||
|
||||
def index
|
||||
@categories = Category.domain(Category::DOMAIN_FORUMS).ordered
|
||||
|
@ -30,7 +30,7 @@ class ForumsController < ApplicationController
|
|||
flash[:notice] = t(:forums_create)
|
||||
redirect_to(@forum)
|
||||
else
|
||||
render :action => "new"
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -40,7 +40,7 @@ class ForumsController < ApplicationController
|
|||
flash[:notice] = t(:forums_update)
|
||||
redirect_to(@forum)
|
||||
else
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class GatherersController < ApplicationController
|
||||
before_filter :get_gatherer, :except => [:create]
|
||||
before_filter :get_gatherer, except: [:create]
|
||||
|
||||
def create
|
||||
Gather.transaction do
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class GathersController < ApplicationController
|
||||
before_filter :get_gather, :except => [:latest, :index, :create]
|
||||
before_filter :get_gather, except: [:latest, :index, :create]
|
||||
respond_to :html, :js
|
||||
|
||||
def index
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class GroupsController < ApplicationController
|
||||
before_filter :get_group, :except => [:index, :new, :create]
|
||||
before_filter :get_group, except: [:index, :new, :create]
|
||||
|
||||
def index
|
||||
@groups = Group.all
|
||||
|
@ -26,7 +26,7 @@ class GroupsController < ApplicationController
|
|||
flash[:notice] = t(:groups_create)
|
||||
redirect_to @group
|
||||
else
|
||||
render :action => "new"
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -36,7 +36,7 @@ class GroupsController < ApplicationController
|
|||
flash[:notice] = t(:groups_update)
|
||||
redirect_to @group
|
||||
else
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -47,12 +47,12 @@ class GroupsController < ApplicationController
|
|||
end
|
||||
|
||||
def addUser
|
||||
@user = User.first :conditions => {:username => params[:username]}
|
||||
@user = User.first conditions: {username: params[:username]}
|
||||
raise AccessError unless @group.can_update? cuser
|
||||
raise Error, t(:duplicate_user) if @group.users.include? @user
|
||||
|
||||
@group.users << @user if @user
|
||||
redirect_to edit_group_url(@group, :groupTab => "groupTabMembers")
|
||||
redirect_to edit_group_url(@group, groupTab: "groupTabMembers")
|
||||
end
|
||||
|
||||
def delUser
|
||||
|
@ -60,7 +60,7 @@ class GroupsController < ApplicationController
|
|||
raise AccessError unless @group.can_update? cuser
|
||||
|
||||
@group.users.delete @user
|
||||
redirect_to edit_group_url(@group, :groupTab => "groupTabMembers")
|
||||
redirect_to edit_group_url(@group, groupTab: "groupTabMembers")
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class IssuesController < ApplicationController
|
||||
before_filter :get_issue, :only => [:show, :edit, :update, :destroy]
|
||||
before_filter :get_issue, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
raise AccessError unless cuser and cuser.admin?
|
||||
|
@ -12,9 +12,9 @@ class IssuesController < ApplicationController
|
|||
else "created_at DESC"
|
||||
end
|
||||
|
||||
@open = Issue.with_status(Issue::STATUS_OPEN).all :order => sort
|
||||
@solved = Issue.with_status(Issue::STATUS_SOLVED).all :order => sort
|
||||
@rejected = Issue.with_status(Issue::STATUS_REJECTED).all :order => sort
|
||||
@open = Issue.with_status(Issue::STATUS_OPEN).all order: sort
|
||||
@solved = Issue.with_status(Issue::STATUS_SOLVED).all order: sort
|
||||
@rejected = Issue.with_status(Issue::STATUS_REJECTED).all order: sort
|
||||
end
|
||||
|
||||
def show
|
||||
|
@ -44,7 +44,7 @@ class IssuesController < ApplicationController
|
|||
redirect_to_home
|
||||
end
|
||||
else
|
||||
render :action => "new"
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -54,7 +54,7 @@ class IssuesController < ApplicationController
|
|||
flash[:notice] = t(:issues_update)
|
||||
redirect_to(@issue)
|
||||
else
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ class LogEventsController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @log_events }
|
||||
format.xml { render xml: @log_events }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -17,7 +17,7 @@ class LogEventsController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @log_event }
|
||||
format.xml { render xml: @log_event }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -28,7 +28,7 @@ class LogEventsController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @log_event }
|
||||
format.xml { render xml: @log_event }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -46,10 +46,10 @@ class LogEventsController < ApplicationController
|
|||
if @log_event.save
|
||||
flash[:notice] = t(:logevent_create)
|
||||
format.html { redirect_to(@log_event) }
|
||||
format.xml { render :xml => @log_event, :status => :created, :location => @log_event }
|
||||
format.xml { render xml: @log_event, :status => :created, :location => @log_event }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @log_event.errors, :status => :unprocessable_entity }
|
||||
format.html { render :new }
|
||||
format.xml { render xml: @log_event.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -65,8 +65,8 @@ class LogEventsController < ApplicationController
|
|||
format.html { redirect_to(@log_event) }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @log_event.errors, :status => :unprocessable_entity }
|
||||
format.html { render :edit }
|
||||
format.xml { render xml: @log_event.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
class LogFilesController < ApplicationController
|
||||
def index
|
||||
LogFile.process
|
||||
render :text => "Ok"
|
||||
render text: 'Ok'
|
||||
end
|
||||
|
||||
def handle
|
||||
LogFile.find(params[:id]).deal
|
||||
render :text => "Ok"
|
||||
render text: 'Ok'
|
||||
end
|
||||
|
||||
def refresh
|
||||
|
@ -16,9 +16,9 @@ class LogFilesController < ApplicationController
|
|||
end
|
||||
|
||||
def fix
|
||||
Rounder.find_in_batches(:batch_size => 100) do |rounders|
|
||||
Rounder.find_in_batches(batch_size: 100) do |rounders|
|
||||
rounders.each do |r|
|
||||
r.team_id = nil
|
||||
r.team_id = nil
|
||||
if r.user and t = Teamer.historic(r.user, r.round.start).first
|
||||
r.team_id = t.team_id
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class MapsController < ApplicationController
|
||||
before_filter :get_map, :only => [:show, :edit, :update, :destroy]
|
||||
before_filter :get_map, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@maps = Map.basic
|
||||
|
@ -25,7 +25,7 @@ class MapsController < ApplicationController
|
|||
flash[:notice] = t(:maps_create)
|
||||
redirect_to @map
|
||||
else
|
||||
render :action => "new"
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -35,7 +35,7 @@ class MapsController < ApplicationController
|
|||
flash[:notice] = t(:maps_update)
|
||||
redirect_to @map
|
||||
else
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
class MatchesController < ApplicationController
|
||||
before_filter :get_match, :except => [:index, :new, :create]
|
||||
before_filter :get_match, except: [:index, :new, :create]
|
||||
|
||||
def index
|
||||
@matches = Match.active
|
||||
end
|
||||
|
||||
def show
|
||||
@ownpred = @match.predictions.first :conditions => {:user_id => cuser.id} if cuser
|
||||
@ownpred = @match.predictions.first conditions: {user_id: cuser.id} if cuser
|
||||
@newpred = @match.predictions.build
|
||||
end
|
||||
|
||||
|
@ -40,9 +40,9 @@ class MatchesController < ApplicationController
|
|||
|
||||
if @match.save
|
||||
flash[:notice] = t(:matches_create)
|
||||
redirect_to :controller => "contests", :action => "edit", :id => @match.contest
|
||||
redirect_to controller: 'contests', action: 'edit', id: @match.contest
|
||||
else
|
||||
render :action => "new"
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -69,7 +69,7 @@ class MatchesController < ApplicationController
|
|||
end
|
||||
end
|
||||
else
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -88,13 +88,13 @@ class MatchesController < ApplicationController
|
|||
@match.hltv_stop
|
||||
flash[:notice] = t(:hltv_stopped)
|
||||
end
|
||||
redirect_to :action => "show"
|
||||
redirect_to action: 'show'
|
||||
end
|
||||
|
||||
def destroy
|
||||
raise AccessError unless @match.can_destroy? cuser
|
||||
@match.destroy
|
||||
redirect_to :controller => "contests", :action => "edit", :id => @match.contest
|
||||
redirect_to controller: 'contests', action: 'edit', id: @match.contest
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class MessagesController < ApplicationController
|
||||
before_filter :get_message, :only => [:show, :edit, :update, :destroy]
|
||||
before_filter :get_message, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
raise AccessError unless cuser
|
||||
|
@ -37,7 +37,7 @@ class MessagesController < ApplicationController
|
|||
flash[:notice] = t(:message_create)
|
||||
redirect_to(@message)
|
||||
else
|
||||
render :action => "new"
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class MoviesController < ApplicationController
|
||||
before_filter :get_movie, :except => [:index, :new, :create]
|
||||
before_filter :get_movie, except: [:index, :new, :create]
|
||||
|
||||
def index
|
||||
@movies = []
|
||||
|
@ -48,7 +48,7 @@ class MoviesController < ApplicationController
|
|||
flash[:notice] = t(:movies_create)
|
||||
redirect_to(@movie)
|
||||
else
|
||||
render :action => "new"
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -59,7 +59,7 @@ class MoviesController < ApplicationController
|
|||
flash[:notice] = t(:movies_update)
|
||||
redirect_to(@movie)
|
||||
else
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -67,20 +67,20 @@ class MoviesController < ApplicationController
|
|||
raise AccessError unless @movie.can_update? cuser
|
||||
x = params[:x].to_i <= 1280 ? params[:x].to_i : 800
|
||||
y = params[:y].to_i <= 720 ? params[:y].to_i : 600
|
||||
render :text => t(:executed) + "<br />" + @movie.make_preview(x, y), :layout => true
|
||||
render text: t(:executed) + "<br />" + @movie.make_preview(x, y), layout: true
|
||||
end
|
||||
|
||||
def snapshot
|
||||
raise AccessError unless @movie.can_update? cuser
|
||||
secs = params[:secs].to_i > 0 ? params[:secs].to_i : 5
|
||||
render :text => t(:executed) + "<br />" + @movie.make_snapshot(secs), :layout => true
|
||||
render text: t(:executed) + "<br />" + @movie.make_snapshot(secs), layout: true
|
||||
end
|
||||
|
||||
def download
|
||||
raise AccessError unless cuser.admin?
|
||||
@movie.stream_ip = params[:ip]
|
||||
@movie.stream_port = params[:port]
|
||||
render :text => t(:executed) + "<br />" + @movie.make_stream, :layout => true
|
||||
render text: t(:executed) + "<br />" + @movie.make_stream, layout: true
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class PollsController < ApplicationController
|
||||
before_filter :get_poll, :except => [:index, :new, :create]
|
||||
before_filter :get_poll, except: [:index, :new, :create]
|
||||
respond_to :js
|
||||
|
||||
def add
|
||||
|
@ -14,7 +14,7 @@ class PollsController < ApplicationController
|
|||
flash[:notice] = t(:polls_create)
|
||||
redirect_to @poll
|
||||
else
|
||||
render :action => "new"
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -25,7 +25,7 @@ class PollsController < ApplicationController
|
|||
flash[:notice] = t(:polls_update)
|
||||
redirect_to @poll
|
||||
else
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class PollsController < ApplicationController
|
||||
before_filter :get_poll, :except => [:index, :new, :create]
|
||||
before_filter :get_poll, except: [:index, :new, :create]
|
||||
|
||||
def index
|
||||
@polls = Poll.all
|
||||
|
@ -27,7 +27,7 @@ class PollsController < ApplicationController
|
|||
flash[:notice] = t(:polls_create)
|
||||
redirect_to @poll
|
||||
else
|
||||
render :action => "new"
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -38,7 +38,7 @@ class PollsController < ApplicationController
|
|||
flash[:notice] = t(:polls_update)
|
||||
redirect_to @poll
|
||||
else
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class PostsController < ApplicationController
|
||||
before_filter :get_post, :except => [:new, :create]
|
||||
before_filter :get_post, except: [:new, :create]
|
||||
respond_to :html, :js
|
||||
|
||||
def quote
|
||||
|
@ -10,12 +10,12 @@ class PostsController < ApplicationController
|
|||
@post = Post.new
|
||||
@post.topic = Topic.find(params[:id])
|
||||
raise AccessError unless @post.can_create? cuser
|
||||
render :layout => "forums"
|
||||
render layout: 'forums'
|
||||
end
|
||||
|
||||
def edit
|
||||
raise AccessError unless @post.can_update? cuser
|
||||
render :layout => "forums"
|
||||
render layout: 'forums'
|
||||
end
|
||||
|
||||
def create
|
||||
|
@ -40,7 +40,7 @@ class PostsController < ApplicationController
|
|||
flash[:notice] = t(:posts_update)
|
||||
redirect_to @post.topic
|
||||
else
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -10,12 +10,12 @@ class RoundsController < ApplicationController
|
|||
end
|
||||
|
||||
@rounds = Round.basic.paginate \
|
||||
:order => sort,
|
||||
:page => params[:page],
|
||||
:per_page => 30
|
||||
order: sort,
|
||||
page: params[:page],
|
||||
per_page: 30
|
||||
|
||||
if params[:ajax]
|
||||
render :partial => "list", :layout => false
|
||||
render partial: 'list', layout: false
|
||||
return
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class ServersController < ApplicationController
|
||||
before_filter :get_server, :except => [:index, :refresh, :new, :create]
|
||||
before_filter :get_server, except: [:index, :refresh, :new, :create]
|
||||
|
||||
def refresh
|
||||
Server.refresh
|
||||
|
@ -30,7 +30,7 @@ class ServersController < ApplicationController
|
|||
raise AccessError unless @server.can_update? cuser
|
||||
|
||||
if request.xhr?
|
||||
render :partial => "response", :layout => false
|
||||
render partial: 'response', layout: false
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -43,7 +43,7 @@ class ServersController < ApplicationController
|
|||
flash[:notice] = t(:server_create)
|
||||
redirect_to @server
|
||||
else
|
||||
render :action => "new"
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -54,14 +54,14 @@ class ServersController < ApplicationController
|
|||
flash[:notice] = t(:server_update)
|
||||
redirect_to @server
|
||||
else
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def default
|
||||
raise AccessError unless @server.can_update? cuser
|
||||
@server.default_record
|
||||
render :text => "Ok"
|
||||
render text: 'Ok'
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class TeamsController < ApplicationController
|
||||
before_filter :get_team, :only => ['show', 'edit', 'update', 'destroy', 'recover']
|
||||
before_filter :get_team, only: [:show, :edit, :update, :destroy, :recover]
|
||||
|
||||
def index
|
||||
@teams = Team.with_teamers_num(0).ordered
|
||||
|
@ -26,7 +26,7 @@ class TeamsController < ApplicationController
|
|||
flash[:notice] = t(:teams_create)
|
||||
redirect_to @team
|
||||
else
|
||||
render :action => "new"
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -48,7 +48,7 @@ class TeamsController < ApplicationController
|
|||
flash[:notice] = t(:teams_update)
|
||||
redirect_to edit_team_path(@team)
|
||||
else
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
class TopicsController < ApplicationController
|
||||
before_filter :get_topic, :only => [:show, :reply, :edit, :update, :destroy]
|
||||
before_filter :get_topic, only: [:show, :reply, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
render :partial => true, :locals => {:page => params[:p].to_i}
|
||||
render partial: true, locals: {page: params[:p].to_i}
|
||||
end
|
||||
|
||||
def show
|
||||
raise AccessError unless @topic.can_show? cuser
|
||||
@posts = @topic.posts.basic.paginate(:page => params[:page],
|
||||
@posts = @topic.posts.basic.paginate(:page => params[:page],
|
||||
:per_page => Topic::POSTS_PAGE)
|
||||
|
||||
return_here
|
||||
|
@ -18,16 +18,16 @@ class TopicsController < ApplicationController
|
|||
@newpost.topic = @topic
|
||||
@newpost.user = cuser
|
||||
@lock = (@topic.lock ? @topic.lock : Lock.new(:lockable => @topic))
|
||||
render :layout => "forums"
|
||||
render layout: 'forums'
|
||||
end
|
||||
|
||||
def reply
|
||||
@post = @topic.posts.build
|
||||
raise AccessError unless @post.can_create? cuser
|
||||
if request.xhr?
|
||||
render "quickreply", :layout => false
|
||||
render 'quickreply', layout: false
|
||||
else
|
||||
render :layout => "forums"
|
||||
render layout: 'forums'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -35,12 +35,12 @@ class TopicsController < ApplicationController
|
|||
@topic = Topic.new
|
||||
@topic.forum = Forum.find(params[:id])
|
||||
raise AccessError unless @topic.can_create? cuser
|
||||
render :layout => "forums"
|
||||
render layout: 'forums'
|
||||
end
|
||||
|
||||
def edit
|
||||
raise AccessError unless @topic.can_update? cuser
|
||||
render :layout => "forums"
|
||||
render layout: 'forums'
|
||||
end
|
||||
|
||||
def create
|
||||
|
@ -52,7 +52,7 @@ class TopicsController < ApplicationController
|
|||
flash[:notice] = t(:topics_create)
|
||||
redirect_to(@topic)
|
||||
else
|
||||
render :action => "new"
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -62,7 +62,7 @@ class TopicsController < ApplicationController
|
|||
flash[:notice] = t(:topics_update)
|
||||
redirect_to(@topic)
|
||||
else
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'open-uri'
|
|||
|
||||
class TweetsController < ApplicationController
|
||||
def index
|
||||
@tweets = Tweet.all :order => "created_at DESC"
|
||||
@tweets = Tweet.all order: "created_at DESC"
|
||||
@nobody = true
|
||||
end
|
||||
|
||||
|
@ -24,6 +24,6 @@ class TweetsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
render :text => t(:tweets_refresh)
|
||||
render text: t(:tweets_refresh)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
class UsersController < ApplicationController
|
||||
before_filter :get_user, :only => [:show, :history, :popup, :agenda, :edit, :update, :destroy]
|
||||
before_filter :get_user, only: [:show, :history, :popup, :agenda, :edit, :update, :destroy]
|
||||
respond_to :html, :js
|
||||
|
||||
def index
|
||||
@users = User.search(params[:search]).paginate(:per_page => 40, :page => params[:page])
|
||||
@users = User.search(params[:search]).paginate(per_page: 40, page: params[:page])
|
||||
end
|
||||
|
||||
def show
|
||||
|
@ -29,7 +29,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def popup
|
||||
render :layout => false
|
||||
render layout: false
|
||||
end
|
||||
|
||||
def new
|
||||
|
@ -54,10 +54,10 @@ class UsersController < ApplicationController
|
|||
@user.profile = Profile.new
|
||||
@user.profile.user = @user
|
||||
@user.profile.save()
|
||||
redirect_to :action => :show, :id => @user.id
|
||||
redirect_to action: :show, id: @user.id
|
||||
save_session @user
|
||||
else
|
||||
render :action => "new"
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -67,7 +67,7 @@ class UsersController < ApplicationController
|
|||
flash[:notice] = t(:users_update)
|
||||
redirect_to_back
|
||||
else
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@ class VersionsController < ApplicationController
|
|||
|
||||
def index
|
||||
@versions = @article.versions
|
||||
render "articles/history"
|
||||
render 'articles/history'
|
||||
end
|
||||
|
||||
def show
|
||||
@version = @article.versions.find params[:id]
|
||||
@nobody = true
|
||||
render "articles/version"
|
||||
render 'articles/version'
|
||||
end
|
||||
|
||||
def update
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class VotesController < ApplicationController
|
||||
def create
|
||||
@vote = Vote.new params[:vote]
|
||||
@vote = Vote.new(params[:vote])
|
||||
@vote.user = cuser
|
||||
raise AccessError unless @vote.can_create? cuser
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
class WeeksController < ApplicationController
|
||||
before_filter :get_week, :except => [:new, :create]
|
||||
before_filter :get_week, except: [:new, :create]
|
||||
|
||||
def new
|
||||
@week = Week.new
|
||||
@week.contest = Contest.find params[:id]
|
||||
@week.contest = Contest.find(params[:id])
|
||||
raise AccessError unless @week.can_create? cuser
|
||||
end
|
||||
|
||||
|
@ -19,7 +19,7 @@ class WeeksController < ApplicationController
|
|||
flash[:notice] = t(:weeks_create)
|
||||
redirect_to @week.contest
|
||||
else
|
||||
render :action => "new"
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -30,7 +30,7 @@ class WeeksController < ApplicationController
|
|||
flash[:notice] = t(:weeks_update)
|
||||
redirect_to @week.contest
|
||||
else
|
||||
render :action => "edit"
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -43,6 +43,6 @@ class WeeksController < ApplicationController
|
|||
private
|
||||
|
||||
def get_week
|
||||
@week = Week.find params[:id]
|
||||
@week = Week.find(params[:id])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,26 +37,26 @@ class Article < ActiveRecord::Base
|
|||
|
||||
attr_protected :id, :updated_at, :created_at, :user_id, :version
|
||||
|
||||
scope :recent, :order => "created_at DESC", :limit => 8
|
||||
scope :recent, order: 'created_at DESC', limit: 8
|
||||
scope :with_comments,
|
||||
:select => "articles.*, COUNT(C.id) AS comment_num",
|
||||
:joins => "LEFT JOIN comments C ON C.commentable_type = 'Article' AND C.commentable_id = articles.id",
|
||||
:group => "articles.id"
|
||||
scope :ordered, :order => "articles.created_at DESC"
|
||||
scope :limited, :limit => 5
|
||||
scope :nodrafts, :conditions => {:status => STATUS_PUBLISHED}
|
||||
scope :drafts, :conditions => {:status => STATUS_DRAFT}
|
||||
scope :articles, :conditions => ["category_id IN (SELECT id FROM categories WHERE domain = ?)", Category::DOMAIN_ARTICLES]
|
||||
scope :onlynews, :conditions => ["category_id IN (SELECT id FROM categories WHERE domain = ?)", Category::DOMAIN_NEWS]
|
||||
scope :category, lambda { |cat| {:conditions => {:category_id => cat}} }
|
||||
scope :domain, lambda { |domain| {:include => "category", :conditions => {"categories.domain" => domain}} }
|
||||
scope :nospecial, :conditions => ["category_id != ?", Category::SPECIAL]
|
||||
scope :interviews, :conditions => ["category_id = ?", Category::INTERVIEWS]
|
||||
select: "articles.*, COUNT(C.id) AS comment_num",
|
||||
joins: "LEFT JOIN comments C ON C.commentable_type = 'Article' AND C.commentable_id = articles.id",
|
||||
group: "articles.id"
|
||||
scope :ordered, order: 'articles.created_at DESC'
|
||||
scope :limited, limit: 5
|
||||
scope :nodrafts, conditions: { status: STATUS_PUBLISHED }
|
||||
scope :drafts, conditions: { status: STATUS_DRAFT }
|
||||
scope :articles, conditions: ["category_id IN (SELECT id FROM categories WHERE domain = ?)", Category::DOMAIN_ARTICLES]
|
||||
scope :onlynews, conditions: ["category_id IN (SELECT id FROM categories WHERE domain = ?)", Category::DOMAIN_NEWS]
|
||||
scope :category, lambda { |cat| { conditions: { category_id: cat } } }
|
||||
scope :domain, lambda { |domain| { includes: 'category', conditions: { "categories.domain" => domain } } }
|
||||
scope :nospecial, conditions: ["category_id != ?", Category::SPECIAL]
|
||||
scope :interviews, conditions: ["category_id = ?", Category::INTERVIEWS]
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :category
|
||||
has_many :comments, :as => :commentable, :order => "created_at ASC", :dependent => :destroy
|
||||
has_many :files, :class_name => "DataFile", :order => "created_at DESC", :dependent => :destroy
|
||||
has_many :comments, as: :commentable, order: 'created_at ASC', dependent: :destroy
|
||||
has_many :files, class_name: 'DataFile', order: 'created_at DESC', dependent: :destroy
|
||||
|
||||
validates_length_of :title, :in => 1..50
|
||||
validates_length_of :text, :in => 1..16000000
|
||||
|
@ -82,11 +82,11 @@ class Article < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def previous_article
|
||||
category.articles.nodrafts.first(:conditions => ["id < ?", self.id], :order => "id DESC")
|
||||
category.articles.nodrafts.first(conditions: ["id < ?", self.id], order: "id DESC")
|
||||
end
|
||||
|
||||
def next_article
|
||||
category.articles.nodrafts.first(:conditions => ["id > ?", self.id], :order => "id ASC")
|
||||
category.articles.nodrafts.first(conditions: ["id > ?", self.id], order: "id ASC")
|
||||
end
|
||||
|
||||
def statuses
|
||||
|
@ -114,11 +114,11 @@ class Article < ActiveRecord::Base
|
|||
if (new_record? or status_changed?) and status == STATUS_PUBLISHED
|
||||
case category.domain
|
||||
when Category::DOMAIN_NEWS
|
||||
Profile.all(:include => :user, :conditions => "notify_news = 1").each do |p|
|
||||
Profile.all(includes: :user, conditions: "notify_news = 1").each do |p|
|
||||
Notifications.news p.user, self if p.user
|
||||
end
|
||||
when Category::DOMAIN_ARTICLES
|
||||
Profile.all(:include => :user, :conditions => "notify_articles = 1").each do |p|
|
||||
Profile.all(includes: :user, conditions: "notify_articles = 1").each do |p|
|
||||
Notifications.article p.user, self if p.user
|
||||
end
|
||||
end
|
||||
|
|
|
@ -29,16 +29,16 @@ class Ban < ActiveRecord::Base
|
|||
attr_protected :id, :created_at, :updated_at
|
||||
attr_accessor :ts, :sign, :len, :user_name
|
||||
|
||||
scope :ordered, :order => "created_at DESC"
|
||||
scope :effective, :conditions => "expiry > UTC_TIMESTAMP()"
|
||||
scope :ineffective, :conditions => "expiry < UTC_TIMESTAMP()"
|
||||
scope :ordered, order: "created_at DESC"
|
||||
scope :effective, conditions: "expiry > UTC_TIMESTAMP()"
|
||||
scope :ineffective, conditions: "expiry < UTC_TIMESTAMP()"
|
||||
|
||||
validate :validate_ts
|
||||
validate :validate_type
|
||||
validate :validate_ventban
|
||||
validates_format_of :steamid, :with => /\A([0-9]{1,10}:){2}[0-9]{1,10}\Z/, :allow_blank => true
|
||||
validates_format_of :addr, :with => /\A([0-9]{1,3}\.){3}[0-9]{1,3}:?[0-9]{0,5}\z/, :allow_blank => true
|
||||
validates_length_of :reason, :maximum => 255, :allow_nil => true, :allow_blank => true
|
||||
validates_format_of :steamid, with: /\A([0-9]{1,10}:){2}[0-9]{1,10}\Z/, allow_blank: true
|
||||
validates_format_of :addr, with: /\A([0-9]{1,3}\.){3}[0-9]{1,3}:?[0-9]{0,5}\z/, allow_blank: true
|
||||
validates_length_of :reason, maximum: 255, allow_nil: true, allow_blank: true
|
||||
|
||||
before_validation :check_user
|
||||
|
||||
|
@ -78,8 +78,8 @@ class Ban < ActiveRecord::Base
|
|||
if user_name
|
||||
self.user = User.find_by_username(user_name)
|
||||
else
|
||||
self.user = User.first(:conditions => {:steamid => steamid})
|
||||
self.server = Server.first(:conditions => ["CONCAT(ip, ':', port) = ?", addr])
|
||||
self.user = User.first(conditions: { steamid: steamid })
|
||||
self.server = Server.first(conditions: ["CONCAT(ip, ':', port) = ?", addr])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -2,4 +2,4 @@ class Api::V1::Collection
|
|||
def execute_query
|
||||
ActiveRecord::Base.connection.execute(arel_query.to_sql)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -55,4 +55,4 @@ class Api::V1::UsersCollection < Api::V1::Collection
|
|||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue