#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(){
|
base_platforms.each(function(){
|
||||||
if ($.inArray(platform_id, base_platforms.map(function(){ return $(this).val(); }).get()) >= 0) {
|
if ($.inArray(platform_id, base_platforms.map(function(){ return $(this).val(); }).get()) >= 0) {
|
||||||
if ($(this).val() == platform_id) {
|
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).attr('checked', 'checked').removeAttr('disabled').trigger('change');
|
||||||
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled');
|
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled');
|
||||||
|
|
||||||
|
@ -30,7 +22,6 @@ $(document).ready(function() {
|
||||||
} else {
|
} else {
|
||||||
$(this).removeAttr('disabled').removeAttr('checked').trigger('change');
|
$(this).removeAttr('disabled').removeAttr('checked').trigger('change');
|
||||||
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled').removeAttr('checked');
|
$(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();
|
setBranchSelected();
|
||||||
|
checkAccessToAutomatedPublising();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.all_platforms .offset25 input').change(function() {
|
||||||
|
checkAccessToAutomatedPublising();
|
||||||
|
});
|
||||||
|
|
||||||
$('#build_list_save_to_platform_id').trigger('change');
|
$('#build_list_save_to_platform_id').trigger('change');
|
||||||
|
|
||||||
$('.offset25 label').click(function() {
|
$('.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) {
|
function setPlChecked(pointer, checked) {
|
||||||
var pl_cbx = $(pointer).parent().parent().parent().find('input[type="checkbox"].build_bpl_ids');
|
var pl_cbx = $(pointer).parent().parent().parent().find('input[type="checkbox"].build_bpl_ids');
|
||||||
var pl_id = pl_cbx.val();
|
var pl_id = pl_cbx.val();
|
||||||
|
|
|
@ -49,7 +49,7 @@ class Projects::BuildListsController < Projects::BaseController
|
||||||
@repository = @project.repositories.where(:id => @platform.repository_ids).first
|
@repository = @project.repositories.where(:id => @platform.repository_ids).first
|
||||||
|
|
||||||
params[:build_list][:save_to_repository_id] = @repository.id
|
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|
|
Arch.where(:id => params[:arches]).each do |arch|
|
||||||
Platform.main.where(:id => params[:build_for_platforms]).each do |build_for_platform|
|
Platform.main.where(:id => params[:build_for_platforms]).each do |build_for_platform|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- platform.repositories.each do |repo|
|
- platform.repositories.each do |repo|
|
||||||
.both
|
.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
|
= label_tag "include_repos_#{repo.id}", repo.name
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
- Platform.main.each do |pl|
|
- Platform.main.each do |pl|
|
||||||
- if pl.repository_ids.size > 0
|
- if pl.repository_ids.size > 0
|
||||||
.both
|
.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
|
= label_tag "bpls_#{pl.id}", pl.name
|
||||||
.offset25{:style => 'padding-left: 25px'}= render 'include_repos', :platform => pl
|
.offset25{:style => 'padding-left: 25px'}= render 'include_repos', :platform => pl
|
||||||
%section.right
|
%section.right
|
||||||
|
|
|
@ -1,5 +1,19 @@
|
||||||
class AddPublishWtihoutQaToRepositories < ActiveRecord::Migration
|
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
|
||||||
end
|
end
|
||||||
|
|
|
@ -367,12 +367,12 @@ ActiveRecord::Schema.define(:version => 20120906115648) do
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "repositories", :force => true do |t|
|
create_table "repositories", :force => true do |t|
|
||||||
t.string "description", :null => false
|
t.string "description", :null => false
|
||||||
t.integer "platform_id", :null => false
|
t.integer "platform_id", :null => false
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.string "name", :null => false
|
t.string "name", :null => false
|
||||||
t.boolean "publish_wtihout_qa", :default => false
|
t.boolean "publish_wtihout_qa", :default => true
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "settings_notifiers", :force => true do |t|
|
create_table "settings_notifiers", :force => true do |t|
|
||||||
|
|
Loading…
Reference in New Issue