19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'app/models/setting/template_sync.rb', line 19
def self.load_defaults
return unless super
%w(template_sync_filter template_sync_branch).each { |s| Setting::BLANK_ATTRS << s }
self.transaction do
[
self.set('template_sync_verbose', N_('Choose verbosity for Rake task importing templates'), false, N_('Verbosity')),
self.set('template_sync_associate', N_('Associate templates to OS'), 'new', N_('Associate'), nil, { :collection => Proc.new { self.associate_types } }),
self.set('template_sync_prefix', N_('The string all imported templates should begin with'), "Community ", N_('Prefix')),
self.set('template_sync_dirname', N_('The directory within the Git repo containing the templates'), '/', N_('Dirname')),
self.set('template_sync_filter', N_('Import or export names matching this regex (case-insensitive; snippets are not filtered)'), nil, N_('Filter')),
self.set('template_sync_repo', N_('Default Git repo to sync from'), 'https://github.com/theforeman/community-templates.git', N_('Repo')),
self.set('template_sync_negate', N_('Negate the prefix (for purging) / filter (for importing/exporting)'), false, N_('Negate')),
self.set('template_sync_branch', N_('Default branch in Git repo'), nil, N_('Branch')),
self.set('template_sync_metadata_export_mode', N_('Default metadata export mode, refresh re-renders metadata, keep will keep existing metadata, remove exports template withou metadata'), 'refresh', N_('Metadata export mode'), nil, { :collection => Proc.new { self.metadata_export_mode_types } }),
self.set('template_sync_force', N_('Should importing overwrite locked templates?'), false, N_('Force import')),
].compact.each { |s| self.create! s.update(:category => "Setting::TemplateSync") }
end
true
end
|