diff --git a/app/controllers/platforms/product_build_lists_controller.rb b/app/controllers/platforms/product_build_lists_controller.rb index 8da466c98..56dc790d9 100644 --- a/app/controllers/platforms/product_build_lists_controller.rb +++ b/app/controllers/platforms/product_build_lists_controller.rb @@ -2,9 +2,9 @@ class Platforms::ProductBuildListsController < Platforms::BaseController before_filter :authenticate_user!, :except => [:status_build] skip_before_filter :authenticate_user!, :only => [:index] if APP_CONFIG['anonymous_access'] - load_and_authorize_resource :platform, :only => [:create, :destroy, :new] - load_and_authorize_resource :product, :through => :platform, :only => [:create, :destroy, :new] - load_and_authorize_resource :product_build_list, :through => :product, :only => [:create, :destroy, :new] + load_and_authorize_resource :platform, :only => [:create, :destroy, :new, :show] + load_and_authorize_resource :product, :through => :platform, :only => [:create, :destroy, :new, :show] + load_and_authorize_resource :product_build_list, :through => :product, :only => [:create, :destroy, :new, :show] load_and_authorize_resource :only => [:index] before_filter :authenticate_product_builder!, :only => [:status_build] @@ -16,8 +16,14 @@ class Platforms::ProductBuildListsController < Platforms::BaseController @arches = Arch.recent.map{ |a| [a.name, a.id] } end + def show + end + def create - @product.product_build_lists.create! :base_url => "http://#{request.host_with_port}" + pbl = @product.product_build_lists.new params[:product_build_list] + pbl.project = @product.project + pbl.base_url = "http://#{request.host_with_port}" + pbl.save! flash[:notice] = t('flash.product.build_started') redirect_to [@platform, @product] end diff --git a/app/helpers/build_lists_helper.rb b/app/helpers/build_lists_helper.rb index 367ba78e7..33d91af81 100644 --- a/app/helpers/build_lists_helper.rb +++ b/app/helpers/build_lists_helper.rb @@ -37,7 +37,7 @@ module BuildListsHelper def build_list_version_link(build_list, str_version = false) if build_list.commit_hash.present? - link_to str_version ? "#{shortest_hash_id @build_list.commit_hash} ( #{@build_list.project_version} )" : shortest_hash_id(build_list.commit_hash), + link_to str_version ? "#{shortest_hash_id build_list.commit_hash} ( #{build_list.project_version} )" : shortest_hash_id(build_list.commit_hash), commit_path(build_list.project.owner, build_list.project, build_list.commit_hash) else build_list.project_version diff --git a/app/models/product_build_list.rb b/app/models/product_build_list.rb index 3222ed5ef..15e84b2f2 100644 --- a/app/models/product_build_list.rb +++ b/app/models/product_build_list.rb @@ -25,7 +25,7 @@ class ProductBuildList < ActiveRecord::Base validates :status, :inclusion => { :in => [BUILD_STARTED, BUILD_COMPLETED, BUILD_FAILED] } attr_accessor :base_url - attr_accessible :status, :base_url, :branch, :arch_id, :project_id, :main_script, :iso_folder, :params, :project_version + attr_accessible :status, :base_url, :branch, :arch_id, :project_id, :main_script, :iso_folder, :params, :project_version, :commit_hash attr_readonly :product_id diff --git a/app/views/platforms/product_build_lists/_product_build_list.html.haml b/app/views/platforms/product_build_lists/_product_build_list.html.haml index 8325f843f..aa06dba1a 100644 --- a/app/views/platforms/product_build_lists/_product_build_list.html.haml +++ b/app/views/platforms/product_build_lists/_product_build_list.html.haml @@ -1,8 +1,13 @@ %tr{:class => cycle("odd", "even")} - %td= product_build_list.id - %td= product_build_list.human_status - %td= link_to nil, product_build_list.container_path - %td= link_to product_build_list.product.name, platform_product_path(product_build_list.product.platform, product_build_list.product) - pbl = product_build_list - %td= link_to image_tag('x.png'), platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl), :method => :delete, :confirm => t("layout.confirm") if can?(:destroy, pbl) && pbl.can_destroy? - %td= l(product_build_list.updated_at, :format => :long) \ No newline at end of file + - product = pbl.product + - platform = product.platform + - if pbl.project + %td= link_to pbl.id, platform_product_product_build_list_path(platform, product, pbl) + - else + %td= pbl.id + %td= product_build_list.human_status + %td= link_to nil, pbl.container_path + %td= link_to pbl.product.name, platform_product_path(platform, product) + %td= link_to image_tag('x.png'), platform_product_product_build_list_path(platform, product, pbl), :method => :delete, :confirm => t("layout.confirm") if can?(:destroy, pbl) && pbl.can_destroy? + %td= l(pbl.updated_at, :format => :long) \ No newline at end of file diff --git a/app/views/platforms/product_build_lists/show.html.haml b/app/views/platforms/product_build_lists/show.html.haml new file mode 100644 index 000000000..161137792 --- /dev/null +++ b/app/views/platforms/product_build_lists/show.html.haml @@ -0,0 +1,31 @@ +-set_meta_tags :title => [title_object(@product_build_list.product), t('layout.product_build_lists.show')] += render 'submenu' += render 'sidebar' + +.leftlist= t("activerecord.attributes.product_build_lists.lst") +.rightlist= @product_build_list.product.try(:lst) +.both + +.leftlist= t("activerecord.attributes.product_build_lists.project") +.rightlist= @product_build_list.project.try(:name_with_owner) +.both + +.leftlist= t("activerecord.attributes.product_build_lists.project_version") +.rightlist= @product_build_list.project ? build_list_version_link(@product_build_list, true) : '' +.both + +.leftlist= t("activerecord.attributes.product_build_lists.arch") +.rightlist= @product_build_list.arch.try(:name) +.both + +.leftlist= t("activerecord.attributes.product_build_lists.main_script") +.rightlist= @product_build_list.main_script +.both + +.leftlist= t("activerecord.attributes.product_build_lists.params") +.rightlist= @product_build_list.params +.both + +.leftlist= t("activerecord.attributes.product_build_lists.iso_folder") +.rightlist= @product_build_list.iso_folder +.both \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index e605cd66e..ed31afa4c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -145,7 +145,7 @@ Rosa::Application.routes.draw do end resources :key_pairs, :only => [:create, :index, :destroy] resources :products do - resources :product_build_lists, :only => [:create, :destroy, :new] + resources :product_build_lists, :only => [:create, :destroy, :new, :show] collection { get :autocomplete_project } end resources :maintainers, :only => [:index] diff --git a/lib/modules/models/commit_and_version.rb b/lib/modules/models/commit_and_version.rb index fe7dedb70..9a12f6bba 100644 --- a/lib/modules/models/commit_and_version.rb +++ b/lib/modules/models/commit_and_version.rb @@ -18,7 +18,7 @@ module Modules protected def set_commit_and_version - if project_version.present? && commit_hash.blank? + if project && project_version.present? && commit_hash.blank? self.commit_hash = project.repo.commits(project_version.match(/^latest_(.+)/).to_a.last || project_version).try(:first).try(:id) elsif project_version.blank? && commit_hash.present?