Sha256: 494e8edb59db8585041c02220ba3f120e626a994bc786f639dd8c0bb9cc50931

Contents?: true

Size: 883 Bytes

Versions: 2

Compression:

Stored size: 883 Bytes

Contents

module Fae
  class OptionsController < ApplicationController

    before_action :super_admin_only

    def edit
      @option = Option.first || Option.instance
      @option.build_logo if @option.logo.blank?
      @option.build_favicon if @option.favicon.blank?
      @deploy_hooks = DeployHook.all
    end

    # PATCH/PUT /options/1
    def update
      if @option.update(option_params)
        flash[:notice] = 'Option was successfully updated.'
        redirect_to :action => :edit
      else
        render :edit
      end
    end

    private

      # Only allow a trusted parameter "white list" through.
      def option_params
        params.require(:option).permit(:title, :time_zone, :colorway, :stage_url, :live_url, logo_attributes: [:id, :asset, :asset_cache, :attached_as, :alt], favicon_attributes: [:id, :asset, :asset_cache, :attached_as, :alt])
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fae-rails-3.0.0 app/controllers/fae/options_controller.rb
fae-rails-2.2.0 app/controllers/fae/options_controller.rb