diff --git a/app/controllers/public/account_controller.rb b/app/controllers/public/account_controller.rb index f6fa00b..2d4dd2c 100644 --- a/app/controllers/public/account_controller.rb +++ b/app/controllers/public/account_controller.rb @@ -13,8 +13,9 @@ class AccountController < PublicController # action to perform login to the application def login + @user = User.new return unless request.post? - self.current_user = User.authenticate(params[:login], params[:password]) + self.current_user = User.authenticate(params[:user][:login], params[:user][:password]) if logged_in? if params[:remember_me] == "1" self.current_user.remember_me diff --git a/app/controllers/public/search_controller.rb b/app/controllers/public/search_controller.rb index f71be50..a1f27fd 100644 --- a/app/controllers/public/search_controller.rb +++ b/app/controllers/public/search_controller.rb @@ -2,6 +2,6 @@ class SearchController < ApplicationController def index @query = params[:query] || '' # TODO: uncomment find_by_contents when ferret start working - @results = Article.find_tagged_with(@query) #+ Article.find_by_contents(@query) + @results = Article.find_tagged_with(@query) + Article.find_all_by_title(@query) + Profile.find_all_by_name(@query) end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 94fa7d4..ca1e2ab 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -276,7 +276,7 @@ module ApplicationHelper submit_tag(_('Search'), :id => 'button_search'), text_field_tag( 'query', _(' '), :id => "input_search"), '', - observe_field('input_search', :function => "element.value=''", :on => :focus) + # observe_field('input_search', :function => "element.value=''", :on => :focus) ].join("\n") end diff --git a/app/views/account/login.rhtml b/app/views/account/login.rhtml index 9ddf46c..195fe9e 100644 --- a/app/views/account/login.rhtml +++ b/app/views/account/login.rhtml @@ -1,18 +1,16 @@

<%= _('Login') %>

-<% form_tag do -%> -


-<%= text_field_tag 'login' %>

-


-<%= password_field_tag 'password' %>

+<% labelled_form_for :user, @user do |f| -%> + <%= f.text_field :login %> + <%= f.password_field :password %> +

<%= submit_tag 'Sign up', {:class => 'submit'} %>

-

<%= submit_tag 'Log in' %>

<% end -%> diff --git a/app/views/enterprise_editor/_form.rhtml b/app/views/enterprise_editor/_form.rhtml index c435e07..9f333f5 100644 --- a/app/views/enterprise_editor/_form.rhtml +++ b/app/views/enterprise_editor/_form.rhtml @@ -1,32 +1,32 @@ -


-<%= text_field 'enterprise', 'name', 'size' => 20 %>

+ +

<%= text_field 'enterprise', 'name', 'size' => 20, 'class' => 'formfield text_field' %>

-


+


<%= text_field 'enterprise', 'address', 'size' => 50 %>

-


+


<%= text_field 'enterprise', 'contact_phone', 'size' => 20 %>

-


+


<%= text_field 'organization_info', 'contact_person', 'size' => 20 %>

-


+


<%= text_field 'organization_info', 'acronym', 'size' => 20 %>

-


+


<%= text_field 'organization_info', 'foundation_year', 'size' => 20 %>

-


+


<%= text_field 'organization_info', 'legal_form', 'size' => 20 %>

-


+


<%= text_field 'organization_info', 'economic_activity', 'size' => 20 %>

-


+


<%= text_area 'organization_info', 'management_information', 'cols' => 40, 'rows' => 20 %>

-


+


<%= select 'validation_entity', 'id', @validation_entities.map{|v| [v.name, v.id]}, :include_blank => true %>

-


+


<%= text_field 'enterprise', 'tag_list', 'size' => 20 %>

diff --git a/app/views/search/index.rhtml b/app/views/search/index.rhtml index 66b08c0..9b87747 100644 --- a/app/views/search/index.rhtml +++ b/app/views/search/index.rhtml @@ -1,6 +1,8 @@

<%= _('Listing articles found') %>

-

<%= _('Searching for ') + @query %>

+

<%= _('Searching for ') + @query %>

<% @results.each do |a| %> -

<%= link_to_document(a) %>

+

<%= link_to_document(a) if a.kind_of?(Article) %>

+

<%= link_to_homepage(a.name, a.identifier) if a.kind_of?(Profile) %>

+ <% end %> diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb index a7a4347..c1a9203 100644 --- a/test/functional/search_controller_test.rb +++ b/test/functional/search_controller_test.rb @@ -11,8 +11,14 @@ class SearchControllerTest < Test::Unit::TestCase @response = ActionController::TestResponse.new end - # Replace this with your real tests. - def test_truth - assert true + should 'find enterprise' do + ent = Enterprise.create!(:name => 'teste', :identifier => 'teste') + get 'index', :query => 'teste' + assert_response :success + assert_template 'index' + assert assigns('results') + assert assigns('results').include?(ent) + end + end -- libgit2 0.21.2