Class: Widgets::Search::Base
- Inherits:
-
ErpApp::Widgets::Base
- Object
- ErpApp::Widgets::Base
- Widgets::Search::Base
- Includes:
- ActionDispatch::Routing::UrlFor, WillPaginate::ActionView
- Defined in:
- app/widgets/search/base.rb
Class Method Summary collapse
Instance Method Summary collapse
- #index ⇒ Object
-
#locate ⇒ Object
should not be modified modify at your own risk.
- #new ⇒ Object
- #set_variables ⇒ Object
Class Method Details
.base_layout ⇒ Object
63 64 65 66 67 68 69 70 |
# File 'app/widgets/search/base.rb', line 63 def base_layout begin file = File.join(File.dirname(__FILE__),"/views/layouts/base.html.erb") IO.read(file) rescue return nil end end |
.title ⇒ Object
55 56 57 |
# File 'app/widgets/search/base.rb', line 55 def title "Search" end |
.widget_name ⇒ Object
59 60 61 |
# File 'app/widgets/search/base.rb', line 59 def File.basename(File.dirname(__FILE__)) end |
Instance Method Details
#index ⇒ Object
22 23 24 25 |
# File 'app/widgets/search/base.rb', line 22 def index set_variables render end |
#locate ⇒ Object
should not be modified modify at your own risk
50 51 52 |
# File 'app/widgets/search/base.rb', line 50 def locate File.dirname(__FILE__) end |
#new ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/widgets/search/base.rb', line 27 def new set_variables @website = Website.find_by_host(request.host_with_port) = { :website_id => @website.id, :query => params[:query], :content_type => params[:content_type], :section_permalink => params[:section_permalink], :page => (params[:page] || 1), :per_page => (params[:per_page] || 20) } @results = Content.do_search() if @ajax_results render :update => {:id => "#{@uuid}_result", :view => :show} else render :view => :show end end |
#set_variables ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/widgets/search/base.rb', line 8 def set_variables @results_permalink = params[:results_permalink] @section_permalink = params[:section_permalink] @content_type = params[:content_type] @per_page = params[:per_page] @css_class = params[:class] if @results_permalink.nil? or @results_permalink.blank? @ajax_results = true else @ajax_results = false end end |