administrate-field-mobility 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +0 -0
- data/README.md +41 -0
- data/administrate-field-mobility-string/Gemfile +3 -0
- data/administrate-field-mobility-string/Gemfile.lock +143 -0
- data/administrate-field-mobility-string/LICENSE +19 -0
- data/administrate-field-mobility-string/Rakefile +22 -0
- data/administrate-field-mobility-string/administrate-field-mobility-string.gemspec +22 -0
- data/administrate-field-mobility-string/app/views/fields/mobility/string/_form.html.erb +9 -0
- data/administrate-field-mobility-string/app/views/fields/mobility/string/_index.html.erb +1 -0
- data/administrate-field-mobility-string/app/views/fields/mobility/string/_show.html.erb +6 -0
- data/administrate-field-mobility-string/lib/administrate/field/mobility/string.rb +33 -0
- data/administrate-field-mobility-string/spec/lib/administrate/field/mobility/string_spec.rb +14 -0
- data/administrate-field-mobility-text/Gemfile +3 -0
- data/administrate-field-mobility-text/Gemfile.lock +143 -0
- data/administrate-field-mobility-text/LICENSE +19 -0
- data/administrate-field-mobility-text/Rakefile +22 -0
- data/administrate-field-mobility-text/administrate-field-mobility-text.gemspec +22 -0
- data/administrate-field-mobility-text/app/views/fields/mobility/text/_form.html.erb +9 -0
- data/administrate-field-mobility-text/app/views/fields/mobility/text/_index.html.erb +1 -0
- data/administrate-field-mobility-text/app/views/fields/mobility/text/_show.html.erb +7 -0
- data/administrate-field-mobility-text/lib/administrate/field/mobility/text.rb +33 -0
- data/administrate-field-mobility-text/spec/lib/administrate/field/mobility/text_spec.rb +14 -0
- data/administrate-field-mobility.gemspec +22 -0
- data/lib/administrate/field/mobility.rb +12 -0
- data/lib/administrate/field/mobility/version.rb +9 -0
- metadata +116 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f495bc4e8641af235b142aee8eff16462b13cdb15b69653b7ab4bfbc9fa8983e
|
4
|
+
data.tar.gz: 5ae6c299629f75fb158ca10ab034eb3d285c8038fe8a03da4ed78020ab5ae7fe
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 81d38d7c91359f9b228a571ee7c92d3fa2bca32d7ff4c2f5b58161bf154b90c26c681d2b1e9e0d2a4604f4075cc8a5208586a68469bd5bb7ebf89dac5432f6a7
|
7
|
+
data.tar.gz: 1b398616fe6fd4759e0f8790872a3f04052c22ed40b6e7c95393f82b8ea93a9219f4cfa82a4142f08a4c87a2ce0cd0f8967fc322d36551cd583d4d1ed0a5a73d
|
data/.gitignore
ADDED
File without changes
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Administrate::Field::Mobility
|
2
|
+
|
3
|
+
## Warning
|
4
|
+
This gem is under early development.
|
5
|
+
|
6
|
+
This Administrate plugin adds support for string fields that use the Mobility gem to hold
|
7
|
+
translated values.
|
8
|
+
|
9
|
+
Requirements in Mobility
|
10
|
+
----------------------
|
11
|
+
|
12
|
+
Set `locale_accessors` to true in `config/initializers/mobility`
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
config.default_options[:locale_accessors] = true
|
16
|
+
```
|
17
|
+
|
18
|
+
Getting Started
|
19
|
+
----------------------
|
20
|
+
|
21
|
+
Add Administrate::Field::Mobility gems to your Gemfile:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
gem "administrate-field-mobility", "0.0.1"
|
25
|
+
```
|
26
|
+
|
27
|
+
Add the Administrate Mobility Field to your dashboard.
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
ATTRIBUTE_TYPES = {
|
31
|
+
created_at: Field::DateTime,
|
32
|
+
update_at: Field::DateTime,
|
33
|
+
name: Field::Mobility::String,
|
34
|
+
description: Field::Mobility::Text,
|
35
|
+
}.freeze
|
36
|
+
```
|
37
|
+
|
38
|
+
Credits
|
39
|
+
----------------------
|
40
|
+
|
41
|
+
This gem is inspired by [administrate-field-globalize](https://github.com/arkirchner/administrate-field-globalize)
|
@@ -0,0 +1,143 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
administrate-field-mobility-string (0.0.1)
|
5
|
+
administrate (~> 0.10, >= 0.10.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionpack (6.0.1)
|
11
|
+
actionview (= 6.0.1)
|
12
|
+
activesupport (= 6.0.1)
|
13
|
+
rack (~> 2.0)
|
14
|
+
rack-test (>= 0.6.3)
|
15
|
+
rails-dom-testing (~> 2.0)
|
16
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
17
|
+
actionview (6.0.1)
|
18
|
+
activesupport (= 6.0.1)
|
19
|
+
builder (~> 3.1)
|
20
|
+
erubi (~> 1.4)
|
21
|
+
rails-dom-testing (~> 2.0)
|
22
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
23
|
+
activemodel (6.0.1)
|
24
|
+
activesupport (= 6.0.1)
|
25
|
+
activerecord (6.0.1)
|
26
|
+
activemodel (= 6.0.1)
|
27
|
+
activesupport (= 6.0.1)
|
28
|
+
activesupport (6.0.1)
|
29
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
30
|
+
i18n (>= 0.7, < 2)
|
31
|
+
minitest (~> 5.1)
|
32
|
+
tzinfo (~> 1.1)
|
33
|
+
zeitwerk (~> 2.2)
|
34
|
+
administrate (0.12.0)
|
35
|
+
actionpack (>= 4.2)
|
36
|
+
actionview (>= 4.2)
|
37
|
+
activerecord (>= 4.2)
|
38
|
+
autoprefixer-rails (>= 6.0)
|
39
|
+
datetime_picker_rails (~> 0.0.7)
|
40
|
+
jquery-rails (>= 4.0)
|
41
|
+
kaminari (>= 1.0)
|
42
|
+
momentjs-rails (~> 2.8)
|
43
|
+
sassc-rails (~> 2.1)
|
44
|
+
selectize-rails (~> 0.6)
|
45
|
+
autoprefixer-rails (9.7.1)
|
46
|
+
execjs
|
47
|
+
builder (3.2.3)
|
48
|
+
concurrent-ruby (1.1.5)
|
49
|
+
crass (1.0.5)
|
50
|
+
datetime_picker_rails (0.0.7)
|
51
|
+
momentjs-rails (>= 2.8.1)
|
52
|
+
diff-lcs (1.3)
|
53
|
+
erubi (1.9.0)
|
54
|
+
execjs (2.7.0)
|
55
|
+
ffi (1.11.1)
|
56
|
+
i18n (1.7.0)
|
57
|
+
concurrent-ruby (~> 1.0)
|
58
|
+
jquery-rails (4.3.5)
|
59
|
+
rails-dom-testing (>= 1, < 3)
|
60
|
+
railties (>= 4.2.0)
|
61
|
+
thor (>= 0.14, < 2.0)
|
62
|
+
kaminari (1.1.1)
|
63
|
+
activesupport (>= 4.1.0)
|
64
|
+
kaminari-actionview (= 1.1.1)
|
65
|
+
kaminari-activerecord (= 1.1.1)
|
66
|
+
kaminari-core (= 1.1.1)
|
67
|
+
kaminari-actionview (1.1.1)
|
68
|
+
actionview
|
69
|
+
kaminari-core (= 1.1.1)
|
70
|
+
kaminari-activerecord (1.1.1)
|
71
|
+
activerecord
|
72
|
+
kaminari-core (= 1.1.1)
|
73
|
+
kaminari-core (1.1.1)
|
74
|
+
loofah (2.3.1)
|
75
|
+
crass (~> 1.0.2)
|
76
|
+
nokogiri (>= 1.5.9)
|
77
|
+
method_source (0.9.2)
|
78
|
+
mini_portile2 (2.4.0)
|
79
|
+
minitest (5.13.0)
|
80
|
+
momentjs-rails (2.20.1)
|
81
|
+
railties (>= 3.1)
|
82
|
+
nokogiri (1.10.5)
|
83
|
+
mini_portile2 (~> 2.4.0)
|
84
|
+
rack (2.0.7)
|
85
|
+
rack-test (1.1.0)
|
86
|
+
rack (>= 1.0, < 3)
|
87
|
+
rails-dom-testing (2.0.3)
|
88
|
+
activesupport (>= 4.2.0)
|
89
|
+
nokogiri (>= 1.6)
|
90
|
+
rails-html-sanitizer (1.3.0)
|
91
|
+
loofah (~> 2.3)
|
92
|
+
railties (6.0.1)
|
93
|
+
actionpack (= 6.0.1)
|
94
|
+
activesupport (= 6.0.1)
|
95
|
+
method_source
|
96
|
+
rake (>= 0.8.7)
|
97
|
+
thor (>= 0.20.3, < 2.0)
|
98
|
+
rake (13.0.0)
|
99
|
+
rspec (3.9.0)
|
100
|
+
rspec-core (~> 3.9.0)
|
101
|
+
rspec-expectations (~> 3.9.0)
|
102
|
+
rspec-mocks (~> 3.9.0)
|
103
|
+
rspec-core (3.9.0)
|
104
|
+
rspec-support (~> 3.9.0)
|
105
|
+
rspec-expectations (3.9.0)
|
106
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
107
|
+
rspec-support (~> 3.9.0)
|
108
|
+
rspec-mocks (3.9.0)
|
109
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
110
|
+
rspec-support (~> 3.9.0)
|
111
|
+
rspec-support (3.9.0)
|
112
|
+
sassc (2.2.1)
|
113
|
+
ffi (~> 1.9)
|
114
|
+
sassc-rails (2.1.2)
|
115
|
+
railties (>= 4.0.0)
|
116
|
+
sassc (>= 2.0)
|
117
|
+
sprockets (> 3.0)
|
118
|
+
sprockets-rails
|
119
|
+
tilt
|
120
|
+
selectize-rails (0.12.6)
|
121
|
+
sprockets (4.0.0)
|
122
|
+
concurrent-ruby (~> 1.0)
|
123
|
+
rack (> 1, < 3)
|
124
|
+
sprockets-rails (3.2.1)
|
125
|
+
actionpack (>= 4.0)
|
126
|
+
activesupport (>= 4.0)
|
127
|
+
sprockets (>= 3.0.0)
|
128
|
+
thor (0.20.3)
|
129
|
+
thread_safe (0.3.6)
|
130
|
+
tilt (2.0.10)
|
131
|
+
tzinfo (1.2.5)
|
132
|
+
thread_safe (~> 0.1)
|
133
|
+
zeitwerk (2.2.1)
|
134
|
+
|
135
|
+
PLATFORMS
|
136
|
+
ruby
|
137
|
+
|
138
|
+
DEPENDENCIES
|
139
|
+
administrate-field-mobility-string!
|
140
|
+
rspec (~> 3.4)
|
141
|
+
|
142
|
+
BUNDLED WITH
|
143
|
+
2.0.2
|
@@ -0,0 +1,19 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
|
3
|
+
begin
|
4
|
+
require "bundler/setup"
|
5
|
+
rescue LoadError
|
6
|
+
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
|
7
|
+
end
|
8
|
+
|
9
|
+
require "bundler/gem_tasks"
|
10
|
+
|
11
|
+
##
|
12
|
+
# Configure the test suite.
|
13
|
+
##
|
14
|
+
require "rspec/core"
|
15
|
+
require "rspec/core/rake_task"
|
16
|
+
|
17
|
+
RSpec::Core::RakeTask.new
|
18
|
+
|
19
|
+
##
|
20
|
+
# By default, just run the tests.
|
21
|
+
##
|
22
|
+
task default: :spec
|
@@ -0,0 +1,22 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
|
3
|
+
require_relative "../lib/administrate/field/mobility/version.rb"
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = "administrate-field-mobility-string"
|
7
|
+
gem.version = Administrate::Field::Mobility.version
|
8
|
+
gem.authors = ["Daniel Tinoco"]
|
9
|
+
gem.email = ["0urobor0s@users.noreply.github.com"]
|
10
|
+
gem.homepage = "https://github.com/0urobor0s/administrate-field-mobility"
|
11
|
+
gem.summary = "Mobility string field plugin for Administrate"
|
12
|
+
gem.description = gem.summary
|
13
|
+
gem.license = "MIT"
|
14
|
+
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.files = `git ls-files`.split("\n")
|
17
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
|
19
|
+
gem.add_dependency "administrate", "~> 0.10", ">= 0.10.0"
|
20
|
+
|
21
|
+
gem.add_development_dependency "rspec", "~> 3.4"
|
22
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<div class="field-unit__label">
|
2
|
+
<%= f.label field.attribute %>
|
3
|
+
</div>
|
4
|
+
<div class="field-unit__field">
|
5
|
+
<% I18n.available_locales.each do |locale| %>
|
6
|
+
<%= f.text_field "#{field.attribute}_#{locale}".downcase.underscore %>
|
7
|
+
(<%= locale %>)
|
8
|
+
<% end %>
|
9
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= field.truncate %>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require "administrate/field/base"
|
2
|
+
require "rails"
|
3
|
+
|
4
|
+
module Administrate
|
5
|
+
module Field
|
6
|
+
module Mobility
|
7
|
+
class String < Administrate::Field::Base
|
8
|
+
class Engine < ::Rails::Engine
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.permitted_attribute(attr, _options = nil)
|
12
|
+
I18n.available_locales.map do |locale|
|
13
|
+
"#{attr}_#{locale}".downcase.underscore
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def truncate
|
18
|
+
data.to_s[0...truncation_length]
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_partial_path
|
22
|
+
"/fields/mobility/string/#{page}"
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def truncation_length
|
28
|
+
options.fetch(:truncate, 50)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "administrate/field/mobility/string"
|
2
|
+
|
3
|
+
describe Administrate::Field::Mobility::String do
|
4
|
+
describe "#to_partial_path" do
|
5
|
+
it "returns a partial based on the page being rendered" do
|
6
|
+
page = :show
|
7
|
+
field = Administrate::Field::Mobility::String.new(:name, "foo", page)
|
8
|
+
|
9
|
+
path = field.to_partial_path
|
10
|
+
|
11
|
+
expect(path).to eq("/fields/mobility/string/#{page}")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,143 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
administrate-field-mobility-text (0.0.1)
|
5
|
+
administrate (~> 0.10, >= 0.10.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionpack (6.0.1)
|
11
|
+
actionview (= 6.0.1)
|
12
|
+
activesupport (= 6.0.1)
|
13
|
+
rack (~> 2.0)
|
14
|
+
rack-test (>= 0.6.3)
|
15
|
+
rails-dom-testing (~> 2.0)
|
16
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
17
|
+
actionview (6.0.1)
|
18
|
+
activesupport (= 6.0.1)
|
19
|
+
builder (~> 3.1)
|
20
|
+
erubi (~> 1.4)
|
21
|
+
rails-dom-testing (~> 2.0)
|
22
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
23
|
+
activemodel (6.0.1)
|
24
|
+
activesupport (= 6.0.1)
|
25
|
+
activerecord (6.0.1)
|
26
|
+
activemodel (= 6.0.1)
|
27
|
+
activesupport (= 6.0.1)
|
28
|
+
activesupport (6.0.1)
|
29
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
30
|
+
i18n (>= 0.7, < 2)
|
31
|
+
minitest (~> 5.1)
|
32
|
+
tzinfo (~> 1.1)
|
33
|
+
zeitwerk (~> 2.2)
|
34
|
+
administrate (0.12.0)
|
35
|
+
actionpack (>= 4.2)
|
36
|
+
actionview (>= 4.2)
|
37
|
+
activerecord (>= 4.2)
|
38
|
+
autoprefixer-rails (>= 6.0)
|
39
|
+
datetime_picker_rails (~> 0.0.7)
|
40
|
+
jquery-rails (>= 4.0)
|
41
|
+
kaminari (>= 1.0)
|
42
|
+
momentjs-rails (~> 2.8)
|
43
|
+
sassc-rails (~> 2.1)
|
44
|
+
selectize-rails (~> 0.6)
|
45
|
+
autoprefixer-rails (9.7.1)
|
46
|
+
execjs
|
47
|
+
builder (3.2.3)
|
48
|
+
concurrent-ruby (1.1.5)
|
49
|
+
crass (1.0.5)
|
50
|
+
datetime_picker_rails (0.0.7)
|
51
|
+
momentjs-rails (>= 2.8.1)
|
52
|
+
diff-lcs (1.3)
|
53
|
+
erubi (1.9.0)
|
54
|
+
execjs (2.7.0)
|
55
|
+
ffi (1.11.1)
|
56
|
+
i18n (1.7.0)
|
57
|
+
concurrent-ruby (~> 1.0)
|
58
|
+
jquery-rails (4.3.5)
|
59
|
+
rails-dom-testing (>= 1, < 3)
|
60
|
+
railties (>= 4.2.0)
|
61
|
+
thor (>= 0.14, < 2.0)
|
62
|
+
kaminari (1.1.1)
|
63
|
+
activesupport (>= 4.1.0)
|
64
|
+
kaminari-actionview (= 1.1.1)
|
65
|
+
kaminari-activerecord (= 1.1.1)
|
66
|
+
kaminari-core (= 1.1.1)
|
67
|
+
kaminari-actionview (1.1.1)
|
68
|
+
actionview
|
69
|
+
kaminari-core (= 1.1.1)
|
70
|
+
kaminari-activerecord (1.1.1)
|
71
|
+
activerecord
|
72
|
+
kaminari-core (= 1.1.1)
|
73
|
+
kaminari-core (1.1.1)
|
74
|
+
loofah (2.3.1)
|
75
|
+
crass (~> 1.0.2)
|
76
|
+
nokogiri (>= 1.5.9)
|
77
|
+
method_source (0.9.2)
|
78
|
+
mini_portile2 (2.4.0)
|
79
|
+
minitest (5.13.0)
|
80
|
+
momentjs-rails (2.20.1)
|
81
|
+
railties (>= 3.1)
|
82
|
+
nokogiri (1.10.5)
|
83
|
+
mini_portile2 (~> 2.4.0)
|
84
|
+
rack (2.0.7)
|
85
|
+
rack-test (1.1.0)
|
86
|
+
rack (>= 1.0, < 3)
|
87
|
+
rails-dom-testing (2.0.3)
|
88
|
+
activesupport (>= 4.2.0)
|
89
|
+
nokogiri (>= 1.6)
|
90
|
+
rails-html-sanitizer (1.3.0)
|
91
|
+
loofah (~> 2.3)
|
92
|
+
railties (6.0.1)
|
93
|
+
actionpack (= 6.0.1)
|
94
|
+
activesupport (= 6.0.1)
|
95
|
+
method_source
|
96
|
+
rake (>= 0.8.7)
|
97
|
+
thor (>= 0.20.3, < 2.0)
|
98
|
+
rake (13.0.0)
|
99
|
+
rspec (3.9.0)
|
100
|
+
rspec-core (~> 3.9.0)
|
101
|
+
rspec-expectations (~> 3.9.0)
|
102
|
+
rspec-mocks (~> 3.9.0)
|
103
|
+
rspec-core (3.9.0)
|
104
|
+
rspec-support (~> 3.9.0)
|
105
|
+
rspec-expectations (3.9.0)
|
106
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
107
|
+
rspec-support (~> 3.9.0)
|
108
|
+
rspec-mocks (3.9.0)
|
109
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
110
|
+
rspec-support (~> 3.9.0)
|
111
|
+
rspec-support (3.9.0)
|
112
|
+
sassc (2.2.1)
|
113
|
+
ffi (~> 1.9)
|
114
|
+
sassc-rails (2.1.2)
|
115
|
+
railties (>= 4.0.0)
|
116
|
+
sassc (>= 2.0)
|
117
|
+
sprockets (> 3.0)
|
118
|
+
sprockets-rails
|
119
|
+
tilt
|
120
|
+
selectize-rails (0.12.6)
|
121
|
+
sprockets (4.0.0)
|
122
|
+
concurrent-ruby (~> 1.0)
|
123
|
+
rack (> 1, < 3)
|
124
|
+
sprockets-rails (3.2.1)
|
125
|
+
actionpack (>= 4.0)
|
126
|
+
activesupport (>= 4.0)
|
127
|
+
sprockets (>= 3.0.0)
|
128
|
+
thor (0.20.3)
|
129
|
+
thread_safe (0.3.6)
|
130
|
+
tilt (2.0.10)
|
131
|
+
tzinfo (1.2.5)
|
132
|
+
thread_safe (~> 0.1)
|
133
|
+
zeitwerk (2.2.1)
|
134
|
+
|
135
|
+
PLATFORMS
|
136
|
+
ruby
|
137
|
+
|
138
|
+
DEPENDENCIES
|
139
|
+
administrate-field-mobility-text!
|
140
|
+
rspec (~> 3.4)
|
141
|
+
|
142
|
+
BUNDLED WITH
|
143
|
+
2.0.2
|
@@ -0,0 +1,19 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
|
3
|
+
begin
|
4
|
+
require "bundler/setup"
|
5
|
+
rescue LoadError
|
6
|
+
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
|
7
|
+
end
|
8
|
+
|
9
|
+
require "bundler/gem_tasks"
|
10
|
+
|
11
|
+
##
|
12
|
+
# Configure the test suite.
|
13
|
+
##
|
14
|
+
require "rspec/core"
|
15
|
+
require "rspec/core/rake_task"
|
16
|
+
|
17
|
+
RSpec::Core::RakeTask.new
|
18
|
+
|
19
|
+
##
|
20
|
+
# By default, just run the tests.
|
21
|
+
##
|
22
|
+
task default: :spec
|
@@ -0,0 +1,22 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
|
3
|
+
require_relative "../lib/administrate/field/mobility/version.rb"
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = "administrate-field-mobility-text"
|
7
|
+
gem.version = Administrate::Field::Mobility.version
|
8
|
+
gem.authors = ["Daniel Tinoco"]
|
9
|
+
gem.email = ["0urobor0s@users.noreply.github.com"]
|
10
|
+
gem.homepage = "https://github.com/0urobor0s/administrate-field-mobility"
|
11
|
+
gem.summary = "Mobility text field plugin for Administrate"
|
12
|
+
gem.description = gem.summary
|
13
|
+
gem.license = "MIT"
|
14
|
+
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.files = `git ls-files`.split("\n")
|
17
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
|
19
|
+
gem.add_dependency "administrate", "~> 0.10", ">= 0.10.0"
|
20
|
+
|
21
|
+
gem.add_development_dependency "rspec", "~> 3.4"
|
22
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<div class="field-unit__label">
|
2
|
+
<%= f.label field.attribute %>
|
3
|
+
</div>
|
4
|
+
<div class="field-unit__field">
|
5
|
+
<% I18n.available_locales.each do |locale| %>
|
6
|
+
<%= f.text_area "#{field.attribute}_#{locale}".downcase.underscore %>
|
7
|
+
(<%= locale %>)
|
8
|
+
<% end %>
|
9
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= field.truncate %>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require "administrate/field/base"
|
2
|
+
require "rails"
|
3
|
+
|
4
|
+
module Administrate
|
5
|
+
module Field
|
6
|
+
module Mobility
|
7
|
+
class Text < Administrate::Field::Base
|
8
|
+
class Engine < ::Rails::Engine
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.permitted_attribute(attr, _options = nil)
|
12
|
+
I18n.available_locales.map do |locale|
|
13
|
+
"#{attr}_#{locale}".downcase.underscore
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def truncate
|
18
|
+
data.to_s[0...truncation_length]
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_partial_path
|
22
|
+
"/fields/mobility/text/#{page}"
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def truncation_length
|
28
|
+
options.fetch(:truncate, 50)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "administrate/field/mobility/text"
|
2
|
+
|
3
|
+
describe Administrate::Field::Mobility::Text do
|
4
|
+
describe "#to_partial_path" do
|
5
|
+
it "returns a partial based on the page being rendered" do
|
6
|
+
page = :show
|
7
|
+
field = Administrate::Field::Mobility::Text.new(:name, "foo", page)
|
8
|
+
|
9
|
+
path = field.to_partial_path
|
10
|
+
|
11
|
+
expect(path).to eq("/fields/mobility/text/#{page}")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
require_relative "lib/administrate/field/mobility/version.rb"
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = "administrate-field-mobility"
|
6
|
+
gem.version = Administrate::Field::Mobility.version
|
7
|
+
gem.authors = ["Daniel Tinoco"]
|
8
|
+
gem.email = ["0urobor0s@users.noreply.github.com"]
|
9
|
+
gem.homepage = "https://github.com/0urobor0s/administrate-field-mobility"
|
10
|
+
gem.summary = "Mobility string and text field plugin for Administrate"
|
11
|
+
gem.description = gem.summary
|
12
|
+
gem.license = "MIT"
|
13
|
+
|
14
|
+
gem.require_paths = ["lib"]
|
15
|
+
gem.files = `git ls-files`.split("\n")
|
16
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
|
18
|
+
gem.add_dependency "administrate", "~> 0.10", ">= 0.10.0"
|
19
|
+
|
20
|
+
gem.add_dependency "administrate-field-mobility-string", gem.version
|
21
|
+
gem.add_dependency "administrate-field-mobility-text", gem.version
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: administrate-field-mobility
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Tinoco
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-11-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: administrate
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.10.0
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0.10'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.10.0
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0.10'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: administrate-field-mobility-string
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - '='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 0.0.1
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - '='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.0.1
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: administrate-field-mobility-text
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - '='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.0.1
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - '='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 0.0.1
|
61
|
+
description: Mobility string and text field plugin for Administrate
|
62
|
+
email:
|
63
|
+
- 0urobor0s@users.noreply.github.com
|
64
|
+
executables: []
|
65
|
+
extensions: []
|
66
|
+
extra_rdoc_files: []
|
67
|
+
files:
|
68
|
+
- ".gitignore"
|
69
|
+
- README.md
|
70
|
+
- administrate-field-mobility-string/Gemfile
|
71
|
+
- administrate-field-mobility-string/Gemfile.lock
|
72
|
+
- administrate-field-mobility-string/LICENSE
|
73
|
+
- administrate-field-mobility-string/Rakefile
|
74
|
+
- administrate-field-mobility-string/administrate-field-mobility-string.gemspec
|
75
|
+
- administrate-field-mobility-string/app/views/fields/mobility/string/_form.html.erb
|
76
|
+
- administrate-field-mobility-string/app/views/fields/mobility/string/_index.html.erb
|
77
|
+
- administrate-field-mobility-string/app/views/fields/mobility/string/_show.html.erb
|
78
|
+
- administrate-field-mobility-string/lib/administrate/field/mobility/string.rb
|
79
|
+
- administrate-field-mobility-string/spec/lib/administrate/field/mobility/string_spec.rb
|
80
|
+
- administrate-field-mobility-text/Gemfile
|
81
|
+
- administrate-field-mobility-text/Gemfile.lock
|
82
|
+
- administrate-field-mobility-text/LICENSE
|
83
|
+
- administrate-field-mobility-text/Rakefile
|
84
|
+
- administrate-field-mobility-text/administrate-field-mobility-text.gemspec
|
85
|
+
- administrate-field-mobility-text/app/views/fields/mobility/text/_form.html.erb
|
86
|
+
- administrate-field-mobility-text/app/views/fields/mobility/text/_index.html.erb
|
87
|
+
- administrate-field-mobility-text/app/views/fields/mobility/text/_show.html.erb
|
88
|
+
- administrate-field-mobility-text/lib/administrate/field/mobility/text.rb
|
89
|
+
- administrate-field-mobility-text/spec/lib/administrate/field/mobility/text_spec.rb
|
90
|
+
- administrate-field-mobility.gemspec
|
91
|
+
- lib/administrate/field/mobility.rb
|
92
|
+
- lib/administrate/field/mobility/version.rb
|
93
|
+
homepage: https://github.com/0urobor0s/administrate-field-mobility
|
94
|
+
licenses:
|
95
|
+
- MIT
|
96
|
+
metadata: {}
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
requirements: []
|
112
|
+
rubygems_version: 3.0.3
|
113
|
+
signing_key:
|
114
|
+
specification_version: 4
|
115
|
+
summary: Mobility string and text field plugin for Administrate
|
116
|
+
test_files: []
|