Module: Wice::SerializedQueriesControllerMixin
- Defined in:
- lib/wice/wice_grid_serialized_queries_controller.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#create ⇒ Object
:nodoc:.
-
#delete ⇒ Object
:nodoc:.
- #extra ⇒ Object
Instance Method Details
#create ⇒ Object
:nodoc:
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/wice/wice_grid_serialized_queries_controller.rb', line 53 def create #:nodoc: init query_params = if params[@grid_name] params[@grid_name] else {} end query_params.delete(:page) @saved_query = @query_store_model.new @saved_query.grid_name = @grid_name @saved_query.name = params[:query_name] @saved_query.query = query_params @saved_query.attributes = params[:extra] unless params[:extra].blank? if @saved_query.save @grid_title_id = "#{@grid_name}_title" @notification_messages = NlMessage['query_saved_message'] else @error_messages = @saved_query.errors.map{ |_, msg| msg }.join(' ') end render_asyns_result end |
#delete ⇒ Object
:nodoc:
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/wice/wice_grid_serialized_queries_controller.rb', line 37 def delete #:nodoc: init if sq = @query_store_model.find_by_id_and_grid_name(params[:id], @grid_name) if sq.destroy if params[:current] @current = @query_store_model.find_by_id_and_grid_name(params[:current], @grid_name) end @notification_messages = NlMessage['query_deleted_message'] else @error_messages = sq.errors..join(' ') end end render_asyns_result end |
#extra ⇒ Object
80 81 82 |
# File 'lib/wice/wice_grid_serialized_queries_controller.rb', line 80 def extra params[:extra] end |