Class: ODDB::Html::View::Search

Inherits:
HtmlGrid::DivForm
  • Object
show all
Includes:
SearchMethods
Defined in:
lib/oddb/html/view/search.rb

Direct Known Subclasses

Drugs::Search

Constant Summary collapse

EVENT =
:search
FORM_NAME =
'search'
COMPONENTS =
{
  [0,0] => 'dstype',
  [0,1] => :dstype,
  [0,2] => :query,
  [0,3] => :submit,
  [1,3] => :reset,
  [0,4] => "explain_search",
  [0,5] => :social_bookmarks,
  [0,6] => :screencast,
}
SYMBOL_MAP =
{
  :query  => SearchBar,
  :reset  => HtmlGrid::Reset,
}
CSS_MAP =
{4 => "explain", 6 => "explain"}
SOCIAL_BOOKMARKS =
[
  [ :sb_delicious, "http://del.icio.us/post?url=%s&title=%s" ],
  [ :sb_stumble, "http://www.stumbleupon.com/submit?url=%s&title=%s" ],
  [ :sb_digg, "http://digg.com/submit?phase=2&url=%stitle=%s" ],
  [ :sb_simpy, 
    "http://www.simpy.com/simpy/LinkAdd.do?href=%s&note=%s"],
]

Instance Method Summary collapse

Methods included from SearchMethods

#dstype

Instance Method Details

#screencast(model) ⇒ Object



69
70
71
72
73
74
75
# File 'lib/oddb/html/view/search.rb', line 69

def screencast(model)
  if @lookandfeel.enabled?(:screencast)
    link = HtmlGrid::Link.new(:screencast, model, @session, self)
    link.href = @lookandfeel.lookup(:screencast_url)
    link
  end
end

#social_bookmarks(model) ⇒ Object



76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/oddb/html/view/search.rb', line 76

def social_bookmarks(model)
  return unless @lookandfeel.enabled?(:social_bookmarks)
  url = @lookandfeel.base_url
  title = escape(@lookandfeel.lookup(:explain_search))
  SOCIAL_BOOKMARKS.collect { |key, fmt|
    span = HtmlGrid::Span.new(model, @session, self)
    link = HtmlGrid::Link.new(key, model, @session, self)
    link.href = sprintf(fmt, url, title)
    span.css_class = 'social'
    span.css_id = key.to_s[3..-1]
    span.value = link
    span
  }
end