#432: cleanup, updated UI, specs

This commit is contained in:
Vokhmin Alexey V 2014-10-02 00:10:05 +04:00
parent c3d30d2dcc
commit 610a995597
4 changed files with 27 additions and 22 deletions

View File

@ -17,7 +17,7 @@ class CreateEmptyMetadataJob < Struct.new(:class_name, :id)
private
def create_empty_metadata_for_platform
platform = Platform.main.find id
platform = Platform.main.opened.find id
@platforms = [platform]
repositories = Repository.joins(:platform).
where(platforms: { platform_type: Platform::TYPE_PERSONAL })
@ -64,7 +64,7 @@ class CreateEmptyMetadataJob < Struct.new(:class_name, :id)
end
def platforms
@platforms ||= Platform.main.to_a
@platforms ||= Platform.main.opened.to_a
end
end

View File

@ -6,7 +6,7 @@ module EmptyMetadata
end
def create_empty_metadata
return if is_a?(Platform) && personal?
return if is_a?(Platform) && ( personal? || hidden? )
Resque.enqueue(CreateEmptyMetadataJob, self.class.name, id)
end

View File

@ -12,6 +12,10 @@
.rightlist= f.select :distrib_type, options_for_select(APP_CONFIG['distr_types'])
.both
.leftlist= f.label :visibility, class: :label
.rightlist= f.select :visibility, options_for_select(Platform::VISIBILITIES.map{ |v| [t("activerecord.attributes.platform.visibility_types.#{v}"), v] })
.both
-#.leftlist= f.label :parent, class: :label
.rightlist= f.collection_select :parent_platform_id, Platform.all, :id, :description, include_blank: true
.both
@ -26,6 +30,7 @@
= hidden_field_tag 'admin_id', @admin_id, id: 'admin_id_field'
.both
- if ['edit', 'update'].include? controller.action_name
%h3= t('layout.platform_arch_settings.extra_settings')
%table.tablesorter{cellpadding: "0", cellspacing: "0"}

View File

@ -60,7 +60,7 @@ describe CreateEmptyMetadataJob do
it 'repository of personal platform' do
platform.platform_type = Platform::TYPE_PERSONAL
allow(Platform).to receive(:main).and_return([platform])
Platform.stub_chain(:main, :opened).and_return([platform])
paths = <<-STR
#{ platform.path }/repository/#{ platform.name }/i586/#{ repository.name }/release
#{ platform.path }/repository/#{ platform.name }/i586/#{ repository.name }/updates
@ -82,7 +82,7 @@ describe CreateEmptyMetadataJob do
let(:job) { CreateEmptyMetadataJob.new('Platform', 123) }
before do
Platform.stub_chain(:main, :find).and_return(platform)
Platform.stub_chain(:main, :opened, :find).and_return(platform)
Repository.stub_chain(:joins, :where, :find_each).and_yield(repository1).and_yield(repository2)
end