Merge pull request #390 from warpc/223-change_build_lists_new_js_handlers
[refs #223] Choosen rep auto set
This commit is contained in:
commit
452464e7e1
|
@ -3,30 +3,24 @@ $(document).ready(function() {
|
|||
var platform_id = $(this).val();
|
||||
var base_platforms = $('.all_platforms input[type=checkbox].build_bpl_ids');
|
||||
|
||||
//$('#include_repos').html($('.preloaded_include_repos .include_repos_' + platform_id).html());
|
||||
|
||||
base_platforms.each(function(){
|
||||
if ($.inArray(platform_id, base_platforms.map(function(){ return $(this).val() }).get()) >= 0) {
|
||||
if ($(this).val() == platform_id) {
|
||||
$(this).attr('checked', 'checked');
|
||||
$(this).removeAttr('disabled');
|
||||
$(this).attr('checked', 'checked').removeAttr('disabled');
|
||||
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled');
|
||||
if ($(this).parent().find('.offset25 label').text() == 'main') {
|
||||
$(this).parent().find('.offset25 input[type="checkbox"]').attr('checked', 'checked');
|
||||
|
||||
var rep_name = $('#build_list_pl_id option[value="' + $(this).val() + '"]').text().match(/[\w-]+\/([\w-]+)/)[1];
|
||||
if (rep_name != 'main') {
|
||||
$(this).parent().find('.offset25 input[type="checkbox"][rep_name="' + rep_name + '"]').attr('checked', 'checked');
|
||||
}
|
||||
$(this).parent().find('.offset25 input[type="checkbox"][rep_name="main"]').attr('checked', 'checked');
|
||||
} else {
|
||||
$(this).removeAttr('checked').attr('disabled', 'disabled');
|
||||
$(this).parent().find('.offset25 input[type="checkbox"]').attr('disabled', 'disabled').removeAttr('checked');
|
||||
}
|
||||
} else {
|
||||
$(this).removeAttr('checked');
|
||||
$(this).attr('disabled', 'disabled');
|
||||
$(this).parent().find('.offset25 input[type="checkbox"]').attr('disabled', 'disabled');
|
||||
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('checked');
|
||||
}
|
||||
//$('.additional_pl').parent().find('.offset25 input[type="checkbox"]').attr('disabled', 'disabled');
|
||||
} else {
|
||||
$(this).removeAttr('disabled');
|
||||
$(this).removeAttr('checked');
|
||||
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled');
|
||||
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('checked');
|
||||
//$('.additional_pl').parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled');
|
||||
$(this).removeAttr('disabled').removeAttr('checked');
|
||||
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled').removeAttr('checked');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -118,6 +118,13 @@ class Project < ActiveRecord::Base
|
|||
tags.map(&:name) + branches.map{|b| "latest_#{b.name}"}
|
||||
end
|
||||
|
||||
def versions_for_group_select
|
||||
[
|
||||
['Tags', tags.map(&:name)],
|
||||
['Branches', branches.map{|b| "latest_#{b.name}"}]
|
||||
]
|
||||
end
|
||||
|
||||
def members
|
||||
collaborators + groups.map(&:members).flatten
|
||||
end
|
||||
|
|
|
@ -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}", :pl_id => platform.id
|
||||
= check_box_tag "build_list[include_repos][]", repo.id, repo.name == 'main' || @project.repositories.map(&:id).include?(repo.id), :id => "include_repos_#{repo.id}", :pl_id => platform.id, :rep_name => repo.name
|
||||
= label_tag "include_repos_#{repo.id}", repo.name
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
= form_for [@project, @build_list], :html => { :class => :form, :method => :post } do |f|
|
||||
%section.left
|
||||
%h3= t("activerecord.attributes.build_list.project_version")
|
||||
.lineForm= f.select :project_version, @project.versions
|
||||
- if controller.action_name == 'new'
|
||||
.lineForm= f.select :project_version, @project.versions_for_group_select, :selected => "latest_" + @project.default_branch
|
||||
- else
|
||||
.lineForm= f.select :project_version, @project.versions_for_group_select
|
||||
%h3= t("activerecord.attributes.build_list.bpl")
|
||||
.all_platforms
|
||||
- Platform.main.each do |pl|
|
||||
|
|
|
@ -26,3 +26,6 @@
|
|||
=f.submit t('layout.projects.fork_to', :to => "#{group.uname} (#{t 'activerecord.models.group'})"), :class => 'btn btn-primary'
|
||||
- else
|
||||
.r#fork-and-edit= link_to t('layout.projects.fork_and_edit'), fork_project_path(@project), :method => :post, :confirm => t("layout.confirm"), :class => 'button'
|
||||
|
||||
- if can? :create, @project.build_lists.new
|
||||
.r{:style => "display: block"}= link_to t('layout.projects.new_build_list'), new_project_build_list_path(@project), :class => 'button'
|
||||
|
|
|
@ -95,7 +95,7 @@ en:
|
|||
success: Build complete
|
||||
build_started: Build started
|
||||
platform_not_found: Platform not found
|
||||
platform_pending: Platforn pending
|
||||
platform_pending: Platform pending
|
||||
project_not_found: Project not found
|
||||
project_version_not_found: Project version not found
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ en:
|
|||
show: Project
|
||||
build: Build
|
||||
new_build: New build %{project_name}
|
||||
new_build_list: New build
|
||||
confirm_delete: Are you sure you want to delete this project?
|
||||
new: New project
|
||||
location: Location
|
||||
|
|
|
@ -13,6 +13,7 @@ ru:
|
|||
show: Проект
|
||||
build: Собрать
|
||||
new_build: Новая сборка %{project_name}
|
||||
new_build_list: Новая сборка
|
||||
confirm_delete: Вы уверены, что хотите удалить этот проект?
|
||||
new: Новый проект
|
||||
location: Расположение
|
||||
|
|
Loading…
Reference in New Issue