Commit c0d3fa26c48282a63aaf8d139122eb0ba6683307
1 parent
8bc4669d
Exists in
master
and in
29 other branches
Start new product search
Showing
5 changed files
with
246 additions
and
86 deletions
Show diff stats
app/models/product.rb
... | ... | @@ -155,37 +155,31 @@ class Product < ActiveRecord::Base |
155 | 155 | def name_or_category |
156 | 156 | name ? name : product_category.name |
157 | 157 | end |
158 | - def f_category_id | |
158 | + def f_category | |
159 | 159 | #def childs(id) |
160 | 160 | #ret = ProductCategory.find(:all, :conditions => {:parent_id => id}).collect(&:id) |
161 | 161 | #([id, ret.map { |i| childs(i) }]) |
162 | 162 | #end |
163 | 163 | #childs(self.product_category.id).flatten |
164 | - [self.product_category.id] | |
164 | + self.product_category.name | |
165 | 165 | end |
166 | - def f_region_id | |
167 | - if self.enterprise.region | |
168 | - self.enterprise.region.id | |
169 | - else | |
170 | - nil | |
171 | - end | |
172 | - end | |
173 | - def f_qualifier_id | |
174 | - product_qualifiers.collect(&:qualifier_id) | |
166 | + def f_region | |
167 | + self.enterprise.region.name if self.enterprise.region | |
175 | 168 | end |
176 | - def f_certifier_id | |
177 | - product_qualifiers.collect(&:certifier_id) | |
169 | + def f_qualifier | |
170 | + product_qualifiers.collect{|i| i.qualifier.name if i.qualifier} + | |
171 | + product_qualifiers.collect{|i| i.certifier.name if i.certifier} | |
178 | 172 | end |
179 | 173 | public |
180 | 174 | |
181 | - acts_as_faceted :fields => {:f_category_id => {:class => ProductCategory, :display_field => :name, :label => _('Related products')}, | |
182 | - :f_region_id => {:class => Region, :display_field => :name, :label => _('Region')}, | |
183 | - :f_qualifier_id => {:class => Qualifier, :display_field => :name, :label => _('Qualifiers')}, | |
184 | - :f_certifier_id => {:class => Certifier, :display_field => :name, :label => _('Certifiers')}}, | |
185 | - :order => [:f_category_id, :f_region_id, :f_qualifier_id, :f_certifier_id] | |
175 | + acts_as_faceted :fields => { | |
176 | + :f_category => {:label => _('Related products')}, | |
177 | + :f_region => {:label => _('Region')}, | |
178 | + :f_qualifier => {:label => _('Qualifiers')}}, | |
179 | + :order => [:f_category, :f_region, :f_qualifier] | |
186 | 180 | |
187 | - acts_as_searchable :fields => [{:name_or_category => {:type => :text, :as => :name}}, | |
188 | - {:name_or_category => {:type => :string, :as => :name_sort}}, :description, {:price => :float}, :category_full_name ] | facets.keys.map{|i| {i => :facet}}, | |
181 | + acts_as_searchable :fields => [{:name_or_category => {:type => :text, :as => :name, :boost => 2.0}}, | |
182 | + {:name_or_category => {:type => :string, :as => :name_sort}}, :description, {:price => :float}, :category_full_name ] + facets.keys.map{|i| {i => :facet}}, | |
189 | 183 | :facets => facets.keys |
190 | 184 | |
191 | 185 | end | ... | ... |
app/views/search/_product.rhtml
1 | -<%# FIXME add more information %> | |
2 | - | |
3 | -<% | |
4 | -product_item_pos = 0 if ! product_item_pos | |
5 | -product_item_pos += 1 | |
6 | -%> | |
7 | - | |
8 | 1 | <% extra_content = @plugins.map(:asset_product_extras, product, product.enterprise).collect { |content| instance_eval(&content) } %> |
9 | 2 | <% extra_properties = @plugins.map(:asset_product_properties, product)%> |
10 | 3 | |
11 | -<li class="product-item <%= ( pos % 2 == 0 ) ? 'odd' : 'even' %>"> | |
12 | - <%= link_to_product product, :class => 'product-pic', :style => 'background-image:url(%s)' % product.default_image(:minor) %> | |
13 | - <strong> | |
14 | - <%= link_to_product product %> | |
15 | - </strong> | |
16 | - <ul> | |
17 | - <li> <%= _('Price: %s') % (product.price ? product.price : _('Not informed')) %> </li> | |
18 | - <% if product.enterprise && product.display_supplier_on_search? %> | |
19 | - <li> <%= _('Supplier: %s') % link_to_homepage(product.enterprise.name, product.enterprise.identifier) %> </li> | |
20 | - <% end %> | |
21 | - | |
22 | - <li> <%= _('Category:') + ' ' + link_to_product_category(product.product_category) %> </li> | |
23 | - | |
24 | - <% extra_properties.each do |property| %> | |
25 | - <li><%= property[:name] + ': ' + instance_eval(&property[:content]) %></li> | |
26 | - <% end %> | |
27 | - </ul> | |
4 | +<li class="product-item"> | |
5 | + <div class="product-item-first-column"> | |
6 | + <%= link_to_product product, :class => 'product-pic', :style => 'background-image:url(%s)' % product.default_image(:minor) %> | |
7 | + <%= product.price if product.price %> | |
8 | + </div> | |
9 | + <div class="product-item-second-column"> | |
10 | + <span class='product-title-link'><%= link_to_product product %></span> | |
11 | + <div class="product-supplier"> | |
12 | + <span class="product-item-topic"><%= _('SUPPLIER') %> </span><%= link_to_homepage(product.enterprise.name, product.enterprise.identifier) %> | |
13 | + </div> | |
14 | + <div class="product-description"> | |
15 | + <% if product.description %> | |
16 | + <span class="product-item-topic"><%= _('DESCRIPTION') %> </span><%= product.description %> | |
17 | + <% end %> | |
18 | + </div> | |
19 | + </div> | |
20 | + <div class="product-item-third-column"> | |
21 | + <div class="product-region"> | |
22 | + <% if product.enterprise.region %> | |
23 | + <span class="product-item-topic"><%= _('REGION') %></span> | |
24 | + <br /><%= product.enterprise.region.name %> | |
25 | + <% end %> | |
26 | + </div> | |
27 | + <div class="product-qualifiers"> | |
28 | + <% if product.product_qualifiers.count > 0 %> | |
29 | + <span class="product-item-topic"><%= _('QUALIFIERS') %></span> | |
30 | + <% product.product_qualifiers.each do |pq| %> | |
31 | + <% if pq.qualifier %> | |
32 | + <br /><%= pq.qualifier.name %> | |
33 | + <% end %> | |
34 | + <% if pq.certifier %> | |
35 | + <br /><%= pq.certifier.name %> | |
36 | + <% end %> | |
37 | + <% end %> | |
38 | + <% end %> | |
39 | + </div> | |
40 | + </div> | |
28 | 41 | |
29 | 42 | <%= extra_content.join('\n') %> |
43 | + <% extra_properties.each do |property| %> | |
44 | + <div><%= property[:name] + ': ' + instance_eval(&property[:content]) %></div> | |
45 | + <% end %> | |
30 | 46 | |
47 | + <hr size=1> | |
31 | 48 | </li> | ... | ... |
... | ... | @@ -0,0 +1,6 @@ |
1 | +<div class="results-header"> | |
2 | + <%= label_total_found(asset, results.total_entries) %> | |
3 | + <span class="current-page"><%= _("Showing page %s of %s") % [results.current_page, results.total_pages] %></div> | |
4 | + <%= facets_unselect_menu(asset) %> | |
5 | + <%= order_by(asset) %> | |
6 | +</div> | ... | ... |
app/views/search/products.rhtml
... | ... | @@ -21,9 +21,7 @@ |
21 | 21 | <% end %> |
22 | 22 | <% end %> |
23 | 23 | |
24 | -<%= facets_unselect_menu(:products) %> | |
25 | - | |
26 | -<%= order_by(:products, [[_('Best match'), ''], [_('Name'), 'name_sort asc'], [_('Lower price'), 'price asc'], [_('Higher price'), 'price desc']]) %> | |
24 | +<%= render :partial => 'results_header', :locals => { :asset => :products, :results => @results[:products] } %> | |
27 | 25 | |
28 | 26 | <%= display_results %> |
29 | 27 | ... | ... |
public/stylesheets/application.css
... | ... | @@ -1777,6 +1777,11 @@ input.disabled { |
1777 | 1777 | |
1778 | 1778 | .search-ordering { |
1779 | 1779 | float: right; |
1780 | + width: 11%; | |
1781 | + margin: 0 0 5px | |
1782 | +} | |
1783 | +.search-ordering select { | |
1784 | + display: block; | |
1780 | 1785 | } |
1781 | 1786 | |
1782 | 1787 | .search-relevance { |
... | ... | @@ -1824,6 +1829,7 @@ input.disabled { |
1824 | 1829 | |
1825 | 1830 | #search-popup .search-field, .search-form { |
1826 | 1831 | text-align: center; |
1832 | + float: right; | |
1827 | 1833 | } |
1828 | 1834 | |
1829 | 1835 | #content .search-options ul, .search-options ul, |
... | ... | @@ -2405,7 +2411,7 @@ div#activation_enterprise div { |
2405 | 2411 | .slideshow-block .slideshow-block-navigation .icon-media-next { |
2406 | 2412 | padding-right: 18px; |
2407 | 2413 | background-position: right; |
2408 | - | |
2414 | + | |
2409 | 2415 | } |
2410 | 2416 | .slideshow-block .slideshow-block-navigation .icon-media-pause, |
2411 | 2417 | .slideshow-block .slideshow-block-navigation .icon-media-play { |
... | ... | @@ -2782,6 +2788,7 @@ div#activation_enterprise div { |
2782 | 2788 | .formfield input { |
2783 | 2789 | text-indent: 5px; |
2784 | 2790 | padding: 2px 0px; |
2791 | + background: #fff; | |
2785 | 2792 | } |
2786 | 2793 | .msie5 .formfield input, |
2787 | 2794 | .msie6 .formfield input { |
... | ... | @@ -3056,17 +3063,42 @@ div#activation_enterprise div { |
3056 | 3063 | .controller-search #facets-menu { |
3057 | 3064 | width: 20%; |
3058 | 3065 | float: left; |
3066 | + min-height: 300px; | |
3059 | 3067 | } |
3060 | 3068 | |
3061 | 3069 | .controller-search #facets-menu div { |
3062 | 3070 | position: relative; |
3063 | 3071 | } |
3064 | - | |
3072 | +.facets-applied { | |
3073 | + float: left; | |
3074 | + margin: 0 0 0 27px; | |
3075 | + padding: 5px 0; | |
3076 | + width: 65%; | |
3077 | +} | |
3078 | +span.appliedFilters { | |
3079 | + display: block; | |
3080 | + font-size: 0.8em; | |
3081 | + font-style: italic; | |
3082 | + margin: 0 0 0 5px; | |
3083 | +} | |
3065 | 3084 | .controller-search .facet-selected { |
3066 | 3085 | display: block; |
3067 | - background-color: #000; | |
3068 | - color: #fff; | |
3086 | + color: #000; | |
3087 | + font-style:italic; | |
3088 | + font-size:0.8em; | |
3069 | 3089 | float: left; |
3090 | + padding:4px 24px 4px 4px; | |
3091 | + -moz-border-radius: 4px; | |
3092 | + -webkit-border-radius: 4px; | |
3093 | + -o-border-radius: 4px; | |
3094 | + -khtml-border-radius: 4px; | |
3095 | + border-radius: 4px; | |
3096 | + margin: 5px; | |
3097 | + background: #B1DFEF url("../images/ico_filtro_exclui.png") right 7px no-repeat; | |
3098 | + text-decoration: none; | |
3099 | +} | |
3100 | +.controller-search a:hover.facet-selected { | |
3101 | + text-decoration: underline; | |
3070 | 3102 | } |
3071 | 3103 | |
3072 | 3104 | #product-category, |
... | ... | @@ -4343,7 +4375,9 @@ h1#agenda-title { |
4343 | 4375 | |
4344 | 4376 | .controller-search #search-results { |
4345 | 4377 | margin-top: 10px; |
4346 | - width: 100%; | |
4378 | + width: 76.5%; | |
4379 | + float: right; | |
4380 | + border-top:1px dotted #000; | |
4347 | 4381 | /* none by default, but... Who knows the future? :-) */ |
4348 | 4382 | } |
4349 | 4383 | |
... | ... | @@ -4383,18 +4417,18 @@ h1#agenda-title { |
4383 | 4417 | #search-results li .icon:hover { |
4384 | 4418 | background-color: transparent; |
4385 | 4419 | } |
4386 | - | |
4420 | +/* | |
4387 | 4421 | .controller-search .has_cat_list #map, |
4388 | 4422 | .controller-search .msie .has_cat_list #map, |
4389 | 4423 | .controller-search .has_cat_list .only-one-result-box .search-results-box, |
4390 | 4424 | .controller-search .msie .has_cat_list .only-one-result-box .search-results-box { |
4391 | - width: 80%; | |
4392 | - float: right; | |
4393 | -} | |
4425 | +width: 80%; | |
4426 | +float: right; | |
4427 | +}*/ | |
4394 | 4428 | |
4395 | -.controller-search .has_cat_list #product-categories-menu { | |
4396 | - width: 20%; | |
4397 | - float: left; | |
4429 | + .controller-search .has_cat_list #product-categories-menu { | |
4430 | + width: 20%; | |
4431 | + float: left; | |
4398 | 4432 | } |
4399 | 4433 | |
4400 | 4434 | .controller-search #product-categories-menu a { |
... | ... | @@ -4451,9 +4485,6 @@ h1#agenda-title { |
4451 | 4485 | background-color: #FF0; |
4452 | 4486 | } |
4453 | 4487 | |
4454 | -.controller-search .search-results-box.odd { | |
4455 | - margin-left: 1%; | |
4456 | -} | |
4457 | 4488 | .controller-search .msie .search-results-box.odd { |
4458 | 4489 | float: right; |
4459 | 4490 | } |
... | ... | @@ -4584,15 +4615,15 @@ h1#agenda-title { |
4584 | 4615 | overflow: auto; |
4585 | 4616 | } |
4586 | 4617 | |
4587 | -.search-results-type-product .odd, | |
4588 | -.search-results-type-product .even { | |
4589 | - float: none; | |
4590 | -} | |
4591 | - | |
4592 | 4618 | .search-results-type-product li.product-item { |
4593 | 4619 | position: relative; |
4594 | 4620 | height: 60px; |
4595 | 4621 | overflow: hidden; |
4622 | + clear: both; | |
4623 | +} | |
4624 | + | |
4625 | +.product-item-topic { | |
4626 | + font-weight: bold; | |
4596 | 4627 | } |
4597 | 4628 | |
4598 | 4629 | #content #search-results .common-profile-list-block li a.profile_link { |
... | ... | @@ -4647,15 +4678,11 @@ h1#agenda-title { |
4647 | 4678 | } |
4648 | 4679 | |
4649 | 4680 | .controller-search #content .only-one-result-box .search-results-type-product .product-item { |
4650 | - width: 50%; | |
4651 | 4681 | height: 80px; |
4652 | 4682 | max-height: 70px; |
4653 | 4683 | overflow: hidden; |
4654 | 4684 | float: left; |
4655 | 4685 | } |
4656 | -.controller-search .msie #content .only-one-result-box .search-results-type-product .product-item { | |
4657 | - width: 49%; | |
4658 | -} | |
4659 | 4686 | |
4660 | 4687 | .controller-search .product-pic { |
4661 | 4688 | display: block; |
... | ... | @@ -6079,7 +6106,7 @@ h1#agenda-title { |
6079 | 6106 | } |
6080 | 6107 | |
6081 | 6108 | .msie7 #leave_scrap { |
6082 | - overflow: hidden; | |
6109 | + overflow: hidden; | |
6083 | 6110 | } |
6084 | 6111 | |
6085 | 6112 | .msie7 #profile-activity hr, .msie7 #profile-network hr, .msie7 #profile-wall hr { |
... | ... | @@ -6102,7 +6129,7 @@ h1#agenda-title { |
6102 | 6129 | .msie7 .leave_scrap_to_self .profile-activity-image, |
6103 | 6130 | .msie7 .leave_scrap .profile-activity-image { |
6104 | 6131 | z-index: 3; |
6105 | - left: 2px; | |
6132 | + left: 2px; | |
6106 | 6133 | } |
6107 | 6134 | |
6108 | 6135 | .msie7 #profile-activity .profile-activity-send-message, |
... | ... | @@ -6118,40 +6145,40 @@ h1#agenda-title { |
6118 | 6145 | |
6119 | 6146 | .msie7 .ui-tabs .ui-tabs-nav li { |
6120 | 6147 | top: 1px; |
6121 | - margin: 0; | |
6122 | - margin-right: 4px; | |
6148 | + margin: 0; | |
6149 | + margin-right: 4px; | |
6123 | 6150 | } |
6124 | 6151 | |
6125 | 6152 | .msie7 .profile-wall-scrap-replies { |
6126 | 6153 | float: none; |
6127 | - margin-top: 10px; | |
6154 | + margin-top: 10px; | |
6128 | 6155 | } |
6129 | 6156 | |
6130 | 6157 | .article-translations-menu { |
6131 | - bottom: 17px; | |
6158 | + bottom: 17px; | |
6132 | 6159 | } |
6133 | 6160 | |
6134 | 6161 | .article-translations-menu { |
6135 | - text-decoration: none !important; | |
6136 | - height: 0; | |
6137 | - float: right; | |
6162 | + text-decoration: none !important; | |
6163 | + height: 0; | |
6164 | + float: right; | |
6138 | 6165 | } |
6139 | 6166 | |
6140 | 6167 | .article-translations .menu-submenu-header, |
6141 | 6168 | .article-translations .menu-submenu-content, |
6142 | 6169 | .article-translations .menu-submenu-footer { |
6143 | - background: none; | |
6170 | + background: none; | |
6144 | 6171 | } |
6145 | 6172 | |
6146 | 6173 | .article-translations .menu-submenu { |
6147 | - bottom: auto; | |
6148 | - right: 0; | |
6149 | - border: 1px solid; | |
6150 | - background: #fff; | |
6174 | + bottom: auto; | |
6175 | + right: 0; | |
6176 | + border: 1px solid; | |
6177 | + background: #fff; | |
6151 | 6178 | } |
6152 | 6179 | |
6153 | 6180 | .article-translations .menu-submenu-list { |
6154 | - list-style: none; | |
6181 | + list-style: none; | |
6155 | 6182 | } |
6156 | 6183 | |
6157 | 6184 | /* Forum */ |
... | ... | @@ -6230,3 +6257,121 @@ h1#agenda-title { |
6230 | 6257 | #cboxClose { |
6231 | 6258 | display: none !important; |
6232 | 6259 | } |
6260 | +/* Alterações */ | |
6261 | +.controller-search #content .search_form { | |
6262 | + background: transparent !important; | |
6263 | + padding:0 !important; | |
6264 | +} | |
6265 | +.formfield input { | |
6266 | + border: 1px solid #231F20; | |
6267 | + height: 28px; | |
6268 | + width: 558px; | |
6269 | +} | |
6270 | +.search-field .formfield { | |
6271 | + height: 34px; | |
6272 | + display: inline-block | |
6273 | +} | |
6274 | + | |
6275 | +#content form .search-field input.button.submit { | |
6276 | + width: 152px; | |
6277 | + background: #000; | |
6278 | + overflow: visible; | |
6279 | + color:#fff; | |
6280 | + text-align: left; | |
6281 | + padding:0; | |
6282 | + border: none; | |
6283 | + height:34px; | |
6284 | + display:inline-block; | |
6285 | + max-height:none; | |
6286 | + -moz-border-radius: 5px; | |
6287 | + -webkit-border-radius: 5px; | |
6288 | + -khtml-border-radius: 5px; | |
6289 | + -o-border-radius: 5px; | |
6290 | + border-radius: 5px; | |
6291 | +} | |
6292 | +#content form .search-field input:hover.button.submit { | |
6293 | + background-color:#444; | |
6294 | +} | |
6295 | +#content #public-profile-search form .search-field input.button.submit { | |
6296 | + margin: 0; | |
6297 | + width: 116px; | |
6298 | +} | |
6299 | +#facets-menu .facet-menu { | |
6300 | + border-bottom: 1px solid #333; | |
6301 | + margin-bottom: 15px; | |
6302 | +} | |
6303 | +#facets-menu .facet-menu-label { | |
6304 | + background:#E8F5FB; | |
6305 | + text-transform:uppercase; | |
6306 | + padding:10px 10px 2px 10px; | |
6307 | +} | |
6308 | +#facets-menu .facet-menu-options { | |
6309 | + color: #959595; | |
6310 | + font-size: 0.8em | |
6311 | +} | |
6312 | +#facets-menu .facet-menu-options a { | |
6313 | + color: #007788; | |
6314 | + font-size: 1.2em; | |
6315 | +} | |
6316 | +.controller-search #content #search-results .search-results-type-product li.product-item { | |
6317 | + display:block; | |
6318 | + float:none | |
6319 | + overflow:visible; | |
6320 | + padding:10px 0; | |
6321 | + margin:10px 0; | |
6322 | + border-bottom:1px solid #000; | |
6323 | + height:auto; | |
6324 | + max-height:none; | |
6325 | +} | |
6326 | +.controller-search .search-results-innerbox li.product-item hr { | |
6327 | + display:block; | |
6328 | + margin:0; | |
6329 | + clear: both; | |
6330 | + border: none; | |
6331 | + background: none; | |
6332 | +} | |
6333 | +.product-item-first-column, .product-item-second-column, .product-item-third-column { | |
6334 | + float: left; | |
6335 | + margin:0 !important; | |
6336 | +} | |
6337 | +.product-item-first-column, .product-item-third-column { | |
6338 | + width: 20%; | |
6339 | +} | |
6340 | +.product-item-second-column { | |
6341 | + width:60%; | |
6342 | +} | |
6343 | +#content h1.page-title.no-boxes { | |
6344 | + left:230px !important; | |
6345 | +} | |
6346 | +#main-content-wrapper-8 { | |
6347 | + padding: 0 !important; | |
6348 | +} | |
6349 | +.product-item-second-column span.product-title-link { | |
6350 | + display:block; | |
6351 | + margin:0 0 15px 0; | |
6352 | +} | |
6353 | +.product-item-second-column span.product-title-link a { | |
6354 | + color: #006577; | |
6355 | + font-weight:bold; | |
6356 | + font-size:1.2em; | |
6357 | +} | |
6358 | +.results-header { | |
6359 | + border-bottom: 1px solid #000; | |
6360 | + float: right; | |
6361 | + font-size: 0.9em; | |
6362 | + padding: 10px 0; | |
6363 | + width: 76.5%; | |
6364 | + margin:0 0 5px 0; | |
6365 | +} | |
6366 | +.total-pages-found { | |
6367 | + float: left; | |
6368 | + width: 50%; | |
6369 | +} | |
6370 | +.current-page { | |
6371 | + float: right; | |
6372 | + width: 50%; | |
6373 | + text-align: right; | |
6374 | +} | |
6375 | +#advanced_search_link { | |
6376 | + display: none; | |
6377 | +} | ... | ... |