para-i18n 0.5.0 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90d12992580fc4a99c6c61436e3fda627f33c8064316d72d9dac154234bf7e58
4
- data.tar.gz: 4592e7c3895bc9200f212879171f5b039d75884bd0dfa73f576a8624346fbd5d
3
+ metadata.gz: 7a0c2cb5b72d32e5b2f3004cf1058e38c2d8d6bfcd27b934209b14c34efb735c
4
+ data.tar.gz: b48b78e2882e346bfd623e82b2db83242e7fd646fc6f2004f9403c083016384a
5
5
  SHA512:
6
- metadata.gz: 2cf9a1a632377a4d9d4f0780401028e4fd44b6991427a96af28e9ea21414d804a3ad97d0ca552b051fe43848a0c98f5df703a999e104bd0a8eae9309a3b7d69c
7
- data.tar.gz: f676eac78ac6492fc3a283a162a0e06874d55873ead0e5a0c429ed93cc2445e6dfa2f0491e51e08626eca37dbcc59c08eaba07a083248c843d9d84c67a9bd8af
6
+ metadata.gz: ac1aebbd243360b95d1cb944bdc76579448dad4c6161440ce1d12361536b46fc4a2b5eeb7ad135490c0462d77845d01d3e49363e325de88f27668c661a75aff7
7
+ data.tar.gz: 4de0c69944f80774d48a8e06fdc42eccf11232424c2f89941887ad6f3617597c03dffa02ac2a722dc439f8003b193033ae1a5060164952c3229e1c749a5b9a5a
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ node_modules/
@@ -0,0 +1,5 @@
1
+ {
2
+ "circleci.persistedProjectSelection": [
3
+ "gh/para-cms/para-i18n"
4
+ ]
5
+ }
data/README.md CHANGED
@@ -24,7 +24,7 @@ Or install it yourself as:
24
24
 
25
25
  $ gem install para-i18n
26
26
 
27
- Add the para-i18n javascript file to your app's admin manifest at `app/assets/javascripts/admin/app.(js|coffee)` :
27
+ Add the para-i18n javascript file to your app's admin manifest at `app/assets/javascripts/admin/app.js` :
28
28
 
29
29
  ```javascript
30
30
  //= require para/i18n
@@ -22,6 +22,13 @@ module Para
22
22
 
23
23
  private
24
24
 
25
+ def after_form_submit_path
26
+ path = super
27
+ return path unless params[:_save_and_edit]
28
+
29
+ path.merge(target_locale: @target_locale)
30
+ end
31
+
25
32
  def load_and_authorize_crud_resource
26
33
  options = { class: resource_model }
27
34
 
@@ -0,0 +1,9 @@
1
+ module Para
2
+ module I18n
3
+ module UrlsHelper
4
+ def translations_form_locale_path_for(resource, target_locale)
5
+ @component.relation_path(resource, :translation, action: :edit, target_locale:)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,20 @@
1
+ import { Controller } from "@hotwired/stimulus";
2
+ import TomSelect from "tom-select";
3
+
4
+ export default class extends Controller {
5
+ static values = { pathTemplate: String };
6
+
7
+ connect() {
8
+ this.localeSelect = new TomSelect(this.element);
9
+ }
10
+
11
+ disconnect() {
12
+ this.localeSelect.destroy();
13
+ }
14
+
15
+ switchLocale() {
16
+ const url = this.pathTemplateValue.replace("__locale__", this.element.value);
17
+
18
+ Turbo.visit(url);
19
+ }
20
+ }
@@ -0,0 +1,11 @@
1
+ const application = window.Stimulus;
2
+
3
+ if (!application) {
4
+ throw new Error(
5
+ "Stimulus is not available in the global scope. Make sure to require Para and / " +
6
+ "or initialize Stimulus in your application before loading this file."
7
+ );
8
+ }
9
+
10
+ import TranslationLocaleSelectController from "./admin/translation_locale_select_controller";
11
+ application.register("translations-locale-select", TranslationLocaleSelectController);
@@ -1,7 +1,4 @@
1
1
  = form.fieldset do
2
- - I18n.with_locale(@target_locale) do
3
- = form.input :_disabled_for_locale, as: :boolean, label: t("para.i18n.disabled_for_locale")
4
-
5
2
  - translated_model_fields_for(form.object.class).each do |field|
6
3
  = form.input field.field_name, as: :i18n
7
4
 
@@ -0,0 +1,9 @@
1
+ - if form.object.class.translates? && form.options["locale"]
2
+ -# Process the label value here while we're in the locale of the UI, and not in the
3
+ -# target translation locale
4
+ - label = t("para.i18n.disabled_for_locale")
5
+
6
+ - I18n.with_locale(form.options["locale"]) do
7
+ = form.input :_disabled_for_locale, as: :boolean, label:
8
+
9
+ = render partial: find_partial_for(form.object.class, "translations_fields"), locals: local_assigns
@@ -2,9 +2,6 @@
2
2
  = target_locale_select
3
3
 
4
4
  = form.fieldset do
5
- - I18n.with_locale(@target_locale) do
6
- = form.input :_disabled_for_locale, as: :boolean, label: t("para.i18n.disabled_for_locale")
7
-
8
5
  - translated_model_fields_for(resource.class).each do |field|
9
6
  = form.input field.field_name, as: :i18n
10
7
 
@@ -0,0 +1,17 @@
1
+ <div class="block form-inputs">
2
+ <div class="form-group">
3
+ <%= label :target_locale, t('para.i18n.choose_locale'), class: 'control-label col-md-3 pull-left' %>
4
+
5
+ <div class="col-md-9">
6
+ <%= select_tag :target_locale,
7
+ options_for_select(
8
+ locales.map { |locale| [locale, locale] }, target_locale),
9
+ data: {
10
+ controller: "translations-locale-select",
11
+ action: "change->translations-locale-select#switchLocale",
12
+ "translations-locale-select-path-template-value": translations_form_locale_path_for(resource, "__locale__"),
13
+ }
14
+ %>
15
+ </div>
16
+ </div>
17
+ </div>
data/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ (() => {
2
+ // app/javascripts/para/admin/translation.js
3
+ var TranslationLocaleSelect;
4
+ TranslationLocaleSelect = class TranslationLocaleSelect2 {
5
+ static onChange($field) {
6
+ var targetLocale, targetURL;
7
+ targetURL = $field.data("locale-select-target-url");
8
+ targetLocale = $field.val();
9
+ targetURL = targetURL.replace("target_locale=_", ["target_locale", targetLocale].join("="));
10
+ return Turbolinks.visit(targetURL.replace(":locale", targetLocale));
11
+ }
12
+ };
13
+ $(document).on("turbo:load turbo:frame-load", function() {
14
+ return $("body").on("change", "[data-locale-select]", function(e) {
15
+ return TranslationLocaleSelect.onChange($(e.currentTarget));
16
+ });
17
+ });
18
+ })();
19
+ //# sourceMappingURL=index.js.map
data/dist/index.js.map ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../app/javascripts/para/admin/translation.js"],
4
+ "sourcesContent": ["var TranslationLocaleSelect;\n\nTranslationLocaleSelect = class TranslationLocaleSelect {\n static onChange($field) {\n var targetLocale, targetURL;\n targetURL = $field.data('locale-select-target-url');\n targetLocale = $field.val();\n targetURL = targetURL.replace('target_locale=_', ['target_locale', targetLocale].join('='));\n return Turbolinks.visit(targetURL.replace(':locale', targetLocale));\n }\n\n};\n\n$(document).on('turbo:load turbo:frame-load', function() {\n return $('body').on('change', '[data-locale-select]', function(e) {\n return TranslationLocaleSelect.onChange($(e.currentTarget));\n });\n});\n"],
5
+ "mappings": ";;AAAA,MAAI;AAEJ,4BAA0B,MAAMA,yBAAwB;AAAA,IACtD,OAAO,SAAS,QAAQ;AACtB,UAAI,cAAc;AAClB,kBAAY,OAAO,KAAK,0BAA0B;AAClD,qBAAe,OAAO,IAAI;AAC1B,kBAAY,UAAU,QAAQ,mBAAmB,CAAC,iBAAiB,YAAY,EAAE,KAAK,GAAG,CAAC;AAC1F,aAAO,WAAW,MAAM,UAAU,QAAQ,WAAW,YAAY,CAAC;AAAA,IACpE;AAAA,EAEF;AAEA,IAAE,QAAQ,EAAE,GAAG,+BAA+B,WAAW;AACvD,WAAO,EAAE,MAAM,EAAE,GAAG,UAAU,wBAAwB,SAAS,GAAG;AAChE,aAAO,wBAAwB,SAAS,EAAE,EAAE,aAAa,CAAC;AAAA,IAC5D,CAAC;AAAA,EACH,CAAC;",
6
+ "names": ["TranslationLocaleSelect"]
7
+ }
@@ -38,7 +38,7 @@ module Para
38
38
  # a different nested fields partial when the builder is a translations form
39
39
  #
40
40
  def nested_fields_partial_name
41
- translations_form? ? :translations_fields : :fields
41
+ translations_form? ? :translations_fields_container : :fields
42
42
  end
43
43
  end
44
44
  end
@@ -76,7 +76,7 @@ module FriendlyId
76
76
  where(friendly_id_config.query_field => id)
77
77
  else
78
78
  json_path = "{#{ locale },#{ friendly_id_config.query_field }}"
79
- where("_translations#>>'#{ json_path }' = ?", id)
79
+ where("#{table_name}._translations#>>'#{ json_path }' = ?", id)
80
80
  end
81
81
  end
82
82
  end
@@ -6,6 +6,29 @@ module Para
6
6
  included do
7
7
  class_attribute :translated_attribute_names
8
8
  class_attribute :translatable
9
+
10
+ # Fetch all records of the current model that are not disabled for the provided
11
+ # locale, which also includes models that are not translatable and records of
12
+ # translatable models that are not translated for the current locale.
13
+ #
14
+ scope :enabled_for_locale, ->(locale = I18n.locale) {
15
+ # Models that are not translatable don't have the `_translations` column, so we
16
+ # avoid any query for them.
17
+ next all unless translates?
18
+
19
+ with_disabled_for_locale_state(disabled: false, locale: locale)
20
+ }
21
+
22
+ # Fetch all records of the current model that are explicitly disabled for the
23
+ # provided locale.
24
+ #
25
+ scope :disabled_for_locale, ->(locale = I18n.locale) {
26
+ # Models that are not translatable don't have the `_translations` column, so we
27
+ # avoid any query for them.
28
+ next none unless translates?
29
+
30
+ with_disabled_for_locale_state(disabled: true, locale: locale)
31
+ }
9
32
  end
10
33
 
11
34
  def read_translated_attribute(field, locale = ::I18n.locale)
@@ -103,6 +126,18 @@ module Para
103
126
  translatable
104
127
  end
105
128
 
129
+ # This methods is used by both the enabled_for_locale and disabled_for_locale
130
+ # scopes to filter the records based on the _disabled_for_locale attribute stored
131
+ # in the translations JSONB column for the provided locale.
132
+ def with_disabled_for_locale_state(disabled:, locale: I18n.locale)
133
+ predicate = disabled ? 'IN' : 'NOT IN'
134
+
135
+ where(<<-SQL.squish, locale, %w[1 t true])
136
+ COALESCE(#{table_name}._translations->?->>'_disabled_for_locale', '0')
137
+ #{predicate} (?)
138
+ SQL
139
+ end
140
+
106
141
  private
107
142
 
108
143
  def prepare_attribute_translation(attribute)
@@ -5,9 +5,14 @@ module Para
5
5
  return unless resource.class.translates? && view.can?(:translate, resource)
6
6
 
7
7
  path = component.relation_path(resource, :translation, action: :edit)
8
- options = { class: 'btn btn-default' }
9
8
 
10
- view.link_to(path, options) do
9
+ options = {
10
+ class: 'btn btn-sm btn-icon-info btn-shadow hint--left',
11
+ data: { 'turbo-frame': '_top' },
12
+ aria: { label: I18n.t('para.i18n.translate') }
13
+ }
14
+
15
+ view.link_to(path, **options) do
11
16
  content_tag(:i, '', class: 'fa fa-globe')
12
17
  end
13
18
  end
@@ -1,5 +1,5 @@
1
1
  module Para
2
2
  module I18n
3
- VERSION = "0.5.0"
3
+ VERSION = '0.5.2'.freeze
4
4
  end
5
5
  end
data/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@para/i18n",
3
+ "version": "1.0.2",
4
+ "description": "Javascript engine for Para's I18n Extension",
5
+ "main": "app/javascripts/para/i18n.js",
6
+ "files": [
7
+ "app/javascripts/para"
8
+ ],
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/respublica-conseil/simple_form_extension.git"
12
+ },
13
+ "author": "Valentin Ballestrino",
14
+ "license": "MIT",
15
+ "homepage": "https://github.com/respublica-conseil/simple_form_extension",
16
+ "dependencies": {
17
+ "tom-select": "^2.2.2"
18
+ },
19
+ "peerDependencies": {
20
+ "jquery": "^3.6.0",
21
+ "@hotwired/stimulus": "^3.2.2",
22
+ "@para/para": "^1.0.0"
23
+ },
24
+ "devDependencies": {
25
+ "esbuild": "^0.19.8"
26
+ }
27
+ }
data/yarn.lock ADDED
@@ -0,0 +1,161 @@
1
+ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ # yarn lockfile v1
3
+
4
+
5
+ "@esbuild/android-arm64@0.19.8":
6
+ version "0.19.8"
7
+ resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.19.8.tgz#fb7130103835b6d43ea499c3f30cfb2b2ed58456"
8
+ integrity sha512-B8JbS61bEunhfx8kasogFENgQfr/dIp+ggYXwTqdbMAgGDhRa3AaPpQMuQU0rNxDLECj6FhDzk1cF9WHMVwrtA==
9
+
10
+ "@esbuild/android-arm@0.19.8":
11
+ version "0.19.8"
12
+ resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.19.8.tgz#b46e4d9e984e6d6db6c4224d72c86b7757e35bcb"
13
+ integrity sha512-31E2lxlGM1KEfivQl8Yf5aYU/mflz9g06H6S15ITUFQueMFtFjESRMoDSkvMo8thYvLBax+VKTPlpnx+sPicOA==
14
+
15
+ "@esbuild/android-x64@0.19.8":
16
+ version "0.19.8"
17
+ resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.19.8.tgz#a13db9441b5a4f4e4fec4a6f8ffacfea07888db7"
18
+ integrity sha512-rdqqYfRIn4jWOp+lzQttYMa2Xar3OK9Yt2fhOhzFXqg0rVWEfSclJvZq5fZslnz6ypHvVf3CT7qyf0A5pM682A==
19
+
20
+ "@esbuild/darwin-arm64@0.19.8":
21
+ version "0.19.8"
22
+ resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.19.8.tgz#49f5718d36541f40dd62bfdf84da9c65168a0fc2"
23
+ integrity sha512-RQw9DemMbIq35Bprbboyf8SmOr4UXsRVxJ97LgB55VKKeJOOdvsIPy0nFyF2l8U+h4PtBx/1kRf0BelOYCiQcw==
24
+
25
+ "@esbuild/darwin-x64@0.19.8":
26
+ version "0.19.8"
27
+ resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.19.8.tgz#75c5c88371eea4bfc1f9ecfd0e75104c74a481ac"
28
+ integrity sha512-3sur80OT9YdeZwIVgERAysAbwncom7b4bCI2XKLjMfPymTud7e/oY4y+ci1XVp5TfQp/bppn7xLw1n/oSQY3/Q==
29
+
30
+ "@esbuild/freebsd-arm64@0.19.8":
31
+ version "0.19.8"
32
+ resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.8.tgz#9d7259fea4fd2b5f7437b52b542816e89d7c8575"
33
+ integrity sha512-WAnPJSDattvS/XtPCTj1tPoTxERjcTpH6HsMr6ujTT+X6rylVe8ggxk8pVxzf5U1wh5sPODpawNicF5ta/9Tmw==
34
+
35
+ "@esbuild/freebsd-x64@0.19.8":
36
+ version "0.19.8"
37
+ resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.19.8.tgz#abac03e1c4c7c75ee8add6d76ec592f46dbb39e3"
38
+ integrity sha512-ICvZyOplIjmmhjd6mxi+zxSdpPTKFfyPPQMQTK/w+8eNK6WV01AjIztJALDtwNNfFhfZLux0tZLC+U9nSyA5Zg==
39
+
40
+ "@esbuild/linux-arm64@0.19.8":
41
+ version "0.19.8"
42
+ resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.19.8.tgz#c577932cf4feeaa43cb9cec27b89cbe0df7d9098"
43
+ integrity sha512-z1zMZivxDLHWnyGOctT9JP70h0beY54xDDDJt4VpTX+iwA77IFsE1vCXWmprajJGa+ZYSqkSbRQ4eyLCpCmiCQ==
44
+
45
+ "@esbuild/linux-arm@0.19.8":
46
+ version "0.19.8"
47
+ resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.19.8.tgz#d6014d8b98b5cbc96b95dad3d14d75bb364fdc0f"
48
+ integrity sha512-H4vmI5PYqSvosPaTJuEppU9oz1dq2A7Mr2vyg5TF9Ga+3+MGgBdGzcyBP7qK9MrwFQZlvNyJrvz6GuCaj3OukQ==
49
+
50
+ "@esbuild/linux-ia32@0.19.8":
51
+ version "0.19.8"
52
+ resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.19.8.tgz#2379a0554307d19ac4a6cdc15b08f0ea28e7a40d"
53
+ integrity sha512-1a8suQiFJmZz1khm/rDglOc8lavtzEMRo0v6WhPgxkrjcU0LkHj+TwBrALwoz/OtMExvsqbbMI0ChyelKabSvQ==
54
+
55
+ "@esbuild/linux-loong64@0.19.8":
56
+ version "0.19.8"
57
+ resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.19.8.tgz#e2a5bbffe15748b49356a6cd7b2d5bf60c5a7123"
58
+ integrity sha512-fHZWS2JJxnXt1uYJsDv9+b60WCc2RlvVAy1F76qOLtXRO+H4mjt3Tr6MJ5l7Q78X8KgCFudnTuiQRBhULUyBKQ==
59
+
60
+ "@esbuild/linux-mips64el@0.19.8":
61
+ version "0.19.8"
62
+ resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.19.8.tgz#1359331e6f6214f26f4b08db9b9df661c57cfa24"
63
+ integrity sha512-Wy/z0EL5qZYLX66dVnEg9riiwls5IYnziwuju2oUiuxVc+/edvqXa04qNtbrs0Ukatg5HEzqT94Zs7J207dN5Q==
64
+
65
+ "@esbuild/linux-ppc64@0.19.8":
66
+ version "0.19.8"
67
+ resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.19.8.tgz#9ba436addc1646dc89dae48c62d3e951ffe70951"
68
+ integrity sha512-ETaW6245wK23YIEufhMQ3HSeHO7NgsLx8gygBVldRHKhOlD1oNeNy/P67mIh1zPn2Hr2HLieQrt6tWrVwuqrxg==
69
+
70
+ "@esbuild/linux-riscv64@0.19.8":
71
+ version "0.19.8"
72
+ resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.19.8.tgz#fbcf0c3a0b20f40b5fc31c3b7695f0769f9de66b"
73
+ integrity sha512-T2DRQk55SgoleTP+DtPlMrxi/5r9AeFgkhkZ/B0ap99zmxtxdOixOMI570VjdRCs9pE4Wdkz7JYrsPvsl7eESg==
74
+
75
+ "@esbuild/linux-s390x@0.19.8":
76
+ version "0.19.8"
77
+ resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.19.8.tgz#989e8a05f7792d139d5564ffa7ff898ac6f20a4a"
78
+ integrity sha512-NPxbdmmo3Bk7mbNeHmcCd7R7fptJaczPYBaELk6NcXxy7HLNyWwCyDJ/Xx+/YcNH7Im5dHdx9gZ5xIwyliQCbg==
79
+
80
+ "@esbuild/linux-x64@0.19.8":
81
+ version "0.19.8"
82
+ resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.19.8.tgz#b187295393a59323397fe5ff51e769ec4e72212b"
83
+ integrity sha512-lytMAVOM3b1gPypL2TRmZ5rnXl7+6IIk8uB3eLsV1JwcizuolblXRrc5ShPrO9ls/b+RTp+E6gbsuLWHWi2zGg==
84
+
85
+ "@esbuild/netbsd-x64@0.19.8":
86
+ version "0.19.8"
87
+ resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.19.8.tgz#c1ec0e24ea82313cb1c7bae176bd5acd5bde7137"
88
+ integrity sha512-hvWVo2VsXz/8NVt1UhLzxwAfo5sioj92uo0bCfLibB0xlOmimU/DeAEsQILlBQvkhrGjamP0/el5HU76HAitGw==
89
+
90
+ "@esbuild/openbsd-x64@0.19.8":
91
+ version "0.19.8"
92
+ resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.19.8.tgz#0c5b696ac66c6d70cf9ee17073a581a28af9e18d"
93
+ integrity sha512-/7Y7u77rdvmGTxR83PgaSvSBJCC2L3Kb1M/+dmSIvRvQPXXCuC97QAwMugBNG0yGcbEGfFBH7ojPzAOxfGNkwQ==
94
+
95
+ "@esbuild/sunos-x64@0.19.8":
96
+ version "0.19.8"
97
+ resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.19.8.tgz#2a697e1f77926ff09fcc457d8f29916d6cd48fb1"
98
+ integrity sha512-9Lc4s7Oi98GqFA4HzA/W2JHIYfnXbUYgekUP/Sm4BG9sfLjyv6GKKHKKVs83SMicBF2JwAX6A1PuOLMqpD001w==
99
+
100
+ "@esbuild/win32-arm64@0.19.8":
101
+ version "0.19.8"
102
+ resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.19.8.tgz#ec029e62a2fca8c071842ecb1bc5c2dd20b066f1"
103
+ integrity sha512-rq6WzBGjSzihI9deW3fC2Gqiak68+b7qo5/3kmB6Gvbh/NYPA0sJhrnp7wgV4bNwjqM+R2AApXGxMO7ZoGhIJg==
104
+
105
+ "@esbuild/win32-ia32@0.19.8":
106
+ version "0.19.8"
107
+ resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.19.8.tgz#cbb9a3146bde64dc15543e48afe418c7a3214851"
108
+ integrity sha512-AIAbverbg5jMvJznYiGhrd3sumfwWs8572mIJL5NQjJa06P8KfCPWZQ0NwZbPQnbQi9OWSZhFVSUWjjIrn4hSw==
109
+
110
+ "@esbuild/win32-x64@0.19.8":
111
+ version "0.19.8"
112
+ resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.19.8.tgz#c8285183dbdb17008578dbacb6e22748709b4822"
113
+ integrity sha512-bfZ0cQ1uZs2PqpulNL5j/3w+GDhP36k1K5c38QdQg+Swy51jFZWWeIkteNsufkQxp986wnqRRsb/bHbY1WQ7TA==
114
+
115
+ "@orchidjs/sifter@^1.0.3":
116
+ version "1.0.3"
117
+ resolved "https://registry.yarnpkg.com/@orchidjs/sifter/-/sifter-1.0.3.tgz#43f42519472282eb632d0a1589184f044d64129b"
118
+ integrity sha512-zCZbwKegHytfsPm8Amcfh7v/4vHqTAaOu6xFswBYcn8nznBOuseu6COB2ON7ez0tFV0mKL0nRNnCiZZA+lU9/g==
119
+ dependencies:
120
+ "@orchidjs/unicode-variants" "^1.0.4"
121
+
122
+ "@orchidjs/unicode-variants@^1.0.4":
123
+ version "1.0.4"
124
+ resolved "https://registry.yarnpkg.com/@orchidjs/unicode-variants/-/unicode-variants-1.0.4.tgz#6d2f812e3b19545bba2d81caffff1204de9a6a58"
125
+ integrity sha512-NvVBRnZNE+dugiXERFsET1JlKZfM5lJDEpSMilKW4bToYJ7pxf0Zne78xyXB2ny2c2aHfJ6WLnz1AaTNHAmQeQ==
126
+
127
+ esbuild@^0.19.8:
128
+ version "0.19.8"
129
+ resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.19.8.tgz#ad05b72281d84483fa6b5345bd246c27a207b8f1"
130
+ integrity sha512-l7iffQpT2OrZfH2rXIp7/FkmaeZM0vxbxN9KfiCwGYuZqzMg/JdvX26R31Zxn/Pxvsrg3Y9N6XTcnknqDyyv4w==
131
+ optionalDependencies:
132
+ "@esbuild/android-arm" "0.19.8"
133
+ "@esbuild/android-arm64" "0.19.8"
134
+ "@esbuild/android-x64" "0.19.8"
135
+ "@esbuild/darwin-arm64" "0.19.8"
136
+ "@esbuild/darwin-x64" "0.19.8"
137
+ "@esbuild/freebsd-arm64" "0.19.8"
138
+ "@esbuild/freebsd-x64" "0.19.8"
139
+ "@esbuild/linux-arm" "0.19.8"
140
+ "@esbuild/linux-arm64" "0.19.8"
141
+ "@esbuild/linux-ia32" "0.19.8"
142
+ "@esbuild/linux-loong64" "0.19.8"
143
+ "@esbuild/linux-mips64el" "0.19.8"
144
+ "@esbuild/linux-ppc64" "0.19.8"
145
+ "@esbuild/linux-riscv64" "0.19.8"
146
+ "@esbuild/linux-s390x" "0.19.8"
147
+ "@esbuild/linux-x64" "0.19.8"
148
+ "@esbuild/netbsd-x64" "0.19.8"
149
+ "@esbuild/openbsd-x64" "0.19.8"
150
+ "@esbuild/sunos-x64" "0.19.8"
151
+ "@esbuild/win32-arm64" "0.19.8"
152
+ "@esbuild/win32-ia32" "0.19.8"
153
+ "@esbuild/win32-x64" "0.19.8"
154
+
155
+ tom-select@^2.2.2:
156
+ version "2.3.1"
157
+ resolved "https://registry.yarnpkg.com/tom-select/-/tom-select-2.3.1.tgz#df338d9082874cd0bceb3bee87ed0184447c47f1"
158
+ integrity sha512-QS4vnOcB6StNGqX4sGboGXL2fkhBF2gIBB+8Hwv30FZXYPn0CyYO8kkdATRvwfCTThxiR4WcXwKJZ3cOmtI9eg==
159
+ dependencies:
160
+ "@orchidjs/sifter" "^1.0.3"
161
+ "@orchidjs/unicode-variants" "^1.0.4"
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.5.0
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valentin Ballestrino
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-09 00:00:00.000000000 Z
11
+ date: 2025-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: para
@@ -82,21 +82,26 @@ files:
82
82
  - ".gitignore"
83
83
  - ".rspec"
84
84
  - ".travis.yml"
85
+ - ".vscode/settings.json"
85
86
  - Gemfile
86
87
  - LICENSE.txt
87
88
  - README.md
88
89
  - Rakefile
89
- - app/assets/javascripts/para/admin/translation.coffee
90
- - app/assets/javascripts/para/i18n.coffee
91
90
  - app/controllers/para/admin/translations_controller.rb
92
91
  - app/helpers/para/i18n/form_helper.rb
92
+ - app/helpers/para/i18n/urls_helper.rb
93
+ - app/javascripts/para/admin/translation_locale_select_controller.js
94
+ - app/javascripts/para/i18n.js
93
95
  - app/views/para/admin/resources/_translations_fields.html.haml
96
+ - app/views/para/admin/resources/_translations_fields_container.html.haml
94
97
  - app/views/para/admin/resources/_translations_form.html.haml
95
- - app/views/para/admin/translations/_target_locale_select.html.haml
98
+ - app/views/para/admin/translations/_target_locale_select.html.erb
96
99
  - app/views/para/admin/translations/edit.html.haml
97
100
  - bin/console
98
101
  - bin/setup
99
102
  - config/locales/para-i18n.fr.yml
103
+ - dist/index.js
104
+ - dist/index.js.map
100
105
  - lib/generators/para/i18n/base_form_generator.rb
101
106
  - lib/generators/para/i18n/form/form_generator.rb
102
107
  - lib/generators/para/i18n/form/templates/_translations_form.html.haml
@@ -125,12 +130,14 @@ files:
125
130
  - lib/para/i18n/resources_buttons.rb
126
131
  - lib/para/i18n/resources_table.rb
127
132
  - lib/para/i18n/version.rb
133
+ - package.json
128
134
  - para-i18n.gemspec
135
+ - yarn.lock
129
136
  homepage: https://github.com/para-cms/para-i18n
130
137
  licenses:
131
138
  - MIT
132
139
  metadata: {}
133
- post_install_message:
140
+ post_install_message:
134
141
  rdoc_options: []
135
142
  require_paths:
136
143
  - lib
@@ -145,8 +152,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
152
  - !ruby/object:Gem::Version
146
153
  version: '0'
147
154
  requirements: []
148
- rubygems_version: 3.1.4
149
- signing_key:
155
+ rubygems_version: 3.5.16
156
+ signing_key:
150
157
  specification_version: 4
151
158
  summary: Para CMS I18n admin module for models
152
159
  test_files: []
@@ -1,10 +0,0 @@
1
- class TranslationLocaleSelect
2
- @onChange = ($field) ->
3
- targetURL = $field.data('locale-select-target-url')
4
- targetLocale = $field.val()
5
- targetURL = targetURL.replace('target_locale=_', ['target_locale', targetLocale].join('='))
6
- Turbolinks.visit(targetURL.replace(':locale', targetLocale))
7
-
8
- $(document).on 'page:change turbolinks:load', ->
9
- $('body').on 'change', '[data-locale-select]', (e) ->
10
- TranslationLocaleSelect.onChange($(e.currentTarget))
@@ -1 +0,0 @@
1
- #= require ./admin/translation
@@ -1,5 +0,0 @@
1
- .block.form-inputs
2
- .form-group
3
- = label :target_locale, t('para.i18n.choose_locale'), class: 'control-label col-md-3 pull-left'
4
- .col-md-9
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: '_') }