Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change variable names to enhance readability in helpers #3399

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions core/app/helpers/spree/base_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@ def taxon_breadcrumbs(taxon, separator = ' » ', breadcrumb_class

crumbs << [t('spree.products'), products_path]
if taxon
crumbs += taxon.ancestors.collect { |a| [a.name, spree.nested_taxons_path(a.permalink)] } unless taxon.ancestors.empty?
crumbs += taxon.ancestors.collect { |ancestor| [ancestor.name, spree.nested_taxons_path(ancestor.permalink)] } unless taxon.ancestors.empty?
crumbs << [taxon.name, spree.nested_taxons_path(taxon.permalink)]
end

separator = raw(separator)

items = crumbs.each_with_index.collect do |crumb, i|
items = crumbs.each_with_index.collect do |crumb, index|
content_tag(:li, itemprop: 'itemListElement', itemscope: '', itemtype: 'https://schema.org/ListItem') do
link_to(crumb.last, itemprop: 'item') do
content_tag(:span, crumb.first, itemprop: 'name') + tag('meta', { itemprop: 'position', content: (i + 1).to_s }, false, false)
content_tag(:span, crumb.first, itemprop: 'name') + tag('meta', { itemprop: 'position', content: (index + 1).to_s }, false, false)
end + (crumb == crumbs.last ? '' : separator)
end
end
Expand Down Expand Up @@ -122,7 +122,7 @@ def available_countries(restrict_to_zone: Spree::Config[:checkout_zone])
countries.collect do |country|
country.name = country_names.fetch(country.iso, country.name)
country
end.sort_by { |c| c.name.parameterize }
end.sort_by { |country| country.name.parameterize }
end

def seo_url(taxon)
Expand Down
2 changes: 1 addition & 1 deletion core/app/helpers/spree/products_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def variant_price_diff(variant)
def variant_full_price(variant)
return if variant.product.variants
.with_prices(current_pricing_options)
.all? { |v| v.price_same_as_master?(current_pricing_options) }
.all? { |variant_with_prices| variant_with_prices.price_same_as_master?(current_pricing_options) }
variant.price_for(current_pricing_options).to_html
end

Expand Down