Sha256: 820156010c220e539c7c60306be22465a056d4d8a982035bc058a7c01271ec48

Contents?: true

Size: 1.05 KB

Versions: 12

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module ForemanSalt
  # UI controller for salt variables
  class SaltVariablesController < ::LookupKeysController
    include Foreman::Controller::AutoCompleteSearch
    include ::ForemanSalt::Concerns::SaltVariableParameters

    before_action :find_resource, only: %i[edit update destroy], if: proc { params[:id] }

    def index
      @salt_variables = resource_base.search_for(params[:search],
        order: params[:order]).paginate(page: params[:page],
                                        per_page: params[:per_page])
    end

    def new
      @salt_variable = SaltVariable.new
    end

    def create
      @salt_variable = SaltVariable.new(salt_variable_params)
      if @salt_variable.save
        process_success
      else
        process_error
      end
    end

    def resource_class
      "ForemanSalt::#{controller_name.singularize.classify}".constantize
    end

    private

    def default_order
    end

    def resource
      @salt_variable
    end

    def resource_params
      salt_variable_params
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
foreman_salt-17.0.0 app/controllers/foreman_salt/salt_variables_controller.rb
foreman_salt-16.0.3 app/controllers/foreman_salt/salt_variables_controller.rb
foreman_salt-16.0.2 app/controllers/foreman_salt/salt_variables_controller.rb
foreman_salt-16.0.1 app/controllers/foreman_salt/salt_variables_controller.rb
foreman_salt-16.0.0 app/controllers/foreman_salt/salt_variables_controller.rb
foreman_salt-15.2.3 app/controllers/foreman_salt/salt_variables_controller.rb
foreman_salt-15.2.2 app/controllers/foreman_salt/salt_variables_controller.rb
foreman_salt-15.2.1 app/controllers/foreman_salt/salt_variables_controller.rb
foreman_salt-15.2.0 app/controllers/foreman_salt/salt_variables_controller.rb
foreman_salt-15.1.0 app/controllers/foreman_salt/salt_variables_controller.rb
foreman_salt-15.0.0 app/controllers/foreman_salt/salt_variables_controller.rb
foreman_salt-14.1.0 app/controllers/foreman_salt/salt_variables_controller.rb