prepare for plugin import
This commit is contained in:
parent
caa32de30c
commit
6dbf768bfb
3 changed files with 15 additions and 4 deletions
2
Gemfile
2
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'
|
||||
|
|
|
@ -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!
|
||||
|
|
|
@ -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}"
|
||||
|
|
Loading…
Reference in a new issue