Merge pull request #239 from abf/rosa-build:237-repository-in-top-of-list
#237: Always show 'main' and 'base' repository in top of list in new build list page
This commit is contained in:
commit
d7c6696b92
|
@ -8,7 +8,7 @@ class Platforms::RepositoriesController < Platforms::BaseController
|
|||
before_filter :set_members, :only => [:edit, :update]
|
||||
|
||||
def index
|
||||
@repositories = @repositories.paginate(:page => params[:page])
|
||||
@repositories = Repository.custom_sort(@repositories).paginate(:page => params[:page])
|
||||
end
|
||||
|
||||
def show
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class Repository < ActiveRecord::Base
|
||||
SORT = {'base' => 1, 'main' => 2, 'contrib' => 3, 'non-free' => 4, 'restricted' => 5}
|
||||
|
||||
belongs_to :platform
|
||||
|
||||
has_many :relations, :as => :target, :dependent => :destroy
|
||||
|
@ -64,6 +66,10 @@ class Repository < ActiveRecord::Base
|
|||
end
|
||||
later :destroy, :queue => :clone_build
|
||||
|
||||
def self.custom_sort(repos)
|
||||
repos.select{ |r| SORT.keys.include?(r.name) }.sort{ |a,b| SORT[a.name] <=> SORT[b.name] } | repos.sort_by(&:name)
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def detele_directory
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- platform.repositories.each do |repo|
|
||||
- Repository.custom_sort(platform.repositories).each do |repo|
|
||||
.both
|
||||
= check_box_tag "build_list[include_repos][]", repo.id, repo.name == 'main' || @project.repositories.map(&:id).include?(repo.id), :id => "include_repos_#{repo.id}", :rep_name => repo.name
|
||||
= label_tag "include_repos_#{repo.id}", repo.name
|
||||
|
|
Loading…
Reference in New Issue