Sha256: df7d7c5246187e2455ca82e0a9c5d510d92591edd9a5ac8654863b955255e7c0

Contents?: true

Size: 605 Bytes

Versions: 3

Compression:

Stored size: 605 Bytes

Contents

# frozen_string_literal: true

module Sail
  class SettingsController < ApplicationController
    def index
      @settings = Setting.paginated(index_params[:page])
      fresh_when(@settings)
    end

    def update
      respond_to do |format|
        @setting = Setting.set(params[:name], value)
        format.js {}
      end
    end

    private

    def value
      if params[:cast_type] == Sail::ConstantCollection::BOOLEAN
        params[:value] == Sail::ConstantCollection::ON
      else
        params[:value]
      end
    end

    def index_params
      params.permit(:page)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sail-1.1.0 app/controllers/sail/settings_controller.rb
sail-1.0.1 app/controllers/sail/settings_controller.rb
sail-1.0.0 app/controllers/sail/settings_controller.rb