merb-search 0.1.2 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/app/controllers/search.rb +12 -33
- data/app/views/search/_article.html.erb +11 -0
- data/app/views/search/_image.html.erb +13 -0
- data/app/views/search/_page.html.erb +11 -0
- data/app/views/search/_resultset.html.erb +15 -0
- data/app/views/search/_spelling.html.erb +9 -0
- data/app/views/search/index.html.erb +8 -0
- data/lib/merb-search.rb +0 -3
- metadata +8 -4
- data/app/views/search/web.html.erb +0 -37
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@ require 'merb-core/tasks/merb'
|
|
6
6
|
spec = Gem::Specification.new do |s|
|
7
7
|
s.add_dependency('merb-slices', '~> 1.0.0')
|
8
8
|
s.add_dependency('merb-ui', '>= 0.4')
|
9
|
-
s.add_dependency('boss', '>= 0.
|
9
|
+
s.add_dependency('boss', '>= 0.3')
|
10
10
|
s.author = 'UiPoet'
|
11
11
|
s.email = 'dont.tase@me.com'
|
12
12
|
s.files = FileList['app/**/*', 'lib/**/*', '[A-Z]*'].to_a
|
@@ -15,7 +15,7 @@ spec = Gem::Specification.new do |s|
|
|
15
15
|
s.name = 'merb-search'
|
16
16
|
s.rubyforge_project = 'uipoet'
|
17
17
|
s.summary = 'Search for Merb'
|
18
|
-
s.version = '0.
|
18
|
+
s.version = '0.2'
|
19
19
|
end
|
20
20
|
|
21
21
|
Rake::GemPackageTask.new(spec) do |pkg|
|
data/app/controllers/search.rb
CHANGED
@@ -1,42 +1,21 @@
|
|
1
1
|
class MerbSearch::Search < MerbSearch::Application
|
2
|
-
|
3
|
-
def index
|
4
|
-
|
5
|
-
render
|
6
|
-
|
7
|
-
end
|
8
|
-
|
9
|
-
def images
|
10
|
-
|
11
|
-
@query = params[:q] || 'merb'
|
12
|
-
@images = boss.images.new(@query, :count => 12).resultset
|
13
|
-
@news = boss.news.new(@query, :age => '1d', :count => 3).resultset
|
14
|
-
@spelling = boss.web.new(@query).resultset
|
15
|
-
@web = boss.web.new(@query, :count => 3).resultset
|
16
2
|
|
17
|
-
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
def news
|
3
|
+
def index
|
22
4
|
|
23
|
-
|
24
|
-
@images = boss.images.new(@query, :count => 3).resultset
|
25
|
-
@news = boss.news.new(@query, :age => '1w', :count => 12).resultset
|
26
|
-
@spelling = boss.web.new(@query).resultset
|
27
|
-
@web = boss.web.new(@query, :count => 3).resultset
|
5
|
+
query = params[:q] || 'merb'
|
28
6
|
|
29
|
-
|
7
|
+
images = boss.images.new(query, :count => 3)
|
8
|
+
@images = images.resultset unless images.count == 0
|
30
9
|
|
31
|
-
|
32
|
-
|
33
|
-
def web
|
10
|
+
news = boss.news.new(query, :age => '1d', :count => 3)
|
11
|
+
@news = news.resultset unless news.count == 0
|
34
12
|
|
35
|
-
|
36
|
-
@
|
37
|
-
|
38
|
-
|
39
|
-
|
13
|
+
spelling = boss.spelling.new(query)
|
14
|
+
@spelling = spelling.resultset unless spelling.count == 0
|
15
|
+
|
16
|
+
web_count = 12 - (images.count + news.count)
|
17
|
+
web = boss.web.new(query, :count => web_count)
|
18
|
+
@web = web.resultset unless web.count == 0
|
40
19
|
|
41
20
|
display @web
|
42
21
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= mui_tray(:inline => true, :title => result.title, :title_url => result.clickurl, :width => '20em') do %>
|
2
|
+
<%= mui_block(:height => '8em', :scroll => true) do %>
|
3
|
+
<%= result.abstract %>
|
4
|
+
<% end =%>
|
5
|
+
<%= mui_block(:subtle => true) do %>
|
6
|
+
<%= result.date %> at <%= result.time %>
|
7
|
+
<% end =%>
|
8
|
+
<%= mui_block(:subtle => true, :truncate => true) do %>
|
9
|
+
<%= result.sourceurl %>
|
10
|
+
<% end =%>
|
11
|
+
<% end =%>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= mui_tray(:inline => true, :title => result.title, :title_url => result.clickurl, :width => '20em') do %>
|
2
|
+
<%= mui_block(:height => '8em', :scroll => true) do %>
|
3
|
+
<%= mui_link(:url => result.clickurl) do %>
|
4
|
+
<%= mui_image(:height => result.thumbnail_height, :url => result.thumbnail_url, :width => result.thumbnail_width) %>
|
5
|
+
<% end =%>
|
6
|
+
<% end =%>
|
7
|
+
<%= mui_block(:subtle => true) do %>
|
8
|
+
<%= result.date %> | <%= result.format %>
|
9
|
+
<% end =%>
|
10
|
+
<%= mui_block(:subtle => true, :truncate => true) do %>
|
11
|
+
<%= result.refererurl %>
|
12
|
+
<% end =%>
|
13
|
+
<% end =%>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= mui_tray(:inline => true, :title => result.title, :title_url => result.clickurl, :width => '20em') do %>
|
2
|
+
<%= mui_block(:height => '8em', :scroll => true) do %>
|
3
|
+
<%= result.abstract %>
|
4
|
+
<% end =%>
|
5
|
+
<%= mui_block(:subtle => true) do %>
|
6
|
+
<%= result.date %>
|
7
|
+
<% end =%>
|
8
|
+
<%= mui_block(:subtle => true, :truncate => true) do %>
|
9
|
+
<%= result.dispurl(:wbr => false) %>
|
10
|
+
<% end =%>
|
11
|
+
<% end =%>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% if @web %>
|
2
|
+
<% @web.each do |result| %>
|
3
|
+
<%= partial(:page, :result => result) %>
|
4
|
+
<% end %>
|
5
|
+
<% end %>
|
6
|
+
<% if @images %>
|
7
|
+
<% @images.each do |result| %>
|
8
|
+
<%= partial(:image, :result => result) %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
11
|
+
<% if @news %>
|
12
|
+
<% @news.each do |result| %>
|
13
|
+
<%= partial(:article, :result => result) %>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<% if @spelling %>
|
2
|
+
<%= mui_tray(:inline => true, :title => 'Did you mean...', :width => '20em') do %>
|
3
|
+
<% @spelling.each do |result| %>
|
4
|
+
<%= mui_block do %>
|
5
|
+
<%= mui_link(:title => result.suggestion, :url => "/?q=#{result.query}") %>
|
6
|
+
<% end =%>
|
7
|
+
<% end %>
|
8
|
+
<% end =%>
|
9
|
+
<% end %>
|
data/lib/merb-search.rb
CHANGED
@@ -15,9 +15,6 @@ if defined?(Merb::Plugins)
|
|
15
15
|
def self.setup_router(scope)
|
16
16
|
scope.to(:controller => 'search') do |s|
|
17
17
|
s.match('/').to(:action => 'index').name(:index)
|
18
|
-
s.match('/images').to(:action => 'images').name(:images)
|
19
|
-
s.match('/news').to(:action => 'news').name(:news)
|
20
|
-
s.match('/web').to(:action => 'web').name(:web)
|
21
18
|
end
|
22
19
|
end
|
23
20
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: merb-search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: "0.2"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- UiPoet
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-12-
|
12
|
+
date: 2008-12-17 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: "0.
|
43
|
+
version: "0.3"
|
44
44
|
version:
|
45
45
|
description:
|
46
46
|
email: dont.tase@me.com
|
@@ -56,8 +56,12 @@ files:
|
|
56
56
|
- app/controllers/search.rb
|
57
57
|
- app/views
|
58
58
|
- app/views/search
|
59
|
+
- app/views/search/_article.html.erb
|
60
|
+
- app/views/search/_image.html.erb
|
61
|
+
- app/views/search/_page.html.erb
|
62
|
+
- app/views/search/_resultset.html.erb
|
63
|
+
- app/views/search/_spelling.html.erb
|
59
64
|
- app/views/search/index.html.erb
|
60
|
-
- app/views/search/web.html.erb
|
61
65
|
- lib/merb-search
|
62
66
|
- lib/merb-search/merbtasks.rb
|
63
67
|
- lib/merb-search/slicetasks.rb
|
@@ -1,37 +0,0 @@
|
|
1
|
-
<%= mui_grid(:cell_valign => 'top', :columns => 2, :width => '100%') do %>
|
2
|
-
<%= mui_cell do %>
|
3
|
-
<% @web.each do |result| %>
|
4
|
-
<%= mui_tray(:inline => true, :title => result.title, :title_url => result.clickurl, :width => '20em') do %>
|
5
|
-
<%= mui_block(:height => '8em') do %>
|
6
|
-
<%= result.abstract %>
|
7
|
-
<% end =%>
|
8
|
-
<%= mui_block(:subtle => true) do %>
|
9
|
-
<%= result.date %>
|
10
|
-
<% end =%>
|
11
|
-
<%= mui_block(:subtle => true, :truncate => true) do %>
|
12
|
-
<%= result.dispurl(:wbr => false) %>
|
13
|
-
<% end =%>
|
14
|
-
<% end =%>
|
15
|
-
<% end %>
|
16
|
-
<% end =%>
|
17
|
-
<%= mui_cell do %>
|
18
|
-
<%= mui_tray(:title => 'Images', :inline => true, :width => '20em') do %>
|
19
|
-
<%= mui_grid(:columns => 3, :width => '100%') do %>
|
20
|
-
<% @images.each do |result| %>
|
21
|
-
<%= mui_cell do %>
|
22
|
-
<%= mui_link(:url => result.clickurl) do %>
|
23
|
-
<%= mui_image(:height => 60, :url => result.thumbnail_url, :width => 60) %>
|
24
|
-
<% end =%>
|
25
|
-
<% end =%>
|
26
|
-
<% end %>
|
27
|
-
<% end =%>
|
28
|
-
<% end =%>
|
29
|
-
<%= mui_tray(:title => 'News', :inline => true, :width => '20em') do %>
|
30
|
-
<% @news.each do |result| %>
|
31
|
-
<%= mui_block(:width => '200px') do %>
|
32
|
-
<%= mui_link(:title => result.title, :url => result.clickurl) %> <span class="mui_date"><%= result.time %></span>
|
33
|
-
<% end =%>
|
34
|
-
<% end %>
|
35
|
-
<% end =%>
|
36
|
-
<% end =%>
|
37
|
-
<% end =%>
|