Sha256: c847aa27d3246b5c05f514ff67bd3f6cbeca6e83871c88c3f1845664fd70f7da

Contents?: true

Size: 628 Bytes

Versions: 9

Compression:

Stored size: 628 Bytes

Contents

# frozen_string_literal: true

class Spree::Admin::ReviewSettingsController < Spree::Admin::BaseController
  before_action :process_unset_checkboxes, only: [:update]

  def update
    Spree::Reviews::Config.set(params[:preferences])

    respond_to do |format|
      format.html do
        redirect_to edit_admin_review_settings_path
      end
    end
  end

  def process_unset_checkboxes
    # workaround for unset checkbox behaviour
    params[:preferences] ||= {}
    Spree::ReviewsConfiguration.boolean_preferences.each do |sym|
      params[:preferences][sym] = false if params[:preferences][sym].blank?
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
solidus_reviews-1.7.0 app/controllers/spree/admin/review_settings_controller.rb
solidus_reviews-1.6.0 app/controllers/spree/admin/review_settings_controller.rb
solidus_reviews-1.5.0 app/controllers/spree/admin/review_settings_controller.rb
solidus_reviews-1.4.1 app/controllers/spree/admin/review_settings_controller.rb
solidus_reviews-1.4.0 app/controllers/spree/admin/review_settings_controller.rb
solidus_reviews-1.3.0 app/controllers/spree/admin/review_settings_controller.rb
solidus_reviews-1.2.0 app/controllers/spree/admin/review_settings_controller.rb
solidus_reviews-1.1.1 app/controllers/spree/admin/review_settings_controller.rb
solidus_reviews-1.1.0 app/controllers/spree/admin/review_settings_controller.rb