Merge pull request #936 from warpc/926-update-routes-for-product-build-list

[refs #926]: Support short url for product build list
This commit is contained in:
Vladimir Sharshov 2013-02-15 07:39:42 -08:00
commit 78dbd1cf5d
2 changed files with 12 additions and 1 deletions

View File

@ -2,6 +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 :redirect_to_full_path_if_short_url, :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
@ -74,4 +75,14 @@ class Platforms::ProductBuildListsController < Platforms::BaseController
@build_server_status = AbfWorker::StatusInspector.products_status
end
protected
def redirect_to_full_path_if_short_url
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

View File

@ -173,7 +173,7 @@ Rosa::Application.routes.draw do
end
match '/private/:platform_name/*file_path' => 'privates#show'
resources :product_build_lists, :only => [:index]
resources :product_build_lists, :only => [:index, :show]
end
resources :autocompletes, :only => [] do