Commit 82c567f207062bc4a2b8e03b1af3373965a259ab
Exists in
master
and in
8 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 | def index |
8 | 8 | @category = params[:level] ? ProductCategory.find(params[:level]) : nil |
9 | 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 | 11 | end |
12 | 12 | |
13 | 13 | protected | ... | ... |
app/helpers/catalog_helper.rb
... | ... | @@ -21,7 +21,7 @@ module CatalogHelper |
21 | 21 | |
22 | 22 | def category_sub_links(category) |
23 | 23 | sub_categories = [] |
24 | - category.children.each do |sub_category| | |
24 | + category.children.order(:name).each do |sub_category| | |
25 | 25 | sub_categories << category_link(sub_category, true) |
26 | 26 | end |
27 | 27 | content_tag('ul', sub_categories) if sub_categories.size > 1 | ... | ... |
app/models/spammer_logger.rb
... | ... | @@ -5,10 +5,10 @@ class SpammerLogger < Logger |
5 | 5 | def self.log(spammer_ip, object=nil) |
6 | 6 | if object |
7 | 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 | 9 | end |
10 | 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 | 12 | end |
13 | 13 | end |
14 | 14 | ... | ... |
app/views/search/_image.rhtml
... | ... | @@ -28,8 +28,9 @@ |
28 | 28 | <div class="search-gallery-items"> |
29 | 29 | <% r = image.children.find(:all, :order => :updated_at, :conditions => ['type = ?', 'UploadedFile']).last(3) %> |
30 | 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 | 34 | <% end %> |
34 | 35 | <% else %> |
35 | 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 @@ |
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 | 9 | # |
10 | 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 | 14 | create_table "abuse_reports", :force => true do |t| |
15 | 15 | t.integer "reporter_id" |
... | ... | @@ -415,7 +415,7 @@ ActiveRecord::Schema.define(:version => 20130111232201) do |
415 | 415 | t.datetime "updated_at" |
416 | 416 | t.decimal "discount" |
417 | 417 | t.boolean "available", :default => true |
418 | - t.boolean "highlighted" | |
418 | + t.boolean "highlighted", :default => false | |
419 | 419 | t.integer "unit_id" |
420 | 420 | t.integer "image_id" |
421 | 421 | end | ... | ... |
debian/changelog
lib/noosfero.rb
plugins/custom_forms/lib/custom_forms_plugin/field.rb
... | ... | @@ -4,7 +4,7 @@ class CustomFormsPlugin::Field < ActiveRecord::Base |
4 | 4 | validates_presence_of :form, :name |
5 | 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 | 8 | has_many :answers, :class_name => 'CustomFormsPlugin::Answer' |
9 | 9 | |
10 | 10 | serialize :choices, Hash | ... | ... |
plugins/custom_forms/lib/custom_forms_plugin/form.rb
1 | 1 | class CustomFormsPlugin::Form < Noosfero::Plugin::ActiveRecord |
2 | 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 | 5 | has_many :submissions, :class_name => 'CustomFormsPlugin::Submission' |
6 | 6 | |
7 | 7 | serialize :access | ... | ... |
plugins/custom_forms/test/unit/custom_forms_plugin/field_test.rb
... | ... | @@ -60,5 +60,16 @@ class CustomFormsPlugin::FieldTest < ActiveSupport::TestCase |
60 | 60 | assert_equal 2, field.choices['Second'] |
61 | 61 | assert_equal 3, field.choices['Third'] |
62 | 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 | 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 | 169 | assert_includes scope, f2 |
170 | 170 | assert_not_includes scope, f3 |
171 | 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 | 183 | end | ... | ... |
plugins/require_auth_to_comment/public/hide_comment_form.js
1 | 1 | (function($) { |
2 | 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 | 4 | $('.post-comment-button').show(); |
5 | 5 | $('#page-comment-form').show(); |
6 | 6 | $('.comment-footer').show(); | ... | ... |
plugins/shopping_cart/public/style.css
plugins/shopping_cart/views/shopping_cart_plugin_myprofile/reports.html.erb
... | ... | @@ -6,7 +6,7 @@ |
6 | 6 | <% status_collection = [[nil, _('All')]] %> |
7 | 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 | 10 | <%= labelled_text_field(_('From')+' ', :from, @from.strftime("%Y-%m-%d"), :id => 'from', :size => 9) %> |
11 | 11 | <%= labelled_text_field(_('to')+' ', :to, @to.strftime("%Y-%m-%d"), :id => 'to', :size => 9) %> |
12 | 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 | 15 | def initialize_logger(environment) |
16 | 16 | logdir = File.join(RAILS_ROOT, 'log', SpaminatorPlugin.name.underscore) |
17 | 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 | 19 | @logger = Logger.new(logpath) |
20 | 20 | end |
21 | 21 | |
22 | 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 | 24 | end |
25 | 25 | end |
26 | 26 | ... | ... |
po/pt/noosfero.po
... | ... | @@ -5497,7 +5497,7 @@ msgstr "Produto destacado" |
5497 | 5497 | #: app/views/catalog/index.rhtml:42 app/views/search/_image.rhtml:35 |
5498 | 5498 | #: app/views/search/_image.rhtml:47 |
5499 | 5499 | msgid "No image" |
5500 | -msgstr "Nenhum imagem" | |
5500 | +msgstr "Nenhuma imagem" | |
5501 | 5501 | |
5502 | 5502 | #: app/views/catalog/index.rhtml:52 |
5503 | 5503 | msgid "from " | ... | ... |
public/stylesheets/search.css
... | ... | @@ -736,10 +736,18 @@ li.search-product-item hr { |
736 | 736 | min-height: 98px; |
737 | 737 | position: absolute; |
738 | 738 | } |
739 | +.search-gallery .search-content-first-column { | |
740 | + width: 190px; | |
741 | +} | |
742 | + | |
739 | 743 | .search-content-second-column { |
740 | 744 | margin-left: 140px; |
741 | 745 | width: auto; |
742 | 746 | } |
747 | +.search-gallery .search-content-second-column { | |
748 | + margin-left: 200px; | |
749 | +} | |
750 | + | |
743 | 751 | .search-content-second-column tr:hover { |
744 | 752 | background-color: none; |
745 | 753 | } |
... | ... | @@ -807,15 +815,45 @@ a.search-image-pic { |
807 | 815 | display: table-cell; |
808 | 816 | vertical-align: middle; |
809 | 817 | } |
818 | + | |
810 | 819 | .search-gallery-items a.search-image-pic { |
811 | 820 | float:left; |
812 | 821 | margin:0 2px; |
813 | 822 | } |
823 | + | |
824 | + | |
814 | 825 | .search-gallery .search-gallery-items { |
815 | 826 | float: left; |
816 | - margin: 0 10px 0 0; | |
827 | + margin: 0; | |
817 | 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 | 857 | .search-content-first-column .search-image-container .search-image-pic |
820 | 858 | .search-uploaded-file-first-column .search-image-container .search-image-pic { |
821 | 859 | display: block; | ... | ... |
test/functional/catalog_controller_test.rb
... | ... | @@ -224,4 +224,21 @@ class CatalogControllerTest < ActionController::TestCase |
224 | 224 | assert_tag :tag => 'li', :attributes => {:id => "product-#{p2.id}", :class => /not-available/} |
225 | 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 | 244 | end | ... | ... |
test/unit/article_test.rb
... | ... | @@ -1371,6 +1371,7 @@ class ArticleTest < ActiveSupport::TestCase |
1371 | 1371 | a = profile.articles.create!(:name => 'a test article', :last_changed_by => author) |
1372 | 1372 | assert_equal author.name, a.author_name |
1373 | 1373 | author.destroy |
1374 | + a.reload | |
1374 | 1375 | a.author_name = 'some name' |
1375 | 1376 | assert_equal 'some name', a.author_name |
1376 | 1377 | end | ... | ... |