|
|
|
@ -2,7 +2,7 @@ class TrustieHacksController < ApplicationController
|
|
|
|
|
before_action :require_admin, :except => [:index]
|
|
|
|
|
before_action :require_login, :except => [:index]
|
|
|
|
|
before_action :find_hackathon
|
|
|
|
|
before_action :find_hack, :except => [:create, :index]
|
|
|
|
|
before_action :find_hack, :except => [:create, :index, :edit_hackathon, :update_hackathon]
|
|
|
|
|
|
|
|
|
|
def index
|
|
|
|
|
## 分页参数
|
|
|
|
@ -16,7 +16,7 @@ class TrustieHacksController < ApplicationController
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def edit ;end
|
|
|
|
|
def edit;end
|
|
|
|
|
|
|
|
|
|
def create
|
|
|
|
|
@hackathon.trustie_hacks.create!(name: params[:name], description: params[:description])
|
|
|
|
@ -25,12 +25,15 @@ class TrustieHacksController < ApplicationController
|
|
|
|
|
|
|
|
|
|
def update
|
|
|
|
|
@hack.update_attributes(name: params[:name], description: params[:description])
|
|
|
|
|
render_ok
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def edit_hackathon ;end
|
|
|
|
|
def edit_hackathon
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def update_hackathon
|
|
|
|
|
@hackathon.update_attributes(name: params[:name], description: params[:description])
|
|
|
|
|
render_ok
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -38,7 +41,7 @@ class TrustieHacksController < ApplicationController
|
|
|
|
|
|
|
|
|
|
def find_hackathon
|
|
|
|
|
@hackathon = TrustieHackathon.first ||
|
|
|
|
|
TrustieHackathon.create(name: params[:name], description: params[:description])
|
|
|
|
|
TrustieHackathon.create!(name: params[:name], description: params[:description])
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def find_hack
|
|
|
|
|