Sha256: bfea5fdb0f54e2fed0654aefadda144e4d9b5b281b1db8ca13c98e6d7eb05d2f
Contents?: true
Size: 1.46 KB
Versions: 2
Compression:
Stored size: 1.46 KB
Contents
class ScaptimonyScapContentsController < ApplicationController include Foreman::Controller::AutoCompleteSearch before_filter :handle_file_upload, :only => [:create] before_filter :find_by_id, :only => [:show, :edit, :update] def model_of_controller ::Scaptimony::ScapContent end # GET /scaptimony/scap_contents def index @contents = resource_base.search_for(params[:search]) end def show send_file @scaptimony_scap_content.path, :type => "application/xml", :filename => @scaptimony_scap_content.original_filename end def new @scaptimony_scap_content = ::Scaptimony::ScapContent.new end # POST /scaptimony/scap_contents def create @scaptimony_scap_content = ::Scaptimony::ScapContent.new(params[:scap_content]) if @scaptimony_scap_content.store process_success :success_redirect => scaptimony_scap_contents_path else process_error end end def handle_file_upload return unless params[:scap_content] and t = params[:scap_content][:scap_file] params[:scap_content][:original_filename] = t.original_filename params[:scap_content][:scap_file] = t.read if t.respond_to?(:read) end def update if @scaptimony_scap_content.update_attributes(params[:scap_content]) process_success :success_redirect => scaptimony_scap_contents_path else process_error end end private def find_by_id @scaptimony_scap_content = resource_base.find(params[:id]) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
foreman_openscap-0.2.1 | app/controllers/scaptimony_scap_contents_controller.rb |
foreman_openscap-0.2.0 | app/controllers/scaptimony_scap_contents_controller.rb |