Module: ForemanPuppet::PuppetclassesAndEnvironmentsHelper
- Included in:
- EnvironmentsHelper, PuppetclassesHelper
- Defined in:
- app/helpers/foreman_puppet/puppetclasses_and_environments_helper.rb
Instance Method Summary collapse
- #class_update_text(pcs, env) ⇒ Object
- #import_proxy_links(hash, import_env_text = false, classes = nil) ⇒ Object
- #import_proxy_select(hash) ⇒ Object
Instance Method Details
#class_update_text(pcs, env) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/helpers/foreman_puppet/puppetclasses_and_environments_helper.rb', line 3 def class_update_text(pcs, env) if pcs.empty? _('Empty environment') elsif pcs == ['_destroy_'] _('Deleted environment') elsif pcs.delete '_destroy_' format(_('Deleted environment %{env} and %{pcs}'), env: env, pcs: pcs.to_sentence) elsif pcs == ['_ignored_'] _('Ignored environment') else module_puppetclasses(pcs.is_a?(Hash) ? pcs.keys : pcs) end end |
#import_proxy_links(hash, import_env_text = false, classes = nil) ⇒ Object
21 22 23 24 25 26 |
# File 'app/helpers/foreman_puppet/puppetclasses_and_environments_helper.rb', line 21 def import_proxy_links(hash, import_env_text = false, classes = nil) import_from_text = import_env_text ? _('Import environments from %s') : _('Import classes from %s') SmartProxy.with_features('Puppet').map do |proxy| (import_from_text % proxy.name, hash.merge(proxy: proxy), { class: classes }) end.flatten end |
#import_proxy_select(hash) ⇒ Object
17 18 19 |
# File 'app/helpers/foreman_puppet/puppetclasses_and_environments_helper.rb', line 17 def import_proxy_select(hash) (_('Import'), {}, import_proxy_links(hash, true)) end |