Admin area improved

This commit is contained in:
Dmitriy Zaporozhets 2012-02-11 19:56:18 +02:00
parent a769204ff4
commit cc043f32d8
39 changed files with 434 additions and 334 deletions

View file

@ -53,6 +53,7 @@ class Project < ActiveRecord::Base
attr_protected :private_flag, :owner_id
scope :public_only, where(:private_flag => false)
scope :without_user, lambda { |user| where("id not in (:ids)", :ids => user.projects.map(&:id) ) }
def self.active
joins(:issues, :notes, :merge_requests).order("issues.created_at, notes.created_at, merge_requests.created_at DESC")

View file

@ -27,6 +27,20 @@ class UsersProject < ActiveRecord::Base
end
end
def self.user_bulk_import(user, project_ids, project_access, repo_access)
UsersProject.transaction do
project_ids.each do |project_id|
users_project = UsersProject.new(
:repo_access => repo_access,
:project_access => project_access,
)
users_project.project_id = project_id
users_project.user_id = user.id
users_project.save
end
end
end
def update_repository
Gitlabhq::GitHost.system.new.configure do |c|
c.update_project(project.path, project)