i18n-edit 0.9.1 → 0.9.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
  SHA1:
3
- metadata.gz: 3ad00e44a3f56ab3ed72383ef51edf3d0602a30a
4
- data.tar.gz: 1fdbb697ad5b587c6dc05e7ae6c44599dfb23431
3
+ metadata.gz: f3802b3756136865be2d5c0b85a3e46cfe3ff475
4
+ data.tar.gz: 994ad7604abd7c69f35ff16061b62dae0a13b261
5
5
  SHA512:
6
- metadata.gz: f501a7a3b635c9f08810ee71f15be5772dab8c387f9d456f414eb78c7fce892d33574c5ed7ca09eaa0568f46139cb27d73012a85cc6843aaebf4af895ecc9664
7
- data.tar.gz: ce3a0577d2fd2aef29daff6c10f793bc612ee238da18dfc161a12bd05f978fa9a9705c9e310ea2c1d0e49617dbb34281bf1deb635fbc4c499d8411de45c729db
6
+ metadata.gz: 825cc241291bc7d9dee948aaa3df6e60ebb43448ca757085756a26d87dcef6f54283dc9d602542a58a1635a9282bd2be41a65e415e37225d2976ae9cc6e00cff
7
+ data.tar.gz: ef36ba8ea09851705fc43665c6a355cadd72855f2d22db6fed4e035027934fd50a1e36005ea31846b6e60399a3780e642f0cc479a4166d4675a53601f3169139
data/README.md CHANGED
@@ -33,22 +33,32 @@ Add this line to your routes in config/routes:
33
33
 
34
34
  i18n_edit_routes
35
35
 
36
- In app/views/layouts, add this line within the <head> element of your layout (or
37
- more than one layout, depending on your project), to include the required Javascript
38
- file:
36
+ In app/views/layouts, add this line within the head of your layout (or more than one
37
+ layout, depending on your project), to include the required Javascript file. Versions
38
+ for the Slim and ERB template languages are shown:
39
+
40
+ Slim version:
39
41
 
40
42
  = i18n_edit_assets
41
43
 
44
+ ERB version:
45
+
46
+ <%= i18n_edit_assets %>
47
+
42
48
  ## How It Works
43
49
  If I18N_EDIT is not set in the environment, this gem does nothing and should not
44
50
  harm your application or its security. When it's set, the magic happens.
45
51
 
46
52
  I18n.translate() is patched to emit a html-safe span containing the editable translation
47
- text, with the contenteditable attribute set. Javascript catches all of the
48
- internationalized attributes containing this span, removes it, and places a span
49
- around the HTML node instead. Javascript is used to catch editing events and requests
50
- to update the locale text to your rails project. A controller and routes are added to
51
- handle those requests.
53
+ text, with the contenteditable attribute set. This works for internationalized texts.
54
+ It would not work for internationalized attributes of HTML nodes, because spans in
55
+ attributes don't parse. So our javascript catches all of the internationalized
56
+ attributes of HTML nodes containing our special span, removes the span from the
57
+ attribute (leaving the text), and places a special span around the HTML node which
58
+ contains the attribute instead. Javascript is used to catch events on our special spans,
59
+ which allow in-place editing and context menus. Our javascript posts requests to Rails
60
+ to update the locale text that you have edited. A controller and routes are added to
61
+ your Rails project to handle those requests.
52
62
 
53
63
  Only locale files under the root of your rails project (rather than ones in gems, etc.)
54
64
  will be edited. Locale files are replaced using the link-create-write-fsync-rename
@@ -87,7 +87,7 @@ module I18n::Edit
87
87
  render plain: "I18_EDIT is not set in the environment.", status: 201;
88
88
  throw :abort
89
89
  elsif !token_valid?(params)
90
- thorw :abort
90
+ throw :abort
91
91
  end
92
92
  end
93
93
 
@@ -1,5 +1,5 @@
1
1
  module I18n
2
2
  module Edit
3
- VERSION = '0.9.1'
3
+ VERSION = '0.9.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-edit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruce Perens
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-28 00:00:00.000000000 Z
11
+ date: 2017-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sysrandom