administrate-field-globalize-text 0.0.1.alpha3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cd6ee6d4dfc6e2589f06aa8324d7b266deba188b4b1151500786d599effecd19
4
+ data.tar.gz: 599f1046e7a2d31ca9c2166e8e829f91abeb655bd076d1bbdab2e3f38586b233
5
+ SHA512:
6
+ metadata.gz: c301833750a887b0544dbb202d1bbfb5fed08e59844b30a0475762a70b696063f88fd80364d2a5cb4a6b48c59e45b7dfd851145a539d5ca619d55ed39802f030
7
+ data.tar.gz: 433411e1beff8ca5bdb58e9846e6bafd6e5871cd3c0200f4783dad115e06f0f93cebc52c66bafe6e12e6178167500110aacf61c9703227179a99a9081249846a
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,149 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ administrate-field-globalize-string (0.0.1.alpha2)
5
+ administrate (~> 0.10, >= 0.10.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionpack (5.2.1)
11
+ actionview (= 5.2.1)
12
+ activesupport (= 5.2.1)
13
+ rack (~> 2.0)
14
+ rack-test (>= 0.6.3)
15
+ rails-dom-testing (~> 2.0)
16
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
17
+ actionview (5.2.1)
18
+ activesupport (= 5.2.1)
19
+ builder (~> 3.1)
20
+ erubi (~> 1.4)
21
+ rails-dom-testing (~> 2.0)
22
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
23
+ activemodel (5.2.1)
24
+ activesupport (= 5.2.1)
25
+ activerecord (5.2.1)
26
+ activemodel (= 5.2.1)
27
+ activesupport (= 5.2.1)
28
+ arel (>= 9.0)
29
+ activesupport (5.2.1)
30
+ concurrent-ruby (~> 1.0, >= 1.0.2)
31
+ i18n (>= 0.7, < 2)
32
+ minitest (~> 5.1)
33
+ tzinfo (~> 1.1)
34
+ administrate (0.10.0)
35
+ actionpack (>= 4.2, < 6.0)
36
+ actionview (>= 4.2, < 6.0)
37
+ activerecord (>= 4.2, < 6.0)
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
+ sass-rails (~> 5.0)
44
+ selectize-rails (~> 0.6)
45
+ arel (9.0.0)
46
+ autoprefixer-rails (9.1.0)
47
+ execjs
48
+ builder (3.2.3)
49
+ concurrent-ruby (1.0.5)
50
+ crass (1.0.4)
51
+ datetime_picker_rails (0.0.7)
52
+ momentjs-rails (>= 2.8.1)
53
+ diff-lcs (1.3)
54
+ erubi (1.7.1)
55
+ execjs (2.7.0)
56
+ ffi (1.9.25)
57
+ i18n (1.1.0)
58
+ concurrent-ruby (~> 1.0)
59
+ jquery-rails (4.3.3)
60
+ rails-dom-testing (>= 1, < 3)
61
+ railties (>= 4.2.0)
62
+ thor (>= 0.14, < 2.0)
63
+ kaminari (1.1.1)
64
+ activesupport (>= 4.1.0)
65
+ kaminari-actionview (= 1.1.1)
66
+ kaminari-activerecord (= 1.1.1)
67
+ kaminari-core (= 1.1.1)
68
+ kaminari-actionview (1.1.1)
69
+ actionview
70
+ kaminari-core (= 1.1.1)
71
+ kaminari-activerecord (1.1.1)
72
+ activerecord
73
+ kaminari-core (= 1.1.1)
74
+ kaminari-core (1.1.1)
75
+ loofah (2.2.2)
76
+ crass (~> 1.0.2)
77
+ nokogiri (>= 1.5.9)
78
+ method_source (0.9.0)
79
+ mini_portile2 (2.3.0)
80
+ minitest (5.11.3)
81
+ momentjs-rails (2.20.1)
82
+ railties (>= 3.1)
83
+ nokogiri (1.8.4)
84
+ mini_portile2 (~> 2.3.0)
85
+ rack (2.0.5)
86
+ rack-test (1.1.0)
87
+ rack (>= 1.0, < 3)
88
+ rails-dom-testing (2.0.3)
89
+ activesupport (>= 4.2.0)
90
+ nokogiri (>= 1.6)
91
+ rails-html-sanitizer (1.0.4)
92
+ loofah (~> 2.2, >= 2.2.2)
93
+ railties (5.2.1)
94
+ actionpack (= 5.2.1)
95
+ activesupport (= 5.2.1)
96
+ method_source
97
+ rake (>= 0.8.7)
98
+ thor (>= 0.19.0, < 2.0)
99
+ rake (12.3.1)
100
+ rb-fsevent (0.10.3)
101
+ rb-inotify (0.9.10)
102
+ ffi (>= 0.5.0, < 2)
103
+ rspec (3.8.0)
104
+ rspec-core (~> 3.8.0)
105
+ rspec-expectations (~> 3.8.0)
106
+ rspec-mocks (~> 3.8.0)
107
+ rspec-core (3.8.0)
108
+ rspec-support (~> 3.8.0)
109
+ rspec-expectations (3.8.1)
110
+ diff-lcs (>= 1.2.0, < 2.0)
111
+ rspec-support (~> 3.8.0)
112
+ rspec-mocks (3.8.0)
113
+ diff-lcs (>= 1.2.0, < 2.0)
114
+ rspec-support (~> 3.8.0)
115
+ rspec-support (3.8.0)
116
+ sass (3.5.7)
117
+ sass-listen (~> 4.0.0)
118
+ sass-listen (4.0.0)
119
+ rb-fsevent (~> 0.9, >= 0.9.4)
120
+ rb-inotify (~> 0.9, >= 0.9.7)
121
+ sass-rails (5.0.7)
122
+ railties (>= 4.0.0, < 6)
123
+ sass (~> 3.1)
124
+ sprockets (>= 2.8, < 4.0)
125
+ sprockets-rails (>= 2.0, < 4.0)
126
+ tilt (>= 1.1, < 3)
127
+ selectize-rails (0.12.5)
128
+ sprockets (3.7.2)
129
+ concurrent-ruby (~> 1.0)
130
+ rack (> 1, < 3)
131
+ sprockets-rails (3.2.1)
132
+ actionpack (>= 4.0)
133
+ activesupport (>= 4.0)
134
+ sprockets (>= 3.0.0)
135
+ thor (0.20.0)
136
+ thread_safe (0.3.6)
137
+ tilt (2.0.8)
138
+ tzinfo (1.2.5)
139
+ thread_safe (~> 0.1)
140
+
141
+ PLATFORMS
142
+ ruby
143
+
144
+ DEPENDENCIES
145
+ administrate-field-globalize-string!
146
+ rspec (~> 3.4)
147
+
148
+ BUNDLED WITH
149
+ 1.16.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.
@@ -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/globalize/version.rb"
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = "administrate-field-globalize-text"
7
+ gem.version = Administrate::Field::Globalize.version
8
+ gem.authors = ["Armin Kirchner"]
9
+ gem.email = ["armin.kirchner@gmail.com"]
10
+ gem.homepage = "https://github.com/arkirchner/administrate-field-globalize"
11
+ gem.summary = "Globalized string and 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,7 @@
1
+ <% I18n.available_locales.each do |locale| %>
2
+ <% I18n.with_locale(locale) do %>
3
+ <span class="preserve-whitespace"><%= field.resource[field.attribute] %></span>
4
+ <%= "(#{locale})" %>
5
+ <% end %>
6
+ <br \>
7
+ <% end %>
@@ -0,0 +1,41 @@
1
+ require "administrate/field/base"
2
+ require "rails"
3
+
4
+ module Administrate
5
+ module Field
6
+ module Globalize
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 self.searchable?
22
+ true
23
+ end
24
+
25
+ def self.translation?
26
+ true
27
+ end
28
+
29
+ def to_partial_path
30
+ "/fields/globalize/text/#{page}"
31
+ end
32
+
33
+ private
34
+
35
+ def truncation_length
36
+ options.fetch(:truncate, 50)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,14 @@
1
+ require "administrate/field/globalize/text"
2
+
3
+ describe Administrate::Field::Globalize::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::Globalize::Text.new(:name, "foo", page)
8
+
9
+ path = field.to_partial_path
10
+
11
+ expect(path).to eq("/fields/globalize/text/#{page}")
12
+ end
13
+ end
14
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: administrate-field-globalize-text
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.alpha3
5
+ platform: ruby
6
+ authors:
7
+ - Armin Kirchner
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-08-13 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'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.10.0
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'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.10.0
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: Globalized string and text field plugin for Administrate
48
+ email:
49
+ - armin.kirchner@gmail.com
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - Gemfile
55
+ - Gemfile.lock
56
+ - LICENSE
57
+ - Rakefile
58
+ - administrate-field-globalize-text.gemspec
59
+ - app/views/fields/globalize/text/_form.html.erb
60
+ - app/views/fields/globalize/text/_index.html.erb
61
+ - app/views/fields/globalize/text/_show.html.erb
62
+ - lib/administrate/field/globalize/text.rb
63
+ - spec/lib/administrate/field/globalize/text_spec.rb
64
+ homepage: https://github.com/arkirchner/administrate-field-globalize
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: 1.3.1
82
+ requirements: []
83
+ rubyforge_project:
84
+ rubygems_version: 2.7.6
85
+ signing_key:
86
+ specification_version: 4
87
+ summary: Globalized string and text field plugin for Administrate
88
+ test_files:
89
+ - spec/lib/administrate/field/globalize/text_spec.rb