#432: cleanup, updated UI, specs
This commit is contained in:
parent
c3d30d2dcc
commit
610a995597
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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,24 +30,25 @@
|
|||
= hidden_field_tag 'admin_id', @admin_id, id: 'admin_id_field'
|
||||
.both
|
||||
|
||||
%h3= t('layout.platform_arch_settings.extra_settings')
|
||||
- if ['edit', 'update'].include? controller.action_name
|
||||
%h3= t('layout.platform_arch_settings.extra_settings')
|
||||
|
||||
%table.tablesorter{cellpadding: "0", cellspacing: "0"}
|
||||
%thead
|
||||
%tr
|
||||
%th.lpadding16= t("activerecord.models.arch")
|
||||
%th.lpadding16= t("activerecord.attributes.platform_arch_setting.default")
|
||||
%th.lpadding16= t("activerecord.attributes.platform_arch_setting.time_living")
|
||||
%tbody
|
||||
- platform_arch_settings(@platform).each do |setting|
|
||||
%tr{class: cycle("odd", "even")}
|
||||
= f.fields_for :platform_arch_settings, setting do |s_form|
|
||||
%td
|
||||
= setting.arch.name
|
||||
= s_form.hidden_field :arch_id
|
||||
%td.center= s_form.check_box :default, class: 'check_box'
|
||||
%td.right= s_form.text_field :time_living, value: setting.time_living / 60, class: 'text_field', size: 10
|
||||
.both
|
||||
%table.tablesorter{cellpadding: "0", cellspacing: "0"}
|
||||
%thead
|
||||
%tr
|
||||
%th.lpadding16= t("activerecord.models.arch")
|
||||
%th.lpadding16= t("activerecord.attributes.platform_arch_setting.default")
|
||||
%th.lpadding16= t("activerecord.attributes.platform_arch_setting.time_living")
|
||||
%tbody
|
||||
- platform_arch_settings(@platform).each do |setting|
|
||||
%tr{class: cycle("odd", "even")}
|
||||
= f.fields_for :platform_arch_settings, setting do |s_form|
|
||||
%td
|
||||
= setting.arch.name
|
||||
= s_form.hidden_field :arch_id
|
||||
%td.center= s_form.check_box :default, class: 'check_box'
|
||||
%td.right= s_form.text_field :time_living, value: setting.time_living / 60, class: 'text_field', size: 10
|
||||
.both
|
||||
|
||||
.button_block
|
||||
= f.submit t('layout.save'), data: {'disable-with' => t('layout.saving')}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue