Sha256: 60b07d4504c8f8e9b65f19eb9aed1009104035c9ab6bd932c65f07f0a026b45d

Contents?: true

Size: 1.66 KB

Versions: 18

Compression:

Stored size: 1.66 KB

Contents

module Katello
  module Concerns
    module OrganizationsControllerExtensions
      extend ActiveSupport::Concern
      include ForemanTasks::Triggers
      include Foreman::Controller::Flash

      module Overrides
        def destroy
          if @taxonomy.is_a?(Organization)
            begin
              async_task(::Actions::Katello::Organization::Destroy, @taxonomy,
                         ::Organization.current)
              process_success :success_msg => _("Organization %s is being deleted.") % @taxonomy.name
            rescue ::Katello::Errors::OrganizationDestroyException => ex
              process_error(:error_msg => ex.message)
            end
          else
            super
          end
        end

        def create
          if taxonomy_class == Organization
            begin
              @taxonomy = Organization.new(resource_params)
              ::Katello::OrganizationCreator.new(@taxonomy).create!
              @taxonomy.reload
              switch_taxonomy
              if @count_nil_hosts > 0
                redirect_to send("step2_#{taxonomy_single}_path", @taxonomy)
              else
                process_success(:object => @taxonomy, :success_redirect => send("edit_#{taxonomy_single}_path", @taxonomy))
              end
            rescue ActiveRecord::RecordInvalid
              process_error(:render => "taxonomies/new", :object => @taxonomy)
            rescue StandardError => ex
              process_error(:render => "taxonomies/new", :object => @taxonomy, :error_msg => ex.message)
            end
          else
            super
          end
        end
      end

      included do
        prepend Overrides
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
katello-4.14.2 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-4.15.0 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-4.15.0.rc2 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-4.15.0.rc1 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-4.14.1 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-4.14.0 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-4.14.0.rc3 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-4.14.0.rc2 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-4.14.0.rc1.1 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-4.14.0.rc1 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-4.13.1 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-4.13.0 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-4.12.1 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-4.13.0.rc1 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-4.12.0 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-4.12.0.rc3 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-4.12.0.rc2 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-4.12.0.rc1 app/controllers/katello/concerns/organizations_controller_extensions.rb