From 91bf3f94898f496af824b8a3a3b97ee9ead6c0d2 Mon Sep 17 00:00:00 2001 From: Daniela Soares Feitosa Date: Wed, 18 Jul 2012 08:16:14 -0300 Subject: [PATCH] Some enhancements on solr --- INSTALL | 2 +- app/controllers/application.rb | 1 - app/controllers/public/search_controller.rb | 12 ++++++------ app/helpers/application_helper.rb | 2 +- app/helpers/lightbox_helper.rb | 5 ++++- app/helpers/search_helper.rb | 10 +++++----- app/models/article.rb | 4 ++-- app/models/domain.rb | 2 +- app/models/enterprise.rb | 6 +++--- app/models/environment.rb | 8 ++++---- app/models/product.rb | 2 +- app/models/profile.rb | 12 ++++++------ app/views/layouts/_javascript.rhtml | 4 ++-- app/views/layouts/application-ng.rhtml | 2 +- app/views/manage_products/_display_image.rhtml | 2 +- app/views/maps/_google_map.js.erb | 10 +++++----- app/views/maps/edit_location.rhtml | 3 +-- app/views/search/_blog.rhtml | 2 +- app/views/search/_display_results.rhtml | 2 +- app/views/search/_image.rhtml | 6 +++--- app/views/search/_product.rhtml | 4 ++-- app/views/search/_profile.rhtml | 14 ++++++-------- app/views/search/_results_header.rhtml | 4 ++-- app/views/search/_search_form.rhtml | 8 ++++---- app/views/search/index.rhtml | 2 +- config/environments/cucumber.rb | 8 -------- config/solr.yml.dist | 32 ++++++++++++++++++++++++++------ db/migrate/20120402205653_remove_broken_references_to_category.rb | 2 +- db/schema.rb | 64 ++++++---------------------------------------------------------- debian/solr.yml | 4 ++-- features/step_definitions/create_community_steps.rb | 3 +-- gitignore.example | 12 ++++++------ lib/acts_as_searchable.rb | 2 +- public/images/icons-app/product-default-pic-big.png | Bin 0 -> 20547 bytes public/javascripts/application.js | 10 +++++----- public/javascripts/google_maps.js | 4 ++-- vendor/plugins/acts_as_solr_reloaded/config/solr.yml | 4 ++-- 37 files changed, 116 insertions(+), 158 deletions(-) create mode 100644 public/images/icons-app/product-default-pic-big.png diff --git a/INSTALL b/INSTALL index a12b8b0..9ee8a6e 100644 --- a/INSTALL +++ b/INSTALL @@ -13,7 +13,7 @@ You need to install some packages Noosfero depends on. On Debian GNU/Linux or Debian-based systems, all of these packages are available through the Debian archive. You can install them with the following command: - # apt-get install ruby rake po4a libgettext-ruby-util libgettext-ruby-data libgettext-ruby1.8 libsqlite3-ruby rcov librmagick-ruby libredcloth-ruby libwill-paginate-ruby iso-codes libfeedparser-ruby openjdk-6-jre libdaemons-ruby thin tango-icon-theme libhpricot-ruby + # apt-get install ruby rake po4a libgettext-ruby-util libgettext-ruby1.8 libsqlite3-ruby rcov librmagick-ruby libredcloth-ruby libwill-paginate-ruby iso-codes libfeedparser-ruby openjdk-6-jre libdaemons-ruby thin tango-icon-theme libhpricot-ruby On other systems, they may or may not be available through your regular package management system. Below are the links to their homepages. diff --git a/app/controllers/application.rb b/app/controllers/application.rb index 7b70633..33f4328 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -1,2 +1 @@ require 'application_controller' - diff --git a/app/controllers/public/search_controller.rb b/app/controllers/public/search_controller.rb index 65a0d31..077bff0 100644 --- a/app/controllers/public/search_controller.rb +++ b/app/controllers/public/search_controller.rb @@ -46,7 +46,7 @@ class SearchController < PublicController def products public_filters = ['public:true', 'enabled:true'] if !@empty_query - full_text_search public_filters + full_text_search public_filters else @one_page = true @geosearch = logged_in? && current_user.person.lat && current_user.person.lng @@ -183,7 +183,7 @@ class SearchController < PublicController @asset = params[:action].to_sym @order ||= [@asset] @results ||= {} - @filter = filter + @filter = filter @filter_title = filter_description(@asset, @filter) @query = params[:query] || '' @@ -198,7 +198,7 @@ class SearchController < PublicController @category = environment.categories.find_by_path(path) if @category.nil? render_not_found(path) - else + else @category_id = @category.id end end @@ -220,12 +220,12 @@ class SearchController < PublicController def filter_description(asset, filter) { 'articles_more_recent' => _('More recent contents from network'), - 'articles_more_popular' => _('More read contents from network'), + 'articles_more_popular' => _('More viewed contents from network'), 'people_more_recent' => _('More recent people from network'), 'people_more_active' => _('More active people from network'), 'people_more_popular' => _('More popular people from network'), - 'communities_more_recent' => _('More recent communities from network'), - 'communities_more_active' => _('More active communities from network'), + 'communities_more_recent' => _('More recent communities from network'), + 'communities_more_active' => _('More active communities from network'), 'communities_more_popular' => _('More popular communities from network'), 'products_more_recent' => _('Highlights'), }[asset.to_s + '_' + filter] diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5d6c9eb..b1820a7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1088,7 +1088,7 @@ module ApplicationHelper def search_contents_menu links = [ {s_('contents|More Recent') => {:href => url_for({:controller => 'search', :action => 'contents', :filter => 'more_recent'})}}, - {s_('contents|More Read') => {:href => url_for({:controller => 'search', :action => 'contents', :filter => 'more_popular'})}} + {s_('contents|More Viewed') => {:href => url_for({:controller => 'search', :action => 'contents', :filter => 'more_popular'})}} ] if logged_in? links.push(_('New Content') => lightbox_options({:href => url_for({:controller => 'cms', :action => 'new', :profile => current_user.login, :cms => true})})) diff --git a/app/helpers/lightbox_helper.rb b/app/helpers/lightbox_helper.rb index ffb8d35..4567c3c 100644 --- a/app/helpers/lightbox_helper.rb +++ b/app/helpers/lightbox_helper.rb @@ -22,7 +22,10 @@ module LightboxHelper def lightbox_options(options, lightbox_type = 'lbOn') the_class = lightbox_type the_class << " #{options[:class]}" if options.has_key?(:class) - options.merge(:class => the_class) + options.merge( + :class => the_class, + :onclick => 'alert("%s"); return false' % _('Please, try again when the page loading completes.') + ) end def lightbox? diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index da79499..091b791 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -77,9 +77,9 @@ module SearchHelper end def city_with_state(city) - if city and city.kind_of?(City) + if city and city.kind_of?(City) s = city.parent - if s and s.kind_of?(State) and s.acronym + if s and s.kind_of?(State) and s.acronym city.name + ', ' + s.acronym else city.name @@ -140,7 +140,7 @@ module SearchHelper def facet_selecteds_html_for(environment, klass, params) def name_with_extra(klass, facet, value) name = klass.facet_result_name(facet, value) - name = name[0] + name[1] if name.kind_of?(Array) + name = name[0] + name[1] if name.kind_of?(Array) name end @@ -165,7 +165,7 @@ module SearchHelper end ret.map do |label, name, url| - content_tag('div', content_tag('span', label, :class => 'facet-selected-label') + + content_tag('div', content_tag('span', label, :class => 'facet-selected-label') + content_tag('span', name, :class => 'facet-selected-name') + link_to('', url, :class => 'facet-selected-remove', :title => 'remove facet'), :class => 'facet-selected') end.join @@ -199,7 +199,7 @@ module SearchHelper def asset_class(asset) asset.to_s.singularize.camelize.constantize end - + def asset_table(asset) asset_class(asset).table_name end diff --git a/app/models/article.rb b/app/models/article.rb index 1bd3c34..221e5f4 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -661,8 +661,8 @@ class Article < ActiveRecord::Base acts_as_faceted :fields => { :f_type => {:label => _('Type'), :proc => proc{|klass| f_type_proc(klass)}}, - :f_published_at => {:type => :date, :label => _('Published date'), :queries => {'[* TO NOW-1YEARS/DAY]' => _("Older than one year"), - '[NOW-1YEARS TO NOW/DAY]' => _("Last year"), '[NOW-1MONTHS TO NOW/DAY]' => _("Last month"), '[NOW-7DAYS TO NOW/DAY]' => _("Last week"), '[NOW-1DAYS TO NOW/DAY]' => _("Last day")}, + :f_published_at => {:type => :date, :label => _('Published date'), :queries => {'[* TO NOW-1YEARS/DAY]' => _("Older than one year"), + '[NOW-1YEARS TO NOW/DAY]' => _("In the last year"), '[NOW-1MONTHS TO NOW/DAY]' => _("In the last month"), '[NOW-7DAYS TO NOW/DAY]' => _("In the last week"), '[NOW-1DAYS TO NOW/DAY]' => _("In the last day")}, :queries_order => ['[NOW-1DAYS TO NOW/DAY]', '[NOW-7DAYS TO NOW/DAY]', '[NOW-1MONTHS TO NOW/DAY]', '[NOW-1YEARS TO NOW/DAY]', '[* TO NOW-1YEARS/DAY]']}, :f_profile_type => {:label => _('Profile'), :proc => proc{|klass| f_profile_type_proc(klass)}}, :f_category => {:label => _('Categories')}, diff --git a/app/models/domain.rb b/app/models/domain.rb index edb0f48..2b29939 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -8,7 +8,7 @@ class Domain < ActiveRecord::Base # validations ############# - # name must be sequences of alphanumeric characters (a to z, + # name must be sequences of alphanumeric characters (a to z, # 0 to 9), plus '_' or '-', separated by dots. Letters must be lowercase. validates_format_of :name, :with => /^([a-z0-9_-]+\.)+[a-z0-9_-]+$/, :message => N_('%{fn} must be composed of sequences of lowercase letters (a to z), numbers (0 to 9), "_" and "-", separated by dots.').fix_i18n diff --git a/app/models/enterprise.rb b/app/models/enterprise.rb index d401dd9..47603ca 100644 --- a/app/models/enterprise.rb +++ b/app/models/enterprise.rb @@ -162,9 +162,9 @@ class Enterprise < Organization end end - def control_panel_settings_button - {:title => __('Enterprise Info and settings'), :icon => 'edit-profile-enterprise'} - end + def control_panel_settings_button + {:title => __('Enterprise Info and settings'), :icon => 'edit-profile-enterprise'} + end settings_items :enable_contact_us, :type => :boolean, :default => true diff --git a/app/models/environment.rb b/app/models/environment.rb index 7e3b178..3df675c 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -365,11 +365,11 @@ class Environment < ActiveRecord::Base end def terminology - #if self.settings[:terminology] - #self.settings[:terminology].constantize.instance - #else + if self.settings[:terminology] + self.settings[:terminology].constantize.instance + else Noosfero.terminology - #end + end end def terminology=(value) diff --git a/app/models/product.rb b/app/models/product.rb index 1ef691c..2d0ec9d 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -219,7 +219,7 @@ class Product < ActiveRecord::Base def self.f_region_proc(id) c = Region.find(id) s = c.parent - if c and c.kind_of?(City) and s and s.kind_of?(State) and s.acronym + if c and c.kind_of?(City) and s and s.kind_of?(State) and s.acronym [c.name, ', ' + s.acronym] else c.name diff --git a/app/models/profile.rb b/app/models/profile.rb index 86cf906..4085588 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -239,7 +239,7 @@ class Profile < ActiveRecord::Base self.categories(true) self.solr_save end - self.categories(reload) + self.categories(reload) end def category_ids=(ids) @@ -544,7 +544,7 @@ private :generate_url, :url_options other.top_level_articles.each do |a| copy_article_tree a end - self.articles.reload + self.articles.reload end def copy_article_tree(article, parent=nil) @@ -864,7 +864,7 @@ private :generate_url, :url_options def self.f_region_proc(id) c = Region.find(id) s = c.parent - if c and c.kind_of?(City) and s and s.kind_of?(State) and s.acronym + if c and c.kind_of?(City) and s and s.kind_of?(State) and s.acronym [c.name, ', ' + s.acronym] else c.name @@ -872,7 +872,7 @@ private :generate_url, :url_options end def self.f_enabled_proc(enabled) - enabled = enabled == "true" ? true : false + enabled = enabled == "true" ? true : false enabled ? _('Enabled') : _('Not enabled') end def f_enabled @@ -920,8 +920,8 @@ private :generate_url, :url_options after_save_reindex [:articles], :with => :delayed_job handle_asynchronously :solr_save - def control_panel_settings_button - {:title => _('Profile Info and settings'), :icon => 'edit-profile'} + def control_panel_settings_button + {:title => _('Profile Info and settings'), :icon => 'edit-profile'} end def followed_by?(person) diff --git a/app/views/layouts/_javascript.rhtml b/app/views/layouts/_javascript.rhtml index bb43c1e..a5dff4e 100644 --- a/app/views/layouts/_javascript.rhtml +++ b/app/views/layouts/_javascript.rhtml @@ -1,7 +1,7 @@ -<%= javascript_include_tag :defaults, 'jquery-latest.js', +<%= javascript_include_tag :defaults, 'jquery-latest.js', 'jquery.noconflict.js', 'jquery.cycle.all.min.js', 'thickbox.js', 'lightbox', 'colorbox', 'jquery-ui-1.8.2.custom.min', 'jquery.scrollTo', 'jquery.form.js', 'jquery-validation/jquery.validate', -'jquery.cookie', 'jquery.ba-bbq.min.js', 'reflection', 'jquery.tokeninput', +'jquery.cookie', 'jquery.ba-bbq.min.js', 'reflection', 'jquery.tokeninput', 'add-and-join', 'report-abuse', 'catalog', 'manage-products', :cache => 'cache-general' %> <% language = FastGettext.locale %> diff --git a/app/views/layouts/application-ng.rhtml b/app/views/layouts/application-ng.rhtml index 6207f15..838fb19 100644 --- a/app/views/layouts/application-ng.rhtml +++ b/app/views/layouts/application-ng.rhtml @@ -62,7 +62,7 @@
- +
<%=_('Press Enter to send the search query.')%>
<%= javascript_tag 'jQuery("#user form input").hint();' %>
diff --git a/app/views/manage_products/_display_image.rhtml b/app/views/manage_products/_display_image.rhtml index a17e39a..e8e44fb 100644 --- a/app/views/manage_products/_display_image.rhtml +++ b/app/views/manage_products/_display_image.rhtml @@ -3,7 +3,7 @@ <% if @product.image %> - <%= link_to content_tag(:span, _('Zoom in')), @product.image.public_filename, + <%= link_to content_tag(:span, _('Zoom in')), @product.image.public_filename, :class => 'zoomify-image' %> <% end %> <%= add_zoom_to_images %> diff --git a/app/views/maps/_google_map.js.erb b/app/views/maps/_google_map.js.erb index 78fd623..c0e2bd1 100644 --- a/app/views/maps/_google_map.js.erb +++ b/app/views/maps/_google_map.js.erb @@ -16,7 +16,7 @@ function getAddress(latlng) { function codeAddress() { $('location-fields').addClassName("loading"); - + var country_option = $('profile_data_country').value; var address = $('profile_data_address').value + "-" + $('profile_data_zip_code').value + "," + $('profile_data_city').value+ "-" + $('profile_data_state').value + "," + country_option; @@ -78,7 +78,7 @@ function getAddressData() { } function showAddress(results, status) { - + if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); updateFields(results[0]); @@ -113,10 +113,10 @@ function updateFields(place) { var state = ""; var country_code = ""; var i = 0; - + for( i =0 ; i < components_len; i ++) { - + if (components[i].types[0] == 'country') country_code = components[i].short_name; else if (components[i].types[0] == 'administrative_area_level_1') @@ -132,7 +132,7 @@ function updateFields(place) { else if (components[i].types[0] == 'postal_code') zip_code = components[i].short_name; } - + $('profile_data_country').value = country_code; $('profile_data_state').value = state; $('profile_data_address').value = address; diff --git a/app/views/maps/edit_location.rhtml b/app/views/maps/edit_location.rhtml index 9ed01a4..08c6203 100644 --- a/app/views/maps/edit_location.rhtml +++ b/app/views/maps/edit_location.rhtml @@ -26,9 +26,8 @@ <%= f.hidden_field :lat %> <%= f.hidden_field :lng %> - + <% end %> <%= content_tag('script', '', :src => "http://maps.googleapis.com/maps/api/js?sensor=false", :type => 'text/javascript') %> <%= content_tag('script', '', :src => url_for(:controller => :maps, :action => :google_map), :type => 'text/javascript') %> - diff --git a/app/views/search/_blog.rhtml b/app/views/search/_blog.rhtml index c155bca..e96a519 100644 --- a/app/views/search/_blog.rhtml +++ b/app/views/search/_blog.rhtml @@ -15,7 +15,7 @@ <%= _('None') if r.empty? %> - + <%= render :partial => 'article_common', :object => blog %> <%= render :partial => 'article_last_change', :object => blog %> diff --git a/app/views/search/_display_results.rhtml b/app/views/search/_display_results.rhtml index d7ce59f..6501b65 100644 --- a/app/views/search/_display_results.rhtml +++ b/app/views/search/_display_results.rhtml @@ -31,7 +31,7 @@ <% end %> <% end %> - +
<%= add_zoom_to_images %> diff --git a/app/views/search/_image.rhtml b/app/views/search/_image.rhtml index ae82a05..8c83359 100644 --- a/app/views/search/_image.rhtml +++ b/app/views/search/_image.rhtml @@ -1,5 +1,5 @@
- + <% if image.is_a? UploadedFile and image.filename %> <% extension = image.filename[(image.filename.rindex('.')+1)..-1].downcase %> <% if ['jpg', 'jpeg', 'gif', 'png', 'tiff', 'svg'].include? extension %> @@ -38,9 +38,9 @@ <% elsif image.is_a? Product %> <% if image.image %>
- <%= link_to '', product_path(image), :class => "search-image-pic", + <%= link_to '', product_path(image), :class => "search-image-pic", :style => 'background-image: url(%s)'% image.default_image(:thumb) %> - <%= link_to content_tag(:span, _('Zoom in')), image.image.public_filename, + <%= link_to content_tag(:span, _('Zoom in')), image.image.public_filename, :class => 'zoomify-image' %>
<% else %> diff --git a/app/views/search/_product.rhtml b/app/views/search/_product.rhtml index 6d1bf20..8ae990f 100644 --- a/app/views/search/_product.rhtml +++ b/app/views/search/_product.rhtml @@ -20,7 +20,7 @@ <% end %>
<% if p = product.percentage_from_solidarity_economy %> -
<%= p[1] %>
@@ -29,7 +29,7 @@ <% if product.price_described? %> <% title = (product.inputs + product.price_details).map{ |i| '
' + - '
' + i.product_category.name + '
' + + '
' + i.product_category.name + '
' + price_span(i.price, :class => 'search-product-input-price') + '
' }.join('') %> <%= link_to_function _("Open Price"), '', :title => title, :class => "search-product-price-details" %> diff --git a/app/views/search/_profile.rhtml b/app/views/search/_profile.rhtml index 5c69639..e50f253 100644 --- a/app/views/search/_profile.rhtml +++ b/app/views/search/_profile.rhtml @@ -26,14 +26,12 @@
<% profile.top_level_categorization.each do |parent, children| %> - <% if parent.name != "Territórios" %> -
- <%= parent.name %> - - <%= children.collect(&:name).join(', ') %> - -
- <% end %> +
+ <%= parent.name %> + + <%= children.collect(&:name).join(', ') %> + +
<% end %>
diff --git a/app/views/search/_results_header.rhtml b/app/views/search/_results_header.rhtml index b608f40..3449eba 100644 --- a/app/views/search/_results_header.rhtml +++ b/app/views/search/_results_header.rhtml @@ -1,6 +1,6 @@
"> <% if !@empty_query %> -
+
<% if @results[@asset].total_entries > 0 %> <%= label_total_found(@asset, @results[@asset].total_entries) %> <% if params[:display] != 'map' %> @@ -9,7 +9,7 @@ <% end %>
-
+
<%= facets_unselect_menu(@asset) %> <%= order_by(@asset) if params[:display] != 'map' %>
diff --git a/app/views/search/_search_form.rhtml b/app/views/search/_search_form.rhtml index 7bc7a6e..e298996 100644 --- a/app/views/search/_search_form.rhtml +++ b/app/views/search/_search_form.rhtml @@ -2,7 +2,7 @@ <% form_tag( { :controller => 'search', :action => @asset ? @asset : 'index', :asset => nil, :category_path => ( @category ? @category.explode_path : [] ) }, :method => 'get', :class => 'search_form' ) do %> - + <%= hidden_field_tag :display, params[:display] %> <% params_uri = CGI::unescape(request.request_uri) %> @@ -14,18 +14,18 @@ <% end %> <% end %> <% end %> - +
<%= text_field_tag 'query', @query, :id => 'search-input', :size => 50 %> <%= javascript_tag "jQuery('#search-input').attr('title', \"#{hint}\").hint()" if defined?(hint) %> - + <%= submit_button(:search, _('Search')) %>
<% end %> - + <% if @empty_query %> <% hint = environment.search_hints[@asset] %> <% if hint and !hint.blank? %> diff --git a/app/views/search/index.rhtml b/app/views/search/index.rhtml index f3eacd5..7b2ee19 100644 --- a/app/views/search/index.rhtml +++ b/app/views/search/index.rhtml @@ -8,7 +8,7 @@ <%= render :partial => 'search_form', :locals => { :hint => '' } %> <%= category_context(@category, params) %> <%= display_results %> - +
<% if @category %>

<%= _('Sub-categories') %>

diff --git a/config/environments/cucumber.rb b/config/environments/cucumber.rb index 489237d..773bb1b 100644 --- a/config/environments/cucumber.rb +++ b/config/environments/cucumber.rb @@ -18,11 +18,3 @@ config.action_controller.allow_forgery_protection = false # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test - -config.gem 'cucumber', :lib => false, :version => '0.4.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber')) -config.gem 'webrat', :lib => false, :version => '0.5.1' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat')) -config.gem 'rspec', :lib => 'spec', :version => '1.2.9' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec')) -config.gem 'rspec-rails', :lib => 'spec/rails', :version => '1.2.9' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails')) -config.gem 'Selenium', :lib => 'selenium', :version => '>= 1.1.14' unless File.directory?(File.join(Rails.root, 'vendor/plugins/selenium')) -config.gem 'selenium-client', :lib => 'selenium/client', :version => '>= 1.2.17' unless File.directory?(File.join(Rails.root, 'vendor/plugins/selenium-client')) -config.gem 'database_cleaner', :lib => 'database_cleaner' diff --git a/config/solr.yml.dist b/config/solr.yml.dist index b0c88c5..70b83ca 100644 --- a/config/solr.yml.dist +++ b/config/solr.yml.dist @@ -1,18 +1,38 @@ # Config file for the acts_as_solr plugin. # -# If you change the host or port number here, make sure you update +# If you change the host or port number here, make sure you update # them in your Solr config file -development: - url: http://0.0.0.0:8982/solr - jvm_options: -server -Xmx128M -Xms16M - timeout: 0 - +# This file must follow a structure in order to achieve multitenancy +# support. In this example, we will configure solr to support 3 +# different schemas: env1, env2 and env3. +# +# Each "hosted" environment must have an entry like this: +# +# production: &PRODUCTION +# url: http://127.0.0.1:8983/solr +# jvm_options: -server -Xmx192M -Xms64M +# timeout: 0 +# +# env1_production: +# <<: *PRODUCTION +# +# env2_production: +# <<: *PRODUCTION +# +# env3_production: +# <<: *PRODUCTION + production: url: http://127.0.0.1:8983/solr jvm_options: -server -Xmx192M -Xms64M timeout: 0 +development: + url: http://0.0.0.0:8982/solr + jvm_options: -server -Xmx128M -Xms16M + timeout: 0 + test: &TEST url: http://0.0.0.0:8981/solr jvm_options: -server -Xmx128M -Xms16M diff --git a/db/migrate/20120402205653_remove_broken_references_to_category.rb b/db/migrate/20120402205653_remove_broken_references_to_category.rb index 220802c..40b0103 100644 --- a/db/migrate/20120402205653_remove_broken_references_to_category.rb +++ b/db/migrate/20120402205653_remove_broken_references_to_category.rb @@ -1,7 +1,7 @@ class RemoveBrokenReferencesToCategory < ActiveRecord::Migration def self.up execute <<-SQL - delete from articles_categories where category_id not in (select id from categories); + delete from articles_categories where category_id not in (select id from categories); SQL execute <<-SQL delete from categories_profiles where category_id not in (select id from categories); diff --git a/db/schema.rb b/db/schema.rb index f4e0fe1..1d4575f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -161,36 +161,6 @@ ActiveRecord::Schema.define(:version => 20120411132751) do add_index "boxes", ["owner_id", "owner_type"], :name => "index_boxes_on_owner_type_and_owner_id" - create_table "bsc_plugin_contracts", :force => true do |t| - t.string "client_name" - t.integer "client_type" - t.integer "business_type" - t.string "state" - t.string "city" - t.integer "status", :default => 0 - t.integer "number_of_producers", :default => 0 - t.datetime "supply_start" - t.datetime "supply_end" - t.text "annotations" - t.integer "bsc_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "bsc_plugin_contracts_enterprises", :id => false, :force => true do |t| - t.integer "contract_id" - t.integer "enterprise_id" - end - - create_table "bsc_plugin_sales", :force => true do |t| - t.integer "product_id", :null => false - t.integer "contract_id", :null => false - t.integer "quantity", :null => false - t.decimal "price" - t.datetime "created_at" - t.datetime "updated_at" - end - create_table "categories", :force => true do |t| t.string "name" t.string "slug" @@ -284,7 +254,6 @@ ActiveRecord::Schema.define(:version => 20120411132751) do t.datetime "created_at" t.datetime "updated_at" t.integer "reports_lower_bound", :default => 0, :null => false - t.text "send_email_plugin_allow_to" end create_table "external_feeds", :force => true do |t| @@ -308,10 +277,6 @@ ActiveRecord::Schema.define(:version => 20120411132751) do t.integer "enterprise_id" end - create_table "foo_plugin_bars", :force => true do |t| - t.string "name" - end - create_table "friendships", :force => true do |t| t.integer "person_id" t.integer "friend_id" @@ -432,7 +397,7 @@ ActiveRecord::Schema.define(:version => 20120411132751) do t.string "type" t.string "identifier" t.integer "environment_id" - t.boolean "active", :default => true + t.boolean "active", :default => true t.string "address" t.string "contact_phone" t.integer "home_page_id" @@ -443,26 +408,19 @@ ActiveRecord::Schema.define(:version => 20120411132751) do t.float "lat" t.float "lng" t.integer "geocode_precision" - t.boolean "enabled", :default => true - t.string "nickname", :limit => 16 + t.boolean "enabled", :default => true + t.string "nickname", :limit => 16 t.text "custom_header" t.text "custom_footer" t.string "theme" - t.boolean "public_profile", :default => true + t.boolean "public_profile", :default => true t.date "birth_date" t.integer "preferred_domain_id" t.datetime "updated_at" - t.boolean "visible", :default => true + t.boolean "visible", :default => true t.integer "image_id" - t.boolean "validated", :default => true + t.boolean "validated", :default => true t.string "cnpj" - t.boolean "shopping_cart", :default => true - t.boolean "shopping_cart_delivery", :default => false - t.decimal "shopping_cart_delivery_price", :default => 0.0 - t.string "usp_id" - t.integer "bar_id" - t.integer "bsc_id" - t.string "company_name" t.string "national_region_code" end @@ -526,15 +484,6 @@ ActiveRecord::Schema.define(:version => 20120411132751) do t.datetime "updated_at" end - create_table "shopping_cart_plugin_purchase_orders", :force => true do |t| - t.integer "customer_id" - t.integer "seller_id" - t.text "data" - t.integer "status" - t.datetime "created_at" - t.datetime "updated_at" - end - create_table "taggings", :force => true do |t| t.integer "tag_id" t.integer "taggable_id" @@ -562,7 +511,6 @@ ActiveRecord::Schema.define(:version => 20120411132751) do t.datetime "created_at" t.string "target_type" t.integer "image_id" - t.integer "bsc_id" end create_table "thumbnails", :force => true do |t| diff --git a/debian/solr.yml b/debian/solr.yml index b0c88c5..753c39e 100644 --- a/debian/solr.yml +++ b/debian/solr.yml @@ -1,13 +1,13 @@ # Config file for the acts_as_solr plugin. # -# If you change the host or port number here, make sure you update +# If you change the host or port number here, make sure you update # them in your Solr config file development: url: http://0.0.0.0:8982/solr jvm_options: -server -Xmx128M -Xms16M timeout: 0 - + production: url: http://127.0.0.1:8983/solr jvm_options: -server -Xmx192M -Xms64M diff --git a/features/step_definitions/create_community_steps.rb b/features/step_definitions/create_community_steps.rb index b1a764a..e45dfa5 100644 --- a/features/step_definitions/create_community_steps.rb +++ b/features/step_definitions/create_community_steps.rb @@ -25,8 +25,7 @@ Given /^I reject community "(.+)"$/ do |community| end Then /^I should see "([^\"]*)"'s creation date$/ do |community| - com = Community.find_by_name community + com = Community.find_by_name community text = "Created at: #{show_date(com.created_at)}" response.should contain(text) end - diff --git a/gitignore.example b/gitignore.example index 08f5120..aef77df 100644 --- a/gitignore.example +++ b/gitignore.example @@ -12,9 +12,9 @@ config/mongrel_cluster.yml config/solr.yml config/plugins config/thin.yml -/index -/locale -/log +index +locale +log public/articles public/image_uploads public/thumbnails @@ -29,9 +29,9 @@ db/production.db db/test.db doc/noosfero/*.xhtml doc/noosfero/*/*.xhtml -/tags -/pkg -/solr +tags +pkg +solr *~ *.swp debian/*.log diff --git a/lib/acts_as_searchable.rb b/lib/acts_as_searchable.rb index 7ee386e..fc67063 100644 --- a/lib/acts_as_searchable.rb +++ b/lib/acts_as_searchable.rb @@ -47,7 +47,7 @@ module ActsAsSearchable options[:facets][:browse] = nil all_facets = find_by_solr(query, options.merge(:per_page => 0)).facets end - + if !solr_result.nil? facets = options.include?(:facets) ? solr_result.facets : [] diff --git a/public/images/icons-app/product-default-pic-big.png b/public/images/icons-app/product-default-pic-big.png new file mode 100644 index 0000000..b7ec210 Binary files /dev/null and b/public/images/icons-app/product-default-pic-big.png differ diff --git a/public/javascripts/application.js b/public/javascripts/application.js index ed31a76..6986adc 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -719,14 +719,14 @@ Array.min = function(array) { (function ($) { $.fn.hint = function (blurClass) { - if (!blurClass) { + if (!blurClass) { blurClass = 'blur'; } - + return this.each(function () { // get jQuery version of 'this' var $input = $(this), - + // capture the rest of the variable to allow for reuse title = $input.attr('title'), $form = $(this.form), @@ -739,14 +739,14 @@ $.fn.hint = function (blurClass) { } // only apply logic if the element has the attribute - if (title) { + if (title) { // on blur, set value to title attr if text is blank $input.blur(function () { if (this.value === '') { $input.val(title).addClass(blurClass); } }).focus(remove).blur(); // now change all inputs to title - + // clear the pre-defined text when form is submitted $form.submit(remove); $win.unload(remove); // handles Firefox's autocomplete diff --git a/public/javascripts/google_maps.js b/public/javascripts/google_maps.js index 26e2187..1a7738f 100644 --- a/public/javascripts/google_maps.js +++ b/public/javascripts/google_maps.js @@ -8,7 +8,7 @@ function mapOpenBalloon(marker, html) { infoWindow.setContent(html); infoWindow.open(map, marker); } - + function mapPutMarker(lat, lng, title, icon, url_or_function) { var point_str = lat + ":" + lng; @@ -18,7 +18,7 @@ function mapPutMarker(lat, lng, title, icon, url_or_function) { } else { mapPoints[point_str] = true; } - + var point = new google.maps.LatLng(lat, lng); var options = { map: map, title: title, icon: icon, position: point }; var marker = new google.maps.Marker(options); diff --git a/vendor/plugins/acts_as_solr_reloaded/config/solr.yml b/vendor/plugins/acts_as_solr_reloaded/config/solr.yml index b0c88c5..753c39e 100644 --- a/vendor/plugins/acts_as_solr_reloaded/config/solr.yml +++ b/vendor/plugins/acts_as_solr_reloaded/config/solr.yml @@ -1,13 +1,13 @@ # Config file for the acts_as_solr plugin. # -# If you change the host or port number here, make sure you update +# If you change the host or port number here, make sure you update # them in your Solr config file development: url: http://0.0.0.0:8982/solr jvm_options: -server -Xmx128M -Xms16M timeout: 0 - + production: url: http://127.0.0.1:8983/solr jvm_options: -server -Xmx192M -Xms64M -- libgit2 0.21.2