#926: small refactoring
This commit is contained in:
parent
56b47715e6
commit
ae5328d19a
|
@ -2,14 +2,7 @@
|
|||
class Platforms::ProductBuildListsController < Platforms::BaseController
|
||||
before_filter :authenticate_user!
|
||||
skip_before_filter :authenticate_user!, :only => [:index, :show, :log] if APP_CONFIG['anonymous_access']
|
||||
before_filter lambda{
|
||||
if params[:platform_id].blank? || params[:product_id].blank?
|
||||
pbl = ProductBuildList.find params[:id]
|
||||
product = pbl.product
|
||||
platform = product.platform
|
||||
redirect_to platform_product_product_build_list_path(platform, product, pbl)
|
||||
end
|
||||
}, :only => :show
|
||||
before_filter :check_path_to_show, :only => :show
|
||||
load_and_authorize_resource :platform, :except => :index
|
||||
load_and_authorize_resource :product, :through => :platform, :except => :index
|
||||
load_and_authorize_resource :product_build_list, :through => :product, :except => :index
|
||||
|
@ -82,4 +75,14 @@ class Platforms::ProductBuildListsController < Platforms::BaseController
|
|||
@build_server_status = AbfWorker::StatusInspector.products_status
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def check_path_to_show
|
||||
if params[:platform_id].blank? || params[:product_id].blank?
|
||||
pbl = ProductBuildList.find params[:id]
|
||||
product, platform = pbl.product, pbl.product.platform
|
||||
redirect_to platform_product_product_build_list_path(platform, product, pbl)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue