Merge pull request #500 from warpc/478-project_build_failed

[refs #478] Change js handler logic for creating build build list for frozen platform
This commit is contained in:
Vladimir Sharshov 2012-05-24 06:11:36 -07:00
commit 568df37570
2 changed files with 9 additions and 11 deletions

View File

@ -46,21 +46,19 @@ $(document).ready(function() {
return false;
});
$("select#build_list_update_type").change(function() {
if ( $(this).val() == "bugfix" || $(this).val() == "security" ) {
$("select#build_list_save_to_platform_id option").each(function(i,el) {
$(el).removeAttr("disabled");
});
} else {
$("select#build_list_save_to_platform_id option").each(function(i,el) {
if ( $.inArray(parseInt($(el).attr("value")), FROZEN_PLS) == 0 ) {
$("select#build_list_save_to_platform_id").change(function() {
if ( $.inArray(parseInt($("select#build_list_save_to_platform_id").val()), FROZEN_PLS) == 0 ) {
$("select#build_list_update_type option").each(function(i,el) {
if ( $.inArray($(el).attr("value"), ["security", "bugfix"]) == -1 ) {
$(el).attr("disabled", "disabled");
// If disabled option is selected - select blank repository (it is always first):
// If disabled option is selected - select 'bugfix':
if ( $(el).attr("selected") ) {
$( $("select#build_list_save_to_platform_id option")[0] ).attr("selected", "selected");
$( $('select#build_list_update_type option[value="bugfix"]') ).attr("selected", "selected");
}
}
});
} else {
$("select#build_list_update_type option").removeAttr("disabled");
}
});
$("select#build_list_update_type").trigger('change');

View File

@ -11,7 +11,7 @@
.offset25{:style => 'padding-left: 25px'}= render 'include_repos', :platform => pl
%section.right
%h3= t("activerecord.attributes.build_list.save_to_platform")
.lineForm= f.select :save_to_platform_id, @project.repositories.collect{|r| ["#{r.platform.name}/#{r.name}", r.platform.id]}, :include_blank => true
.lineForm= f.select :save_to_platform_id, @project.repositories.collect{|r| ["#{r.platform.name}/#{r.name}", r.platform.id]}
%h3= t("activerecord.attributes.build_list.project_version")
- if controller.action_name == 'new'
.lineForm= f.select :project_version, @project.versions_for_group_select, :selected => "latest_" + @project.default_branch