diff --git a/app/models/product.rb b/app/models/product.rb index 8bb2d82..4e2cdf0 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -155,37 +155,31 @@ class Product < ActiveRecord::Base def name_or_category name ? name : product_category.name end - def f_category_id + def f_category #def childs(id) #ret = ProductCategory.find(:all, :conditions => {:parent_id => id}).collect(&:id) #([id, ret.map { |i| childs(i) }]) #end #childs(self.product_category.id).flatten - [self.product_category.id] + self.product_category.name end - def f_region_id - if self.enterprise.region - self.enterprise.region.id - else - nil - end - end - def f_qualifier_id - product_qualifiers.collect(&:qualifier_id) + def f_region + self.enterprise.region.name if self.enterprise.region end - def f_certifier_id - product_qualifiers.collect(&:certifier_id) + def f_qualifier + product_qualifiers.collect{|i| i.qualifier.name if i.qualifier} + + product_qualifiers.collect{|i| i.certifier.name if i.certifier} end public - acts_as_faceted :fields => {:f_category_id => {:class => ProductCategory, :display_field => :name, :label => _('Related products')}, - :f_region_id => {:class => Region, :display_field => :name, :label => _('Region')}, - :f_qualifier_id => {:class => Qualifier, :display_field => :name, :label => _('Qualifiers')}, - :f_certifier_id => {:class => Certifier, :display_field => :name, :label => _('Certifiers')}}, - :order => [:f_category_id, :f_region_id, :f_qualifier_id, :f_certifier_id] + acts_as_faceted :fields => { + :f_category => {:label => _('Related products')}, + :f_region => {:label => _('Region')}, + :f_qualifier => {:label => _('Qualifiers')}}, + :order => [:f_category, :f_region, :f_qualifier] - acts_as_searchable :fields => [{:name_or_category => {:type => :text, :as => :name}}, - {:name_or_category => {:type => :string, :as => :name_sort}}, :description, {:price => :float}, :category_full_name ] | facets.keys.map{|i| {i => :facet}}, + acts_as_searchable :fields => [{:name_or_category => {:type => :text, :as => :name, :boost => 2.0}}, + {:name_or_category => {:type => :string, :as => :name_sort}}, :description, {:price => :float}, :category_full_name ] + facets.keys.map{|i| {i => :facet}}, :facets => facets.keys end diff --git a/app/views/search/_product.rhtml b/app/views/search/_product.rhtml index 265720e..28cd918 100644 --- a/app/views/search/_product.rhtml +++ b/app/views/search/_product.rhtml @@ -1,31 +1,48 @@ -<%# FIXME add more information %> - -<% -product_item_pos = 0 if ! product_item_pos -product_item_pos += 1 -%> - <% extra_content = @plugins.map(:asset_product_extras, product, product.enterprise).collect { |content| instance_eval(&content) } %> <% extra_properties = @plugins.map(:asset_product_properties, product)%> -
  • - <%= link_to_product product, :class => 'product-pic', :style => 'background-image:url(%s)' % product.default_image(:minor) %> - - <%= link_to_product product %> - - +
  • +
    + <%= link_to_product product, :class => 'product-pic', :style => 'background-image:url(%s)' % product.default_image(:minor) %> + <%= product.price if product.price %> +
    +
    + <%= link_to_product product %> +
    + <%= _('SUPPLIER') %> <%= link_to_homepage(product.enterprise.name, product.enterprise.identifier) %> +
    +
    + <% if product.description %> + <%= _('DESCRIPTION') %> <%= product.description %> + <% end %> +
    +
    +
    +
    + <% if product.enterprise.region %> + <%= _('REGION') %> +
    <%= product.enterprise.region.name %> + <% end %> +
    +
    + <% if product.product_qualifiers.count > 0 %> + <%= _('QUALIFIERS') %> + <% product.product_qualifiers.each do |pq| %> + <% if pq.qualifier %> +
    <%= pq.qualifier.name %> + <% end %> + <% if pq.certifier %> +
    <%= pq.certifier.name %> + <% end %> + <% end %> + <% end %> +
    +
    <%= extra_content.join('\n') %> + <% extra_properties.each do |property| %> +
    <%= property[:name] + ': ' + instance_eval(&property[:content]) %>
    + <% end %> +
  • diff --git a/app/views/search/_results_header.rhtml b/app/views/search/_results_header.rhtml new file mode 100644 index 0000000..8d41410 --- /dev/null +++ b/app/views/search/_results_header.rhtml @@ -0,0 +1,6 @@ +
    + <%= label_total_found(asset, results.total_entries) %> + <%= _("Showing page %s of %s") % [results.current_page, results.total_pages] %>
    + <%= facets_unselect_menu(asset) %> + <%= order_by(asset) %> + diff --git a/app/views/search/products.rhtml b/app/views/search/products.rhtml index db6be14..8128119 100644 --- a/app/views/search/products.rhtml +++ b/app/views/search/products.rhtml @@ -21,9 +21,7 @@ <% end %> <% end %> -<%= facets_unselect_menu(:products) %> - -<%= order_by(:products, [[_('Best match'), ''], [_('Name'), 'name_sort asc'], [_('Lower price'), 'price asc'], [_('Higher price'), 'price desc']]) %> +<%= render :partial => 'results_header', :locals => { :asset => :products, :results => @results[:products] } %> <%= display_results %> diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index d86e4cb..437c59d 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1777,6 +1777,11 @@ input.disabled { .search-ordering { float: right; + width: 11%; + margin: 0 0 5px +} +.search-ordering select { + display: block; } .search-relevance { @@ -1824,6 +1829,7 @@ input.disabled { #search-popup .search-field, .search-form { text-align: center; + float: right; } #content .search-options ul, .search-options ul, @@ -2405,7 +2411,7 @@ div#activation_enterprise div { .slideshow-block .slideshow-block-navigation .icon-media-next { padding-right: 18px; background-position: right; - + } .slideshow-block .slideshow-block-navigation .icon-media-pause, .slideshow-block .slideshow-block-navigation .icon-media-play { @@ -2782,6 +2788,7 @@ div#activation_enterprise div { .formfield input { text-indent: 5px; padding: 2px 0px; + background: #fff; } .msie5 .formfield input, .msie6 .formfield input { @@ -3056,17 +3063,42 @@ div#activation_enterprise div { .controller-search #facets-menu { width: 20%; float: left; + min-height: 300px; } .controller-search #facets-menu div { position: relative; } - +.facets-applied { + float: left; + margin: 0 0 0 27px; + padding: 5px 0; + width: 65%; +} +span.appliedFilters { + display: block; + font-size: 0.8em; + font-style: italic; + margin: 0 0 0 5px; +} .controller-search .facet-selected { display: block; - background-color: #000; - color: #fff; + color: #000; + font-style:italic; + font-size:0.8em; float: left; + padding:4px 24px 4px 4px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + -o-border-radius: 4px; + -khtml-border-radius: 4px; + border-radius: 4px; + margin: 5px; + background: #B1DFEF url("../images/ico_filtro_exclui.png") right 7px no-repeat; + text-decoration: none; +} +.controller-search a:hover.facet-selected { + text-decoration: underline; } #product-category, @@ -4343,7 +4375,9 @@ h1#agenda-title { .controller-search #search-results { margin-top: 10px; - width: 100%; + width: 76.5%; + float: right; + border-top:1px dotted #000; /* none by default, but... Who knows the future? :-) */ } @@ -4383,18 +4417,18 @@ h1#agenda-title { #search-results li .icon:hover { background-color: transparent; } - +/* .controller-search .has_cat_list #map, .controller-search .msie .has_cat_list #map, .controller-search .has_cat_list .only-one-result-box .search-results-box, .controller-search .msie .has_cat_list .only-one-result-box .search-results-box { - width: 80%; - float: right; -} +width: 80%; +float: right; +}*/ -.controller-search .has_cat_list #product-categories-menu { - width: 20%; - float: left; + .controller-search .has_cat_list #product-categories-menu { + width: 20%; + float: left; } .controller-search #product-categories-menu a { @@ -4451,9 +4485,6 @@ h1#agenda-title { background-color: #FF0; } -.controller-search .search-results-box.odd { - margin-left: 1%; -} .controller-search .msie .search-results-box.odd { float: right; } @@ -4584,15 +4615,15 @@ h1#agenda-title { overflow: auto; } -.search-results-type-product .odd, -.search-results-type-product .even { - float: none; -} - .search-results-type-product li.product-item { position: relative; height: 60px; overflow: hidden; + clear: both; +} + +.product-item-topic { + font-weight: bold; } #content #search-results .common-profile-list-block li a.profile_link { @@ -4647,15 +4678,11 @@ h1#agenda-title { } .controller-search #content .only-one-result-box .search-results-type-product .product-item { - width: 50%; height: 80px; max-height: 70px; overflow: hidden; float: left; } -.controller-search .msie #content .only-one-result-box .search-results-type-product .product-item { - width: 49%; -} .controller-search .product-pic { display: block; @@ -6079,7 +6106,7 @@ h1#agenda-title { } .msie7 #leave_scrap { - overflow: hidden; + overflow: hidden; } .msie7 #profile-activity hr, .msie7 #profile-network hr, .msie7 #profile-wall hr { @@ -6102,7 +6129,7 @@ h1#agenda-title { .msie7 .leave_scrap_to_self .profile-activity-image, .msie7 .leave_scrap .profile-activity-image { z-index: 3; - left: 2px; + left: 2px; } .msie7 #profile-activity .profile-activity-send-message, @@ -6118,40 +6145,40 @@ h1#agenda-title { .msie7 .ui-tabs .ui-tabs-nav li { top: 1px; - margin: 0; - margin-right: 4px; + margin: 0; + margin-right: 4px; } .msie7 .profile-wall-scrap-replies { float: none; - margin-top: 10px; + margin-top: 10px; } .article-translations-menu { - bottom: 17px; + bottom: 17px; } .article-translations-menu { - text-decoration: none !important; - height: 0; - float: right; + text-decoration: none !important; + height: 0; + float: right; } .article-translations .menu-submenu-header, .article-translations .menu-submenu-content, .article-translations .menu-submenu-footer { - background: none; + background: none; } .article-translations .menu-submenu { - bottom: auto; - right: 0; - border: 1px solid; - background: #fff; + bottom: auto; + right: 0; + border: 1px solid; + background: #fff; } .article-translations .menu-submenu-list { - list-style: none; + list-style: none; } /* Forum */ @@ -6230,3 +6257,121 @@ h1#agenda-title { #cboxClose { display: none !important; } +/* Alterações */ +.controller-search #content .search_form { + background: transparent !important; + padding:0 !important; +} +.formfield input { + border: 1px solid #231F20; + height: 28px; + width: 558px; +} +.search-field .formfield { + height: 34px; + display: inline-block +} + +#content form .search-field input.button.submit { + width: 152px; + background: #000; + overflow: visible; + color:#fff; + text-align: left; + padding:0; + border: none; + height:34px; + display:inline-block; + max-height:none; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + -khtml-border-radius: 5px; + -o-border-radius: 5px; + border-radius: 5px; +} +#content form .search-field input:hover.button.submit { + background-color:#444; +} +#content #public-profile-search form .search-field input.button.submit { + margin: 0; + width: 116px; +} +#facets-menu .facet-menu { + border-bottom: 1px solid #333; + margin-bottom: 15px; +} +#facets-menu .facet-menu-label { + background:#E8F5FB; + text-transform:uppercase; + padding:10px 10px 2px 10px; +} +#facets-menu .facet-menu-options { + color: #959595; + font-size: 0.8em +} +#facets-menu .facet-menu-options a { + color: #007788; + font-size: 1.2em; +} +.controller-search #content #search-results .search-results-type-product li.product-item { + display:block; + float:none + overflow:visible; + padding:10px 0; + margin:10px 0; + border-bottom:1px solid #000; + height:auto; + max-height:none; +} +.controller-search .search-results-innerbox li.product-item hr { + display:block; + margin:0; + clear: both; + border: none; + background: none; +} +.product-item-first-column, .product-item-second-column, .product-item-third-column { + float: left; + margin:0 !important; +} +.product-item-first-column, .product-item-third-column { + width: 20%; +} +.product-item-second-column { + width:60%; +} +#content h1.page-title.no-boxes { + left:230px !important; +} +#main-content-wrapper-8 { + padding: 0 !important; +} +.product-item-second-column span.product-title-link { + display:block; + margin:0 0 15px 0; +} +.product-item-second-column span.product-title-link a { + color: #006577; + font-weight:bold; + font-size:1.2em; +} +.results-header { + border-bottom: 1px solid #000; + float: right; + font-size: 0.9em; + padding: 10px 0; + width: 76.5%; + margin:0 0 5px 0; +} +.total-pages-found { + float: left; + width: 50%; +} +.current-page { + float: right; + width: 50%; + text-align: right; +} +#advanced_search_link { + display: none; +} -- libgit2 0.21.2