diff --git a/Gemfile b/Gemfile index 97422021..f724d5bf 100644 --- a/Gemfile +++ b/Gemfile @@ -64,6 +64,8 @@ gem "terser", "~> 1.1" # we use the git version of acts_as_versioned, and need to include it in this Gemfile gem 'acts_as_versioned', git: 'https://github.com/technoweenie/acts_as_versioned.git' + +gem 'foodsoft_article_import', path: 'plugins/article_import' gem 'foodsoft_discourse', path: 'plugins/discourse' gem 'foodsoft_documents', path: 'plugins/documents' gem 'foodsoft_links', path: 'plugins/links' diff --git a/Gemfile.lock b/Gemfile.lock index c66901cf..23b0f672 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -16,6 +16,14 @@ GIT acts_as_versioned (0.6.0) activerecord (>= 3.0.9) +PATH + remote: plugins/article_import + specs: + foodsoft_article_import (0.0.1) + deface (~> 1.0) + rails + roo (~> 2.9.0) + PATH remote: plugins/discourse specs: @@ -624,6 +632,7 @@ DEPENDENCIES exception_notification factory_bot_rails faker + foodsoft_article_import! foodsoft_discourse! foodsoft_documents! foodsoft_links! diff --git a/app/models/concerns/localize_input.rb b/app/models/concerns/localize_input.rb index 296c4c17..7cd26acd 100644 --- a/app/models/concerns/localize_input.rb +++ b/app/models/concerns/localize_input.rb @@ -5,10 +5,10 @@ module LocalizeInput return input unless input.is_a? String Rails.logger.debug { "Input: #{input.inspect}" } - separator = I18n.t('separator', scope: 'number.format') - delimiter = I18n.t('delimiter', scope: 'number.format') - input.gsub!(delimiter, '') if input.match(/\d+#{Regexp.escape(delimiter)}+\d+#{Regexp.escape(separator)}+\d+/) # Remove delimiter - input.gsub!(separator, '.') # Replace separator with db compatible character + separator = I18n.t("separator", scope: "number.format") + delimiter = I18n.t("delimiter", scope: "number.format") + input.gsub!(delimiter, "") if input.match(/\d+#{Regexp.escape(delimiter)}+\d+#{Regexp.escape(separator)}+\d+/) # Remove delimiter + input.gsub!(separator, ".") or input.gsub!(",", ".") # Replace separator with db compatible character input rescue StandardError Rails.logger.warn "Can't localize input: #{input}"