37
38
39
40
41
42
43
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
# File 'lib/waves/views.rb', line 37
def search(result, keywords)
doctype
html {
head {
@css = Cssy.new
@css.process {
li.palette_box {
border(:solid)
margin_bottom('3em')
background_color("#DBE6EC")
width('780px')
height('350px')
position(:relative)
z_index('1')
}
td.color_bar {
vertical_align(:top)
font_size('xx-small')
}
table.colors {
width('440px');
height('330px');
border(:solid);
margin('10px');
position(:relative)
z_index('2')
}
div.info_box {
position(:absolute)
top('0px')
left('480px')
z_index('2')
width("295px")
}
dl.info {
margin_top("1.5em")
list_style(:none)
position(:relative)
}
dd{
margin_left('1em')
padding('0')
}
ul.colors { list_style(:none); margin("0"); padding("0") }
li.colors { margin_left("3px") }
ol.palettes { list_style(:none); position(:relative) }
body { position(:relative) }
a { color(:black); text_decoration(:none) }
selector("a:hover") { text_decoration(:underline) }
}
style @css.to_s, "type"=>"text/css"
title "Palette Search: #{keywords}"
}
body(:bgcolor => "#BCBDAC", :style => "font-family: sans-serif") {
h1 "Palettes"
h3 "Search results for: #{keywords}"
ol(:class => "palettes") {
result.each do |r|
li(:class => "palette_box") {
table(:class => "colors", 'cellspacing' => '0px' ) { tr {
r[:colors].each {|color|
td(:class => 'color_bar', :title => "##{color}",
:style => " width: #{440/r[:colors].length}px;
color: ##{color};
background-color: ##{color}") { raw "##{color}" }
} } } div(:class => "info_box") {
h3 { a(:href => "http://colourlovers.com/palette/#{r[:id].to_s}") { raw "#{r[:title].to_s}" } }
dl(:class => "info") {
dt { raw "Creator: " }
dd { raw "#{r[:creator]}"}
dt { raw "ID: " }
dd { raw "#{r[:id]}"}
dt { raw "Colors: " }
dd { ul(:class => "colors") { r[:colors].each {|color| li(:class=>"colors") { raw "##{color}" } }}}
} } } end
} }
}
render
end
|