[refs #200] Change build list repos and platforms interface

This commit is contained in:
konstantin.grabar 2012-03-19 23:52:46 +04:00
parent fcc17c7c0a
commit f0645be9c5
2 changed files with 25 additions and 9 deletions

View File

@ -1,21 +1,26 @@
$(document).ready(function() { $(document).ready(function() {
$('#build_list_pl_id').change(function() { $('#build_list_pl_id').change(function() {
var platform_id = $(this).val(); var platform_id = $(this).val();
var base_platforms = $('.base_platforms input[type=checkbox]'); var base_platforms = $('.all_platforms input[type=checkbox].build_bpl_ids');
$('#include_repos').html($('.preloaded_include_repos .include_repos_' + platform_id).html()); //$('#include_repos').html($('.preloaded_include_repos .include_repos_' + platform_id).html());
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) {
$(this).attr('checked', 'checked'); $(this).attr('checked', 'checked');
$(this).removeAttr('disabled'); $(this).removeAttr('disabled');
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled');
} else { } else {
$(this).removeAttr('checked'); $(this).removeAttr('checked');
$(this).attr('disabled', 'disabled'); $(this).attr('disabled', 'disabled');
$(this).parent().find('.offset25 input[type="checkbox"]').attr('disabled', 'disabled');
} }
$('.additional_pl').parent().find('.offset25 input[type="checkbox"]').attr('disabled', 'disabled');
} else { } else {
$(this).removeAttr('disabled'); $(this).removeAttr('disabled');
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled');
$('.additional_pl').parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled');
} }
}); });
}); });

View File

@ -3,11 +3,22 @@
%h3= t("activerecord.attributes.build_list.project_version") %h3= t("activerecord.attributes.build_list.project_version")
.lineForm= f.select :project_version, @project.versions .lineForm= f.select :project_version, @project.versions
%h3= t("activerecord.attributes.build_list.bpl") %h3= t("activerecord.attributes.build_list.bpl")
.base_platforms .all_platforms
- Platform.main.each do |bpl| - (Platform.main | @project.platforms).each do |pl|
.both .both
= check_box_tag "bpls[]", bpl.id, (params[:bpls]||[]).include?(bpl.id.to_s), :class => 'build_bpl_ids', :id => "bpls_#{bpl.id}" - if pl.platform_type == 'main'
= label_tag "bpls_#{bpl.id}", bpl.name = check_box_tag "bpls[]", pl.id, (params[:bpls]||[]).include?(pl.id.to_s), :class => 'build_bpl_ids', :id => "bpls_#{pl.id}"
= label_tag "bpls_#{pl.id}", pl.name
- else
= check_box_tag "", "", :class => "additional_pl", :disabled => :disabled
= label_tag "", pl.name, :class => "additional_pl"
.offset25{:style => 'padding-left: 25px'}
= render 'include_repos', :platform => pl
-#%div{:class => "include_repos_#{p.id}"}= render 'include_repos', :platform => p
-#- Platform.main.each do |bpl|
-# .both
-# = check_box_tag "bpls[]", bpl.id, (params[:bpls]||[]).include?(bpl.id.to_s), :class => 'build_bpl_ids', :id => "bpls_#{bpl.id}"
-# = label_tag "bpls_#{bpl.id}", bpl.name
%h3= t("activerecord.attributes.build_list.update_type") %h3= t("activerecord.attributes.build_list.update_type")
.lineForm= f.select :update_type, BuildList::UPDATE_TYPES .lineForm= f.select :update_type, BuildList::UPDATE_TYPES
%h3= t("activerecord.attributes.build_list.preferences") %h3= t("activerecord.attributes.build_list.preferences")
@ -30,8 +41,8 @@
%h3= t("activerecord.attributes.build_list.include_repos") %h3= t("activerecord.attributes.build_list.include_repos")
#include_repos #include_repos
.preloaded_include_repos{:style => 'display: none'} -#.preloaded_include_repos{:style => 'display: none'}
- @project.platforms.each do |p| -# - @project.platforms.each do |p|
%div{:class => "include_repos_#{p.id}"}= render 'include_repos', :platform => p -# %div{:class => "include_repos_#{p.id}"}= render 'include_repos', :platform => p
= render 'projects/submenu' = render 'projects/submenu'