Sha256: 969c478f25e9989fb5fb18b4a2809e97b1729505e08e09e0dc038fbc4a50cf97

Contents?: true

Size: 790 Bytes

Versions: 24

Compression:

Stored size: 790 Bytes

Contents

module Dorsale
  module SmallData
    class FiltersController < ::Dorsale::ApplicationController

      def create
        new_filters = params[:filters] || {}

        new_filters.each do |key, value|
          new_filters[key] = "" if value == "0"
        end

        filters = Filter.new(cookies)
        new_filters = filters.read.merge(new_filters)
        filters.store(new_filters)

        # Rewrite cookie with 1 year expiry
        cookies[:filters] = {
          :value    => cookies[:filters],
          :expires => 1.year.from_now,
          :path     => "/",
        }

        urls = [
          params[:back_url],
          request.referer,
          (main_app.root_path rescue nil)
        ]

        redirect_to urls.select(&:present?).first
      end

    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
dorsale-2.2.6 app/controllers/dorsale/small_data/filters_controller.rb
dorsale-2.2.5 app/controllers/dorsale/small_data/filters_controller.rb
dorsale-2.2.4 app/controllers/dorsale/small_data/filters_controller.rb
dorsale-2.2.3 app/controllers/dorsale/small_data/filters_controller.rb
dorsale-2.2.2 app/controllers/dorsale/small_data/filters_controller.rb
dorsale-2.2.1 app/controllers/dorsale/small_data/filters_controller.rb
dorsale-2.2.0 app/controllers/dorsale/small_data/filters_controller.rb
dorsale-2.1.15 app/controllers/dorsale/small_data/filters_controller.rb
dorsale-2.1.14 app/controllers/dorsale/small_data/filters_controller.rb
dorsale-2.1.13 app/controllers/dorsale/small_data/filters_controller.rb
dorsale-2.1.12 app/controllers/dorsale/small_data/filters_controller.rb
dorsale-2.1.11 app/controllers/dorsale/small_data/filters_controller.rb
dorsale-2.1.10 app/controllers/dorsale/small_data/filters_controller.rb
dorsale-2.1.9 app/controllers/dorsale/small_data/filters_controller.rb
dorsale-2.1.8 app/controllers/dorsale/small_data/filters_controller.rb
dorsale-2.1.7 app/controllers/dorsale/small_data/filters_controller.rb
dorsale-2.1.6 app/controllers/dorsale/small_data/filters_controller.rb
dorsale-2.1.5 app/controllers/dorsale/small_data/filters_controller.rb
dorsale-2.1.4 app/controllers/dorsale/small_data/filters_controller.rb
dorsale-2.1.3 app/controllers/dorsale/small_data/filters_controller.rb