diff --git a/app/controllers/public/search_controller.rb b/app/controllers/public/search_controller.rb index 19230e3..eef613a 100644 --- a/app/controllers/public/search_controller.rb +++ b/app/controllers/public/search_controller.rb @@ -9,7 +9,7 @@ class SearchController < ApplicationController protected def search(finder, query) - finder.find_by_contents(query).sort_by(&:created_at).sort_by do |hit| + finder.find_by_contents(query).sort_by do |hit| -(relevance_for(hit)) end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4c74e33..5433baf 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -468,4 +468,23 @@ module ApplicationHelper content_tag('div', result) end + def select_city(name, top_level='Nacional') + city_field_name = "#{object}[#{method}]" + state_field_name = "#{object}_#{method}_state" + region_field_name = "#{object}_#{method}_region" + + selected_state = nil + selected_region = nil + + regions = Region.find_by_name(top_level).children + + select_tag(region_field_name, options_for_select(regions.map {|r| [r.name, r.id] } + ['---','']) + + select_tag(state_field_name, options_for_select(['---', ''])) + + select_tag(city_fied_name, options_for_select(['---',''])) + + + observe_field(country_field_name, :update => state_field_name, :url => { :controller => 'geography', :action => 'states' }, :with => 'country' ) + + observe_field(country_field_name, :update => city_field_name, :url => { :controller => 'geography', :action => 'cities_by_country' }, :with => 'country') + + observe_field(state_field_name, :update => city_field_name, :url => { :controller => 'geography', :action => 'cities' }, :with => 'state_id') + end + end diff --git a/app/models/article.rb b/app/models/article.rb index 9075fa5..5ec6cab 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -33,7 +33,7 @@ class Article < ActiveRecord::Base # retrieves the latest +limit+ articles, sorted from the most recent to the # oldest. def self.recent(limit) - options = { :limit => limit, :order => 'created_on desc, articles.id desc' } + options = { :limit => limit, :order => 'created_at desc, articles.id desc' } self.find(:all, options) end diff --git a/app/models/category.rb b/app/models/category.rb index f8413f0..6ceea24 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -37,7 +37,7 @@ class Category < ActiveRecord::Base end def recent_comments(limit = 10) - comments.find(:all, :order => 'created_on DESC, comments.id DESC', :limit => limit) + comments.find(:all, :order => 'created_at DESC, comments.id DESC', :limit => limit) end def most_commented_articles(limit = 10) diff --git a/app/models/comment.rb b/app/models/comment.rb index b625d6c..3694574 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -36,7 +36,7 @@ class Comment < ActiveRecord::Base end def self.recent(limit = nil) - self.find(:all, :order => 'created_on desc, id desc', :limit => limit) + self.find(:all, :order => 'created_at desc, id desc', :limit => limit) end end diff --git a/app/models/rss_feed.rb b/app/models/rss_feed.rb index 5465326..65c7c26 100644 --- a/app/models/rss_feed.rb +++ b/app/models/rss_feed.rb @@ -88,7 +88,7 @@ class RssFeed < Article xml.description(article.abstract) end # rfc822 - xml.pubDate(article.created_on.rfc2822) + xml.pubDate(article.created_at.rfc2822) # link to article xml.link(url_for(article.url)) xml.guid(url_for(article.url)) diff --git a/app/views/content_viewer/_comment.rhtml b/app/views/content_viewer/_comment.rhtml index 374f50a..3b3250c 100644 --- a/app/views/content_viewer/_comment.rhtml +++ b/app/views/content_viewer/_comment.rhtml @@ -23,7 +23,7 @@
' + _('(unauthenticated user)') if ! comment.author %>