para-i18n 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/para/admin/translations_controller.rb +0 -4
- data/app/views/para/admin/translations/_target_locale_select.html.haml +1 -1
- data/app/views/para/admin/translations/edit.html.haml +1 -1
- data/config/locales/para-i18n.fr.yml +1 -0
- data/lib/generators/para/i18n/form/form_generator.rb +2 -4
- data/lib/para/i18n/model.rb +3 -1
- data/lib/para/i18n/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d42fdf56d948684c4f79e31c8ba0f9d3294e6f2
|
4
|
+
data.tar.gz: 9aea334a03c9f1d2ccdda7035ac129b6a562e498
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8e539835da54493e3d414726aa5ee897d938da5116074f0212b400c62464e4e95f7a6d82935ea7575c644933764b32ab53b2b001f25d95729a63cf46f020ba6
|
7
|
+
data.tar.gz: a390ac46b53f0706b1defd4acdf48b2081ab2f4e87c67f8ad8cd0808c5fc6972e259e75096a909698cf25bf258aefb05e7becf9b06f0ea93b882fd6b60a82783
|
@@ -39,10 +39,6 @@ module Para
|
|
39
39
|
@target_locale = params[:target_locale] || @locales.first
|
40
40
|
end
|
41
41
|
|
42
|
-
def resource_params
|
43
|
-
params.require(:resource).permit!
|
44
|
-
end
|
45
|
-
|
46
42
|
def add_breadcrumbs
|
47
43
|
add_breadcrumb(resource_title_for(resource), @component.relation_path(resource, action: :show)) if resource
|
48
44
|
add_breadcrumb(t('para.i18n.translation'))
|
@@ -1,5 +1,5 @@
|
|
1
1
|
.block.form-inputs
|
2
2
|
.form-group
|
3
|
-
= label :target_locale, t('
|
3
|
+
= label :target_locale, t('para.i18n.choose_locale'), class: 'control-label col-md-3 pull-left'
|
4
4
|
.col-md-9
|
5
5
|
= select_tag :target_locale, options_for_select(locales.map { |locale| [locale, locale] }, target_locale), data: { :'locale-select' => true, selectize: true, multi: false, value: { text: target_locale, value: target_locale }, :'locale-select-target-url' => @component.relation_path(resource, :translation, action: :edit, target_locale: '_') }
|
@@ -1,12 +1,10 @@
|
|
1
|
-
require 'para/i18n/translations_helper'
|
2
|
-
|
3
1
|
module Para
|
4
2
|
module I18n
|
5
3
|
class FormGenerator < Para::Generators::NamedBase
|
6
4
|
include Para::Admin::BaseHelper
|
7
5
|
include Para::Generators::FieldHelpers
|
8
6
|
include Para::ModelHelper
|
9
|
-
include Para::I18n::TranslationsHelper
|
7
|
+
include Para::I18n::Helpers::TranslationsHelper
|
10
8
|
|
11
9
|
source_root File.expand_path("../templates", __FILE__)
|
12
10
|
|
@@ -24,7 +22,7 @@ module Para
|
|
24
22
|
end
|
25
23
|
|
26
24
|
def model
|
27
|
-
@model ||=
|
25
|
+
@model ||= class_name.constantize
|
28
26
|
end
|
29
27
|
end
|
30
28
|
end
|
data/lib/para/i18n/model.rb
CHANGED
@@ -25,7 +25,9 @@ module Para
|
|
25
25
|
def write_translated_attribute field, value, locale = ::I18n.locale
|
26
26
|
return write_plain_or_store_attribute(field, value) if locale == ::I18n.default_locale
|
27
27
|
|
28
|
-
|
28
|
+
# did not us ||= here to fix first assignation.
|
29
|
+
# Did not investigate on why ||= does not work
|
30
|
+
model_translations[locale.to_s] = {} unless model_translations[locale.to_s]
|
29
31
|
model_translations[locale.to_s][field.to_s] = value
|
30
32
|
end
|
31
33
|
|
data/lib/para/i18n/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: para-i18n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Valentin Ballestrino
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
111
|
version: '0'
|
112
112
|
requirements: []
|
113
113
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.6.
|
114
|
+
rubygems_version: 2.6.11
|
115
115
|
signing_key:
|
116
116
|
specification_version: 4
|
117
117
|
summary: Para CMS I18n admin module for models
|