Commit 59947d16a1cf4d50821b1263a67b76ef94a1eefc
1 parent
2ce7476f
Exists in
master
and in
29 other branches
ActionItem114: changed some views to use the new form style
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@888 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
7 changed files
with
33 additions
and
26 deletions
Show diff stats
app/controllers/public/account_controller.rb
... | ... | @@ -13,8 +13,9 @@ class AccountController < PublicController |
13 | 13 | |
14 | 14 | # action to perform login to the application |
15 | 15 | def login |
16 | + @user = User.new | |
16 | 17 | return unless request.post? |
17 | - self.current_user = User.authenticate(params[:login], params[:password]) | |
18 | + self.current_user = User.authenticate(params[:user][:login], params[:user][:password]) | |
18 | 19 | if logged_in? |
19 | 20 | if params[:remember_me] == "1" |
20 | 21 | self.current_user.remember_me | ... | ... |
app/controllers/public/search_controller.rb
... | ... | @@ -2,6 +2,6 @@ class SearchController < ApplicationController |
2 | 2 | def index |
3 | 3 | @query = params[:query] || '' |
4 | 4 | # TODO: uncomment find_by_contents when ferret start working |
5 | - @results = Article.find_tagged_with(@query) #+ Article.find_by_contents(@query) | |
5 | + @results = Article.find_tagged_with(@query) + Article.find_all_by_title(@query) + Profile.find_all_by_name(@query) | |
6 | 6 | end |
7 | 7 | end | ... | ... |
app/helpers/application_helper.rb
... | ... | @@ -276,7 +276,7 @@ module ApplicationHelper |
276 | 276 | submit_tag(_('Search'), :id => 'button_search'), |
277 | 277 | text_field_tag( 'query', _(' '), :id => "input_search"), |
278 | 278 | '</form>', |
279 | - observe_field('input_search', :function => "element.value=''", :on => :focus) | |
279 | + # observe_field('input_search', :function => "element.value=''", :on => :focus) | |
280 | 280 | ].join("\n") |
281 | 281 | end |
282 | 282 | ... | ... |
app/views/account/login.rhtml
1 | 1 | <h1><%= _('Login') %></h1> |
2 | 2 | |
3 | -<% form_tag do -%> | |
4 | -<p><label for="login"> <%= _('Username') %> </label><br/> | |
5 | -<%= text_field_tag 'login' %></p> | |
6 | 3 | |
7 | -<p><label for="password"> <%= _('Password') %></label><br/> | |
8 | -<%= password_field_tag 'password' %></p> | |
4 | +<% labelled_form_for :user, @user do |f| -%> | |
5 | + <%= f.text_field :login %> | |
6 | + <%= f.password_field :password %> | |
7 | + <p class="submitline"><%= submit_tag 'Sign up', {:class => 'submit'} %></p> | |
9 | 8 | |
10 | 9 | <!-- Uncomment this if you want this functionality |
11 | 10 | <p><label for="remember_me">Remember me:</label> |
12 | 11 | <%= check_box_tag 'remember_me' %></p> |
13 | 12 | --> |
14 | 13 | |
15 | -<p><%= submit_tag 'Log in' %></p> | |
16 | 14 | <% end -%> |
17 | 15 | |
18 | 16 | ... | ... |
app/views/enterprise_editor/_form.rhtml
1 | -<p><label for="name"><%= _('Name') %></label><br/> | |
2 | -<%= text_field 'enterprise', 'name', 'size' => 20 %></p> | |
1 | +<label class='formlabel' for="name"><%= _('Name') %></label> | |
2 | +<p class='formfield text_field'><%= text_field 'enterprise', 'name', 'size' => 20, 'class' => 'formfield text_field' %></p> | |
3 | 3 | |
4 | -<p><label for="address"><%= _('Address') %></label><br/> | |
4 | +<p class='formfield text_field'><label for="address"><%= _('Address') %></label><br/> | |
5 | 5 | <%= text_field 'enterprise', 'address', 'size' => 50 %></p> |
6 | 6 | |
7 | -<p><label for="contact_phone"><%= _('Contact Phone') %></label><br/> | |
7 | +<p class='formfield text_field'><label for="contact_phone"><%= _('Contact Phone') %></label><br/> | |
8 | 8 | <%= text_field 'enterprise', 'contact_phone', 'size' => 20 %></p> |
9 | 9 | |
10 | -<p><label for="contact_person"><%= _('Contact Person') %></label><br/> | |
10 | +<p class='formfield text_field'><label for="contact_person"><%= _('Contact Person') %></label><br/> | |
11 | 11 | <%= text_field 'organization_info', 'contact_person', 'size' => 20 %></p> |
12 | 12 | |
13 | -<p><label for="acronym"><%= _('Acronym') %></label><br/> | |
13 | +<p class='formfield text_field'><label for="acronym"><%= _('Acronym') %></label><br/> | |
14 | 14 | <%= text_field 'organization_info', 'acronym', 'size' => 20 %></p> |
15 | 15 | |
16 | -<p><label for="foundation_year"><%= _('Foundation Year') %></label><br/> | |
16 | +<p class='formfield text_field'><label for="foundation_year"><%= _('Foundation Year') %></label><br/> | |
17 | 17 | <%= text_field 'organization_info', 'foundation_year', 'size' => 20 %></p> |
18 | 18 | |
19 | -<p><label for="legal_form"><%= _('Legal Form') %></label><br/> | |
19 | +<p class='formfield text_field'><label for="legal_form"><%= _('Legal Form') %></label><br/> | |
20 | 20 | <%= text_field 'organization_info', 'legal_form', 'size' => 20 %></p> |
21 | 21 | |
22 | -<p><label for="economic_activity"><%= _('Economic Activity') %></label><br/> | |
22 | +<p class='formfield text_field'><label for="economic_activity"><%= _('Economic Activity') %></label><br/> | |
23 | 23 | <%= text_field 'organization_info', 'economic_activity', 'size' => 20 %></p> |
24 | 24 | |
25 | -<p><label for="management_information"><%= _('Management Information') %></label><br/> | |
25 | +<p class='formfield text_area'><label for="management_information"><%= _('Management Information') %></label><br/> | |
26 | 26 | <%= text_area 'organization_info', 'management_information', 'cols' => 40, 'rows' => 20 %></p> |
27 | 27 | |
28 | -<p><label for="validation_entity"><%= _('Validation Entity') %></label><br/> | |
28 | +<p class='formfield select'><label for="validation_entity"><%= _('Validation Entity') %></label><br/> | |
29 | 29 | <%= select 'validation_entity', 'id', @validation_entities.map{|v| [v.name, v.id]}, :include_blank => true %></p> |
30 | 30 | |
31 | -<p><label for="tag_list"><%= _('Tags') %></label><br/> | |
31 | +<p class='formfield text_field'><label for="tag_list"><%= _('Tags') %></label><br/> | |
32 | 32 | <%= text_field 'enterprise', 'tag_list', 'size' => 20 %></p> | ... | ... |
app/views/search/index.rhtml
1 | 1 | <h2> <%= _('Listing articles found') %> </h2> |
2 | 2 | |
3 | -<h4> <%= _('Searching for ') + @query %></h4> | |
3 | +<h3> <%= _('Searching for ') + @query %></h3> | |
4 | 4 | <% @results.each do |a| %> |
5 | - <h4> <%= link_to_document(a) %> </h4> | |
5 | + <h4> <%= link_to_document(a) if a.kind_of?(Article) %> </h4> | |
6 | + <h4> <%= link_to_homepage(a.name, a.identifier) if a.kind_of?(Profile) %> </h4> | |
7 | + | |
6 | 8 | <% end %> | ... | ... |
test/functional/search_controller_test.rb
... | ... | @@ -11,8 +11,14 @@ class SearchControllerTest < Test::Unit::TestCase |
11 | 11 | @response = ActionController::TestResponse.new |
12 | 12 | end |
13 | 13 | |
14 | - # Replace this with your real tests. | |
15 | - def test_truth | |
16 | - assert true | |
14 | + should 'find enterprise' do | |
15 | + ent = Enterprise.create!(:name => 'teste', :identifier => 'teste') | |
16 | + get 'index', :query => 'teste' | |
17 | + assert_response :success | |
18 | + assert_template 'index' | |
19 | + assert assigns('results') | |
20 | + assert assigns('results').include?(ent) | |
21 | + | |
17 | 22 | end |
23 | + | |
18 | 24 | end | ... | ... |