administrate-field-mobility-text 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/Gemfile +3 -0
- data/Gemfile.lock +143 -0
- data/LICENSE +19 -0
- data/Rakefile +22 -0
- data/administrate-field-mobility-text.gemspec +22 -0
- data/app/views/fields/mobility/text/_form.html.erb +9 -0
- data/app/views/fields/mobility/text/_index.html.erb +1 -0
- data/app/views/fields/mobility/text/_show.html.erb +7 -0
- data/lib/administrate/field/mobility/text.rb +33 -0
- data/spec/lib/administrate/field/mobility/text_spec.rb +14 -0
- metadata +88 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5427855a2abef9052b29b29f7f4960c348c3ec5953aed4b439bd7436fb0264dd
|
4
|
+
data.tar.gz: ad89fa0e6ff33f724155098ec7facadcd14479f9bd8282f1f3135a3986350b0e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4e3ea4c4ea87d6490e9d0b74a287baa27510c437afa9584be103f22e32f72d0c6436b772981774c1931d45e2b31d0de862085b445327a1dab3931a0f5ffa7179
|
7
|
+
data.tar.gz: 5371430476bc6871a47ee312a74270d39b212379d2e5e4031c6ec2c79615af70ac29645220895af66b43c03e2186cc28a8a605c0dcd44cfc90f430d927079b9d
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -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
|
data/LICENSE
ADDED
@@ -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.
|
data/Rakefile
ADDED
@@ -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
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: administrate-field-mobility-text
|
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: rspec
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '3.4'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '3.4'
|
47
|
+
description: Mobility text field plugin for Administrate
|
48
|
+
email:
|
49
|
+
- 0urobor0s@users.noreply.github.com
|
50
|
+
executables: []
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- Gemfile
|
55
|
+
- Gemfile.lock
|
56
|
+
- LICENSE
|
57
|
+
- Rakefile
|
58
|
+
- administrate-field-mobility-text.gemspec
|
59
|
+
- app/views/fields/mobility/text/_form.html.erb
|
60
|
+
- app/views/fields/mobility/text/_index.html.erb
|
61
|
+
- app/views/fields/mobility/text/_show.html.erb
|
62
|
+
- lib/administrate/field/mobility/text.rb
|
63
|
+
- spec/lib/administrate/field/mobility/text_spec.rb
|
64
|
+
homepage: https://github.com/0urobor0s/administrate-field-mobility
|
65
|
+
licenses:
|
66
|
+
- MIT
|
67
|
+
metadata: {}
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubygems_version: 3.0.3
|
84
|
+
signing_key:
|
85
|
+
specification_version: 4
|
86
|
+
summary: Mobility text field plugin for Administrate
|
87
|
+
test_files:
|
88
|
+
- spec/lib/administrate/field/mobility/text_spec.rb
|