Commit dd6b5db71bb4b056982ebd1ab4e3e171504e291b

Authored by AurelioAHeckert
1 parent 4659d272

ActionItem260: Search formatation apear ok now. May be better, but this is ok.

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1709 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/helpers/forms_helper.rb
... ... @@ -10,4 +10,16 @@ module FormsHelper
10 10  
11 11 end
12 12  
  13 + def labelled_radio_button( human_name, name, value, checked = false, options = {} )
  14 + options[:id] ||= 'radio-' + rand.to_s
  15 + radio_button_tag( name, value, checked, options ) +
  16 + content_tag( 'label', human_name, :for => options[:id] )
  17 + end
  18 +
  19 + def labelled_check_box( human_name, name, value = "1", checked = false, options = {} )
  20 + options[:id] ||= 'checkbox-' + rand.to_s
  21 + check_box_tag( name, value, checked, options ) +
  22 + content_tag( 'label', human_name, :for => options[:id] )
  23 + end
  24 +
13 25 end
... ...
app/views/consumed_products/new.rhtml
... ... @@ -3,8 +3,14 @@
3 3 <%= error_messages_for :consumption %>
4 4  
5 5 <% form_for :consumption, @consumption do |f| %>
6   - <p> <%= _('Product:') %> <%= f.select "product_category_id", ProductCategory.find(:all).map{|pc| [pc.name, pc.id]} %></p>
7   - <p> <%= _('Aditional specifications:') %><br> <%= f.text_area "aditional_specifications" %> </p>
  6 + <p>
  7 + <%= _('Product:') %>
  8 + <span class="formfield"> <%= f.select "product_category_id", ProductCategory.find(:all).map{|pc| [pc.name, pc.id]} %> </span>
  9 + </p>
  10 + <p>
  11 + <%= _('Aditional specifications:') %> <br />
  12 + <span class="formfield"> <%= f.text_area "aditional_specifications", :rows => 5 %> </span>
  13 + </p>
8 14 <% button_bar do %>
9 15 <%= submit_button('add', _('Add product'), :cancel => {:action => 'index'}) %>
10 16 <% end %>
... ...
app/views/layouts/application.rhtml
... ... @@ -127,21 +127,23 @@
127 127 <% end %>
128 128  
129 129 </div><!-- id="content" -->
130   - <div id="footer_content"><!-- Rodape do onteudo -->
  130 + <div id="footer_content"><!-- Rodape do Conteudo -->
131 131 </div><!-- id="footer_content" -->
132 132 </div><!-- id="frame" -->
133 133 </div><!-- id="wrap" -->
134 134  
135 135 <div id="footer">
136   - Um projeto do FBES <br/>
137   - F&oacute;rum Brasileiro de Economia Solid&aacute;ria
138   - <p/>
  136 + <a href="http://fbes.org.br" id="footer-esq">
  137 + <%= _('A FBES project') %> <br/>
  138 + F&oacute;rum Brasileiro de Economia Solid&aacute;ria
  139 + </a>
  140 + <a href="http://colivre.coop.br" id="footer-dir">
  141 + <%= _('Desenvolvimento Colivre') %> <br/>
  142 + Cooperativa de Tecnologias Livres
  143 + </a>
139 144 <%= language_chooser %>
140 145 <p/>
141 146 <%= footer %>
142   - <p/>
143   - Desenvolvimento Colivre <br/>
144   - Cooperativa de Tecnologias Livres
145 147 </div><!-- id="footer" -->
146 148  
147 149 <div id="helpBox" style="display:none">
... ...
app/views/search/_category.rhtml
... ... @@ -15,27 +15,7 @@
15 15 <div class="category-innerbox">
16 16 <ul class="recent_on_cat recent_comments">
17 17 <% @recent_comments.each do |comment| %>
18   - <li>
19   - <% if comment.author %>
20   - <%= link_to content_tag( 'span', comment.author.name() ), comment.author.url,
21   - :class => 'comment-picture',
22   - :style => 'background-image:url(%s)' % profile_icon(comment.author, :icon)
23   - %>
24   - <% else %>
25   - <%# unauthenticated user: display gravatar icon %>
26   - <%= content_tag 'span', '&nbsp;',
27   - :class => 'comment-picture',
28   - :style => 'background-image:url(%s)' % str_gravatar_url_for( comment.email, :size => 20 )
29   - %>
30   - <% end %>
31   - <strong><%= link_to(comment.title, comment.url) %></strong>
32   - <div class="item_meta">
33   - <%= _('by %{author} on "%{article}"') % {
34   - :comment => link_to(comment.title, comment.url),
35   - :article => link_to(comment.article.title, comment.article.url),
36   - :author => comment.author_name } %>
37   - </div>
38   - </li>
  18 + <%= render :partial => 'comment', :object => comment %>
39 19 <% end %>
40 20 </ul>
41 21 </div><!-- end class="category-innerbox" -->
... ...
app/views/search/_comment.rhtml
1 1 <li>
2   - <strong><%= link_to(comment.title, comment.url)%></strong>
  2 + <%- if comment.author -%>
  3 + <%= link_to content_tag( 'span', comment.author.name() ), comment.author.url,
  4 + :class => 'comment-picture',
  5 + :style => 'background-image:url(%s)' % profile_icon(comment.author, :icon)
  6 + %>
  7 + <%- else -%>
  8 + <%# unauthenticated user: display gravatar icon %>
  9 + <%= content_tag 'span', '&nbsp;',
  10 + :class => 'comment-picture',
  11 + :style => 'background-image:url(%s)' % str_gravatar_url_for( comment.email, :size => 20 )
  12 + %>
  13 + <%- end %>
  14 + <strong><%= link_to(comment.title, comment.url) %></strong>
3 15 <div class="item_meta">
4   - <span class="cat_item_by"><%= _('by %s, on "%s"') % [comment.author_name, link_to(comment.article.name, comment.article.url)] %></span>
  16 + <%= _('by %{author} on "%{article}"') % {
  17 + :comment => link_to(comment.title, comment.url),
  18 + :article => link_to(comment.article.title, comment.article.url),
  19 + :author => comment.author_name } %>
5 20 </div>
6 21 </li>
7 22  
... ...
app/views/search/_display_results.rhtml
1   -<%= render :partial => 'search_form' %>
2   -
3   -<div>
4   -<%= link_to _('Search for "%s" in the whole site') % @query, :controller => 'search', :action => 'index', :category_path => [], :query => @query if @category %>
5   -</div>
6   -
7   -
8 1 <div id="search-results" class="<%= 'only-one-result-box' if @results.size == 1 %>">
9   -<% pos = :odd %>
10   -<% @results.each do |name,results| %>
  2 +<%
  3 + pos2 = :odd # allow to format in a two colons layout
  4 + pos3 = 3 # allow to format in a thre colons layout
  5 +%>
  6 +<% @results.sort_by { |name,results| @names[name] }.each do |name,results| %>
  7 + <%
  8 + pos3 += 1; pos3 = 1 if pos3 > 3
  9 + pos2==:odd ? pos2=:even : pos2=:odd
  10 + %>
11 11 <% if !results.nil? and !results.empty? %>
12   - <div class="search-results-<%= name %> search-results-box <%= pos==:odd ? pos=:even : pos=:odd %>">
  12 + <div class="search-results-<%= name %> search-results-box <%= pos2 %> <%= 'col%s_of3' % pos3.to_s %>">
13 13 <% if @controller.action_name != 'assets' %>
14 14 <h3><%= @names[name] %></h3>
15 15 <% end %>
... ... @@ -23,7 +23,7 @@
23 23 </div><!-- end class="search-results-innerbox" -->
24 24 </div><!-- end class="search-results-<%= name %>" -->
25 25 <% else %>
26   - <div class="search-results-<%= name %> search-results-empty search-results-box <%= pos==:odd ? pos=:even : pos=:odd %>">
  26 + <div class="search-results-<%= name %> search-results-empty search-results-box <%= pos2 %> <%= 'col%s_of3' % pos3.to_s %>">
27 27 <% if @controller.action_name != 'assets' %>
28 28 <h3><%= @names[name] %></h3>
29 29 <% end %>
... ... @@ -35,3 +35,4 @@
35 35 <% end %>
36 36 <br style="clear:both" />
37 37 </div><!-- end id="search-results" -->
  38 +
... ...
app/views/search/_search_form.rhtml
1   -<% form_tag({:action => 'index', :category_path => (@category ? @category.explode_path : [])}, :method => 'get') do%>
  1 +<% form_tag( { :action => 'index', :category_path => ( @category ? @category.explode_path : [] ) },
  2 + :method => 'get', :class => 'search_form' ) do %>
  3 + <%= '<h3>%s</h3>' % form_title if defined? form_title %>
2 4  
3 5 <div class="search-field">
4 6 <span class="formfield">
... ... @@ -9,36 +11,30 @@
9 11 </div>
10 12  
11 13 <% if @category %>
12   - <h3><%= _('Search in:') %></h3>
  14 + <div class="search-options search-in">
  15 + <h4><%= _('Search in:') %></h4>
13 16 <ul>
14   - <li>
15   - <%= radio_button_tag :search_whole_site, 'no', true %>
16   - <span><%= _('Only in %{category}') % { :category => @category.full_name } %></span>
17   - </li>
18   - <li>
19   - <%= radio_button_tag :search_whole_site, 'yes' %>
20   - <span><%= _('Whole site') %></span>
21   - </li>
  17 + <li><%= labelled_radio_button _('Only in %s') % @category.full_name(' &rarr; '), :search_whole_site, 'no', true %></li>
  18 + <li><%= labelled_radio_button _('Whole site'), :search_whole_site, 'yes' %></li>
22 19 </ul>
  20 + </div><!-- fim class="search-options" -->
23 21 <% end %>
24 22  
25   - <div class="search-options">
26   - <h3><%= _('Search for:') %></h3>
  23 + <div class="search-options search-for">
  24 + <h4><%= _('Search for:') %></h4>
27 25 <ul>
28 26 <% @search_in.map { |t,n| [t,gettext(n)] } .
29 27 sort_by(&:last).each do |thing, name| %>
30 28 <li>
31   - <%= check_box_tag 'find_in[]', thing.to_s, true %>
32   - <span><%= name %></span>
  29 + <%= labelled_check_box name, 'find_in[]', thing.to_s, true %>
33 30 </li>
34 31 <% end %>
35 32 </ul>
36 33 <br style="clear:both" />
37 34 </div><!-- fim class="search-options" -->
38 35  
39   - <% button_bar do %>
40   - <%= submit_button(:search, _('Search')) %>
41   - <%= lightbox_close_button(_('Close')) if lightbox? %>
42   - <% end %>
  36 + <% if lightbox?; button_bar do %>
  37 + <%= lightbox_close_button _('Close') %>
  38 + <% end; end %>
43 39  
44 40 <% end %>
... ...
app/views/search/index.rhtml
1   -<h2> <%=h @category ? (_('Search results for "%{query}" in "%{category}"') % { :query => @query, :category => @category.name}) : (_('Search results for "%s"') % @query) %> </h2>
  1 +<h1> <%=h @category ? (_('Search results for "%{query}" in "%{category}"') % { :query => @query, :category => @category.name}) : (_('Search results for "%s"') % @query) %> </h1>
2 2  
3 3 <%= render :partial => 'display_results' %>
4 4  
  5 +<%= render :partial => 'search_form', :locals => { :form_title => _("Filter your search") } %>
  6 +<br style="clear:both" />
  7 +
... ...
app/views/search/popup.rhtml
1 1 <div id="search-popup">
2 2  
3   -<h2><%= _('Search %s') % @environment.name %></h2>
4   -
5   -<%= render :partial => 'search_form' %>
  3 +<%= render :partial => 'search_form', :locals => { :form_title => _('Search %s') % @environment.name } %>
6 4  
7 5 <script type='text/javascript'>
8 6 $('query').focus();
... ...
app/views/shared/categories_menu.rhtml
... ... @@ -6,7 +6,7 @@
6 6 <ul>
7 7 <% item.all_children.each do |child| %>
8 8 <% if (@controller.controller_name == 'search') && (@controller.action_name == 'assets') %>
9   - <li><%=h link_to(content_tag('span', child.name), :controller => 'search', :action => 'assets', :asset => params[:asset], :category_path => child.explode_path) %></li>
  9 + <li><%= link_to(content_tag('span', child.name), :controller => 'search', :action => 'assets', :asset => params[:asset], :category_path => child.explode_path) %></li>
10 10 <% else %>
11 11 <li><%= link_to(content_tag('span', child.name), :controller => 'search', :action => 'category_index', :category_path => child.explode_path) %></li>
12 12 <% end %>
... ...
doc/README_FOR_APP
... ... @@ -49,6 +49,8 @@ commands and make sure you understand what you are doing):
49 49 rake makemo
50 50 # create some test data:
51 51 ./script/populate
  52 + # install the test dependences:
  53 + aptitude install libtidy-ruby libhpricot-ruby
52 54 # run the automated test suite to make sure your environment is sane:
53 55 rake test
54 56  
... ...
public/designs/themes/default/stylesheets/controller_search.css
1 1  
  2 +#view-category,
  3 +#search-results {
  4 + padding: 0% 2% 10px 2%;
  5 +}
  6 +
  7 +#view-category a,
  8 +#search-results a {
  9 + text-decoration: none;
  10 +}
  11 +#view-category a:hover,
  12 +#search-results .search-results-type-comment a:hover,
  13 +#search-results .search-results-type-article a:hover,
  14 +#search-results .search-results-type-product a:hover {
  15 + text-decoration: underline;
  16 +}
  17 +
  18 +#content .search_form {
  19 + margin: 0px;
  20 + padding: 0% 10%;
  21 +}
  22 +
  23 +body.category1 .search-options {
  24 + border: 1px solid #E26B00;
  25 +}
  26 +body.category2 .search-options {
  27 + border: 1px solid #58A80A;
  28 +}
  29 +body.category3 .search-options {
  30 + border: 1px solid #694371;
  31 +}
  32 +body.category4 .search-options {
  33 + border: 1px solid #B80000;
  34 +}
  35 +
  36 +.search-results-box {
  37 + width: 32.5%;
  38 +}
  39 +
  40 +.search-results-box.odd {
  41 + margin-left: 0px;
  42 +}
  43 +
  44 +.search-results-box.col2_of3,
  45 +.search-results-box.col3_of3 {
  46 + margin-left: 1.25%;
  47 +}
  48 +
2 49 .category-innerbox,
3 50 .search-results-innerbox {
4 51 padding: 10px 0px 10px 10px;
... ... @@ -7,14 +54,17 @@
7 54 background: #B8CFE7;
8 55 -moz-border-radius: 15px;
9 56 }
10   -
11   -.search-results-type-article a,
12   -.search-results-type-product a {
13   - text-decoration: none;
  57 +body.category1 .search-results-innerbox {
  58 + background: #FDD79E;
14 59 }
15   -.search-results-type-article a:hover,
16   -.search-results-type-product a:hover {
17   - text-decoration: underline;
  60 +body.category2 .search-results-innerbox {
  61 + background: #C4F099;
  62 +}
  63 +body.category3 .search-results-innerbox {
  64 + background: #D6BFD3;
  65 +}
  66 +body.category4 .search-results-innerbox {
  67 + background: #F79494;
18 68 }
19 69  
20 70 .search-results-type-product li li a {
... ... @@ -38,12 +88,41 @@
38 88 padding: 0px 0px 5px 0px;
39 89 }
40 90  
41   -/* * * Category Page * * * * * * * * * * * * */
  91 +.search-results-type-profile.common-profile-list-block a {
  92 + width: 90px;
  93 +}
  94 +.search-results-type-profile.common-profile-list-block li div {
  95 + width: 88px;
  96 + height: 64px;
  97 +}
  98 +.search-results-type-profile.common-profile-list-block li span {
  99 + display: block;
  100 + width: 82px;
  101 +}
42 102  
43   -.category_itens ul a {
44   - text-decoration: none;
  103 +.search-results-type-profile.common-profile-list-block li a {
  104 + color: #000;
  105 +}
  106 +
  107 +body.category1 .search-results-type-profile.common-profile-list-block li a {
  108 + background: #FDD79E;
  109 +}
  110 +body.category2 .search-results-type-profile.common-profile-list-block li a {
  111 + border: 2px solid #C4F099 !important;
  112 +}
  113 +body.category2 .search-results-type-profile.common-profile-list-block li a:hover {
  114 + border: 2px solid #61B60E !important;
  115 + background: #D0F8A0 !important;
  116 +}
  117 +body.category3 .search-results-type-profile.common-profile-list-block li a {
  118 + background: #D6BFD3;
  119 +}
  120 +body.category4 .search-results-type-profile.common-profile-list-block li a {
  121 + background: #F79494;
45 122 }
46 123  
  124 +/* * * Category Page * * * * * * * * * * * * */
  125 +
47 126 #view-category h2 {
48 127 font-size: 16px;
49 128 line-height: 20px;
... ... @@ -60,18 +139,6 @@
60 139 float: left;
61 140 }
62 141  
63   -#category-comments {
64   - margin-left: 55%;
65   -}
66   -
67   -#content #category-comments ul,
68   -#content #category-comments li {
69   - margin: 0px;
70   - padding: 0px;
71   - list-style: none;
72   - color: #888;
73   -}
74   -
75 142 .category-innerbox {
76 143 height: 170px;
77 144 }
... ... @@ -119,14 +186,5 @@ body.category4 .category-innerbox {
119 186  
120 187 #category-childs a {
121 188 font-weight: bold;
122   - text-decoration: none;
123   -}
124   -
125   -/* * * Comments on Category Page * * * * * * */
126   -
127   -#view-category .comment-picture {
128   - width: 20px;
129   - height: 20px;
130   - margin: -2px 5px 0px 0px;
131 189 }
132 190  
... ...
public/stylesheets/common.css
1 1 body {
2 2 padding: 0px;
3 3 margin: 0px;
4   - font-family: Verdana, Sans-Serif;
  4 + font-family: Verdana, sans-serif;
5 5 font-size: 14px;
6 6 }
7 7  
... ... @@ -88,41 +88,58 @@ div#errorExplanation h2 {
88 88 text-align: center;
89 89 }
90 90  
91   -div#footer {
92   - background: #ffffff url("../images/bg_footer.png") repeat-x !important;
  91 +#footer_content {
  92 + clear: both;
  93 +}
  94 +
  95 +#footer {
  96 + background: #ffffff url("../images/bg_footer.png") repeat-x;
93 97 background-position: 0px 0px;
94   - font-family: Verdana, Arial, Serif-sans;
95   - margin: 0px !important;
96   - padding: 5px !important;
97   - text-align: center !important;
98   - clear: both !important;
99   - font-size: 10px !important;
100   - color: #545454 !important;
  98 + margin: 0px;
  99 + padding: 10px;
  100 + text-align: center;
  101 + clear: both;
  102 + font-size: 10px;
  103 + color: #777;
101 104 }
102 105  
103   -div#footer a {
104   - color: #545454;
  106 +#footer a {
  107 + color: #777;
105 108 text-decoration: none;
106   - border-bottom: 1px dotted #545454;
  109 + border-bottom: 1px dotted #777;
107 110 }
108 111  
109   -div#footer a:hover {
110   - color: #000000;
  112 +#footer a:hover {
  113 + color: #555;
111 114 border: 0px;
112 115 }
113 116  
114   -div#footer ul {
  117 +#footer ul {
115 118 margin: 0px;
116 119 padding: 0px;
117 120 }
118 121  
119   -div#footer li {
  122 +#footer li {
120 123 display: block;
121 124 float: right;
122 125 margin-right: 20px;
123 126 height: 20px;
124 127 }
125 128  
  129 +#footer a#footer-esq {
  130 + padding: 5px 0px 0px 10px;
  131 + float: left;
  132 + text-align: left;
  133 + border: none;
  134 +}
  135 +
  136 +#footer a#footer-dir {
  137 + padding: 5px 10px 0px 0px;
  138 + float: right;
  139 + text-align: right;
  140 + border: none;
  141 +}
  142 +
126 143  
127 144 /*********************************************************/
128 145  
... ... @@ -135,20 +152,6 @@ div#footer li {
135 152 top: 200px;
136 153 }
137 154  
138   -#footer_content {
139   -clear: both;
140   -}
141   -
142   -#footer {
143   - clear: both;
144   - text-align: center;
145   - font-size: smaller;
146   - color: #333;
147   - margin: 0px;
148   - padding: 5px;
149   -}
150   -
151   -
152 155 /* Notice */
153 156  
154 157 div#notice {
... ...
public/stylesheets/controller_search.css
... ... @@ -52,6 +52,27 @@
52 52 color: #888;
53 53 }
54 54  
  55 +#category-comments {
  56 + margin-left: 55%;
  57 +}
  58 +
  59 +#content .search-results-comments ul,
  60 +#content .search-results-comments li,
  61 +#content #category-comments ul,
  62 +#content #category-comments li {
  63 + margin: 0px;
  64 + padding: 0px;
  65 + list-style: none;
  66 + color: #888;
  67 +}
  68 +
  69 +.search-results-comments .comment-picture,
  70 +#category-comments .comment-picture {
  71 + width: 20px;
  72 + height: 20px;
  73 + margin: -2px 5px 0px 0px;
  74 +}
  75 +
55 76 #content .search-results-type-product ul,
56 77 #content .search-results-type-product li {
57 78 margin: 0px;
... ...
public/stylesheets/search.css
... ... @@ -15,11 +15,11 @@
15 15  
16 16 /***** search-popup ***************************/
17 17  
18   -#search-popup h2 {
  18 +#search-popup h3 {
19 19 color: #2A5896;
20 20 font-size: 20px;
21 21 }
22   -#search-popup h3 {
  22 +#search-popup h4 {
23 23 color: #2A5896;
24 24 font-size: 16px;
25 25 }
... ... @@ -28,8 +28,8 @@
28 28 text-align: center;
29 29 }
30 30  
31   -.search-options ul,
32   -.search-options li {
  31 +#content .search-options ul, .search-options ul,
  32 +#content .search-options li, .search-options li {
33 33 margin: 0px;
34 34 padding: 0px;
35 35 list-style: none;
... ... @@ -44,7 +44,8 @@
44 44 margin-top: 20px;
45 45 }
46 46  
47   -.search-options h3 {
  47 +.search-options h4,
  48 +#content .search-options h4 {
48 49 float: left;
49 50 margin: -10px 0px 0px 0px;
50 51 background: #FFF;
... ... @@ -57,8 +58,17 @@
57 58 padding: 2px 0px;
58 59 }
59 60  
  61 +.search-in li {
  62 + float: none;
  63 + width: auto;
  64 +}
  65 +.search-in br {
  66 + clear: none;
  67 +}
  68 +
60 69 #search-popup .button-bar {
61 70 clear: left;
62 71 padding-top: 0px;
  72 + margin-bottom: -20px;
63 73 }
64 74  
... ...