locales_panel 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/README.md +8 -23
- data/app/controllers/locales_controller.rb +6 -3
- data/app/views/locales/edit.html.erb +4 -3
- data/lib/locales_panel/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: afaa0acd3da6432f5873d66a771e287ffa411185
|
|
4
|
+
data.tar.gz: 0fed03c8e8d14057aa3d426ed3c0f3b4e35259ec
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7626041cbf2d73a5ff23c44c0bf3656d26741b725e0d1a3346199bc8465bfbc02881795903a97e32386aca16a5d253db17da6a36f86ba59e0fe3843942132dca
|
|
7
|
+
data.tar.gz: 6585a358eeab09b86718f3001b40f5c940f25ee71e2499a8ea85559b29153f733863b4f7b26389c150a0102e4e284972acefe684347475afa635689574cbb53c
|
data/README.md
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
**Major issues, too early for use**
|
|
2
|
-
- shows readonly locales from application's gems
|
|
3
|
-
- could be hacked to overwrite non locale files
|
|
4
|
-
|
|
5
|
-
---
|
|
6
1
|
# Locales Panel
|
|
7
2
|
|
|
8
3
|
Change translations directly in a published site.
|
|
9
4
|
|
|
10
|
-
Use by visiting `http://.../locales/edit`. Saving
|
|
11
|
-
|
|
12
|
-
When ready for upload, push files from the server to your application's git repository.
|
|
5
|
+
Use by visiting `http://.../locales/edit`. Saving will overwrite YAML locales files.
|
|
13
6
|
|
|
14
7
|
# Installation
|
|
15
8
|
|
|
@@ -21,26 +14,18 @@ Run in console:
|
|
|
21
14
|
|
|
22
15
|
$ bundle
|
|
23
16
|
|
|
24
|
-
To enable live changes, be sure to run with Rails configuration option (typical for non-production):
|
|
25
|
-
|
|
26
|
-
config.cache_classes = false
|
|
27
|
-
|
|
28
17
|
# Join
|
|
29
18
|
|
|
30
19
|
Create pull request or contact on [skype chat](http://kapustka.net/chat?user=kapustka.maciek).
|
|
31
20
|
|
|
32
|
-
**
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
**todos**
|
|
37
|
-
- css
|
|
38
|
-
- reload I18n after change
|
|
21
|
+
**todo**
|
|
22
|
+
- hook for authorization
|
|
23
|
+
- configurable route
|
|
39
24
|
- download link
|
|
40
25
|
- add to git link
|
|
41
|
-
-
|
|
26
|
+
- check with rails 3
|
|
42
27
|
- validation
|
|
43
28
|
- highlight untranslated
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
29
|
+
- translate editor itself
|
|
30
|
+
- css
|
|
31
|
+
- tests for indentation fix, security fix and I18n.reload
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
class LocalesController < ApplicationController
|
|
2
|
+
before_action { @paths = Rails.configuration.i18n.load_path.delete_if{|path|path['/gems/']}}
|
|
3
|
+
|
|
2
4
|
def edit
|
|
3
5
|
@files = []
|
|
4
|
-
|
|
5
|
-
@files << { path: path, name: File::basename(path)[0..-5], content: File.read(path) }
|
|
6
|
+
@paths.each do |path|
|
|
7
|
+
@files << { path: path, name: File::basename(path)[0..-5], content: File.read(path).gsub("\n",'
').html_safe }
|
|
6
8
|
end
|
|
7
9
|
end
|
|
8
10
|
|
|
9
11
|
def update
|
|
10
|
-
params[:files].each do |file|
|
|
12
|
+
params[:files].keep_if{|file| file[:path].in? @paths}.each do |file|
|
|
11
13
|
File.write file[:path], file[:content].gsub("\r",'')
|
|
12
14
|
end
|
|
15
|
+
I18n.reload!
|
|
13
16
|
redirect_to edit_locales_path
|
|
14
17
|
end
|
|
15
18
|
end
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<%= form_tag(locales_path, method: :put) do %>
|
|
2
2
|
<% @files.each do |file| %>
|
|
3
3
|
<h2><%= file[:name] %></h2>
|
|
4
|
-
<input type="hidden" name="files[][path]" value="<%= file[:path] %>"
|
|
4
|
+
<input type="hidden" name="files[][path]" value="<%= file[:path] %>"/>
|
|
5
5
|
<textarea name="files[][content]" cols="80" rows="20" wrap="off" style="width:100%"><%= file[:content] %></textarea>
|
|
6
6
|
<% end %>
|
|
7
|
-
<input type="submit" value="submit"
|
|
8
|
-
<% end %>
|
|
7
|
+
<input type="submit" value="submit"/>
|
|
8
|
+
<% end %>
|
|
9
|
+
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: locales_panel
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Maciej Kasprzyk
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-04-
|
|
11
|
+
date: 2015-04-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|