Sha256: 22c8449d861e385268b188540fb8a226c9c0b911ab037b6bac8951e8d252fbdc

Contents?: true

Size: 891 Bytes

Versions: 6

Compression:

Stored size: 891 Bytes

Contents

# frozen_string_literal: true

module Lcms
  module Engine
    module Admin
      class StandardsController < AdminController
        before_action :find_standard, except: [:index]

        def edit; end

        def index
          @query = OpenStruct.new params[:query]

          scope = Standard.order(:id)
          scope = scope.search_by_name(@query.name) if @query.name.present?

          @standards = scope.paginate(page: params[:page])
        end

        def update
          if @standard.update(standard_params)
            redirect_to admin_standards_path, notice: t('.success')
          else
            render :edit
          end
        end

        private

        def find_standard
          @standard = Standard.find(params[:id])
        end

        def standard_params
          params.require(:standard).permit(:description)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lcms-engine-0.1.4 app/controllers/lcms/engine/admin/standards_controller.rb
lcms-engine-0.3.0 app/controllers/lcms/engine/admin/standards_controller.rb
lcms-engine-0.1.3 app/controllers/lcms/engine/admin/standards_controller.rb
lcms-engine-0.2.0 app/controllers/lcms/engine/admin/standards_controller.rb
lcms-engine-0.1.2 app/controllers/lcms/engine/admin/standards_controller.rb
lcms-engine-0.1.0 app/controllers/lcms/engine/admin/standards_controller.rb