Class: Marsdawn::Site::SearchBox

Inherits:
Object
  • Object
show all
Defined in:
lib/marsdawn/site/search_box.rb

Instance Method Summary collapse

Constructor Details

#initialize(site, word) ⇒ SearchBox

Returns a new instance of SearchBox.



6
7
8
9
# File 'lib/marsdawn/site/search_box.rb', line 6

def initialize site, word
  @site = site
  @word = word
end

Instance Method Details

#to_htmlObject



15
16
17
18
19
20
21
22
23
# File 'lib/marsdawn/site/search_box.rb', line 15

def to_html
  if @site.searchable?
    %|<div id="search-box">
      <form action="#{@site.search_path}" method="get">
        <input type="search" name="search" value="#{Marsdawn::Util.html_escape(@word)}" />
      </form>
    </div>|
  end
end

#to_sObject



11
12
13
# File 'lib/marsdawn/site/search_box.rb', line 11

def to_s
  to_html
end