trestle-mobility 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -3
- data/app/views/trestle/mobility/_text_area.html.erb +6 -8
- data/app/views/trestle/mobility/_text_field.html.erb +6 -8
- data/lib/trestle/mobility/text_area.rb +3 -2
- data/lib/trestle/mobility/text_field.rb +1 -1
- data/lib/trestle/mobility/version.rb +1 -1
- data/screenshot.png +0 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b024ad069d14e6c5e42fb4a0cfc42d6e5469316f4ab1c3c3bb1e4274f34b044a
|
4
|
+
data.tar.gz: 1b0ea2bb3aeac07751382ba28b6ba151fee47c3da098d948c4624b0e4deabf4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcbce616ed0a7a43c1b79877da54c7804fd7634054870d1a41f46f89fd7b684b4cd4a120dc0e0af14d280c8863e8727b3ae90b39532efcdae1fdef71a557a801
|
7
|
+
data.tar.gz: dcbf2ea3f704dfa59fc25a2cd6c7537ec3f467bd0f5792e673ed01979450e9f1aa7a5d7cb0abec29570791cc9feec91785af4a67e804eeadfccca15e1cfa83db
|
data/README.md
CHANGED
@@ -6,9 +6,11 @@
|
|
6
6
|
|
7
7
|
## Features / problems
|
8
8
|
|
9
|
-
-
|
10
|
-
-
|
11
|
-
-
|
9
|
+
- Manage Mobility translations with a tabbed interface in trestle
|
10
|
+
- Supports Postgres container back-end
|
11
|
+
- Probably works with other back-ends but has not been tested
|
12
|
+
|
13
|
+
![Trestle Mobility screenshot](/screenshot.png?raw=true "Trestle Mobility screenshot")
|
12
14
|
|
13
15
|
## Usage
|
14
16
|
|
@@ -26,6 +28,18 @@ Trestle.resource(:posts) do
|
|
26
28
|
end
|
27
29
|
```
|
28
30
|
|
31
|
+
### Specifying locales
|
32
|
+
|
33
|
+
By default Trestle Mobility uses `I18n.available_locales` to generate the form fields, but you can specify this on a per-field basis:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
mobility_text_field :title, locales: %w(nl de fr)
|
37
|
+
```
|
38
|
+
|
39
|
+
Quoting from Mobility's README:
|
40
|
+
|
41
|
+
> (Note however that Mobility will complain if you have I18n.enforce_available_locales set to true and you try accessing a locale not present in I18n.available_locales; set it to false if you want to allow any locale.)
|
42
|
+
|
29
43
|
## Installation
|
30
44
|
|
31
45
|
These instructions assume you have a working Trestle application. To integrate trestle-mobility, first add it to your application's Gemfile:
|
@@ -7,13 +7,11 @@
|
|
7
7
|
<% end %>
|
8
8
|
</ul>
|
9
9
|
|
10
|
-
<div class="
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
<% end %>
|
17
|
-
</div>
|
10
|
+
<div class="tab-content">
|
11
|
+
<% locales.each.with_index do |locale, index| %>
|
12
|
+
<div role="tabpanel" class="tab-pane<%= " active" if index.zero? %>" id="<%= "#{field_name}_#{locale}" %>">
|
13
|
+
<%= form.text_area "#{field_name}_#{locale}", label: false, placeholder: "#{field_name.capitalize} (#{locale.upcase})", rows: rows %>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
18
16
|
</div>
|
19
17
|
</div>
|
@@ -7,13 +7,11 @@
|
|
7
7
|
<% end %>
|
8
8
|
</ul>
|
9
9
|
|
10
|
-
<div class="
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
<% end %>
|
17
|
-
</div>
|
10
|
+
<div class="tab-content">
|
11
|
+
<% locales.each.with_index do |locale, index| %>
|
12
|
+
<div role="tabpanel" class="tab-pane<%= " active" if index.zero? %>" id="<%= "#{field_name}_#{locale}" %>">
|
13
|
+
<%= form.text_field "#{field_name}_#{locale}", label: false, placeholder: "#{field_name.capitalize} (#{locale.upcase})" %>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
18
16
|
</div>
|
19
17
|
</div>
|
@@ -3,10 +3,11 @@ module Trestle
|
|
3
3
|
class TextArea < Trestle::Form::Field
|
4
4
|
def field
|
5
5
|
instance = builder.object
|
6
|
-
locales =
|
6
|
+
locales = options[:locales] || I18n.available_locales.sort
|
7
|
+
rows = options[:rows] || 5
|
7
8
|
|
8
9
|
@template.render partial: "trestle/mobility/text_area",
|
9
|
-
locals: { field_name: name, locales: locales }
|
10
|
+
locals: { field_name: name, locales: locales, rows: rows }
|
10
11
|
end
|
11
12
|
end
|
12
13
|
end
|
@@ -3,7 +3,7 @@ module Trestle
|
|
3
3
|
class TextField < Trestle::Form::Field
|
4
4
|
def field
|
5
5
|
instance = builder.object
|
6
|
-
locales = I18n.available_locales.sort
|
6
|
+
locales = options[:locales] || I18n.available_locales.sort
|
7
7
|
|
8
8
|
@template.render partial: "trestle/mobility/text_field",
|
9
9
|
locals: { field_name: name, locales: locales }
|
data/screenshot.png
ADDED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trestle-mobility
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Venneman
|
@@ -89,6 +89,7 @@ files:
|
|
89
89
|
- lib/trestle/mobility/text_area.rb
|
90
90
|
- lib/trestle/mobility/text_field.rb
|
91
91
|
- lib/trestle/mobility/version.rb
|
92
|
+
- screenshot.png
|
92
93
|
- trestle-mobility.gemspec
|
93
94
|
homepage: https://github.com/richardvenneman/trestle-mobility
|
94
95
|
licenses:
|