Class: Refine::BlueprintsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Refine::BlueprintsController
- Defined in:
- app/controllers/refine/blueprints_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
handles filter submission.
-
#new ⇒ Object
entry point for initial render of the filter builder.
-
#show ⇒ Object
refresh the filter builder.
- #stored_filters ⇒ Object
- #validate ⇒ Object
Instance Method Details
#create ⇒ Object
handles filter submission
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/refine/blueprints_controller.rb', line 30 def create if @refine_filter_query.valid? # set stable_id @stable_id = @refine_filter.to_stable_id # set url uri = URI(request.referrer) new_query_ar = URI.decode_www_form(String(uri.query)) new_query_ar.reject! { |(k, _v)| k == "stable_id" } new_query_ar << ["stable_id", @stable_id] uri.query = URI.encode_www_form(new_query_ar) @url_for_redirect = uri.to_s @filter_submit_success = true end end |
#new ⇒ Object
entry point for initial render of the filter builder
9 10 11 |
# File 'app/controllers/refine/blueprints_controller.rb', line 9 def new @show_stored_filters = params[:stored_filters] end |
#show ⇒ Object
refresh the filter builder
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/refine/blueprints_controller.rb', line 14 def show if @refine_filter_query.valid? @stable_id = @refine_filter.to_stable_id end # don't display errors include_errors = ActiveRecord::Type::Boolean.new.cast(params[:include_errors]) @refine_filter_query.clear_errors unless include_errors respond_to do |format| format.turbo_stream format.html end end |
#stored_filters ⇒ Object
46 47 48 |
# File 'app/controllers/refine/blueprints_controller.rb', line 46 def stored_filters render partial: "stored_filters", layout: false end |
#validate ⇒ Object
50 51 52 53 54 55 56 |
# File 'app/controllers/refine/blueprints_controller.rb', line 50 def validate if @refine_filter_query.valid? head :ok else head :unprocessable_entity end end |