From 7928b30e866f423c6f99532c3616adef5b387e0d Mon Sep 17 00:00:00 2001 From: AurelioAHeckert Date: Sun, 13 Jul 2008 18:46:02 +0000 Subject: [PATCH] ActionItem527: less space for sellers search box --- app/helpers/forms_helper.rb | 44 ++++++++++++++++++++++++++++++++++++-------- app/views/search/_product_categories_menu.rhtml | 23 ++++++++++++++++------- app/views/search/_sellers_form.rhtml | 2 +- app/views/search/cities.rhtml | 2 +- db/schema.rb | 21 ++++++++++++++++++++- public/stylesheets/blocks/sellers-search-block.css | 33 +++++++++++++++++++++++++-------- public/stylesheets/controller_search.css | 9 +++++++++ 7 files changed, 108 insertions(+), 26 deletions(-) diff --git a/app/helpers/forms_helper.rb b/app/helpers/forms_helper.rb index 4025070..81cb2d1 100644 --- a/app/helpers/forms_helper.rb +++ b/app/helpers/forms_helper.rb @@ -53,18 +53,46 @@ module FormsHelper javascript_tag('new Autocompleter.Local(%s, %s, %s)' % [ id.to_json, "autocomplete-for-#{id}".to_json, choices.to_json ] ) end - def select_city + def select_city( simple=false ) states = State.find(:all, :order => 'name') - states = [State.new(:name => '---')] + states - cities = [City.new(:name => '---')] - + state_id = 'state-' + FormsHelper.next_id_number city_id = 'city-' + FormsHelper.next_id_number - content_tag('div', labelled_select(_('State:'), 'state', :id, :name, nil, states, :id => state_id), :class => 'select_state_for_origin' ) + - content_tag('div', labelled_select(_('City:'), 'city', :id, :name, nil, cities, :id => city_id), :class => 'select_city_for_origin' ) + - - observe_field(state_id, :update => city_id, :function => "new Ajax.Updater(#{city_id.inspect}, #{url_for(:controller => 'search', :action => 'cities').inspect}, {asynchronous:true, evalScripts:true, parameters:'state_id=' + value}); $(#{city_id.inspect}).innerHTML = ''", :with => 'state_id') + if simple + states = [State.new(:name => _('Select the State'))] + states + cities = [City.new(:name => _('Select the City'))] + + html_state = + content_tag( 'div', + select_tag( 'state', + options_from_collection_for_select( states, :id, :name, nil), + :id => state_id ), + :class => 'select_state_for_origin' ) + html_city = + content_tag( 'div', + select_tag( 'city', + options_from_collection_for_select( cities, :id, :name, nil), + :id => city_id ), + :class => 'select_city_for_origin' ) + html_state[' '---')] + states + cities = [City.new(:name => '---')] + + html = + content_tag( 'div', + labelled_select( _('State:'), 'state', :id, :name, nil, states, :id => state_id ), + :class => 'select_state_for_origin' ) + + content_tag( 'div', + labelled_select( _('City:'), 'city', :id, :name, nil, cities, :id => city_id ), + :class => 'select_city_for_origin' ) + end + + html + + observe_field( state_id, :update => city_id, :function => "new Ajax.Updater(#{city_id.inspect}, #{url_for(:controller => 'search', :action => 'cities').inspect}, {asynchronous:true, evalScripts:true, parameters:'state_id=' + value}); $(#{city_id.inspect}).innerHTML = ''", :with => 'state_id') end protected diff --git a/app/views/search/_product_categories_menu.rhtml b/app/views/search/_product_categories_menu.rhtml index c50cd10..f6c4179 100644 --- a/app/views/search/_product_categories_menu.rhtml +++ b/app/views/search/_product_categories_menu.rhtml @@ -90,13 +90,22 @@ function prodCatMenuOut( li ) { } } -$$("#product-categories-menu ul div").each( function(subMenu){ - var li = subMenu.parentNode; - subMenu.li = li; - li.subMenu = subMenu; - li.subMenu.style.display = "none"; - li.closed = true; -}) +if ( document.all ) { + + function prodCatMenuOver( li ) { li.className = "cat-parent sub-opened" } + function prodCatMenuOut( li ) { li.className = "cat-parent sub-closed" } + +} else { + + $$("#product-categories-menu ul div").each( function(subMenu){ + var li = subMenu.parentNode; + subMenu.li = li; + li.subMenu = subMenu; + li.subMenu.style.display = "none"; + li.closed = true; + }) + +} diff --git a/app/views/search/_sellers_form.rhtml b/app/views/search/_sellers_form.rhtml index 77bb69d..f7f7da3 100644 --- a/app/views/search/_sellers_form.rhtml +++ b/app/views/search/_sellers_form.rhtml @@ -10,7 +10,7 @@
- <%= select_city %> + <%= select_city(true) %>
diff --git a/app/views/search/cities.rhtml b/app/views/search/cities.rhtml index a6bf7f0..f34cd1b 100644 --- a/app/views/search/cities.rhtml +++ b/app/views/search/cities.rhtml @@ -3,5 +3,5 @@ <% end %> <% else %> - + <% end%> diff --git a/db/schema.rb b/db/schema.rb index 9c1926e..f2becea 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -9,7 +9,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 43) do +ActiveRecord::Schema.define(:version => 46) do create_table "article_versions", :force => true do |t| t.integer "article_id" @@ -82,12 +82,16 @@ ActiveRecord::Schema.define(:version => 43) do t.integer "position" end + add_index "blocks", ["box_id"], :name => "index_blocks_on_box_id" + create_table "boxes", :force => true do |t| t.string "owner_type" t.integer "owner_id" t.integer "position" end + add_index "boxes", ["owner_type", "owner_id"], :name => "index_boxes_on_owner_type_and_owner_id" + create_table "categories", :force => true do |t| t.string "name" t.string "slug" @@ -165,6 +169,17 @@ ActiveRecord::Schema.define(:version => 43) do t.integer "height" end + create_table "product_categorizations", :force => true do |t| + t.integer "category_id" + t.integer "product_id" + t.boolean "virtual", :default => false + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "product_categorizations", ["category_id"], :name => "index_product_categorizations_on_category_id" + add_index "product_categorizations", ["product_id"], :name => "index_product_categorizations_on_product_id" + create_table "products", :force => true do |t| t.integer "enterprise_id" t.integer "product_category_id" @@ -178,6 +193,8 @@ ActiveRecord::Schema.define(:version => 43) do t.float "lng" end + add_index "products", ["enterprise_id"], :name => "index_products_on_enterprise_id" + create_table "profiles", :force => true do |t| t.string "name" t.string "type" @@ -197,6 +214,8 @@ ActiveRecord::Schema.define(:version => 43) do t.boolean "enabled", :default => true end + add_index "profiles", ["environment_id"], :name => "index_profiles_on_environment_id" + create_table "region_validators", :id => false, :force => true do |t| t.integer "region_id" t.integer "organization_id" diff --git a/public/stylesheets/blocks/sellers-search-block.css b/public/stylesheets/blocks/sellers-search-block.css index 2da876d..70970cc 100644 --- a/public/stylesheets/blocks/sellers-search-block.css +++ b/public/stylesheets/blocks/sellers-search-block.css @@ -18,7 +18,7 @@ } .sellers-search-block .search-in-opt { - padding-left: 40px; + padding-left: 5px; } .sellers-search-block .search-in-opt dir { @@ -26,21 +26,38 @@ padding-left: 20px; } -.sellers-search-block .formfield { - text-align: right; - padding: 0px 10px 5px 0px; - font-size: 11px; -} - .sellers-search-block .formfield input { width: 120px; } +.sellers-search-block .search-from-opt { + padding: 0px 10px 5px 10px; +} + .sellers-search-block select { - width: 160px; font-size: 11px; } +.sellers-search-block .search-from-opt select { + width: 100%; +} + +.sellers-search-block .search-from-opt select, +.sellers-search-block .search-from-opt option.first-option { + font-weight: bold; + text-align: center; +} +.sellers-search-block .search-from-opt option { + font-weight: normal; + text-align: left; +} + +.sellers-search-block .search-distance-opt { + text-align: right; + font-size: 11px; + padding: 0px 10px 5px 0px; +} + .sellers-search-block .button-bar { text-align: right; padding: 0px 10px 0px 0px; diff --git a/public/stylesheets/controller_search.css b/public/stylesheets/controller_search.css index 4420f18..ef9a336 100644 --- a/public/stylesheets/controller_search.css +++ b/public/stylesheets/controller_search.css @@ -56,6 +56,9 @@ #product-categories-menu a { display: block; } +.msie6 #product-categories-menu a { + display: inline; +} #product-categories-menu div { position: relative; @@ -67,6 +70,10 @@ padding: 0px; } +#product-categories-menu small { + font-size: 75%; +} + #product-categories-menu .cat-parent { position: relative; font-weight: bold; @@ -82,6 +89,8 @@ #product-categories-menu .cat-parent ul { padding-bottom: 5px; + font-weight: normal; + font-size: 12px; } #product-categories-menu .cat-parent li, -- libgit2 0.21.2