Project

General

Profile

« Previous | Next » 

Revision 404ead2a

Added by Marek Hulán over 7 years ago

Fixes #17403 - enable exporting of templates

View differences:

app/controllers/api/v2/ptables_controller.rb
wrap_parameters :ptable, :include => ptable_params_filter.accessible_attributes(parameter_filter_context)
before_action :find_optional_nested_object
before_action :find_resource, :only => %w{show update destroy clone}
before_action :find_resource, :only => %w{show update destroy clone export}
api :GET, "/ptables/", N_("List all partition tables")
api :GET, "/operatingsystems/:operatingsystem_id/ptables", N_("List all partition tables for an operating system")
......
process_response @ptable.save
end
api :GET, '/ptables/:id/export', N_('Export a partition template to ERB')
param :id, :identifier, :required => true
def export
send_data @ptable.to_erb, :type => 'text/plain', :disposition => 'attachment', :filename => @ptable.filename
end
private
def load_vars_from_ptable
......
case params[:action]
when 'clone'
'create'
when 'export'
'view'
else
super
end

Also available in: Unified diff