#345: update build_lists_controller
This commit is contained in:
parent
61bcfb9e4e
commit
22b8ce9e2c
|
@ -12,7 +12,7 @@ class Projects::BaseController < ApplicationController
|
|||
end
|
||||
|
||||
def find_project
|
||||
@project = Project.find_by_owner_and_name! params[:name_with_owner]
|
||||
@project = Project.find_by_owner_and_name! params[:name_with_owner] if params[:name_with_owner].present?
|
||||
end
|
||||
|
||||
def init_statistics
|
||||
|
|
|
@ -8,13 +8,15 @@ class Projects::BuildListsController < Projects::BaseController
|
|||
|
||||
before_filter :find_build_list, only: [:show, :publish, :cancel, :update, :log, :create_container]
|
||||
|
||||
load_and_authorize_resource :project, only: NESTED_ACTIONS
|
||||
load_and_authorize_resource :project, only: [:new, :create]
|
||||
load_resource :project, only: :index, parent: false
|
||||
load_and_authorize_resource :build_list, through: :project, only: NESTED_ACTIONS, shallow: true
|
||||
load_and_authorize_resource except: NESTED_ACTIONS
|
||||
|
||||
before_filter :create_from_build_list, only: :new
|
||||
|
||||
def index
|
||||
authorize!(:show, @project) if @project
|
||||
params[:filter].each{|k,v| params[:filter].delete(k) if v.blank? } if params[:filter]
|
||||
|
||||
respond_to do |format|
|
||||
|
|
|
@ -9,7 +9,7 @@ class BuildList::Filter
|
|||
end
|
||||
|
||||
def find
|
||||
build_lists = @project ? @project.build_lists : BuildList.scoped
|
||||
build_lists = @project ? @project.build_lists : BuildList.all
|
||||
|
||||
if @options[:id]
|
||||
build_lists = build_lists.where(id: @options[:id])
|
||||
|
|
|
@ -17,7 +17,7 @@ class BuildList::Item < ActiveRecord::Base
|
|||
BuildList::BUILD_CANCELED => :build_canceled
|
||||
}
|
||||
|
||||
scope :recent, order("#{table_name}.level ASC, #{table_name}.name ASC")
|
||||
scope :recent, -> { order("#{table_name}.level ASC, #{table_name}.name ASC") }
|
||||
|
||||
def self.group_by_level
|
||||
groups = []
|
||||
|
|
Loading…
Reference in New Issue