#794: merge master into the branch

This commit is contained in:
Vokhmin Alexey V 2012-12-24 18:07:09 +04:00
commit 9b8a55db42
5 changed files with 9 additions and 10 deletions

View File

@ -9,9 +9,13 @@ $(document).ready(function() {
var build_platform = $('#build_for_pl_' + platform_id);
var all_repositories = $('.all_platforms input');
all_repositories.removeAttr('checked');
var new_core = $('#build_list_new_core');
if (build_platform.size() == 0) {
all_repositories.removeAttr('disabled');
new_core.removeAttr('disabled').attr('checked', 'checked');
} else {
new_core.removeAttr('checked').attr('disabled', 'disabled');
all_repositories.attr('disabled', 'disabled');
var parent = build_platform.parent();
parent.find('input').removeAttr('disabled');

View File

@ -26,7 +26,7 @@ class Api::V1::BuildListsController < Api::V1::BaseController
@build_list.user = current_user
@build_list.priority = current_user.build_priority # User builds more priority than mass rebuild with zero priority
@build_list.new_core = BuildList.has_access_to_new_core?(current_user) && bl_params[:new_core] == '1'
@build_list.new_core = save_to_repository.platform.personal? && bl_params[:new_core] == '1'
if @build_list.save
render :action => 'show'

View File

@ -55,7 +55,7 @@ class Projects::BuildListsController < Projects::BaseController
build_for_platforms = Repository.select(:platform_id).
where(:id => params[:build_list][:include_repos]).group(:platform_id).map(&:platform_id)
new_core = BuildList.has_access_to_new_core?(current_user) && params[:build_list][:new_core] == '1'
new_core = @platform.personal? && params[:build_list][:new_core] == '1'
Arch.where(:id => params[:arches]).each do |arch|
Platform.main.where(:id => build_for_platforms).each do |build_for_platform|
@build_list = @project.build_lists.build(params[:build_list])

View File

@ -337,10 +337,6 @@ class BuildList < ActiveRecord::Base
@status
end
def self.has_access_to_new_core?(user)
user && (user.admin? || user.tester?)
end
def self.human_status(status)
I18n.t("layout.build_lists.statuses.#{HUMAN_STATUSES[status]}")
end

View File

@ -29,10 +29,9 @@
.both
= f.check_box :build_requires
= f.label :build_requires
- if BuildList.has_access_to_new_core?(current_user)
.both
= f.check_box :new_core
= f.label :new_core
.both
= f.check_box :new_core
= f.label :new_core
%br
= f.submit t("layout.projects.build_button")