Module: Wice::SerializedQueriesControllerMixin
- Defined in:
- lib/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:
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/wice_grid_serialized_queries_controller.rb', line 44 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(:grid_name => @grid_name, :name => params[:query_name], :query => query_params) @saved_query.attributes = params[:extra] unless params[:extra].blank? if @saved_query.save @grid_title_id = "#{@grid_name}_title" @notification_messages = WiceGridNlMessageProvider.(:QUERY_SAVED_MESSAGE) else @error_messages = @saved_query.errors.map{ |_, msg| msg }.join(' ') end template_name = if Wice::ConfigurationProvider.value_for(:JS_FRAMEWORK) == :prototype 'create' else 'create_jq' end render :file => "#{Pathname.new(__FILE__).dirname}/views/#{template_name}.rjs" end |
#delete ⇒ Object
:nodoc:
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/wice_grid_serialized_queries_controller.rb', line 24 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 = WiceGridNlMessageProvider.(:QUERY_DELETED_MESSAGE) else @error_messages = sq.errors..join(' ') end end template_name = if Wice::ConfigurationProvider.value_for(:JS_FRAMEWORK) == :prototype 'delete' else 'delete_jq' end render :file => "#{Pathname.new(__FILE__).dirname}/views/#{template_name}.rjs" end |
#extra ⇒ Object
71 72 73 |
# File 'lib/wice_grid_serialized_queries_controller.rb', line 71 def extra params[:extra] end |