#258: removed advisories backbone JS

This commit is contained in:
Vokhmin Alexey V 2013-08-08 16:16:51 +04:00
parent 0d26362b32
commit 4f8e7ab71e
15 changed files with 234 additions and 530 deletions

View File

@ -0,0 +1,42 @@
RosaABF.controller('BuildListController', ['$scope', '$http', function($scope, $http) {
$scope.advisoriable_types = <%=BuildList::RELEASE_UPDATE_TYPES%>;
$scope.build_list = {};
$scope.attach_advisory = 'no';
// Statuses: advisory_not_found, server_error, continue_input
$scope.search_status = 'continue_input';
$scope.term = null;
$scope.advisory = null;
$scope.search = function() {
var params = {query: $scope.term, bl_type: $scope.build_list.update_type, format: 'json'};
$http.get(Routes.search_advisories_path(params)).success(function(results) {
$scope.search_status = 'continue_input';
$scope.advisory = results;
$('#attach_advisory').find('.advisory_id').val($scope.advisory.advisory_id);
}).error(function(data, status, headers, config) {
$scope.search_status = status == 404 ? 'advisory_not_found' : 'server_error';
$scope.advisory = null;
$('#attach_advisory').find('.advisory_id').val('');
});;
}
$scope.updateTypeChanged = function() {
if (_.indexOf($scope.advisoriable_types, $scope.build_list.update_type) != -1) {
if ($scope.advisory) { $scope.search(); }
} else {
$scope.attach_advisory = 'no';
}
}
$scope.attachAdvisoryChanged = function() {
if (_.indexOf($scope.advisoriable_types, $scope.build_list.update_type) == -1) {
$scope.build_list.update_type = $scope.advisoriable_types[0];
}
$('#build_list_update_type .nonadvisoriable').attr('disabled', ($scope.attach_advisory != 'no'));
}
}]);

View File

@ -1 +0,0 @@
Rosa.bootstrapedData.ROLES = <%= Relation::ROLES.to_json %>;

View File

@ -1,96 +0,0 @@
Rosa.Models.Advisory = Backbone.Model.extend({
defaults: {
id: null,
description: null,
references: null,
update_type: null,
found: false
},
initialize: function() {
_.bindAll(this, 'findByAdvisoryID');
this.url = '/advisories';
},
findByAdvisoryID: function(id, bl_type, options) {
var self = this;
var urlError = function() {
throw new Error("A 'url' property or function must be specified");
};
var typeError = function() {
throw new Error("A 'bl_type' must be 'security' or 'bugfix'");
};
var idError = function() {
throw new Error("A 'id' must be a string at least 4 characters long");
};
if ( (typeof(id) != "string") || (id.length < 4) ) {
idError();
}
if ( (bl_type == undefined) || (bl_type == null) || ((bl_type != 'security') && (bl_type != 'bugfix')) ) {
typeError();
}
options |= {};
var data = _.extend({
query: id,
bl_type: bl_type
}, {});
var params = _.extend({
type: 'GET',
dataType: 'json',
beforeSend: function( xhr ) {
var token = $('meta[name="csrf-token"]').attr('content');
if (token) xhr.setRequestHeader('X-CSRF-Token', token);
self.trigger('search:start');
}
}, options);
if (!params.url) {
params.url = ((_.isFunction(this.url) ? this.url() : this.url) + '/search') || urlError();
}
params.data = data;
var complete = options.complete;
params.complete = function(jqXHR, textStatus) {
//console.log(jqXHR);
switch (jqXHR.status) {
case 200:
self.set(_.extend({
found: true
}, JSON.parse(jqXHR.responseText)), {silent: true});
self.trigger('search:end');
break
case 404:
self.set(self.defaults, {silent: true});
self.trigger('search:end');
break
default:
self.set(self.defaults, {silent: true});
self.trigger('search:failed');
}
if (complete) complete(jqXHR, textStatus);
}
$.ajax(params);
return this;
}
});
Rosa.Collections.AdvisoriesCollection = Backbone.Collection.extend({
model: Rosa.Models.Advisory
});

View File

@ -1,15 +0,0 @@
//= require_self
//= require ./additionals
//= require_tree ./templates
//= require_tree ./models
//= require_tree ./views
//= require_tree ./routers
window.Rosa = {
Models: {},
Collections: {},
Routers: {},
Views: {},
bootstrapedData: {}
}

View File

@ -1,9 +0,0 @@
Rosa.Routers.BuildListsAdvisoriesRouter = Backbone.Router.extend({
routes: {},
initialize: function() {
this.advisoriesView = new Rosa.Views.BuildListAdvisoriesView({ model: new Rosa.Models.Advisory() });
this.advisoriesView.render();
}
});

View File

@ -1,3 +0,0 @@
%li.empty_result
%span
Nothing found

View File

@ -1,215 +0,0 @@
Rosa.Views.BuildListAdvisoriesView = Backbone.View.extend({
initialize: function() {
_.bindAll(this, 'showAdvisory', 'showPreview', 'showForm',
'showSearch', 'hideAll', 'displayStatus', 'processSearch',
'showInTypeSelect', 'typeSelectChange');
this.$el = $('#advisory_block');
this._$type_select = $('#build_list_update_type');
this._$publish_button = $('input[type="submit"][name="publish"]');
this._$form = this.$('#new_advisory_form');
this._$preview = this.$('#advisory_preview');
this._$search = this.$('#advisory_search_block');
this._$search_field = this.$('#advisory_search');
this._$not_found = this.$('#advisory_search_block > .advisory_not_found');
this._$server_error = this.$('#advisory_search_block > .server_error');
this._$continue_input = this.$('#advisory_search_block > .continue_input');
this._search_timer = null;
this._$selector = this.$('#attach_advisory');
this._state_vars = {};
this._state_vars = _.extend({
checked_update_type: this._$type_select.val(),
header_text: this._$preview.children('h3').html()
}, this.state_vars);
this._$selector.on('change', this.showAdvisory);
this._$search_field.on('input keyup', this.processSearch);
this._$type_select.on('change', this.typeSelectChange);
this.model.on('search:start', function() {
this._$publish_button.prop({disabled: true});
}, this);
this.model.on('search:end', this.showPreview, this);
this.model.on('search:failed', this.handleSearchError, this);
},
showAdvisory: function(ev) {
this._$publish_button.prop({disabled: false});
switch (this._$selector.val()) {
case 'no':
this.hideAll();
this.showInTypeSelect('all');
break
case 'new':
this.showForm();
this.showInTypeSelect('advisoriable');
break
default:
this.showSearch();
this.showInTypeSelect('advisoriable');
this._$publish_button.prop({disabled: true});
}
},
typeSelectChange: function(ev) {
switch (this._$selector.val()) {
case 'no':
this._state_vars.checked_update_type = this._$selector.val();
break
case 'new':
break
default:
this._$search_field.trigger('input');
}
},
showInTypeSelect: function(type) {
var children = this._$type_select.children('option');
if (type != 'all') {
var visible_ch = children.filter('.' + type);
var sel = children.filter(':selected');
children.prop('disabled', true);
visible_ch.prop('disabled', false);
if (sel.prop('disabled')) {
sel.prop('selected', false);
visible_ch.first().prop('selected', true);
}
} else {
children.prop('disabled', false).prop('selected', false);
children.filter('option[value="' + this._state_vars.checked_update_type + '"]').prop('selected', true);
}
},
processSearch: function(ev) {
if (ev.type == "keyup") {
if (ev.keyCode != 13) {
return
} else {
ev.preventDefault();
}
}
var TIMER_INTERVAL = 500;
var self = this;
var timerCallback = function() {
if (self._$search_field.val().length > 3) {
// real search
self.model.findByAdvisoryID(self._$search_field.val(), self._$type_select.val());
} else {
// hide preview if nothing to show
if (self._$preview.is(':visible')) {
self._$preview.slideUp();
}
self.displayStatus('found');
}
};
if (this.model.get('advisory_id') == this._$search_field.val()) {
this.showPreview();
return;
}
// timeout before real AJAX request
clearTimeout(this._search_timer);
this._search_timer = setTimeout(timerCallback, TIMER_INTERVAL);
},
showPreview: function(id) {
this._$publish_button.prop({disabled: false});
if (this._$form.is(':visible')) {
this._$form.slideUp();
}
var prev = this._$preview;
var adv = this.model;
if (adv.get('found')) {
this._$selector.children('option.advisory_id').val(adv.get('advisory_id'));
prev.children('h3').html(this._state_vars.header_text + ' ' + adv.get('advisory_id'));
prev.children('.descr').html(adv.get('description'));
prev.children('.refs').html(adv.get('references'));
if (!this._$preview.is(':visible')) {
this._$preview.slideDown();
}
this.displayStatus('found');
} else {
if (this._$preview.is(':visible')) {
this._$preview.slideUp();
}
this._$publish_button.prop({disabled: true});
this.displayStatus('not_found');
this._$selector.children('option.advisory_id').val('');
}
},
showForm: function() {
if (this._$preview.is(':visible')) {
this._$preview.slideUp();
}
if (this._$search.is(':visible')) {
this._$search.slideUp();
}
if (!this._$form.is(':visible')) {
this._$form.slideDown();
}
},
showSearch: function() {
if (this._$form.is(':visible')) {
this._$form.slideUp();
}
if (!this._$search.is(':visible')) {
this._$search.slideDown();
this._$search_field.trigger('input');
}
},
handleSearchError: function() {
this._$publish_button.prop({disabled: true});
this.displayStatus('error');
if (this._$preview.is(':visible')) {
this._$preview.slideUp();
}
if (this._$form.is(':visible')) {
this._$form.slideUp();
}
},
hideAll: function() {
if (this._$preview.is(':visible')) {
this._$preview.slideUp();
}
if (this._$search.is(':visible')) {
this._$search.slideUp();
}
if (this._$form.is(':visible')) {
this._$form.slideUp();
}
},
displayStatus: function(st) {
var ELEMS = {
'found': this._$continue_input,
'not_found': this._$not_found,
'error': this._$server_error
};
this._$continue_input.hide();
this._$not_found.hide();
this._$server_error.hide();
ELEMS[st].show();
},
render: function() {
this.showAdvisory();
return this;
}
});

View File

@ -1010,12 +1010,12 @@ form.mass_build input[type="checkbox"] {
height: 11px;
}
div#new_advisory_form,
/*div#new_advisory_form,
div#advisory_preview,
div#advisory_search_block,
div#advisory_search_block div.info {
display: none;
}
}*/
div#advisory_search_block {
padding-bottom: 15px;

View File

@ -21,9 +21,13 @@ class AdvisoriesController < ApplicationController
def search
@advisory = Advisory.by_update_type(params[:bl_type]).search_by_id(params[:query]).first
raise ActiveRecord::RecordNotFound.new('Not Found') if @advisory.nil?
respond_to do |format|
format.json { render @advisory }
if @advisory.nil?
render :nothing => true, :status => 404
else
# respond_to do |format|
# format.json { render @advisory }
# end
render @advisory
end
end
end

View File

@ -173,7 +173,7 @@ class Ability
cannot [:create, :update, :destroy, :clone], Product, :platform => {:platform_type => 'personal'}
cannot [:clone], Platform, :platform_type => 'personal'
cannot :publish, BuildList, :new_core => false
# cannot :publish, BuildList, :new_core => false
cannot :create_container, BuildList, :new_core => false
cannot(:publish, BuildList) {|build_list| !build_list.can_publish? }

View File

@ -4,213 +4,210 @@
%p= @build_list.human_status
%p= @build_list.updated_at
.both
=form_for @build_list, :url => publish_build_list_path(@build_list), :html => { :class => :form } do |f|
%h3= t("layout.build_lists.main_data")
.leftlist= t("activerecord.attributes.build_list.container_path")
.rightlist
- if @build_list.container_published?
-url = container_url
= link_to url, url
- elsif @build_list.container_publish?
= t("layout.build_lists.creating")
.both
.leftlist= t("activerecord.attributes.build_list.id")
.rightlist= @build_list.id
.both
.leftlist= t("activerecord.attributes.build_list.user")
.rightlist
= link_to @build_list.user.try(:fullname), @build_list.user
.both
.leftlist= t("activerecord.attributes.build_list.publisher")
.rightlist
= link_to @build_list.publisher.try(:fullname), @build_list.publisher if @build_list.publisher
.both
.leftlist= t("activerecord.attributes.build_list.build_for_platform")
.rightlist
- bfp = @build_list.build_for_platform
- if bfp.present?
= link_to(bfp.name, bfp)
- else
= t("layout.build_lists.platform_deleted")
.both
.leftlist= t("activerecord.attributes.build_list.save_to_repository")
.rightlist
= link_to "#{@build_list.save_to_platform.name}/#{@build_list.save_to_repository.name}", [@build_list.save_to_platform, @build_list.save_to_repository]
.both
.leftlist= t("activerecord.attributes.build_list.include_repos")
.rightlist= (@build_list.include_repos||[]).map{|r| Repository.find(r).name}.join(', ')
.both
.leftlist= t("activerecord.attributes.build_list.update_type")
.rightlist
- if can?(:publish, @build_list)
= f.select :update_type, options_for_select(build_list_classified_update_types, @build_list.update_type)
- else
= @build_list.update_type
.both
.leftlist= t("activerecord.attributes.build_list.auto_publish")
.rightlist= t("layout.#{@build_list.auto_publish}_")
.both
.leftlist= t("activerecord.attributes.build_list.auto_create_container")
.rightlist= t("layout.#{@build_list.auto_create_container?}_")
.both
.leftlist= t("diff")
.rightlist= build_list_version_link(@build_list, true)
.both
.leftlist= t("activerecord.attributes.build_list.arch")
.rightlist= @build_list.arch.name
.both
.leftlist= t("activerecord.attributes.build_list.updated_at")
.rightlist= @build_list.updated_at
.both
.leftlist= t("activerecord.attributes.build_list.is_circle")
.rightlist= t("layout.#{@build_list.is_circle?}_")
.both
.leftlist= t("activerecord.attributes.build_list.new_core")
.rightlist= t("layout.#{@build_list.new_core?}_")
.both
- if @build_list.extra_build_lists.present? || @build_list.extra_repositories.present?
.leftlist= t("activerecord.attributes.build_list.extra_repos")
%div{'ng-controller' => 'BuildListController'}
=form_for @build_list, :url => publish_build_list_path(@build_list), :html => { :class => :form } do |f|
%h3= t("layout.build_lists.main_data")
.leftlist= t("activerecord.attributes.build_list.container_path")
.rightlist
- Repository.where(:id => @build_list.extra_repositories).each do |repo|
%p= link_to "#{repo.platform.name}/#{repo.name}", [repo.platform, repo]
- BuildList.where(:id => @build_list.extra_build_lists).each do |bl|
%p= link_to "#{bl.id} (#{bl.project.name} - #{bl.arch.name})", bl
- if @build_list.container_published?
-url = container_url
= link_to url, url
- elsif @build_list.container_publish?
= t("layout.build_lists.creating")
.both
- if @build_list.mass_build_id.present?
.leftlist= t("activerecord.attributes.mass_build_id")
.rightlist= link_to @build_list.mass_build.name, platform_mass_builds_path(@build_list.save_to_platform)
.leftlist= t("activerecord.attributes.build_list.id")
.rightlist= @build_list.id
.both
- if @build_list.advisory.present?
.leftlist= t("layout.build_lists.attached_advisory")
.rightlist= link_to @build_list.advisory.advisory_id, advisory_path(@build_list.advisory)
.both
- if !@build_list.in_work? && @build_list.started_at
%br
.leftlist
.rightlist= @build_list.human_duration
.both
- if @build_list.in_work?
%br
.leftlist
.leftlist= t("activerecord.attributes.build_list.user")
.rightlist
= "#{@build_list.human_current_duration} / #{@build_list.human_average_build_time}"
= link_to @build_list.user.try(:fullname), @build_list.user
.both
.leftlist= t("activerecord.attributes.build_list.publisher")
.rightlist
= link_to @build_list.publisher.try(:fullname), @build_list.publisher if @build_list.publisher
.both
.leftlist= t("activerecord.attributes.build_list.build_for_platform")
.rightlist
- bfp = @build_list.build_for_platform
- if bfp.present?
= link_to(bfp.name, bfp)
- else
= t("layout.build_lists.platform_deleted")
.both
.leftlist= t("activerecord.attributes.build_list.save_to_repository")
.rightlist
= link_to "#{@build_list.save_to_platform.name}/#{@build_list.save_to_repository.name}", [@build_list.save_to_platform, @build_list.save_to_repository]
.both
.leftlist= t("activerecord.attributes.build_list.include_repos")
.rightlist= (@build_list.include_repos||[]).map{|r| Repository.find(r).name}.join(', ')
.both
.leftlist= t("activerecord.attributes.build_list.update_type")
.rightlist{'ng-init' => "build_list.update_type = '#{@build_list.update_type}'"}
- if can?(:publish, @build_list)
= f.select :update_type, options_for_select(build_list_classified_update_types, @build_list.update_type), {}, 'ng-model' => 'build_list.update_type', 'ng-change' => 'updateTypeChanged()'
- else
= @build_list.update_type
.both
.leftlist= t("activerecord.attributes.build_list.auto_publish")
.rightlist= t("layout.#{@build_list.auto_publish}_")
.both
.leftlist= t("activerecord.attributes.build_list.auto_create_container")
.rightlist= t("layout.#{@build_list.auto_create_container?}_")
.both
.leftlist= t("diff")
.rightlist= build_list_version_link(@build_list, true)
.both
.leftlist= t("activerecord.attributes.build_list.arch")
.rightlist= @build_list.arch.name
.both
.leftlist= t("activerecord.attributes.build_list.updated_at")
.rightlist= @build_list.updated_at
.both
.leftlist= t("activerecord.attributes.build_list.is_circle")
.rightlist= t("layout.#{@build_list.is_circle?}_")
.both
.leftlist= t("activerecord.attributes.build_list.new_core")
.rightlist= t("layout.#{@build_list.new_core?}_")
.both
- if @build_list.can_cancel? && can?(:cancel, @build_list)
= link_to t("layout.build_lists.cancel"), cancel_build_list_path(@build_list),
:method => :put, :confirm => t("layout.confirm"), :class => 'button'
- if @build_list.save_to_platform.released && @build_list.advisory.nil? && can?(:publish, @build_list)
#advisory_block
.leftlist= label_tag :attach_advisory, t("layout.build_lists.attached_advisory")
- if @build_list.extra_build_lists.present? || @build_list.extra_repositories.present?
.leftlist= t("activerecord.attributes.build_list.extra_repos")
.rightlist
= select_tag :attach_advisory, advisories_select_options(@advisories)
%p.hint_text= t("layout.advisories.publication_info", :update_types => BuildList::RELEASE_UPDATE_TYPES.join(', '))
- Repository.where(:id => @build_list.extra_repositories).each do |repo|
%p= link_to "#{repo.platform.name}/#{repo.name}", [repo.platform, repo]
- BuildList.where(:id => @build_list.extra_build_lists).each do |bl|
%p= link_to "#{bl.id} (#{bl.project.name} - #{bl.arch.name})", bl
.both
#advisory_search_block
%h3= t("layout.advisories.search_by_id")
.leftlist= label_tag :advisory_search, t("layout.advisories.search_hint")
- if @build_list.mass_build_id.present?
.leftlist= t("activerecord.attributes.mass_build_id")
.rightlist= link_to @build_list.mass_build.name, platform_mass_builds_path(@build_list.save_to_platform)
.both
- if @build_list.advisory.present?
.leftlist= t("layout.build_lists.attached_advisory")
.rightlist= link_to @build_list.advisory.advisory_id, advisory_path(@build_list.advisory)
.both
- if !@build_list.in_work? && @build_list.started_at
%br
.leftlist
.rightlist= @build_list.human_duration
.both
- if @build_list.in_work?
%br
.leftlist
.rightlist
= "#{@build_list.human_current_duration} / #{@build_list.human_average_build_time}"
.both
- if @build_list.can_cancel? && can?(:cancel, @build_list)
= link_to t("layout.build_lists.cancel"), cancel_build_list_path(@build_list),
:method => :put, :confirm => t("layout.confirm"), :class => 'button'
- if @build_list.save_to_platform.released && @build_list.advisory.nil? && can?(:publish, @build_list)
#advisory_block
.leftlist= label_tag :attach_advisory, t("layout.build_lists.attached_advisory")
.rightlist
%input#advisory_search{:type => 'text'}
%p.hint_text= t("layout.advisories.advisory_id_info", :advisory_format => advisory_id_for_hint)
.both
- %w(advisory_not_found server_error continue_input).each do |el|
.info{:class => el}
%p= t("layout.advisories.banners.#{el}")
#new_advisory_form
= f.fields_for @build_list.build_advisory do |f|
= render :partial => 'advisories/form', :locals => {:f => f}
#advisory_preview
%h3= t("activerecord.models.advisory") << ' '
.leftlist= t("activerecord.attributes.advisory.description")
.rightlist.descr &nbsp;
= select_tag :attach_advisory, advisories_select_options(@advisories), 'ng-model' => 'attach_advisory', 'ng-change' => 'attachAdvisoryChanged()'
%p.hint_text= t("layout.advisories.publication_info", :update_types => BuildList::RELEASE_UPDATE_TYPES.join(', '))
.both
.leftlist= t("activerecord.attributes.advisory.references")
.rightlist.refs &nbsp;
.both
:javascript
$(function() {
var r = new Rosa.Routers.BuildListsAdvisoriesRouter();
});
#advisory_search_block{'ng-show' => 'attach_advisory != "no" && attach_advisory != "new"'}
%h3= t("layout.advisories.search_by_id")
.leftlist= label_tag :advisory_search, t("layout.advisories.search_hint")
.rightlist
%input#advisory_search{:type => 'text', 'ng-model' => 'term', 'ng-keyup' => 'search()'}
%p.hint_text= t("layout.advisories.advisory_id_info", :advisory_format => advisory_id_for_hint)
.both
- I18n.t('layout.advisories.banners').keys.each do |key|
.info{:class => key, 'ng-show' => "search_status == '#{key}'"}
%p= t("layout.advisories.banners.#{key}")
- if @build_list.build_started?
= render 'shared/log', { :build_started => true, :get_log_path => log_build_list_path(@build_list) }
#new_advisory_form{'ng-show' => 'attach_advisory == "new"'}
= f.fields_for @build_list.build_advisory do |f|
= render :partial => 'advisories/form', :locals => {:f => f}
- unless @build_list.extra_build_lists_published?
.flash_notify
.alert.alert-error= t('layout.build_lists.publish_with_extra_fail')
.both
#advisory_preview{'ng-show' => 'attach_advisory != "no" && attach_advisory != "new"'}
%h3= t('activerecord.models.advisory') << ' {{advisory.advisory_id}}'
- if can?(:publish, @build_list)
- if @build_list.build_published?
= submit_tag t("layout.publish_again"), :confirm => t("layout.publish_again_warning"), :name => 'publish'
- elsif can_publish_in_future?(@build_list) && @build_list.extra_build_lists_published?
- confirm = @build_list.tests_failed? ? t('layout.build_lists.tests_failed') : t('layout.confirm')
= submit_tag t("layout.publish"), :confirm => confirm, :name => 'publish'
- if @build_list.can_reject_publish? && can?(:reject_publish, @build_list)
= link_to t('layout.reject_publish'), reject_publish_build_list_path(@build_list),
:method => :put, :confirm => t("layout.confirm"), :class => 'button reject_publish'
- if @build_list.can_create_container? && can?(:create_container, @build_list)
= link_to t("layout.build_lists.create_container"), create_container_build_list_path(@build_list),
:method => :put, :confirm => t("layout.confirm"), :class => 'button create_container'
- if can? :create, @build_list
= link_to t('layout.build_lists.recreate_build_list'), new_project_build_list_path(@build_list.project, :build_list_id => @build_list.id), :class => 'button'
.leftlist= t('activerecord.attributes.advisory.description')
.rightlist.descr {{advisory.description}}
.both
.hr
%h3= t("layout.build_lists.items_header")
- if @item_groups.blank?
%h4.nomargin= t("layout.build_lists.no_items_data")
- @item_groups.each_with_index do |group, level|
- group.each do |item|
%h4.nomargin= "#{item.name} ##{level}"
.leftlist= t('activerecord.attributes.advisory.references')
.rightlist.refs {{advisory.references}}
.both
- if @build_list.build_started?
= render 'shared/log', { :build_started => true, :get_log_path => log_build_list_path(@build_list) }
- unless @build_list.extra_build_lists_published?
.flash_notify
.alert.alert-error= t('layout.build_lists.publish_with_extra_fail')
.both
- if can?(:publish, @build_list)
- if @build_list.build_published?
= submit_tag t("layout.publish_again"), :confirm => t("layout.publish_again_warning"), :name => 'publish'
- elsif can_publish_in_future?(@build_list) && @build_list.extra_build_lists_published?
- confirm = @build_list.tests_failed? ? t('layout.build_lists.tests_failed') : t('layout.confirm')
= submit_tag t("layout.publish"), :confirm => confirm, :name => 'publish'
- if @build_list.can_reject_publish? && can?(:reject_publish, @build_list)
= link_to t('layout.reject_publish'), reject_publish_build_list_path(@build_list),
:method => :put, :confirm => t("layout.confirm"), :class => 'button reject_publish'
- if @build_list.can_create_container? && can?(:create_container, @build_list)
= link_to t("layout.build_lists.create_container"), create_container_build_list_path(@build_list),
:method => :put, :confirm => t("layout.confirm"), :class => 'button create_container'
- if can? :create, @build_list
= link_to t('layout.build_lists.recreate_build_list'), new_project_build_list_path(@build_list.project, :build_list_id => @build_list.id), :class => 'button'
.hr
%h3= t("layout.build_lists.items_header")
- if @item_groups.blank?
%h4.nomargin= t("layout.build_lists.no_items_data")
- @item_groups.each_with_index do |group, level|
- group.each do |item|
%h4.nomargin= "#{item.name} ##{level}"
%table.tablesorter.width565{:cellpadding => "0", :cellspacing => "0"}
%thead
%tr
%th= t("activerecord.attributes.build_list/item.name")
%th= t("activerecord.attributes.build_list/item.version")
%th= t("activerecord.attributes.build_list/item.status")
%tbody
%tr{:class => build_list_item_status_color(item.status)}
%td= item.name
%td= build_list_item_version_link item
%td= item.human_status
.both
- if @build_list.packages.present?
.hr
%h3= t("layout.build_lists.packages_header")
%table.tablesorter.width565{:cellpadding => "0", :cellspacing => "0"}
%thead
%tr
%th= t("activerecord.attributes.build_list/item.name")
%th= t("activerecord.attributes.build_list/item.version")
%th= t("activerecord.attributes.build_list/item.status")
%th= t("activerecord.attributes.build_list/package.fullname")
%th= t("activerecord.attributes.build_list/package.name")
%th= t("activerecord.attributes.build_list/package.version")
%th= t("activerecord.attributes.build_list/package.release")
%tbody
%tr{:class => build_list_item_status_color(item.status)}
%td= item.name
%td= build_list_item_version_link item
%td= item.human_status
.both
- @build_list.packages.each do |package|
%tr
- if package.sha1.present?
%td= link_to package.fullname, "#{APP_CONFIG['file_store_url']}/api/v1/file_stores/#{package.sha1}"
- else
%td= package.fullname
%td= package.name
%td= package.version
%td= package.release
.both
- if @build_list.packages.present?
.hr
%h3= t("layout.build_lists.packages_header")
%table.tablesorter.width565{:cellpadding => "0", :cellspacing => "0"}
%thead
%tr
%th= t("activerecord.attributes.build_list/package.fullname")
%th= t("activerecord.attributes.build_list/package.name")
%th= t("activerecord.attributes.build_list/package.version")
%th= t("activerecord.attributes.build_list/package.release")
%tbody
- @build_list.packages.each do |package|
%tr
- if package.sha1.present?
%td= link_to package.fullname, "#{APP_CONFIG['file_store_url']}/api/v1/file_stores/#{package.sha1}"
- else
%td= package.fullname
%td= package.name
%td= package.version
%td= package.release
.both
- if @build_list.new_core?
.hr
= render 'platforms/product_build_lists/results', :subject => @build_list
- if @build_list.new_core?
.hr
= render 'platforms/product_build_lists/results', :subject => @build_list
:javascript
$('article .all').addClass('bigpadding');