Commit 7928b30e866f423c6f99532c3616adef5b387e0d

Authored by AurelioAHeckert
1 parent 4e87412c

ActionItem527: less space for sellers search box

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2251 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/helpers/forms_helper.rb
... ... @@ -53,18 +53,46 @@ module FormsHelper
53 53 javascript_tag('new Autocompleter.Local(%s, %s, %s)' % [ id.to_json, "autocomplete-for-#{id}".to_json, choices.to_json ] )
54 54 end
55 55  
56   - def select_city
  56 + def select_city( simple=false )
57 57 states = State.find(:all, :order => 'name')
58   - states = [State.new(:name => '---')] + states
59   - cities = [City.new(:name => '---')]
60   -
  58 +
61 59 state_id = 'state-' + FormsHelper.next_id_number
62 60 city_id = 'city-' + FormsHelper.next_id_number
63 61  
64   - content_tag('div', labelled_select(_('State:'), 'state', :id, :name, nil, states, :id => state_id), :class => 'select_state_for_origin' ) +
65   - content_tag('div', labelled_select(_('City:'), 'city', :id, :name, nil, cities, :id => city_id), :class => 'select_city_for_origin' ) +
66   -
67   - 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 = '<option>#{_('Loading...')}</option>'", :with => 'state_id')
  62 + if simple
  63 + states = [State.new(:name => _('Select the State'))] + states
  64 + cities = [City.new(:name => _('Select the City'))]
  65 +
  66 + html_state =
  67 + content_tag( 'div',
  68 + select_tag( 'state',
  69 + options_from_collection_for_select( states, :id, :name, nil),
  70 + :id => state_id ),
  71 + :class => 'select_state_for_origin' )
  72 + html_city =
  73 + content_tag( 'div',
  74 + select_tag( 'city',
  75 + options_from_collection_for_select( cities, :id, :name, nil),
  76 + :id => city_id ),
  77 + :class => 'select_city_for_origin' )
  78 + html_state['<option'] = '<option class="first-option"'
  79 + html_city['<option'] = '<option class="first-option"'
  80 + html = html_state + html_city
  81 + else
  82 + states = [State.new(:name => '---')] + states
  83 + cities = [City.new(:name => '---')]
  84 +
  85 + html =
  86 + content_tag( 'div',
  87 + labelled_select( _('State:'), 'state', :id, :name, nil, states, :id => state_id ),
  88 + :class => 'select_state_for_origin' ) +
  89 + content_tag( 'div',
  90 + labelled_select( _('City:'), 'city', :id, :name, nil, cities, :id => city_id ),
  91 + :class => 'select_city_for_origin' )
  92 + end
  93 +
  94 + html +
  95 + 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 = '<option>#{_('Loading...')}</option>'", :with => 'state_id')
68 96 end
69 97  
70 98 protected
... ...
app/views/search/_product_categories_menu.rhtml
... ... @@ -90,13 +90,22 @@ function prodCatMenuOut( li ) {
90 90 }
91 91 }
92 92  
93   -$$("#product-categories-menu ul div").each( function(subMenu){
94   - var li = subMenu.parentNode;
95   - subMenu.li = li;
96   - li.subMenu = subMenu;
97   - li.subMenu.style.display = "none";
98   - li.closed = true;
99   -})
  93 +if ( document.all ) {
  94 +
  95 + function prodCatMenuOver( li ) { li.className = "cat-parent sub-opened" }
  96 + function prodCatMenuOut( li ) { li.className = "cat-parent sub-closed" }
  97 +
  98 +} else {
  99 +
  100 + $$("#product-categories-menu ul div").each( function(subMenu){
  101 + var li = subMenu.parentNode;
  102 + subMenu.li = li;
  103 + li.subMenu = subMenu;
  104 + li.subMenu.style.display = "none";
  105 + li.closed = true;
  106 + })
  107 +
  108 +}
100 109  
101 110 </script>
102 111  
... ...
app/views/search/_sellers_form.rhtml
... ... @@ -10,7 +10,7 @@
10 10 </div>
11 11  
12 12 <div class="formfield search-from-opt">
13   - <%= select_city %>
  13 + <%= select_city(true) %>
14 14 </div>
15 15  
16 16 <div class="formfield search-distance-opt">
... ...
app/views/search/cities.rhtml
... ... @@ -3,5 +3,5 @@
3 3 <option value=<%= city.id.to_s.inspect %>><%= city.name %></option>
4 4 <% end %>
5 5 <% else %>
6   - <option value=''>---</option>
  6 + <option value=''><%= _('No City') %></option>
7 7 <% end%>
... ...
db/schema.rb
... ... @@ -9,7 +9,7 @@
9 9 #
10 10 # It's strongly recommended to check this file into your version control system.
11 11  
12   -ActiveRecord::Schema.define(:version => 43) do
  12 +ActiveRecord::Schema.define(:version => 46) do
13 13  
14 14 create_table "article_versions", :force => true do |t|
15 15 t.integer "article_id"
... ... @@ -82,12 +82,16 @@ ActiveRecord::Schema.define(:version =&gt; 43) do
82 82 t.integer "position"
83 83 end
84 84  
  85 + add_index "blocks", ["box_id"], :name => "index_blocks_on_box_id"
  86 +
85 87 create_table "boxes", :force => true do |t|
86 88 t.string "owner_type"
87 89 t.integer "owner_id"
88 90 t.integer "position"
89 91 end
90 92  
  93 + add_index "boxes", ["owner_type", "owner_id"], :name => "index_boxes_on_owner_type_and_owner_id"
  94 +
91 95 create_table "categories", :force => true do |t|
92 96 t.string "name"
93 97 t.string "slug"
... ... @@ -165,6 +169,17 @@ ActiveRecord::Schema.define(:version =&gt; 43) do
165 169 t.integer "height"
166 170 end
167 171  
  172 + create_table "product_categorizations", :force => true do |t|
  173 + t.integer "category_id"
  174 + t.integer "product_id"
  175 + t.boolean "virtual", :default => false
  176 + t.datetime "created_at"
  177 + t.datetime "updated_at"
  178 + end
  179 +
  180 + add_index "product_categorizations", ["category_id"], :name => "index_product_categorizations_on_category_id"
  181 + add_index "product_categorizations", ["product_id"], :name => "index_product_categorizations_on_product_id"
  182 +
168 183 create_table "products", :force => true do |t|
169 184 t.integer "enterprise_id"
170 185 t.integer "product_category_id"
... ... @@ -178,6 +193,8 @@ ActiveRecord::Schema.define(:version =&gt; 43) do
178 193 t.float "lng"
179 194 end
180 195  
  196 + add_index "products", ["enterprise_id"], :name => "index_products_on_enterprise_id"
  197 +
181 198 create_table "profiles", :force => true do |t|
182 199 t.string "name"
183 200 t.string "type"
... ... @@ -197,6 +214,8 @@ ActiveRecord::Schema.define(:version =&gt; 43) do
197 214 t.boolean "enabled", :default => true
198 215 end
199 216  
  217 + add_index "profiles", ["environment_id"], :name => "index_profiles_on_environment_id"
  218 +
200 219 create_table "region_validators", :id => false, :force => true do |t|
201 220 t.integer "region_id"
202 221 t.integer "organization_id"
... ...
public/stylesheets/blocks/sellers-search-block.css
... ... @@ -18,7 +18,7 @@
18 18 }
19 19  
20 20 .sellers-search-block .search-in-opt {
21   - padding-left: 40px;
  21 + padding-left: 5px;
22 22 }
23 23  
24 24 .sellers-search-block .search-in-opt dir {
... ... @@ -26,21 +26,38 @@
26 26 padding-left: 20px;
27 27 }
28 28  
29   -.sellers-search-block .formfield {
30   - text-align: right;
31   - padding: 0px 10px 5px 0px;
32   - font-size: 11px;
33   -}
34   -
35 29 .sellers-search-block .formfield input {
36 30 width: 120px;
37 31 }
38 32  
  33 +.sellers-search-block .search-from-opt {
  34 + padding: 0px 10px 5px 10px;
  35 +}
  36 +
39 37 .sellers-search-block select {
40   - width: 160px;
41 38 font-size: 11px;
42 39 }
43 40  
  41 +.sellers-search-block .search-from-opt select {
  42 + width: 100%;
  43 +}
  44 +
  45 +.sellers-search-block .search-from-opt select,
  46 +.sellers-search-block .search-from-opt option.first-option {
  47 + font-weight: bold;
  48 + text-align: center;
  49 +}
  50 +.sellers-search-block .search-from-opt option {
  51 + font-weight: normal;
  52 + text-align: left;
  53 +}
  54 +
  55 +.sellers-search-block .search-distance-opt {
  56 + text-align: right;
  57 + font-size: 11px;
  58 + padding: 0px 10px 5px 0px;
  59 +}
  60 +
44 61 .sellers-search-block .button-bar {
45 62 text-align: right;
46 63 padding: 0px 10px 0px 0px;
... ...
public/stylesheets/controller_search.css
... ... @@ -56,6 +56,9 @@
56 56 #product-categories-menu a {
57 57 display: block;
58 58 }
  59 +.msie6 #product-categories-menu a {
  60 + display: inline;
  61 +}
59 62  
60 63 #product-categories-menu div {
61 64 position: relative;
... ... @@ -67,6 +70,10 @@
67 70 padding: 0px;
68 71 }
69 72  
  73 +#product-categories-menu small {
  74 + font-size: 75%;
  75 +}
  76 +
70 77 #product-categories-menu .cat-parent {
71 78 position: relative;
72 79 font-weight: bold;
... ... @@ -82,6 +89,8 @@
82 89  
83 90 #product-categories-menu .cat-parent ul {
84 91 padding-bottom: 5px;
  92 + font-weight: normal;
  93 + font-size: 12px;
85 94 }
86 95  
87 96 #product-categories-menu .cat-parent li,
... ...