From 2e98ca49e04597bfa5920f249ba2850134175cef Mon Sep 17 00:00:00 2001 From: AurelioAHeckert Date: Fri, 18 Apr 2008 00:31:57 +0000 Subject: [PATCH] ActionItem260: the search box is better and the search result is in organized boxes --- app/helpers/application_helper.rb | 6 ++++-- app/views/search/_display_results.rhtml | 28 ++++++++++++++++++++++------ app/views/search/_product.rhtml | 8 ++++---- app/views/search/_profile.rhtml | 9 +-------- app/views/search/popup.rhtml | 35 ++++++++++++++++++++++------------- public/designs/icons/default/gnome-search.png | Bin 1026 -> 0 bytes public/designs/icons/default/gtk-find.png | Bin 871 -> 0 bytes public/designs/icons/default/style.css | 2 +- public/designs/themes/default/stylesheets/common.css | 3 +++ public/designs/themes/default/stylesheets/controller_search.css | 32 ++++++++++++++++++++++++++++++++ public/images/icons-app/gnome-home_size-minor.png | Bin 0 -> 3165 bytes public/images/icons-app/product-default-pic-minor.png | Bin 0 -> 1389 bytes public/images/icons-app/users_size-minor.png | Bin 0 -> 3549 bytes public/stylesheets/common.css | 1 + public/stylesheets/controller_search.css | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ public/stylesheets/lightbox.css | 1 - public/stylesheets/search.css | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- 17 files changed, 238 insertions(+), 37 deletions(-) delete mode 100644 public/designs/icons/default/gnome-search.png delete mode 100644 public/designs/icons/default/gtk-find.png create mode 100644 public/designs/themes/default/stylesheets/controller_search.css create mode 100644 public/images/icons-app/gnome-home_size-minor.png create mode 100644 public/images/icons-app/product-default-pic-minor.png create mode 100644 public/images/icons-app/users_size-minor.png create mode 100644 public/stylesheets/controller_search.css diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8520dc0..4c74e33 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -312,9 +312,11 @@ module ApplicationHelper link_to name, :controller => 'search', :action => 'category_index', :category_path => category.path.split('/') end - def link_to_product(product) + def link_to_product(product, opts={}) return _('No product') unless product - link_to product.name, :controller => 'catalog', :action => 'show', :id => product, :profile => product.enterprise.identifier + link_to content_tag( 'span', product.name ), + { :controller => 'catalog', :action => 'show', :id => product, :profile => product.enterprise.identifier }, + opts end def partial_for_class(klass) diff --git a/app/views/search/_display_results.rhtml b/app/views/search/_display_results.rhtml index 2d7cec3..cbb86a6 100644 --- a/app/views/search/_display_results.rhtml +++ b/app/views/search/_display_results.rhtml @@ -1,14 +1,30 @@ +
+<% pos = :odd %> <% @results.each do |name,results| %> <% if !results.nil? and !results.empty? %> -
+
<% if params[:action] != 'assets' %>

<%= @names[name] %>

<% end %> -
    - <% results.each do |hit| %> - <%= render :partial => partial_for_class(hit.class), :object => hit %> + <% partial = partial_for_class results.first.class %> +
    +
      + <% results.each do |hit| %> + <%= render :partial => partial, :object => hit %> + <% end %> +
    +
    +
+ <% else %> +
+ <% if params[:action] != 'assets' %> +

<%= @names[name] %>

<% end %> - -
+
+
<%= _('None') %>
+
+
<% end %> <% end %> +
+
diff --git a/app/views/search/_product.rhtml b/app/views/search/_product.rhtml index 662a1e8..79f6ab7 100644 --- a/app/views/search/_product.rhtml +++ b/app/views/search/_product.rhtml @@ -1,10 +1,11 @@ <%# FIXME add more information %>
  • -
    - <%= image_tag(product.image.public_filename(:minor)) if product.image %> + <%= link_to_product product, :class => 'product-pic', :style => 'background-image:url(%s)' % + ( product.image ? product.image.public_filename(:minor) : + '/images/icons-app/product-default-pic-minor.png' ) %> - <%= link_to_product(product) %> + <%= link_to_product product %>
    • <%= _('Price: %d') % product.price %>
    • @@ -13,5 +14,4 @@ <% end %>
    • <%= _('Category: %s') % link_to_category(product.product_category) %>
    -
  • diff --git a/app/views/search/_profile.rhtml b/app/views/search/_profile.rhtml index 7cfb582..928677b 100644 --- a/app/views/search/_profile.rhtml +++ b/app/views/search/_profile.rhtml @@ -1,9 +1,2 @@ <%# FIXME add more information %> -
  • -
    - <%= image_tag(profile.image.public_filename(:minor)) if profile.image %> - - <%= link_to_homepage(profile.name, profile.identifier) %> - -
    -
  • +
  • <%= profile_image_link profile, :portrait %>
  • diff --git a/app/views/search/popup.rhtml b/app/views/search/popup.rhtml index bf51211..d61b360 100644 --- a/app/views/search/popup.rhtml +++ b/app/views/search/popup.rhtml @@ -1,9 +1,14 @@ +
    +

    <%= _('Search %s') % @environment.name %>

    <% form_tag({:action => 'index', :category_path => (@category ? @category.explode_path : [])}, :method => 'get') do%> -
    - <%= text_field_tag('query', '', :size => 50) %> +
    + + <%= text_field_tag 'query', '', :id => 'popup-search-input', :size => 50 %> + <%= javascript_tag '$("popup-search-input").focus()' %> + <%= submit_button(:search, _('Search')) %>
    @@ -21,17 +26,19 @@ <% end %> -

    <%= _('Search for:') %>

    - -
      - <% @search_in.each do |thing, name| %> -
    • - <%= check_box_tag 'find_in[]', thing.to_s, true %> - <%= gettext(name) %> -
    • - <% end %> -
    - +
    +

    <%= _('Search for:') %>

    +
      + <% @search_in.map { |t,n| [t,gettext(n)] } . + sort_by(&:last).each do |thing, name| %> +
    • + <%= check_box_tag 'find_in[]', thing.to_s, true %> + <%= name %> +
    • + <% end %> +
    +
    +
    <% button_bar do %> <%= submit_button(:search, _('Search')) %> @@ -43,3 +50,5 @@ + +
    diff --git a/public/designs/icons/default/gnome-search.png b/public/designs/icons/default/gnome-search.png deleted file mode 100644 index da30400..0000000 Binary files a/public/designs/icons/default/gnome-search.png and /dev/null differ diff --git a/public/designs/icons/default/gtk-find.png b/public/designs/icons/default/gtk-find.png deleted file mode 100644 index 6bfa91b..0000000 Binary files a/public/designs/icons/default/gtk-find.png and /dev/null differ diff --git a/public/designs/icons/default/style.css b/public/designs/icons/default/style.css index 27fe487..74c8962 100644 --- a/public/designs/icons/default/style.css +++ b/public/designs/icons/default/style.css @@ -16,7 +16,7 @@ .icon-add { background-image: url(add-HC.gif) } .icon-up { background-image: url(go-up-HC.gif) } .icon-down { background-image: url(go-down-HC.gif) } -.icon-search { background-image: url(gnome-search.png) } +.icon-search { background-image: url(search-HC.gif) } .icon-ok { background-image: url(ok-HC.gif) } .icon-login { background-image: url(key-HC.gif) } .icon-help { background-image: url(help.gif) } diff --git a/public/designs/themes/default/stylesheets/common.css b/public/designs/themes/default/stylesheets/common.css index c5d9514..bf2026c 100644 --- a/public/designs/themes/default/stylesheets/common.css +++ b/public/designs/themes/default/stylesheets/common.css @@ -152,3 +152,6 @@ div.file-manager-button a:hover { } +#lightbox{ + background: #FFF url(../images/bg-top-cinza.jpg) no-repeat 50% -15px; +} diff --git a/public/designs/themes/default/stylesheets/controller_search.css b/public/designs/themes/default/stylesheets/controller_search.css new file mode 100644 index 0000000..4926c1d --- /dev/null +++ b/public/designs/themes/default/stylesheets/controller_search.css @@ -0,0 +1,32 @@ + +.search-results-innerbox { + border: none; + background: #B8CFE7; + -moz-border-radius: 15px; +} + +.search-results-type-article a, +.search-results-type-product a { + text-decoration: none; +} +.search-results-type-article a:hover, +.search-results-type-product a:hover { + text-decoration: underline; +} + +.search-results-type-product li li a { + color: #204A87; +} + +#search-results .common-profile-list-block li a { + border: 2px solid #B8CFE7; +} +#search-results .common-profile-list-block li a:hover { + border: 2px solid #2A5896; + background: #CFDFF7; +} + +.search-results-type-empty div { + color: #729FCF; +} + diff --git a/public/images/icons-app/gnome-home_size-minor.png b/public/images/icons-app/gnome-home_size-minor.png new file mode 100644 index 0000000..cbdedd6 Binary files /dev/null and b/public/images/icons-app/gnome-home_size-minor.png differ diff --git a/public/images/icons-app/product-default-pic-minor.png b/public/images/icons-app/product-default-pic-minor.png new file mode 100644 index 0000000..7abfc60 Binary files /dev/null and b/public/images/icons-app/product-default-pic-minor.png differ diff --git a/public/images/icons-app/users_size-minor.png b/public/images/icons-app/users_size-minor.png new file mode 100644 index 0000000..0ed3766 Binary files /dev/null and b/public/images/icons-app/users_size-minor.png differ diff --git a/public/stylesheets/common.css b/public/stylesheets/common.css index ea97a4d..0f6fb62 100644 --- a/public/stylesheets/common.css +++ b/public/stylesheets/common.css @@ -330,3 +330,4 @@ div.pending-tasks { padding: 2px; margin: 1em; } + diff --git a/public/stylesheets/controller_search.css b/public/stylesheets/controller_search.css new file mode 100644 index 0000000..4f34d9e --- /dev/null +++ b/public/stylesheets/controller_search.css @@ -0,0 +1,100 @@ +#search-results { + /* none by default, but... Who knows the future? :-) */ +} + +#search-results h3 { + margin: 20px 0px 0px 20px; +} + +.search-results-box { + float: left; + width: 49%; +} + +.only-one-result-box .search-results-box { + width: 100%; +} + +.search-results-box.odd { + margin-left: 1%; +} + +.search-results-innerbox { + border: 1px solid #2A5896; + padding: 10px 0px 10px 10px; + height: 205px; + overflow: auto; +} + +.search-results-innerbox.common-profile-list-block { + padding: 10px 0px 0px 10px; + height: 215px; +} + +.only-one-result-box .search-results-innerbox, +.only-one-result-box .search-results-innerbox.common-profile-list-block { + height: auto; + padding: 10px 4px 10px 10px; +} + +#content .search-results-type-article ul, +#content .search-results-type-article li { + margin: 0px; + padding: 0px; + list-style: none; +} +#content .search-results-type-article li { + padding: 2px 0px 4px 0px; +} + +.search-results-type-article .item_meta { + font-size: 10px; + color: #888; +} + +#content .search-results-type-product ul, +#content .search-results-type-product li { + margin: 0px; + padding: 0px; + list-style: none; + font-size: 10px; +} +#content .search-results-type-product li strong { + display: block; + margin-left: 55px; + font-size: 12px; +} + +#content .search-results-type-product li { + padding-bottom: 10px; +} +#content .search-results-type-product li li { + padding-bottom: 0px; +} + +.product-pic { + display: block; + float: left; + width: 50px; + height: 50px; + background-repeat: no-repeat; + background-position: 50% 50%; + position: relative; + top: 5px; +} +.product-pic span { + display: none; +} + +#content .search-results-type-product ul ul { + margin-left: 55px; +} + +.search-results-type-empty div { + text-align: center; + color: #DDD; + font-weight: bold; + font-size: 30px; + padding: 70px 10px 0px 0px; +} + diff --git a/public/stylesheets/lightbox.css b/public/stylesheets/lightbox.css index f3812d9..5d074f7 100644 --- a/public/stylesheets/lightbox.css +++ b/public/stylesheets/lightbox.css @@ -18,7 +18,6 @@ Modified : February 1, 2006 width: 500px; margin: -200px 0 0 -250px; border: 10px solid #000; - background: #FFF url(../images/bg-top-cinza.jpg) no-repeat 50% -15px; text-align: left; padding: 1em; } diff --git a/public/stylesheets/search.css b/public/stylesheets/search.css index 5a187c2..a1a99b8 100644 --- a/public/stylesheets/search.css +++ b/public/stylesheets/search.css @@ -13,6 +13,52 @@ margin-top: 1em; } -#search-field input[type=text] { - border: 1px solid black; +/***** search-popup ***************************/ + +#search-popup h2 { + color: #2A5896; + font-size: 20px; +} +#search-popup h3 { + color: #2A5896; + font-size: 16px; +} + +#search-popup .search-field { + text-align: center; +} + +#search-popup .search-options ul, +#search-popup .search-options li { + margin: 0px; + padding: 0px; + list-style: none; +} +#search-popup .search-options ul { + clear: left; +} + +#search-popup .search-options { + border: 1px solid #2A5896; + padding: 0px 0px 5px 20px; + margin-top: 20px; +} + +#search-popup .search-options h3 { + float: left; + margin: -10px 0px 0px 0px; + background: #FFF; + padding: 0px 5px; +} + +#search-popup .search-options li { + float: left; + width: 33%; + padding: 2px 0px; +} + +#search-popup .button-bar { + clear: left; + padding-top: 0px; } + -- libgit2 0.21.2