Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7290f61
Update routing-filter gem now that a compatible version is released
kennyadsl Apr 8, 2022
fd88c77
Merge pull request #142 from solidusio-contrib/kennyadsl/solidus-3
kennyadsl Apr 8, 2022
fe0388f
Update to use forked solidus_frontend when needed
waiting-for-dev Jul 29, 2022
8aa26ca
Merge pull request #146 from waiting-for-dev/waiting-for-dev/support_…
kennyadsl Aug 2, 2022
385afac
allow ruby 3
hefan Aug 28, 2022
329fbb2
describe usage with ruby 3.x
Aug 29, 2022
fe7705b
Merge pull request #149 from hefan/master
jarednorman Aug 29, 2022
95fe64d
Fix product name search retention
cjreeve Sep 29, 2022
7072482
Merge pull request #150 from watg/cjreeve/fix-product-name-search-ret…
jarednorman Sep 29, 2022
4abd26c
Allow Solidus 4
kennyadsl May 22, 2023
5ccf2a4
Remove unused backend css file
kennyadsl May 23, 2023
3df4ace
Convert coffee files to plain JS
kennyadsl May 23, 2023
c03ad9b
Fix specs to work with the latest test tools versions
kennyadsl May 23, 2023
ceeeedb
Make Rubocop almost happy
kennyadsl May 23, 2023
8e4c497
Merge pull request #151 from solidusio-contrib/kennyadsl/allow-solidus-4
kennyadsl May 23, 2023
56af622
Remove circleCI config that uses ruby 3.0
Jan 21, 2025
cdacfa3
Define ransackable_ methods on ::Translation models
Jan 21, 2025
f3e1c43
Change tests to use query param locale instead of route
Jan 21, 2025
caf31d3
Remove routing-filter
Jan 21, 2025
6db9f8e
Override serialize to support Rails 7.1 with Globalize 6
Jan 27, 2025
c8caf17
Always pass a class_name_or_coder param to super
Jan 27, 2025
845c4b3
Utilize configuration object for translatable fields
Sep 16, 2021
780056d
Add note to README explaining configuring translatable fields
Sep 16, 2021
6327114
Don't use globalize friendly_id for slug unless slug is translatable
Sep 28, 2021
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
54 changes: 44 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,55 @@
version: 2.1

orbs:
# Required for feature specs.
browser-tools: circleci/browser-tools@1.1

# Always take the latest version of the orb, this allows us to
# run specs against Solidus supported versions only without the need
# to change this configuration every time a Solidus version is released
# or goes EOL.
solidusio_extensions: solidusio/extensions@volatile

jobs:
run-specs-with-postgres:
executor: solidusio_extensions/postgres
run-specs:
parameters:
solidus:
type: string
default: main
db:
type: string
default: "postgres"
ruby:
type: string
default: "3.2"
executor:
name: solidusio_extensions/<< parameters.db >>
ruby_version: << parameters.ruby >>
steps:
- solidusio_extensions/run-tests
run-specs-with-mysql:
executor: solidusio_extensions/mysql
- checkout
- browser-tools/install-chrome
- solidusio_extensions/run-tests-solidus-<< parameters.solidus >>

lint-code:
executor:
name: solidusio_extensions/sqlite
ruby_version: "3.2"
steps:
- solidusio_extensions/run-tests
- solidusio_extensions/lint-code

workflows:
"Run specs on supported Solidus versions":
jobs:
- run-specs-with-postgres
- run-specs-with-mysql
- run-specs:
name: &name "run-specs-solidus-<< matrix.solidus >>-ruby-<< matrix.ruby >>-db-<< matrix.db >>"
matrix:
parameters: { solidus: ["main"], ruby: ["3.2"], db: ["postgres"] }
- run-specs:
name: *name
matrix:
parameters: { solidus: ["current"], ruby: ["3.1"], db: ["mysql"] }
- lint-code

"Weekly run specs against master":
triggers:
- schedule:
Expand All @@ -31,5 +59,11 @@ workflows:
only:
- master
jobs:
- run-specs-with-postgres
- run-specs-with-mysql
- run-specs:
name: *name
matrix:
parameters: { solidus: ["main"], ruby: ["3.2"], db: ["postgres"] }
- run-specs:
name: *name
matrix:
parameters: { solidus: ["current"], ruby: ["3.1"], db: ["mysql"] }
18 changes: 1 addition & 17 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
_extends: .github
2 changes: 2 additions & 0 deletions .github_changelog_generator
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
issues=false
exclude-labels=infrastructure
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@
.sass-cache
coverage
Gemfile.lock
Gemfile-local
tmp
nbproject
pkg
*.swp
spec/dummy
spec/examples.txt
/sandbox
.rvmrc
.ruby-version
.ruby-gemset
7 changes: 4 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
inherit_from: .rubocop_todo.yml

require:
- solidus_dev_support/rubocop

Rails/SkipsModelValidations:
Exclude:
- db/migrate/**/*
AllCops:
NewCops: disable
95 changes: 50 additions & 45 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,60 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2019-11-14 12:59:11 +0100 using RuboCop version 0.76.0.
# on 2023-05-23 11:06:18 UTC using RuboCop version 1.51.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
Lint/AmbiguousBlockAssociation:
Capybara/VisibilityMatcher:
Exclude:
- 'spec/features/admin/translations_spec.rb'
- 'spec/features/admin/products_spec.rb'

# Offense count: 1
Lint/BooleanSymbol:
# Configuration parameters: Severity, Include.
# Include: **/*.gemspec
Gemspec/RequiredRubyVersion:
Exclude:
- 'db/migrate/20191108162345_add_locale_to_friendly_id_slugs.rb'
- 'solidus_globalize.gemspec'

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 196
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
Layout/ExtraSpacing:
Exclude:
- 'app/models/concerns/solidus_globalize/translatable.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
# SupportedStylesForExponentOperator: space, no_space
Layout/SpaceAroundOperators:
Exclude:
- 'app/models/concerns/solidus_globalize/translatable.rb'

# Offense count: 18
# Configuration parameters: Prefixes.
# Offense count: 20
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Exclude:
- 'spec/controllers/spree/admin/translations_controller_spec.rb'
- 'spec/controllers/spree/products_controller_spec.rb'
- 'spec/features/admin/products_spec.rb'
- 'spec/features/admin/translations_spec.rb'
- 'spec/features/translations_spec.rb'
- 'spec/models/product_spec.rb'
- 'spec/support/shared_contexts/translatable_context.rb'

# Offense count: 3
RSpec/DescribeClass:
# Offense count: 4
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
# Include: **/*_spec*rb*, **/spec/**/*
RSpec/FilePath:
Exclude:
- 'spec/features/admin/products_spec.rb'
- 'spec/features/admin/translations_spec.rb'
- 'spec/features/translations_spec.rb'
- 'spec/models/product_property_spec.rb'
- 'spec/models/product_spec.rb'
- 'spec/models/shipping_method_spec.rb'
- 'spec/models/taxon_spec.rb'

# Offense count: 9
RSpec/LetSetup:
Expand All @@ -50,42 +64,33 @@ RSpec/LetSetup:
- 'spec/features/translations_spec.rb'
- 'spec/models/taxon_spec.rb'

# Offense count: 9
# Configuration parameters: AggregateFailuresByDefault.
# Offense count: 1
RSpec/MultipleDescribes:
Exclude:
- 'spec/models/translated_models_spec.rb'

# Offense count: 10
RSpec/MultipleExpectations:
Max: 3
Max: 4

# Offense count: 2
# Configuration parameters: IgnoreSharedExamples.
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
# SupportedStyles: always, named_only
RSpec/NamedSubject:
Exclude:
- 'spec/models/product_property_spec.rb'
- 'spec/support/shared_contexts/translatable_context.rb'

# Offense count: 1
# Configuration parameters: Include.
# Include: app/**/*.rb, config/**/*.rb, db/**/*.rb, lib/**/*.rb
Rails/Output:
# Include: db/migrate/*.rb
Rails/NotNullColumn:
Exclude:
- 'lib/generators/solidus_globalize/install/install_generator.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, never
Style/FrozenStringLiteralComment:
Exclude:
- 'spec/support/shared_contexts/translatable_context.rb'
- 'db/migrate/20191108162345_add_locale_to_friendly_id_slugs.rb'

# Offense count: 8
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Exclude:
- 'db/migrate/20130419041407_add_translations_to_main_models.rb'
- 'db/migrate/20130518224827_add_translations_to_product_permalink.rb'
- 'db/migrate/20131009091000_add_translations_to_option_value.rb'
- 'db/migrate/20140206202524_rename_activator_translations_to_promotion_translations.rb'
- 'db/migrate/20140219130603_update_spree_product_translations.rb'
- 'db/migrate/20141112121313_add_translations_to_product_properties.rb'
- 'db/migrate/20150224152415_add_deleted_at_to_translation_tables.rb'
- 'db/migrate/20150323210949_add_translations_to_store.rb'
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 128
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Changelog
13 changes: 11 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
branch = ENV.fetch('SOLIDUS_BRANCH', 'main')
gem 'solidus', github: 'solidusio/solidus', branch: branch

# The solidus_frontend gem has been pulled out since v3.2
if branch >= 'v3.2'
gem 'solidus_frontend'
elsif branch == 'main'
gem 'solidus_frontend', github: 'solidusio/solidus_frontend'
else
gem 'solidus_frontend', github: 'solidusio/solidus', branch: branch
end

# Needed to help Bundler figure out how to resolve dependencies,
# otherwise it takes forever to resolve them.
# See https://github.com/bundler/bundler/issues/6677
Expand All @@ -14,7 +23,7 @@ gem 'rails', '>0.a'
# Provides basic authentication functionality for testing parts of your engine
# gem 'solidus_auth_devise'

gem 'routing-filter', github: "svenfuchs/routing-filter", branch: "master"
gem 'friendly_id-globalize', github: 'norman/friendly_id-globalize', branch: "master"

case ENV['DB']
when 'mysql'
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ Add the following to your `Gemfile`:
gem 'solidus_globalize', github: 'solidusio-contrib/solidus_globalize'
```

For Ruby 3.x you have to force the usage of the friendly_id-globalize master version:

```ruby
gem 'friendly_id-globalize', github: 'norman/friendly_id-globalize', branch: "master"
gem 'solidus_globalize', github: 'solidusio-contrib/solidus_globalize'
```


Run `bundle install`

You can use the generator to install migrations and append solidus_globalize assets to
Expand Down Expand Up @@ -57,6 +65,16 @@ into an initializer:
SolidusGlobalize::Config.supported_locales = [:en, :'pt-BR']
```

Additionally, the translatable fields on individual models can be adjusted with configuration:

```ruby
SolidusGlobalize::Config[:translatable_fields].merge!(
{
'Spree::OptionValue' => [:presentation]
}
)
```

**PS 1.** The languages you add to this configuration need to be supported by
your store. This means that you need to have a transations file for them
into `/config/locales/` (eg. `/config/locales/pt-BR.yml`).
Expand Down
Loading