#631: updated UI and JS validation for build_lists, rewrote migration
This commit is contained in:
parent
30b5188b50
commit
4d1166e6b3
|
@ -7,14 +7,6 @@ $(document).ready(function() {
|
|||
base_platforms.each(function(){
|
||||
if ($.inArray(platform_id, base_platforms.map(function(){ return $(this).val(); }).get()) >= 0) {
|
||||
if ($(this).val() == platform_id) {
|
||||
if ($(this).attr('data-released') === '1') {
|
||||
$('#build_list_auto_publish').removeAttr('checked').attr('disabled', 'disabled');
|
||||
//disableUpdateTypes();
|
||||
} else {
|
||||
$('#build_list_auto_publish').removeAttr('disabled').attr('checked', 'checked');
|
||||
//enableUpdateTypes();
|
||||
}
|
||||
|
||||
$(this).attr('checked', 'checked').removeAttr('disabled').trigger('change');
|
||||
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled');
|
||||
|
||||
|
@ -30,7 +22,6 @@ $(document).ready(function() {
|
|||
} else {
|
||||
$(this).removeAttr('disabled').removeAttr('checked').trigger('change');
|
||||
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled').removeAttr('checked');
|
||||
$('#build_list_auto_publish').removeAttr('disabled').attr('checked', 'checked');
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -41,7 +32,13 @@ $(document).ready(function() {
|
|||
|
||||
|
||||
setBranchSelected();
|
||||
checkAccessToAutomatedPublising();
|
||||
});
|
||||
|
||||
$('.all_platforms .offset25 input').change(function() {
|
||||
checkAccessToAutomatedPublising();
|
||||
});
|
||||
|
||||
$('#build_list_save_to_platform_id').trigger('change');
|
||||
|
||||
$('.offset25 label').click(function() {
|
||||
|
@ -57,6 +54,16 @@ $(document).ready(function() {
|
|||
|
||||
});
|
||||
|
||||
function checkAccessToAutomatedPublising() {
|
||||
if ($('.all_platforms .offset25 input:checked[publish_wtihout_qa="1"]').length > 0) {
|
||||
$('#build_list_auto_publish').removeAttr('disabled').attr('checked', 'checked');
|
||||
//enableUpdateTypes();
|
||||
} else {
|
||||
$('#build_list_auto_publish').removeAttr('checked').attr('disabled', 'disabled');
|
||||
//disableUpdateTypes();
|
||||
}
|
||||
}
|
||||
|
||||
function setPlChecked(pointer, checked) {
|
||||
var pl_cbx = $(pointer).parent().parent().parent().find('input[type="checkbox"].build_bpl_ids');
|
||||
var pl_id = pl_cbx.val();
|
||||
|
|
|
@ -49,7 +49,7 @@ class Projects::BuildListsController < Projects::BaseController
|
|||
@repository = @project.repositories.where(:id => @platform.repository_ids).first
|
||||
|
||||
params[:build_list][:save_to_repository_id] = @repository.id
|
||||
params[:build_list][:auto_publish] = false if @platform.released && !@repository.publish_wtihout_qa
|
||||
params[:build_list][:auto_publish] = false unless @repository.publish_wtihout_qa?
|
||||
|
||||
Arch.where(:id => params[:arches]).each do |arch|
|
||||
Platform.main.where(:id => params[:build_for_platforms]).each do |build_for_platform|
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- 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}", :save_to_platform_id => platform.id, :rep_name => repo.name
|
||||
= check_box_tag "build_list[include_repos][]", repo.id, repo.name == 'main' || @project.repositories.map(&:id).include?(repo.id), :id => "include_repos_#{repo.id}", :save_to_platform_id => platform.id, :rep_name => repo.name, :publish_wtihout_qa => repo.publish_wtihout_qa? ? 1 : 0
|
||||
= label_tag "include_repos_#{repo.id}", repo.name
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
- Platform.main.each do |pl|
|
||||
- if pl.repository_ids.size > 0
|
||||
.both
|
||||
= check_box_tag "build_for_platforms[]", pl.id, (params[:build_for_platforms]||[]).include?(pl.id.to_s), :class => 'build_bpl_ids', :id => "bpls_#{pl.id}", :'data-released' => pl.released ? 1 : 0
|
||||
= check_box_tag "build_for_platforms[]", pl.id, (params[:build_for_platforms]||[]).include?(pl.id.to_s), :class => 'build_bpl_ids', :id => "bpls_#{pl.id}"
|
||||
= label_tag "bpls_#{pl.id}", pl.name
|
||||
.offset25{:style => 'padding-left: 25px'}= render 'include_repos', :platform => pl
|
||||
%section.right
|
||||
|
|
|
@ -1,5 +1,19 @@
|
|||
class AddPublishWtihoutQaToRepositories < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :repositories, :publish_wtihout_qa, :boolean, :default => false
|
||||
|
||||
class Platform < ActiveRecord::Base
|
||||
end
|
||||
|
||||
class Repository < ActiveRecord::Base
|
||||
belongs_to :platform
|
||||
end
|
||||
|
||||
def up
|
||||
add_column :repositories, :publish_wtihout_qa, :boolean, :default => true
|
||||
Repository.where('platforms.released is true').joins(:platform).
|
||||
update_all(:publish_wtihout_qa => false)
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :repositories, :publish_wtihout_qa
|
||||
end
|
||||
end
|
||||
|
|
|
@ -372,7 +372,7 @@ ActiveRecord::Schema.define(:version => 20120906115648) do
|
|||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "name", :null => false
|
||||
t.boolean "publish_wtihout_qa", :default => false
|
||||
t.boolean "publish_wtihout_qa", :default => true
|
||||
end
|
||||
|
||||
create_table "settings_notifiers", :force => true do |t|
|
||||
|
|
Loading…
Reference in New Issue