Commit a522ab44595283a0fd4870b9a6b8d15f46eaa66f
1 parent
f3cf61a8
Exists in
master
and in
22 other branches
ActionItem507: allmost done in product listing with category
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2146 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
8 changed files
with
91 additions
and
12 deletions
Show diff stats
app/views/search/_display_results.rhtml
| @@ -17,13 +17,17 @@ | @@ -17,13 +17,17 @@ | ||
| 17 | <%= @names[name] %> | 17 | <%= @names[name] %> |
| 18 | </h3> | 18 | </h3> |
| 19 | <% end %> | 19 | <% end %> |
| 20 | - <%= link_to _('see all (%d)') % results.total_entries, params.merge(:action => 'index', :find_in => [ name ]), :class => 'see-more' %> | 20 | + <%= link_to( _('see all (%d)') % results.total_entries, |
| 21 | + params.merge(:action => 'index', | ||
| 22 | + :find_in => [ name ]), | ||
| 23 | + :class => 'see-more' ) if @results.size > 1 %> | ||
| 21 | <% end %> | 24 | <% end %> |
| 22 | <% partial = partial_for_class results.first.class %> | 25 | <% partial = partial_for_class results.first.class %> |
| 23 | <div class="search-results-innerbox search-results-type-<%= partial %> <%= 'common-profile-list-block' if partial == 'profile' %>"> | 26 | <div class="search-results-innerbox search-results-type-<%= partial %> <%= 'common-profile-list-block' if partial == 'profile' %>"> |
| 24 | <ul> | 27 | <ul> |
| 28 | + <% hit_pos = 0 %> | ||
| 25 | <% results.each do |hit| %> | 29 | <% results.each do |hit| %> |
| 26 | - <%= render :partial => partial, :object => hit %> | 30 | + <%= render :partial => partial, :object => hit, :locals => { :pos => ( hit_pos += 1 ) } %> |
| 27 | <% end %> | 31 | <% end %> |
| 28 | </ul> | 32 | </ul> |
| 29 | <hr /> | 33 | <hr /> |
app/views/search/_product.rhtml
| 1 | <%# FIXME add more information %> | 1 | <%# FIXME add more information %> |
| 2 | 2 | ||
| 3 | -<li> | 3 | +<% |
| 4 | +product_item_pos = 0 if ! product_item_pos | ||
| 5 | +product_item_pos += 1 | ||
| 6 | +%> | ||
| 7 | + | ||
| 8 | +<li class="product-item <%= ( pos % 2 == 0 ) ? 'odd' : 'even' %>"> | ||
| 4 | <%= link_to_product product, :class => 'product-pic', :style => 'background-image:url(%s)' % | 9 | <%= link_to_product product, :class => 'product-pic', :style => 'background-image:url(%s)' % |
| 5 | ( product.image ? product.image.public_filename(:minor) : '/images/icons-app/product-default-pic-minor.png' ) %> | 10 | ( product.image ? product.image.public_filename(:minor) : '/images/icons-app/product-default-pic-minor.png' ) %> |
| 6 | <strong> | 11 | <strong> |
app/views/search/_product_categories_menu.rhtml
| 1 | +<% if @product_category %> | ||
| 2 | + <h3 class="current-cat-path"> | ||
| 3 | + <%= @product_category.hierarchy.map {|cat| ((cat == @product_category) ? content_tag('span', cat.name) : link_to((cat.name), params.merge({:product_category => cat.id}))) }.join(' → ') %> | ||
| 4 | + </h3> | ||
| 5 | +<% end %> | ||
| 6 | + | ||
| 1 | <% if product_categories_menu %> | 7 | <% if product_categories_menu %> |
| 2 | 8 | ||
| 3 | <div id="product-categories-menu"> | 9 | <div id="product-categories-menu"> |
| @@ -44,7 +50,7 @@ function prodCatMenuOver( li ) { | @@ -44,7 +50,7 @@ function prodCatMenuOver( li ) { | ||
| 44 | li.opening = true; | 50 | li.opening = true; |
| 45 | li.className = "cat-parent sub-opening"; | 51 | li.className = "cat-parent sub-opening"; |
| 46 | li.subMenu.className = "opening"; | 52 | li.subMenu.className = "opening"; |
| 47 | - li.e = Effect.BlindDown(li.subMenu); | 53 | + li.e = Effect.BlindDown(li.subMenu, { duration: 0.33 }); |
| 48 | li.e._finish = li.e.finish; | 54 | li.e._finish = li.e.finish; |
| 49 | li.e.finish = function(){ | 55 | li.e.finish = function(){ |
| 50 | this._finish(); | 56 | this._finish(); |
| @@ -68,7 +74,7 @@ function prodCatMenuOut( li ) { | @@ -68,7 +74,7 @@ function prodCatMenuOut( li ) { | ||
| 68 | this.closeing = true; | 74 | this.closeing = true; |
| 69 | this.className = "cat-parent sub-closeing"; | 75 | this.className = "cat-parent sub-closeing"; |
| 70 | this.subMenu.className = "closeing"; | 76 | this.subMenu.className = "closeing"; |
| 71 | - this.e = Effect.BlindUp(this.subMenu); | 77 | + this.e = Effect.BlindUp(this.subMenu, { duration: 0.5 }); |
| 72 | this.e._finish = this.e.finish; | 78 | this.e._finish = this.e.finish; |
| 73 | this.e.finish = function(){ | 79 | this.e.finish = function(){ |
| 74 | this._finish(); | 80 | this._finish(); |
app/views/search/enterprises.rhtml
| @@ -12,10 +12,18 @@ | @@ -12,10 +12,18 @@ | ||
| 12 | 12 | ||
| 13 | <%= render :partial => 'search_form', :locals => { :form_title => _("Refine your search"), :simple_search => true } %> | 13 | <%= render :partial => 'search_form', :locals => { :form_title => _("Refine your search"), :simple_search => true } %> |
| 14 | 14 | ||
| 15 | +<% if @categories_menu %> | ||
| 16 | +<div class="has_cat_list"> | ||
| 17 | +<% end %> | ||
| 18 | + | ||
| 15 | <%= render :partial => 'product_categories_menu', :object => @categories_menu %> | 19 | <%= render :partial => 'product_categories_menu', :object => @categories_menu %> |
| 16 | 20 | ||
| 17 | <%= display_results %> | 21 | <%= display_results %> |
| 18 | 22 | ||
| 23 | +<% if @categories_menu %> | ||
| 24 | +</div><!-- class="has_cat_list" --> | ||
| 25 | +<% end %> | ||
| 26 | + | ||
| 19 | <%= pagination_links @results[:enterprises] %> | 27 | <%= pagination_links @results[:enterprises] %> |
| 20 | 28 | ||
| 21 | <br style="clear:both" /> | 29 | <br style="clear:both" /> |
app/views/search/products.rhtml
| @@ -10,12 +10,6 @@ | @@ -10,12 +10,6 @@ | ||
| 10 | <h2><%=h (_('Within %s km from %s') % [@radius, @region.name]) %><h2> | 10 | <h2><%=h (_('Within %s km from %s') % [@radius, @region.name]) %><h2> |
| 11 | <% end %> | 11 | <% end %> |
| 12 | 12 | ||
| 13 | -<% if @product_category %> | ||
| 14 | - <h3> | ||
| 15 | - <%= @product_category.hierarchy.map {|cat| ((cat == @product_category) ? cat.name : link_to((cat.name), params.merge({:product_category => cat.id}))) }.join(' → ') %> | ||
| 16 | - </h3> | ||
| 17 | -<% end %> | ||
| 18 | - | ||
| 19 | <%= render :partial => 'search_form', :locals => { :form_title => _("Refine your search"), :simple_search => true } %> | 13 | <%= render :partial => 'search_form', :locals => { :form_title => _("Refine your search"), :simple_search => true } %> |
| 20 | 14 | ||
| 21 | <% if @categories_menu %> | 15 | <% if @categories_menu %> |
config/web2.0.yml.dist
| @@ -6,4 +6,5 @@ addthis: | @@ -6,4 +6,5 @@ addthis: | ||
| 6 | pub: your-user-name | 6 | pub: your-user-name |
| 7 | logo: http://localhost:3000/images/logo-200x50.png | 7 | logo: http://localhost:3000/images/logo-200x50.png |
| 8 | options: favorites, email, digg, delicious, technorati, slashdot, twitter, more | 8 | options: favorites, email, digg, delicious, technorati, slashdot, twitter, more |
| 9 | - | 9 | +googlemaps: |
| 10 | + key: <id google> |
public/designs/themes/ecosol/stylesheets/controller_search.css
| @@ -225,3 +225,20 @@ body.category4 .category-innerbox { | @@ -225,3 +225,20 @@ body.category4 .category-innerbox { | ||
| 225 | font-weight: bold; | 225 | font-weight: bold; |
| 226 | } | 226 | } |
| 227 | 227 | ||
| 228 | + | ||
| 229 | +/* * * Pagination * * * * * * * * * * * */ | ||
| 230 | + | ||
| 231 | +.pagination * { | ||
| 232 | + padding: 0px 3px 2px 3px; | ||
| 233 | + -moz-border-radius: 5px; | ||
| 234 | +} | ||
| 235 | + | ||
| 236 | +.pagination a { | ||
| 237 | + text-decoration: none; | ||
| 238 | +} | ||
| 239 | + | ||
| 240 | +.pagination a:hover { | ||
| 241 | + color: #FFF; | ||
| 242 | + background: #729FCF; | ||
| 243 | +} | ||
| 244 | + |
public/stylesheets/controller_search.css
| @@ -2,6 +2,18 @@ | @@ -2,6 +2,18 @@ | ||
| 2 | position: relative; /* to the text appear on MSIE 6 */ | 2 | position: relative; /* to the text appear on MSIE 6 */ |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | +#content .map-toggle-button { | ||
| 6 | + float: right; | ||
| 7 | + margin-top: -35px; | ||
| 8 | +} | ||
| 9 | + | ||
| 10 | +.current-cat-path { | ||
| 11 | + padding-left: 25px; | ||
| 12 | +} | ||
| 13 | +.current-cat-path * { | ||
| 14 | + white-space: nowrap; | ||
| 15 | +} | ||
| 16 | + | ||
| 5 | #search-results { | 17 | #search-results { |
| 6 | margin-top: 10px; | 18 | margin-top: 10px; |
| 7 | /* none by default, but... Who knows the future? :-) */ | 19 | /* none by default, but... Who knows the future? :-) */ |
| @@ -195,6 +207,14 @@ | @@ -195,6 +207,14 @@ | ||
| 195 | line-height: 12px; | 207 | line-height: 12px; |
| 196 | } | 208 | } |
| 197 | 209 | ||
| 210 | +#content .only-one-result-box .search-results-type-product .product-item { | ||
| 211 | + width: 50%; | ||
| 212 | + height: 80px; | ||
| 213 | + max-height: 70px; | ||
| 214 | + overflow: hidden; | ||
| 215 | + float: left; | ||
| 216 | +} | ||
| 217 | + | ||
| 198 | .product-pic { | 218 | .product-pic { |
| 199 | display: block; | 219 | display: block; |
| 200 | float: left; | 220 | float: left; |
| @@ -225,3 +245,27 @@ | @@ -225,3 +245,27 @@ | ||
| 225 | .profile-info { | 245 | .profile-info { |
| 226 | text-align: left; | 246 | text-align: left; |
| 227 | } | 247 | } |
| 248 | + | ||
| 249 | + | ||
| 250 | +/* * * Pagination * * * * * * * * * * * */ | ||
| 251 | + | ||
| 252 | +.pagination { | ||
| 253 | + text-align: center; | ||
| 254 | +} | ||
| 255 | + | ||
| 256 | +.pagination .disabled { | ||
| 257 | + color: #888; | ||
| 258 | +} | ||
| 259 | + | ||
| 260 | +.pagination .current { | ||
| 261 | + font-weight: bold; | ||
| 262 | +} | ||
| 263 | + | ||
| 264 | +.pagination a { | ||
| 265 | + text-decoration: none; | ||
| 266 | +} | ||
| 267 | + | ||
| 268 | +.pagination a:hover { | ||
| 269 | + color: #026; | ||
| 270 | +} | ||
| 271 | + |