Commit 82c567f207062bc4a2b8e03b1af3373965a259ab
Exists in
master
and in
29 other branches
Merge branch 'stable'
Showing
20 changed files
with
113 additions
and
18 deletions
Show diff stats
app/controllers/public/catalog_controller.rb
@@ -7,7 +7,7 @@ class CatalogController < PublicController | @@ -7,7 +7,7 @@ class CatalogController < PublicController | ||
7 | def index | 7 | def index |
8 | @category = params[:level] ? ProductCategory.find(params[:level]) : nil | 8 | @category = params[:level] ? ProductCategory.find(params[:level]) : nil |
9 | @products = @profile.products.from_category(@category).paginate(:order => 'available desc, highlighted desc, name asc', :per_page => 9, :page => params[:page]) | 9 | @products = @profile.products.from_category(@category).paginate(:order => 'available desc, highlighted desc, name asc', :per_page => 9, :page => params[:page]) |
10 | - @categories = ProductCategory.on_level(params[:level]) | 10 | + @categories = ProductCategory.on_level(params[:level]).order(:name) |
11 | end | 11 | end |
12 | 12 | ||
13 | protected | 13 | protected |
app/helpers/catalog_helper.rb
@@ -21,7 +21,7 @@ module CatalogHelper | @@ -21,7 +21,7 @@ module CatalogHelper | ||
21 | 21 | ||
22 | def category_sub_links(category) | 22 | def category_sub_links(category) |
23 | sub_categories = [] | 23 | sub_categories = [] |
24 | - category.children.each do |sub_category| | 24 | + category.children.order(:name).each do |sub_category| |
25 | sub_categories << category_link(sub_category, true) | 25 | sub_categories << category_link(sub_category, true) |
26 | end | 26 | end |
27 | content_tag('ul', sub_categories) if sub_categories.size > 1 | 27 | content_tag('ul', sub_categories) if sub_categories.size > 1 |
app/models/spammer_logger.rb
@@ -5,10 +5,10 @@ class SpammerLogger < Logger | @@ -5,10 +5,10 @@ class SpammerLogger < Logger | ||
5 | def self.log(spammer_ip, object=nil) | 5 | def self.log(spammer_ip, object=nil) |
6 | if object | 6 | if object |
7 | if object.kind_of?(Comment) | 7 | if object.kind_of?(Comment) |
8 | - @logger << "[#{Time.now.strftime("%F %T %z")}] Comment-id: #{object.id} IP: #{spammer_ip}\n" | 8 | + @logger << "[#{Time.now.strftime('%F %T %z')}] Comment-id: #{object.id} IP: #{spammer_ip}\n" |
9 | end | 9 | end |
10 | else | 10 | else |
11 | - @logger << "[#{Time.now.strftime("%F %T %z")}] IP: #{spammer_ip}\n" | 11 | + @logger << "[#{Time.now.strftime('%F %T %z')}] IP: #{spammer_ip}\n" |
12 | end | 12 | end |
13 | end | 13 | end |
14 | 14 |
app/views/search/_image.rhtml
@@ -28,8 +28,9 @@ | @@ -28,8 +28,9 @@ | ||
28 | <div class="search-gallery-items"> | 28 | <div class="search-gallery-items"> |
29 | <% r = image.children.find(:all, :order => :updated_at, :conditions => ['type = ?', 'UploadedFile']).last(3) %> | 29 | <% r = image.children.find(:all, :order => :updated_at, :conditions => ['type = ?', 'UploadedFile']).last(3) %> |
30 | <% if r.length > 0 %> | 30 | <% if r.length > 0 %> |
31 | - <% r.each do |i| %> | ||
32 | - <%= link_to '', i.view_url, :class => "search-image-pic", :style => 'background-image: url(%s)'% i.public_filename(:thumb) %> | 31 | + <% r.each_index do |i| img = r[i] %> |
32 | + <%= link_to '', img.view_url, :class => "search-image-pic pic-num#{i+1}", | ||
33 | + :style => 'background-image: url(%s)'% img.public_filename(:thumb) %> | ||
33 | <% end %> | 34 | <% end %> |
34 | <% else %> | 35 | <% else %> |
35 | <div class="search-no-image"><span><%= _('No image') %></span></div> | 36 | <div class="search-no-image"><span><%= _('No image') %></span></div> |
db/migrate/20130304200849_add_default_value_to_product_highlighted.rb
0 → 100644
@@ -0,0 +1,10 @@ | @@ -0,0 +1,10 @@ | ||
1 | +class AddDefaultValueToProductHighlighted < ActiveRecord::Migration | ||
2 | + def self.up | ||
3 | + change_column :products, :highlighted, :boolean, :default => false | ||
4 | + execute('UPDATE products SET highlighted=(0>1) WHERE highlighted IS NULL;') | ||
5 | + end | ||
6 | + | ||
7 | + def self.down | ||
8 | + say 'This migraiton is not reversible!' | ||
9 | + end | ||
10 | +end |
db/schema.rb
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | # | 9 | # |
10 | # It's strongly recommended to check this file into your version control system. | 10 | # It's strongly recommended to check this file into your version control system. |
11 | 11 | ||
12 | -ActiveRecord::Schema.define(:version => 20130111232201) do | 12 | +ActiveRecord::Schema.define(:version => 20130304200849) do |
13 | 13 | ||
14 | create_table "abuse_reports", :force => true do |t| | 14 | create_table "abuse_reports", :force => true do |t| |
15 | t.integer "reporter_id" | 15 | t.integer "reporter_id" |
@@ -415,7 +415,7 @@ ActiveRecord::Schema.define(:version => 20130111232201) do | @@ -415,7 +415,7 @@ ActiveRecord::Schema.define(:version => 20130111232201) do | ||
415 | t.datetime "updated_at" | 415 | t.datetime "updated_at" |
416 | t.decimal "discount" | 416 | t.decimal "discount" |
417 | t.boolean "available", :default => true | 417 | t.boolean "available", :default => true |
418 | - t.boolean "highlighted" | 418 | + t.boolean "highlighted", :default => false |
419 | t.integer "unit_id" | 419 | t.integer "unit_id" |
420 | t.integer "image_id" | 420 | t.integer "image_id" |
421 | end | 421 | end |
debian/changelog
1 | +noosfero (0.41.1) unstable; urgency=low | ||
2 | + | ||
3 | + * Bugfixes release | ||
4 | + | ||
5 | + -- Rodrigo Souto <rodrigo@colivre.coop.br> Fri, 08 Mar 2013 11:33:11 -0300 | ||
6 | + | ||
1 | noosfero (0.41.0) unstable; urgency=low | 7 | noosfero (0.41.0) unstable; urgency=low |
2 | 8 | ||
3 | * Features version with anti spam-bot measures | 9 | * Features version with anti spam-bot measures |
lib/noosfero.rb
@@ -2,7 +2,7 @@ require 'fast_gettext' | @@ -2,7 +2,7 @@ require 'fast_gettext' | ||
2 | 2 | ||
3 | module Noosfero | 3 | module Noosfero |
4 | PROJECT = 'noosfero' | 4 | PROJECT = 'noosfero' |
5 | - VERSION = '0.41.0' | 5 | + VERSION = '0.41.1' |
6 | 6 | ||
7 | def self.pattern_for_controllers_in_directory(dir) | 7 | def self.pattern_for_controllers_in_directory(dir) |
8 | disjunction = controllers_in_directory(dir).join('|') | 8 | disjunction = controllers_in_directory(dir).join('|') |
plugins/custom_forms/lib/custom_forms_plugin/field.rb
@@ -4,7 +4,7 @@ class CustomFormsPlugin::Field < ActiveRecord::Base | @@ -4,7 +4,7 @@ class CustomFormsPlugin::Field < ActiveRecord::Base | ||
4 | validates_presence_of :form, :name | 4 | validates_presence_of :form, :name |
5 | validates_uniqueness_of :slug, :scope => :form_id | 5 | validates_uniqueness_of :slug, :scope => :form_id |
6 | 6 | ||
7 | - belongs_to :form, :class_name => 'CustomFormsPlugin::Form', :dependent => :destroy | 7 | + belongs_to :form, :class_name => 'CustomFormsPlugin::Form' |
8 | has_many :answers, :class_name => 'CustomFormsPlugin::Answer' | 8 | has_many :answers, :class_name => 'CustomFormsPlugin::Answer' |
9 | 9 | ||
10 | serialize :choices, Hash | 10 | serialize :choices, Hash |
plugins/custom_forms/lib/custom_forms_plugin/form.rb
1 | class CustomFormsPlugin::Form < Noosfero::Plugin::ActiveRecord | 1 | class CustomFormsPlugin::Form < Noosfero::Plugin::ActiveRecord |
2 | belongs_to :profile | 2 | belongs_to :profile |
3 | 3 | ||
4 | - has_many :fields, :class_name => 'CustomFormsPlugin::Field' | 4 | + has_many :fields, :class_name => 'CustomFormsPlugin::Field', :dependent => :destroy |
5 | has_many :submissions, :class_name => 'CustomFormsPlugin::Submission' | 5 | has_many :submissions, :class_name => 'CustomFormsPlugin::Submission' |
6 | 6 | ||
7 | serialize :access | 7 | serialize :access |
plugins/custom_forms/test/unit/custom_forms_plugin/field_test.rb
@@ -60,5 +60,16 @@ class CustomFormsPlugin::FieldTest < ActiveSupport::TestCase | @@ -60,5 +60,16 @@ class CustomFormsPlugin::FieldTest < ActiveSupport::TestCase | ||
60 | assert_equal 2, field.choices['Second'] | 60 | assert_equal 2, field.choices['Second'] |
61 | assert_equal 3, field.choices['Third'] | 61 | assert_equal 3, field.choices['Third'] |
62 | end | 62 | end |
63 | + | ||
64 | + should 'not destroy form after removing a field' do | ||
65 | + form = CustomFormsPlugin::Form.create!(:name => 'Free Software', :profile => fast_create(Profile)) | ||
66 | + license_field = CustomFormsPlugin::Field.create!(:name => 'License', :form => form) | ||
67 | + url_field = CustomFormsPlugin::Field.create!(:name => 'URL', :form => form) | ||
68 | + | ||
69 | + assert_no_difference CustomFormsPlugin::Form, :count do | ||
70 | + url_field.destroy | ||
71 | + end | ||
72 | + assert_equal form.fields, [license_field] | ||
73 | + end | ||
63 | end | 74 | end |
64 | 75 |
plugins/custom_forms/test/unit/custom_forms_plugin/form_test.rb
@@ -169,4 +169,15 @@ class CustomFormsPlugin::FormTest < ActiveSupport::TestCase | @@ -169,4 +169,15 @@ class CustomFormsPlugin::FormTest < ActiveSupport::TestCase | ||
169 | assert_includes scope, f2 | 169 | assert_includes scope, f2 |
170 | assert_not_includes scope, f3 | 170 | assert_not_includes scope, f3 |
171 | end | 171 | end |
172 | + | ||
173 | + should 'destroy fields after removing a form' do | ||
174 | + form = CustomFormsPlugin::Form.create!(:name => 'Free Software', :profile => fast_create(Profile)) | ||
175 | + license_field = CustomFormsPlugin::Field.create!(:name => 'License', :form => form) | ||
176 | + url_field = CustomFormsPlugin::Field.create!(:name => 'URL', :form => form) | ||
177 | + | ||
178 | + assert_difference CustomFormsPlugin::Field, :count, -2 do | ||
179 | + form.destroy | ||
180 | + end | ||
181 | + end | ||
182 | + | ||
172 | end | 183 | end |
plugins/require_auth_to_comment/public/hide_comment_form.js
1 | (function($) { | 1 | (function($) { |
2 | $(window).bind('userDataLoaded', function(event, data) { | 2 | $(window).bind('userDataLoaded', function(event, data) { |
3 | - if (data.login || $('meta[name=profile.allow_unauthenticated_comments]').length > 0) { | 3 | + if (data.login || $('meta[name="profile.allow_unauthenticated_comments"]').length > 0) { |
4 | $('.post-comment-button').show(); | 4 | $('.post-comment-button').show(); |
5 | $('#page-comment-form').show(); | 5 | $('#page-comment-form').show(); |
6 | $('.comment-footer').show(); | 6 | $('.comment-footer').show(); |
plugins/shopping_cart/public/style.css
@@ -209,7 +209,7 @@ label.error { | @@ -209,7 +209,7 @@ label.error { | ||
209 | padding-left: 5px; | 209 | padding-left: 5px; |
210 | } | 210 | } |
211 | 211 | ||
212 | -#order-filter { | 212 | +#cart-order-filter { |
213 | background-color: #ccc; | 213 | background-color: #ccc; |
214 | border: 1px solid #aaa; | 214 | border: 1px solid #aaa; |
215 | border-radius: 5px; | 215 | border-radius: 5px; |
plugins/shopping_cart/views/shopping_cart_plugin_myprofile/reports.html.erb
@@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
6 | <% status_collection = [[nil, _('All')]] %> | 6 | <% status_collection = [[nil, _('All')]] %> |
7 | <% status_collection += status.map{|s| [pos+=1, s] } %> | 7 | <% status_collection += status.map{|s| [pos+=1, s] } %> |
8 | 8 | ||
9 | -<% form_tag({}, {:id => 'order-filter'}) do %> | 9 | +<% form_tag({}, {:id => 'cart-order-filter'}) do %> |
10 | <%= labelled_text_field(_('From')+' ', :from, @from.strftime("%Y-%m-%d"), :id => 'from', :size => 9) %> | 10 | <%= labelled_text_field(_('From')+' ', :from, @from.strftime("%Y-%m-%d"), :id => 'from', :size => 9) %> |
11 | <%= labelled_text_field(_('to')+' ', :to, @to.strftime("%Y-%m-%d"), :id => 'to', :size => 9) %> | 11 | <%= labelled_text_field(_('to')+' ', :to, @to.strftime("%Y-%m-%d"), :id => 'to', :size => 9) %> |
12 | <span style="white-space:nowrap"><%= labelled_select(_('Status')+' ', :filter_status, :first, :last, @status, status_collection)%></span> | 12 | <span style="white-space:nowrap"><%= labelled_select(_('Status')+' ', :filter_status, :first, :last, @status, status_collection)%></span> |
plugins/spaminator/lib/spaminator_plugin/spaminator.rb
@@ -15,12 +15,12 @@ class SpaminatorPlugin::Spaminator | @@ -15,12 +15,12 @@ class SpaminatorPlugin::Spaminator | ||
15 | def initialize_logger(environment) | 15 | def initialize_logger(environment) |
16 | logdir = File.join(RAILS_ROOT, 'log', SpaminatorPlugin.name.underscore) | 16 | logdir = File.join(RAILS_ROOT, 'log', SpaminatorPlugin.name.underscore) |
17 | File.makedirs(logdir) if !File.exist?(logdir) | 17 | File.makedirs(logdir) if !File.exist?(logdir) |
18 | - logpath = File.join(logdir, "#{environment.name.to_slug}_#{ENV['RAILS_ENV']}_#{Time.now.strftime("%F_%T")}.log") | 18 | + logpath = File.join(logdir, "#{environment.name.to_slug}_#{ENV['RAILS_ENV']}_#{Time.now.strftime('%F_%T')}.log") |
19 | @logger = Logger.new(logpath) | 19 | @logger = Logger.new(logpath) |
20 | end | 20 | end |
21 | 21 | ||
22 | def log(message) | 22 | def log(message) |
23 | - @logger << "[#{Time.now.strftime("%F %T %z")}] #{message}\n" | 23 | + @logger << "[#{Time.now.strftime('%F %T %z')}] #{message}\n" |
24 | end | 24 | end |
25 | end | 25 | end |
26 | 26 |
po/pt/noosfero.po
@@ -5497,7 +5497,7 @@ msgstr "Produto destacado" | @@ -5497,7 +5497,7 @@ msgstr "Produto destacado" | ||
5497 | #: app/views/catalog/index.rhtml:42 app/views/search/_image.rhtml:35 | 5497 | #: app/views/catalog/index.rhtml:42 app/views/search/_image.rhtml:35 |
5498 | #: app/views/search/_image.rhtml:47 | 5498 | #: app/views/search/_image.rhtml:47 |
5499 | msgid "No image" | 5499 | msgid "No image" |
5500 | -msgstr "Nenhum imagem" | 5500 | +msgstr "Nenhuma imagem" |
5501 | 5501 | ||
5502 | #: app/views/catalog/index.rhtml:52 | 5502 | #: app/views/catalog/index.rhtml:52 |
5503 | msgid "from " | 5503 | msgid "from " |
public/stylesheets/search.css
@@ -736,10 +736,18 @@ li.search-product-item hr { | @@ -736,10 +736,18 @@ li.search-product-item hr { | ||
736 | min-height: 98px; | 736 | min-height: 98px; |
737 | position: absolute; | 737 | position: absolute; |
738 | } | 738 | } |
739 | +.search-gallery .search-content-first-column { | ||
740 | + width: 190px; | ||
741 | +} | ||
742 | + | ||
739 | .search-content-second-column { | 743 | .search-content-second-column { |
740 | margin-left: 140px; | 744 | margin-left: 140px; |
741 | width: auto; | 745 | width: auto; |
742 | } | 746 | } |
747 | +.search-gallery .search-content-second-column { | ||
748 | + margin-left: 200px; | ||
749 | +} | ||
750 | + | ||
743 | .search-content-second-column tr:hover { | 751 | .search-content-second-column tr:hover { |
744 | background-color: none; | 752 | background-color: none; |
745 | } | 753 | } |
@@ -807,15 +815,45 @@ a.search-image-pic { | @@ -807,15 +815,45 @@ a.search-image-pic { | ||
807 | display: table-cell; | 815 | display: table-cell; |
808 | vertical-align: middle; | 816 | vertical-align: middle; |
809 | } | 817 | } |
818 | + | ||
810 | .search-gallery-items a.search-image-pic { | 819 | .search-gallery-items a.search-image-pic { |
811 | float:left; | 820 | float:left; |
812 | margin:0 2px; | 821 | margin:0 2px; |
813 | } | 822 | } |
823 | + | ||
824 | + | ||
814 | .search-gallery .search-gallery-items { | 825 | .search-gallery .search-gallery-items { |
815 | float: left; | 826 | float: left; |
816 | - margin: 0 10px 0 0; | 827 | + margin: 0; |
817 | min-width: 130px; | 828 | min-width: 130px; |
829 | + position: relative; | ||
818 | } | 830 | } |
831 | + | ||
832 | +.search-gallery .search-gallery-items a.search-image-pic { | ||
833 | + border: none; | ||
834 | + border-radius: 0; | ||
835 | + box-shadow: none; | ||
836 | + width: 62px; | ||
837 | + margin: 0px 0px 1px 1px; | ||
838 | + background-size: cover; | ||
839 | + background-position: 50% 10%; | ||
840 | + float: none; | ||
841 | +} | ||
842 | + | ||
843 | +.search-gallery .search-gallery-items a.search-image-pic.pic-num1, | ||
844 | +.search-gallery .search-gallery-items a.search-image-pic.pic-num2 { | ||
845 | + display: block; | ||
846 | + width: 60px; | ||
847 | + height: 49px; | ||
848 | +} | ||
849 | +.search-gallery .search-gallery-items a.search-image-pic.pic-num3 { | ||
850 | + width: 130px; | ||
851 | + height: 99px; | ||
852 | + position: absolute; | ||
853 | + left: 61px; | ||
854 | + top: 0px; | ||
855 | +} | ||
856 | + | ||
819 | .search-content-first-column .search-image-container .search-image-pic | 857 | .search-content-first-column .search-image-container .search-image-pic |
820 | .search-uploaded-file-first-column .search-image-container .search-image-pic { | 858 | .search-uploaded-file-first-column .search-image-container .search-image-pic { |
821 | display: block; | 859 | display: block; |
test/functional/catalog_controller_test.rb
@@ -224,4 +224,21 @@ class CatalogControllerTest < ActionController::TestCase | @@ -224,4 +224,21 @@ class CatalogControllerTest < ActionController::TestCase | ||
224 | assert_tag :tag => 'li', :attributes => {:id => "product-#{p2.id}", :class => /not-available/} | 224 | assert_tag :tag => 'li', :attributes => {:id => "product-#{p2.id}", :class => /not-available/} |
225 | end | 225 | end |
226 | 226 | ||
227 | + should 'sort categories by name' do | ||
228 | + environment = @enterprise.environment | ||
229 | + environment.categories.destroy_all | ||
230 | + pc1 = ProductCategory.create!(:name => "Drinks", :environment => environment) | ||
231 | + pc2 = ProductCategory.create!(:name => "Bananas", :environment => environment) | ||
232 | + pc3 = ProductCategory.create!(:name => "Sodas", :environment => environment) | ||
233 | + pc4 = ProductCategory.create!(:name => "Pies", :environment => environment) | ||
234 | + p1 = fast_create(Product, :product_category_id => pc1.id, :enterprise_id => @enterprise.id) | ||
235 | + p2 = fast_create(Product, :product_category_id => pc2.id, :enterprise_id => @enterprise.id) | ||
236 | + p3 = fast_create(Product, :product_category_id => pc3.id, :enterprise_id => @enterprise.id) | ||
237 | + p4 = fast_create(Product, :product_category_id => pc4.id, :enterprise_id => @enterprise.id) | ||
238 | + | ||
239 | + get :index, :profile => @enterprise.identifier | ||
240 | + | ||
241 | + assert_equal [pc2, pc1, pc4, pc3], assigns(:categories) | ||
242 | + end | ||
243 | + | ||
227 | end | 244 | end |
test/unit/article_test.rb
@@ -1371,6 +1371,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1371,6 +1371,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
1371 | a = profile.articles.create!(:name => 'a test article', :last_changed_by => author) | 1371 | a = profile.articles.create!(:name => 'a test article', :last_changed_by => author) |
1372 | assert_equal author.name, a.author_name | 1372 | assert_equal author.name, a.author_name |
1373 | author.destroy | 1373 | author.destroy |
1374 | + a.reload | ||
1374 | a.author_name = 'some name' | 1375 | a.author_name = 'some name' |
1375 | assert_equal 'some name', a.author_name | 1376 | assert_equal 'some name', a.author_name |
1376 | end | 1377 | end |