Module: ForemanPipeline::Api::Rendering

Instance Method Summary collapse

Instance Method Details

#respond_with_template(action, resource_name, options = {}, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'app/lib/foreman_pipeline/api/rendering.rb', line 5

def respond_with_template(action, resource_name, options = {}, &block)
  yield if block_given?
  status = options[:status] || 200

  render :template => "foreman_pipeline/api/#{resource_name}/#{action}",
         :status => status,
         :locals => { :object_name => options[:object_name],
                      :root_name => options[:root_name] },
         :layout => "katello/api/v2/layouts/#{options[:layout]}" 
end