#156: update UI of MassBuild#new BuildList#new

This commit is contained in:
Vokhmin Alexey V 2013-06-04 23:59:08 +04:00
parent 4a5ac4330a
commit 237bd6affb
31 changed files with 290 additions and 215 deletions

View File

@ -0,0 +1,52 @@
$(document).ready(function() {
// // TODO: Refactor this handler!! It's too complicated.
// $('#build_list_save_to_repository_id, #build_for_platform').change(function() {
// var selected_option = $(this).find('option:selected');
// var platform_id = selected_option.attr('platform_id') || selected_option.val();
// var path = '/build_lists/autocomplete_to_extra_repos_and_builds?platform_id=' + platform_id;
// $('#extra_repos').attr('data-autocomplete', (path + '&search_repos=true'));
// $('#extra_build_lists').attr('data-autocomplete', path);
// });
$('.autocomplete-form .button.add').click(function() {
var form = $(this).parent();
var field = form.attr('field');
var subject = $('#' + field + '_field');
if (!subject.val()) { return false; }
var name = form.attr('subject_class') + '[' + field + ']' + '[]';
var path = $('#' + field + '_field_path').val();
var label = $('#' + field + '_field_label').val();
var tr = '<tr>' +
'<td>' +
'<a href="' + path + '">' + label + '</a>' +
'</td>' +
'<td class="actions">' +
'<input name="' + name + '" type="hidden" value="' + subject.val() + '">' +
'<span class="delete"> </span>' +
'</td>' +
'</tr>';
form.find('table tbody').append($(tr));
form.find('.autocomplete').val('');
return false;
});
$(document).on('click', '.autocomplete-form .delete', function() {
$(this).parent().parent().remove();
});
$('.autocomplete-form .dialog').dialog({
autoOpen: false,
resizable: false,
width: 500
});
$('.autocomplete-form .icon-question-sign').click(function() {
var field = $(this).parent().attr('field');
var dialog = $('#' + field + '_dialog');
if (dialog.is(':visible')) { dialog.dialog('close'); } else { dialog.dialog('open'); }
});
});

View File

@ -10,10 +10,10 @@ $(document).ready(function() {
var all_repositories = $('.all_platforms input');
all_repositories.removeAttr('checked');
var auto_create_container = $('#build_list_auto_create_container');
var extra_repos = $('#extra-repos');
var extra_repos = $('.autocomplete-form.extra_repositories');
updateExtraReposOrBuildLists('repos');
updateExtraReposOrBuildLists('build_lists');
updateExtraReposAndBuildLists(platform_id);
$('.autocomplete-form table tbody').empty();
if (build_platform.size() == 0) {
all_repositories.removeAttr('disabled');
auto_create_container.removeAttr('checked');
@ -36,41 +36,10 @@ $(document).ready(function() {
build_list_auto_publish.removeAttr('checked').attr('disabled', 'disabled');
auto_create_container.attr('checked', 'checked');
}
var path = '/build_lists/autocomplete_to_extra_repos_and_builds?platform_id=' + platform_id;
$('#extra_repos').attr('data-autocomplete', (path + '&search_repos=true'));
$('#extra_build_lists').attr('data-autocomplete', path);
});
$('#build_list_save_to_repository_id').trigger('change');
$('#extra-repos > .button').click(function() {
updateExtraReposOrBuildLists('repos');
return false;
});
$('#extra-build-lists > .button').click(function() {
updateExtraReposOrBuildLists('build-lists');
return false;
});
$(document).on('click', '#extra-repos .delete, #extra-repos-dialog .delete', function() {
$(this).parent().parent().remove();
});
$('#extra-repos-dialog, #extra-build-lists-dialog').dialog({
autoOpen: false,
resizable: false,
width: 500
});
$('#extra-repos .icon-question-sign').click(function() {
showOrHideDialog($('#extra-repos-dialog'));
});
$('#extra-build-lists .icon-question-sign').click(function() {
showOrHideDialog($('#extra-build-lists-dialog'));
});
var ownership_btn = $('.btn.ownership');
ownership_btn.click(function() {
@ -107,26 +76,12 @@ $(document).ready(function() {
});
});
function showOrHideDialog(dialog) {
if (dialog.is(':visible')) { dialog.dialog('close'); } else { dialog.dialog('open'); }
}
function updateExtraReposOrBuildLists(term) {
var path = '/build_lists/update_extra_repos_and_builds';
var container_id = '';
if (term == 'repos') {
path += '?update_repos=true';
container_id = '#extra-repos';
} else {
container_id = '#extra-build-lists';
}
$.get(path, $('#new_build_list').serialize()).
done(function(data) {
var container = $(container_id);
container.find('table tbody').html(data);
container.find('.ui-autocomplete-input').val('');
function updateExtraReposAndBuildLists(save_to_platform_id) {
$.each($('.autocomplete-form'), function() {
var form = $(this);
var path = form.attr('path') + '?platform_id=' + save_to_platform_id;
form.find('.autocomplete').attr('data-autocomplete', path);
});
}
function setBranchSelected(selected_option) {

View File

@ -1,5 +1,5 @@
$(document).ready(function() {
var projects_list = $('.form.mass_build #projects_list');
var projects_list = $('.form.mass_build #mass_build_projects_list');
var repositories = $(".form.mass_build .left input:checkbox");
repositories.click(function(){
if (this.checked){

View File

@ -571,6 +571,7 @@ table.tablesorter tr td.buttons a span.delete,
span.delete {
background: image-url('x.png') no-repeat 0 0 transparent;
width: 12px;
height: 12px;
display: inline-block;
cursor: pointer;
}
@ -1839,18 +1840,22 @@ table#myTable thead tr.search th form.button_to div input {
}
#extra-repos, #extra-build-lists {
.autocomplete-form {
width: 330px;
.actions { width: 15px; }
h3 { display: inline-block; }
.tablesorter {
width: auto;
min-width: 250px;
}
}
#extra-repos-dialog, #extra-build-lists-dialog {
#extra_repositories_dialog, #extra_build_lists_dialog {
font-size: 12px;
text-align: left;
p { margin: 0; }
}
#ui-dialog-title-extra-repos-dialog, #ui-dialog-title-extra-build-lists-dialog {
#ui-dialog-title-extra_repositories_dialog, #ui-dialog-title-extra_build_lists_dialog {
font-size: 14px;
}

View File

@ -4,4 +4,46 @@ class AutocompletesController < ApplicationController
autocomplete :group, :uname
autocomplete :user, :uname
autocomplete :user, :uname
def autocomplete_extra_build_list
bl = BuildList.where(:id => params[:term]).published_container.accessible_by(current_ability, :read)
bl = bl.where(:save_to_platform_id => save_to_platform.id) if save_to_platform.main?
bl = bl.first
results << { :id => bl.id,
:value => bl.id,
:label => "#{bl.id} (#{bl.project.name} - #{bl.arch.name})",
:path => build_list_path(bl)
} if bl
render json: results.to_json
end
def autocomplete_extra_repositories
# Only personal repositories can be attached to the build
Platform.includes(:repositories).personal.search(params[:term])
.accessible_by(current_ability, :read)
.search_order.limit(5).each do |platform|
platform.repositories.each do |repository|
label = "#{platform.name}/#{repository.name}"
results << { :id => repository.id,
:label => label,
:value => label,
:path => platform_repository_path(platform, repository)
}
end
end if save_to_platform.personal?
render json: results.to_json
end
protected
def save_to_platform
@save_to_platform ||= Platform.find(params[:platform_id])
end
def results
@results ||= []
end
end

View File

@ -1,33 +1,44 @@
#class MassBuildsController < ApplicationController
class Platforms::MassBuildsController < Platforms::BaseController
# before_filter :authenticate_user!
# skip_before_filter :authenticate_user!, :only => [:index, :get_list] if APP_CONFIG['anonymous_access']
# load_and_authorize_resource :platform
# load_and_authorize_resource
# skip_load_and_authorize_resource :only => [:index, :create]
# skip_load_and_authorize_resource :platform, :only => [:cancel, :failed_builds_list, :publish]
# skip_authorize_resource :platform, :only => [:index, :create]
NESTED_ACTIONS = [:index, :new, :create]
before_filter :authenticate_user!
skip_before_filter :authenticate_user!, :only => [:index, :get_list] if APP_CONFIG['anonymous_access']
load_and_authorize_resource :platform
load_and_authorize_resource
# before_filter :find_mass_build, :only => [:publish, :cancel]
skip_load_and_authorize_resource :only => [:index, :create]
skip_load_and_authorize_resource :platform, :only => [:cancel, :failed_builds_list, :publish]
skip_authorize_resource :platform, :only => [:index, :create]
load_and_authorize_resource :platform, :only => NESTED_ACTIONS
load_and_authorize_resource :mass_build, :through => :platform, :only => NESTED_ACTIONS, :shallow => true
load_and_authorize_resource :except => NESTED_ACTIONS
def new
end
def create
@auto_publish_selected, @use_save_to_repository = params[:auto_publish].present?, params[:use_save_to_repository].present?
mass_build = @platform.mass_builds.new(:arches => params[:arches],
:auto_publish => @auto_publish_selected,
:use_save_to_repository => @use_save_to_repository,
:projects_list => params[:projects_list],
:build_for_platform_id => Platform.main.where(:id => params[:build_for_platform]).first.try(:id)
)
mass_build.user = current_user
authorize! :create, mass_build
@mass_build = @platform.mass_builds.build(params[:mass_build]) do |mb|
mb.arches = params[:arches]
mb.user = current_user
end
if mass_build.save
if @mass_build.save
redirect_to(platform_mass_builds_path(@platform), :notice => t("flash.platform.build_all_success"))
else
@mass_builds = MassBuild.by_platform(@platform).order('created_at DESC').paginate(:page => params[:page], :per_page => 20)
flash[:warning] = mass_build.errors.full_messages.join('. ')
flash[:error] = t("flash.platform.build_all_error")
render :index
flash[:warning] = @mass_build.errors.full_messages.join('. ')
flash[:error] = t('flash.platform.build_all_error')
render :action => :new
end
end
@ -42,7 +53,6 @@ class Platforms::MassBuildsController < Platforms::BaseController
def index
@mass_builds = MassBuild.by_platform(@platform).order('created_at DESC').paginate(:page => params[:page], :per_page => 20)
@auto_publish_selected = @use_save_to_repository = true
end
def cancel

View File

@ -34,7 +34,6 @@ class Projects::BuildListsController < Projects::BaseController
end
def new
# @build_list = BuildList.new # @build_list already created by CanCan
end
def create
@ -114,37 +113,37 @@ class Projects::BuildListsController < Projects::BaseController
}
end
def autocomplete_to_extra_repos_and_builds
results, save_to_platform = [], Platform.find(params[:platform_id])
if params[:search_repos].present? && save_to_platform.personal?
# Only personal repositories can be attached to the build
platforms = Platform.includes(:repositories).personal.search(params[:term]).
accessible_by(current_ability, :read).search_order.limit(5)
platforms.each{ |p| p.repositories.each{ |r| results << {:id => r.id, :label => "#{p.name}/#{r.name}", :value => "#{p.name}/#{r.name}"} } }
elsif params[:search_repos].blank?
bl = BuildList.where(:id => params[:term]).published_container.accessible_by(current_ability, :read)
bl = bl.where(:save_to_platform_id => save_to_platform.id) if save_to_platform.main?
bl = bl.first
results << {:id => bl.id, :value => bl.id, :label => "#{bl.id} (#{bl.project.name} - #{bl.arch.name})"} if bl
end
render json: results.to_json
end
# def autocomplete_to_extra_repos_and_builds
# results, save_to_platform = [], Platform.find(params[:platform_id])
# if params[:search_repos].present? && save_to_platform.personal?
# # Only personal repositories can be attached to the build
# platforms = Platform.includes(:repositories).personal.search(params[:term]).
# accessible_by(current_ability, :read).search_order.limit(5)
# platforms.each{ |p| p.repositories.each{ |r| results << {:id => r.id, :label => "#{p.name}/#{r.name}", :value => "#{p.name}/#{r.name}"} } }
# elsif params[:search_repos].blank?
# bl = BuildList.where(:id => params[:term]).published_container.accessible_by(current_ability, :read)
# bl = bl.where(:save_to_platform_id => save_to_platform.id) if save_to_platform.main?
# bl = bl.first
# results << {:id => bl.id, :value => bl.id, :label => "#{bl.id} (#{bl.project.name} - #{bl.arch.name})"} if bl
# end
# render json: results.to_json
# end
def update_extra_repos_and_builds
results, save_to_repository = [], Repository.find(params[:build_list][:save_to_repository_id])
if params[:update_repos].present?
extra_repos = params[:build_list][:extra_repositories] || []
extra_repos << params[:extra_repos] if params[:extra_repos].present?
results = Repository.where(:id => extra_repos).accessible_by(current_ability, :read) if save_to_repository.platform.personal?
results |= [save_to_repository] if save_to_repository.platform.personal?
else
extra_bls = params[:build_list][:extra_build_lists] || []
extra_bls << params[:extra_build_lists] if params[:extra_build_lists].present?
results = BuildList.where(:id => extra_bls).published_container.accessible_by(current_ability, :read)
results = results.where(:save_to_platform_id => save_to_repository.platform_id) if save_to_repository.platform.main?
end
render :partial => 'extra', :collection => results
end
# def update_extra_repos_and_builds
# results, save_to_repository = [], Repository.find(params[:build_list][:save_to_repository_id])
# if params[:update_repos].present?
# extra_repos = params[:build_list][:extra_repositories] || []
# extra_repos << params[:extra_repos] if params[:extra_repos].present?
# results = Repository.where(:id => extra_repos).accessible_by(current_ability, :read) if save_to_repository.platform.personal?
# results |= [save_to_repository] if save_to_repository.platform.personal?
# else
# extra_bls = params[:build_list][:extra_build_lists] || []
# extra_bls << params[:extra_build_lists] if params[:extra_build_lists].present?
# results = BuildList.where(:id => extra_bls).published_container.accessible_by(current_ability, :read)
# results = results.where(:save_to_platform_id => save_to_repository.platform_id) if save_to_repository.platform.main?
# end
# render :partial => 'extra', :collection => results
# end
protected

View File

@ -78,7 +78,7 @@ class Ability
can([:read, :create, :edit, :destroy, :update], Hook) {|hook| can?(:edit, hook.project)}
can [:autocomplete_to_extra_repos_and_builds, :update_extra_repos_and_builds], BuildList
# can [:autocomplete_to_extra_repos_and_builds, :update_extra_repos_and_builds], BuildList
can [:read, :log, :owned, :everything], BuildList, :user_id => user.id
can [:read, :log, :related, :everything], BuildList, :project => {:owner_type => 'User', :owner_id => user.id}
can [:read, :log, :related, :everything], BuildList, :project => {:owner_type => 'Group', :owner_id => user.group_ids}

View File

@ -484,8 +484,8 @@ class BuildList < ActiveRecord::Base
def prepare_extra_build_lists
bls = BuildList.where(:id => extra_build_lists).published_container.accessible_by(current_ability, :read)
if save_to_platform && save_to_platform.main?
bls = bls.where(:save_to_platform_id => save_to_platform.id)
if save_to_platform
bls = bls.where(:save_to_platform_id => save_to_platform.id) if save_to_platform.main?
if save_to_platform.distrib_type == 'rhel'
bls = bls.where('
(build_lists.arch_id = ? AND projects.publish_i686_into_x86_64 is not true) OR
@ -494,7 +494,6 @@ class BuildList < ActiveRecord::Base
else
bls = bls.where(:arch_id => arch_id)
end
end
self.extra_build_lists = bls.pluck('build_lists.id')
end

View File

@ -1,22 +1,25 @@
class MassBuild < ActiveRecord::Base
belongs_to :build_for_platform, :class_name => 'Platform'
belongs_to :build_for_platform, :class_name => 'Platform', :conditions => {:platform_type => 'main'}
belongs_to :save_to_platform, :class_name => 'Platform'
belongs_to :user
has_many :build_lists, :dependent => :destroy
serialize :extra_repositories, Array
serialize :extra_build_lists, Array
scope :recent, order("#{table_name}.created_at DESC")
scope :by_platform, lambda { |platform| where(:save_to_platform_id => platform.id) }
scope :outdated, where("#{table_name}.created_at < ?", Time.now + 1.day - BuildList::MAX_LIVE_TIME)
attr_accessor :arches
attr_accessible :arches, :auto_publish, :projects_list, :use_save_to_repository, :build_for_platform_id
attr_accessible :arches, :auto_publish, :projects_list, :build_for_platform_id,
:extra_repositories, :extra_build_lists
validates :save_to_platform_id, :build_for_platform_id, :arch_names, :name, :user_id, :projects_list, :presence => true
validates_inclusion_of :auto_publish, :in => [true, false]
after_create :build_all
after_commit :build_all
before_validation :set_data, :on => :create
before_validation :set_build_for_platform, :on => :create
COUNT_STATUSES = [
:build_lists,
@ -54,7 +57,7 @@ class MassBuild < ActiveRecord::Base
end
end
end
later :build_all, :queue => :clone_build
# later :build_all, :queue => :clone_build
def generate_failed_builds_list
report = ""
@ -100,15 +103,9 @@ class MassBuild < ActiveRecord::Base
end
end
def set_build_for_platform
if save_to_platform && save_to_platform.main?
self.build_for_platform = save_to_platform
self.use_save_to_repository = true
end
end
def set_data
self.name = "#{Time.now.utc.to_date.strftime("%d.%b")}-#{save_to_platform.name}"
self.arch_names = Arch.where(:id => self.arches).map(&:name).join(", ")
self.build_for_platform = save_to_platform if save_to_platform && save_to_platform.main?
end
end

View File

@ -170,9 +170,10 @@ class Project < ActiveRecord::Base
bl.user = user
bl.auto_publish = auto_publish
bl.include_repos = include_repos
bl.extra_repositories = [repository_id] if save_to_platform.personal? && mass_build.use_save_to_repository?
bl.extra_repositories = mass_build.extra_repositories
bl.extra_build_lists = mass_build.extra_build_lists
bl.priority = priority
bl.mass_build_id = mass_build.try(:id)
bl.mass_build_id = mass_build.id
bl.save_to_repository_id = repository_id
end
build_list.save

View File

@ -14,7 +14,7 @@
%li{:class => (act == :index && contr == :maintainers) ? 'active' : nil}
= link_to t("layout.platforms.maintainers"), platform_maintainers_path(@platform)
- if can?(:show, @platform)
%li{:class => (contr == :mass_builds && [:index, :create].include?(act)) ? 'active' : ''}
%li{:class => (contr == :mass_builds) ? 'active' : ''}
= link_to t("layout.platforms.mass_build"), platform_mass_builds_path(@platform)
- if can? :read, @platform.products.build
%li{:class => (contr == :products) ? 'active' : ''}

View File

@ -1,25 +0,0 @@
= form_for :build, :url => platform_mass_builds_path(@platform), :html => { :class => 'form mass_build', :method => :post } do |f|
%section.left
=render 'repos_or_list_choice'
%br
= f.submit t("layout.projects.build_button")
%section.right
%h3= t("activerecord.attributes.build_list.arch")
- Arch.recent.each do |arch|
.lefter
= check_box_tag "arches[]", arch.id, (params[:arches]||[]).include?(arch.id.to_s), :id => "arches_#{arch.id}"
= label_tag "arches_#{arch.id}", arch.name
.both
- if @platform.personal?
%h3= t('activerecord.attributes.build_list.build_for_platform')
- platforms = Platform.main.select{ |p| p.repository_ids.size > 0 }
= select_tag 'build_for_platform', options_from_collection_for_select(platforms, :id, :name), :include_blank => false
.both
%h3= t("activerecord.attributes.build_list.preferences")
.both
= check_box_tag :auto_publish, true, @auto_publish_selected, :id => 'auto_publish'
= label_tag :auto_publish, t('activerecord.attributes.build_list.auto_publish')
- if @platform.personal?
= check_box_tag :use_save_to_repository, true, @use_save_to_repository, :id => 'auto_publish'
= label_tag :use_save_to_repository, t('activerecord.attributes.mass_build.use_save_to_repository')
.both

View File

@ -1,8 +0,0 @@
%h3=t("layout.mass_builds.repositories")
-@platform.repositories.each do |rep|
.both
=check_box_tag "repositories[]", rep.id, (params[:repositories]||[]).include?(rep.id.to_s), :id => "repositories_#{rep.id}", :href => "#{projects_list_platform_repository_path(@platform, rep)}?text=true"
=label_tag "repositories_#{rep.id}", rep.name
%h3=t("layout.mass_builds.projects_list")
=text_area_tag :projects_list, nil

View File

@ -1,7 +1,7 @@
= render 'platforms/base/submenu'
= render 'platforms/base/sidebar'
= render 'form' if can? :create, @platform.mass_builds.new
= link_to t('layout.mass_builds.new'), new_platform_mass_build_path(@platform), :class => 'button' if can? :create, @platform.mass_builds.build
%table.tablesorter.unbordered{:cellpadding => "0", :cellspacing => "0"}
%thead

View File

@ -0,0 +1,34 @@
- set_meta_tags :title => [title_object(@platform), t('layout.mass_builds.new')]
= render 'platforms/base/submenu'
= render 'platforms/base/sidebar'
= form_for [@platform, @mass_build], :html => { :class => 'form mass_build', :method => :post } do |f|
%section.left
%h3=t('layout.mass_builds.repositories')
- @platform.repositories.each do |rep|
.both
= check_box_tag "repositories[]", rep.id, (params[:repositories]||[]).include?(rep.id.to_s), :id => "repositories_#{rep.id}", :href => "#{projects_list_platform_repository_path(@platform, rep)}?text=true"
= label_tag "repositories_#{rep.id}", rep.name
%h3=t('layout.mass_builds.projects_list')
= f.text_area :projects_list
%br
= f.submit t("layout.projects.build_button")
%section.right
%h3= t("activerecord.attributes.build_list.arch")
- Arch.recent.each do |arch|
.lefter
= check_box_tag "arches[]", arch.id, (params[:arches]||[]).include?(arch.id.to_s), :id => "arches_#{arch.id}"
= label_tag "arches_#{arch.id}", arch.name
.both
- if @platform.personal?
%h3= t('activerecord.attributes.build_list.build_for_platform')
= f.collection_select :build_for_platform_id, Platform.main, :id, :name
.both
= render 'shared/autocomplete_form', :field => :extra_repositories, :field_class => Repository, :placeholder => 'uxteam_personal', :subject => @mass_build, :autocomplete_path => autocomplete_extra_repositories_autocompletes_path
= render 'shared/autocomplete_form', :field => :extra_build_lists, :field_class => BuildList, :placeholder => '1000000', :subject => @mass_build, :autocomplete_path => autocomplete_extra_build_list_autocompletes_path
%h3= t("activerecord.attributes.build_list.preferences")
.both
= f.check_box :auto_publish
= f.label :auto_publish
.both

View File

@ -1,9 +0,0 @@
%tr
- if extra.is_a?(BuildList)
%td= link_to "#{extra.id} (#{extra.project.name} - #{extra.arch.name})", extra
- else
%td= link_to "#{extra.platform.name}/#{extra.name}", [extra.platform, extra]
%td.actions
- field = extra.is_a?(BuildList) ? 'extra_build_lists' : 'extra_repositories'
= hidden_field_tag "build_list[#{field}][]", extra.id
%span.delete &nbsp;

View File

@ -1,13 +0,0 @@
- html_field = field.to_s.gsub('_', '-')
%div{:id => html_field}
%h3= t("activerecord.attributes.build_list.#{field}")
%span.icon-question-sign
%div{:title => t("activerecord.attributes.build_list.extra_repos"), :id => "#{html_field}-dialog"}
= render "projects/build_lists/docs/#{field}"
.both
= autocomplete_field_tag field, nil, autocomplete_to_extra_repos_and_builds_build_lists_path, :id_element => "##{html_field}_field", :placeholder => placeholder
= hidden_field_tag field, nil, :id => "#{html_field}_field"
= submit_tag t('layout.add'), :class => 'button', :id => 'add'
%table.tablesorter{:cellpadding => "0", :cellspacing => "0"}
%tbody

View File

@ -6,8 +6,6 @@
- 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}"
=# label_tag "bpls_#{pl.id}", pl.name
%div{:id => "build_for_pl_#{pl.id}", :class => 'build_for_pl'}= pl.name
.offset25= render 'include_repos', :platform => pl
%section.right
@ -23,8 +21,8 @@
%h3= t("activerecord.attributes.build_list.update_type")
.lineForm= f.select :update_type, BuildList::UPDATE_TYPES
= render 'extra_form', :field => :extra_repos, :placeholder => 'uxteam_personal'
= render 'extra_form', :field => :extra_build_lists, :placeholder => '1000000'
= render 'shared/autocomplete_form', :field => :extra_repositories, :field_class => Repository, :placeholder => 'uxteam_personal', :subject => @build_list, :autocomplete_path => autocomplete_extra_repositories_autocompletes_path
= render 'shared/autocomplete_form', :field => :extra_build_lists, :field_class => BuildList, :placeholder => '1000000', :subject => @build_list, :autocomplete_path => autocomplete_extra_build_list_autocompletes_path
%h3= t("activerecord.attributes.build_list.preferences")
- [:auto_publish, :auto_create_container].each do |kind|

View File

@ -0,0 +1,33 @@
/
Variables:
- subject
- field
- field_class
- autocomplete_path
- placeholder
- subject_class = subject.class.name.underscore
.autocomplete-form{:subject_class => subject_class, :field => field, :path => autocomplete_path, :class => field}
%h3= t("activerecord.attributes.build_list.#{field}")
%span.icon-question-sign
.dialog{:title => t("activerecord.attributes.build_list.#{field}"), :id => "#{field}_dialog"}
= render "shared/autocomplete_docs/#{field}"
.both
= autocomplete_field_tag field, nil, "#{autocomplete_path}?#{{:platform_id => subject.save_to_platform.try(:id)}.to_param}", :placeholder => placeholder, :class => 'autocomplete', :update_elements => {:id => "##{field}_field", :path => "##{field}_field_path", :label => "##{field}_field_label"}
= hidden_field_tag field, nil, :id => "#{field}_field"
= hidden_field_tag field, nil, :id => "#{field}_field_path"
= hidden_field_tag field, nil, :id => "#{field}_field_label"
= submit_tag t('layout.add'), :class => 'button add'
%table.tablesorter{:cellpadding => "0", :cellspacing => "0"}
%tbody
- field_class.where(:id => subject.send(field)).each do |extra|
%tr
- if extra.is_a?(BuildList)
%td= link_to "#{extra.id} (#{extra.project.name} - #{extra.arch.name})", extra
- else
%td= link_to "#{extra.platform.name}/#{extra.name}", [extra.platform, extra]
%td.actions
- field = extra.is_a?(BuildList) ? 'extra_build_lists' : 'extra_repositories'
= hidden_field_tag "#{subject_class}[#{field}][]", extra.id
%span.delete &nbsp;

View File

@ -7,7 +7,7 @@ en:
build_list:
bs_id: Id
name: Name
extra_repos: Extra repositories
extra_repositories: Extra repositories
extra_build_lists: Extra build lists
auto_create_container: Create container automatically
container_path: Container path

View File

@ -7,7 +7,7 @@ ru:
build_list:
bs_id: Id
name: Название
extra_repos: Дополнительные репозитории
extra_repositories: Дополнительные репозитории
extra_build_lists: Дополнительные сборки
auto_create_container: Создать контейнер автоматически
container_path: Путь до контейнера

View File

@ -1,6 +1,7 @@
en:
layout:
mass_builds:
new: New mass build
publish_success: Publish success builds
publish_test_failed: Publish test failed builds
repositories: Repositories
@ -21,7 +22,6 @@ en:
created_at: Created
updated_at: Updated
arch_names: Architectures
use_save_to_repository: Use personal repository for assembly
user: User
auto_publish: Auto Publish
repositories: Repositories

View File

@ -1,6 +1,7 @@
ru:
layout:
mass_builds:
new: Новая массовая сборка
publish_success: Опубликовать успешные сборки
publish_test_failed: Опубликовать сборки с проваленными тестами
repositories: Репозитории
@ -21,7 +22,6 @@ ru:
created_at: Создан
updated_at: Обновлен
arch_names: Архитектуры
use_save_to_repository: Использовать персональный репозиторий для сборки
user: Пользователь
auto_publish: Авто Публикация
repositories: Репозитории

View File

@ -149,7 +149,7 @@ Rosa::Application.routes.draw do
get :advisories
end
resources :mass_builds, :only => [:create, :index] do
resources :mass_builds, :only => [:create, :new, :index] do
member do
post :cancel
post :publish
@ -189,6 +189,8 @@ Rosa::Application.routes.draw do
collection do
get :autocomplete_user_uname
get :autocomplete_group_uname
get :autocomplete_extra_build_list
get :autocomplete_extra_repositories
end
end

View File

@ -1,4 +1,4 @@
class AddSaveToPlatformToMassBuild < ActiveRecord::Migration
class AddExtraReposAndBuildListsToMassBuild < ActiveRecord::Migration
class MassBuild < ActiveRecord::Base
end
@ -8,12 +8,14 @@ class AddSaveToPlatformToMassBuild < ActiveRecord::Migration
change_column :mass_builds, :save_to_platform_id, :integer, :null => false
change_column :mass_builds, :platform_id, :integer, :null => false
rename_column :mass_builds, :platform_id, :build_for_platform_id
add_column :mass_builds, :use_save_to_repository, :boolean
add_column :mass_builds, :extra_repositories, :text
add_column :mass_builds, :extra_build_lists, :text
end
def down
remove_column :mass_builds, :extra_repositories
remove_column :mass_builds, :extra_build_lists
remove_column :mass_builds, :save_to_platform_id
remove_column :mass_builds, :use_save_to_repository
rename_column :mass_builds, :build_for_platform_id, :platform_id
end

View File

@ -292,7 +292,8 @@ ActiveRecord::Schema.define(:version => 20130603124853) do
t.integer "success_count", :default => 0, :null => false
t.integer "build_canceled_count", :default => 0, :null => false
t.integer "save_to_platform_id", :null => false
t.boolean "use_save_to_repository"
t.text "extra_repositories"
t.text "extra_build_lists"
end
create_table "platforms", :force => true do |t|