|
|
|
@ -8,8 +8,13 @@ class TrustieHacksController < ApplicationController
|
|
|
|
|
## 分页参数
|
|
|
|
|
page = params[:page] || 1
|
|
|
|
|
limit = params[:limit] || 16
|
|
|
|
|
|
|
|
|
|
search = params[:search]
|
|
|
|
|
hacks = @hackathon.trustie_hacks
|
|
|
|
|
|
|
|
|
|
if search
|
|
|
|
|
hacks = hacks.where("name like ?", "%#{search}%")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
@hackathon_users_count = hacks ? 0 : hacks.sum(:hack_users_count)
|
|
|
|
|
|
|
|
|
|
@hacks = hacks.page(page).per(limit)
|
|
|
|
@ -28,6 +33,11 @@ class TrustieHacksController < ApplicationController
|
|
|
|
|
render_ok
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
|
@hack.destroy
|
|
|
|
|
render_ok
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def edit_hackathon
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -36,6 +46,7 @@ class TrustieHacksController < ApplicationController
|
|
|
|
|
render_ok
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 报名入口
|
|
|
|
|
def entry
|
|
|
|
|
if @hack.hack_users.exists?(user_id: current_user)
|
|
|
|
|
render_error('已经报名,请勿重复操作')
|
|
|
|
|