administrate-field-jsontable 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 59e9d9dd36f223fce8b089fb5598192c8771eb55
4
+ data.tar.gz: a6c4258a03ce324cb17a77d2f1e1a7952d59927b
5
+ SHA512:
6
+ metadata.gz: b37c6b4b52af795c212b5b4cd7b99290a57d91a96d28612bb20c6c03d37e3dcefd21495e1527c7459e4dfce21ed13f2ecbdb72d1c950c47af17a87f8a2f775d4
7
+ data.tar.gz: 06d409c0c30ef039a892712f6f05abc772bbdf68f11fac58d806c8c098ad6d07133f6fe4bbe0a6a477ee964439a14cb999da1ed4561b89864b56cbc5abd901f3
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'rspec-rails', '~> 3.5.0'
7
+ end
@@ -0,0 +1,181 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ administrate-field-jsontable (0.0.1)
5
+ administrate
6
+ rails (>= 4.2, < 5.1)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ actioncable (5.0.3)
12
+ actionpack (= 5.0.3)
13
+ nio4r (>= 1.2, < 3.0)
14
+ websocket-driver (~> 0.6.1)
15
+ actionmailer (5.0.3)
16
+ actionpack (= 5.0.3)
17
+ actionview (= 5.0.3)
18
+ activejob (= 5.0.3)
19
+ mail (~> 2.5, >= 2.5.4)
20
+ rails-dom-testing (~> 2.0)
21
+ actionpack (5.0.3)
22
+ actionview (= 5.0.3)
23
+ activesupport (= 5.0.3)
24
+ rack (~> 2.0)
25
+ rack-test (~> 0.6.3)
26
+ rails-dom-testing (~> 2.0)
27
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
+ actionview (5.0.3)
29
+ activesupport (= 5.0.3)
30
+ builder (~> 3.1)
31
+ erubis (~> 2.7.0)
32
+ rails-dom-testing (~> 2.0)
33
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
34
+ activejob (5.0.3)
35
+ activesupport (= 5.0.3)
36
+ globalid (>= 0.3.6)
37
+ activemodel (5.0.3)
38
+ activesupport (= 5.0.3)
39
+ activerecord (5.0.3)
40
+ activemodel (= 5.0.3)
41
+ activesupport (= 5.0.3)
42
+ arel (~> 7.0)
43
+ activesupport (5.0.3)
44
+ concurrent-ruby (~> 1.0, >= 1.0.2)
45
+ i18n (~> 0.7)
46
+ minitest (~> 5.1)
47
+ tzinfo (~> 1.1)
48
+ administrate (0.7.0)
49
+ actionpack (>= 4.2, < 5.1)
50
+ actionview (>= 4.2, < 5.1)
51
+ activerecord (>= 4.2, < 5.1)
52
+ autoprefixer-rails (~> 6.0)
53
+ datetime_picker_rails (~> 0.0.7)
54
+ jquery-rails (>= 4.0)
55
+ kaminari (>= 1.0)
56
+ momentjs-rails (~> 2.8)
57
+ normalize-rails (>= 3.0)
58
+ sass-rails (~> 5.0)
59
+ selectize-rails (~> 0.6)
60
+ arel (7.1.4)
61
+ autoprefixer-rails (6.7.7.2)
62
+ execjs
63
+ builder (3.2.3)
64
+ concurrent-ruby (1.0.5)
65
+ datetime_picker_rails (0.0.7)
66
+ momentjs-rails (>= 2.8.1)
67
+ diff-lcs (1.3)
68
+ erubis (2.7.0)
69
+ execjs (2.7.0)
70
+ globalid (0.4.0)
71
+ activesupport (>= 4.2.0)
72
+ i18n (0.8.1)
73
+ jquery-rails (4.3.1)
74
+ rails-dom-testing (>= 1, < 3)
75
+ railties (>= 4.2.0)
76
+ thor (>= 0.14, < 2.0)
77
+ kaminari (1.0.1)
78
+ activesupport (>= 4.1.0)
79
+ kaminari-actionview (= 1.0.1)
80
+ kaminari-activerecord (= 1.0.1)
81
+ kaminari-core (= 1.0.1)
82
+ kaminari-actionview (1.0.1)
83
+ actionview
84
+ kaminari-core (= 1.0.1)
85
+ kaminari-activerecord (1.0.1)
86
+ activerecord
87
+ kaminari-core (= 1.0.1)
88
+ kaminari-core (1.0.1)
89
+ loofah (2.0.3)
90
+ nokogiri (>= 1.5.9)
91
+ mail (2.6.5)
92
+ mime-types (>= 1.16, < 4)
93
+ method_source (0.8.2)
94
+ mime-types (3.1)
95
+ mime-types-data (~> 3.2015)
96
+ mime-types-data (3.2016.0521)
97
+ mini_portile2 (2.1.0)
98
+ minitest (5.10.2)
99
+ momentjs-rails (2.17.1)
100
+ railties (>= 3.1)
101
+ nio4r (2.0.0)
102
+ nokogiri (1.7.2)
103
+ mini_portile2 (~> 2.1.0)
104
+ normalize-rails (4.1.1)
105
+ rack (2.0.3)
106
+ rack-test (0.6.3)
107
+ rack (>= 1.0)
108
+ rails (5.0.3)
109
+ actioncable (= 5.0.3)
110
+ actionmailer (= 5.0.3)
111
+ actionpack (= 5.0.3)
112
+ actionview (= 5.0.3)
113
+ activejob (= 5.0.3)
114
+ activemodel (= 5.0.3)
115
+ activerecord (= 5.0.3)
116
+ activesupport (= 5.0.3)
117
+ bundler (>= 1.3.0, < 2.0)
118
+ railties (= 5.0.3)
119
+ sprockets-rails (>= 2.0.0)
120
+ rails-dom-testing (2.0.3)
121
+ activesupport (>= 4.2.0)
122
+ nokogiri (>= 1.6)
123
+ rails-html-sanitizer (1.0.3)
124
+ loofah (~> 2.0)
125
+ railties (5.0.3)
126
+ actionpack (= 5.0.3)
127
+ activesupport (= 5.0.3)
128
+ method_source
129
+ rake (>= 0.8.7)
130
+ thor (>= 0.18.1, < 2.0)
131
+ rake (12.0.0)
132
+ rspec-core (3.5.4)
133
+ rspec-support (~> 3.5.0)
134
+ rspec-expectations (3.5.0)
135
+ diff-lcs (>= 1.2.0, < 2.0)
136
+ rspec-support (~> 3.5.0)
137
+ rspec-mocks (3.5.0)
138
+ diff-lcs (>= 1.2.0, < 2.0)
139
+ rspec-support (~> 3.5.0)
140
+ rspec-rails (3.5.2)
141
+ actionpack (>= 3.0)
142
+ activesupport (>= 3.0)
143
+ railties (>= 3.0)
144
+ rspec-core (~> 3.5.0)
145
+ rspec-expectations (~> 3.5.0)
146
+ rspec-mocks (~> 3.5.0)
147
+ rspec-support (~> 3.5.0)
148
+ rspec-support (3.5.0)
149
+ sass (3.4.24)
150
+ sass-rails (5.0.6)
151
+ railties (>= 4.0.0, < 6)
152
+ sass (~> 3.1)
153
+ sprockets (>= 2.8, < 4.0)
154
+ sprockets-rails (>= 2.0, < 4.0)
155
+ tilt (>= 1.1, < 3)
156
+ selectize-rails (0.12.4)
157
+ sprockets (3.7.1)
158
+ concurrent-ruby (~> 1.0)
159
+ rack (> 1, < 3)
160
+ sprockets-rails (3.2.0)
161
+ actionpack (>= 4.0)
162
+ activesupport (>= 4.0)
163
+ sprockets (>= 3.0.0)
164
+ thor (0.19.4)
165
+ thread_safe (0.3.6)
166
+ tilt (2.0.7)
167
+ tzinfo (1.2.3)
168
+ thread_safe (~> 0.1)
169
+ websocket-driver (0.6.5)
170
+ websocket-extensions (>= 0.1.0)
171
+ websocket-extensions (0.1.2)
172
+
173
+ PLATFORMS
174
+ ruby
175
+
176
+ DEPENDENCIES
177
+ administrate-field-jsontable!
178
+ rspec-rails (~> 3.5.0)
179
+
180
+ BUNDLED WITH
181
+ 1.14.6
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 DisruptiveAngels
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,33 @@
1
+ # Administrate::Field::Jsontable
2
+
3
+ A plugin to show JSON to table attributes in [Administrate].
4
+
5
+ This repository is the first field plugin extracted out of Administrate.
6
+ Although its structure may change,
7
+ it's designed to act as a template for other Administrate field plugins.
8
+
9
+ ## FAQs
10
+
11
+ **Q: How should I name my gem?**
12
+
13
+ A: Administrate field gems must be named according to the [Rubygems naming guidelines].
14
+
15
+ Essentially, name your gem after the field class that it defines.
16
+ If there's a namespace in the class name, that gets translated to a dash (`-`) in the gem name.
17
+ If the class name is CamelCased, that translates to an underscore (`_`) in the gem name.
18
+
19
+ Since all administrate field gems are under the namespace `Administrate::Field`,
20
+ every field gem name should start with the prefix `administrate-field-`.
21
+
22
+ Here are some examples (these don't correspond to actual gems):
23
+
24
+ | Gem Name | Field Name |
25
+ |----------------------------|------------------------------|
26
+ | `administrate-field-enum` | `Administrate::Field::Enum` |
27
+ | `administrate-field-file_upload` | `Administrate::Field::FileUpload` |
28
+ | `administrate-field-geocoding-region` | `Administrate::Field::Geocoding::Region` |
29
+ | `administrate-field-geocoding-geo_json` | `Administrate::Field::Geocoding::GeoJson` |
30
+
31
+ [Rubygems naming guidelines]: http://guides.rubygems.org/name-your-gem/
32
+
33
+ [Administrate]: https://github.com/thoughtbot/administrate
@@ -0,0 +1,19 @@
1
+ $:.push File.expand_path('../lib', __FILE__)
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = 'administrate-field-jsontable'
5
+ s.version = '0.0.1'
6
+ s.authors = ['Enrique Barragan', 'Esteban Arocha']
7
+ s.email = ['enrique@disruptiveangels.com','esteban@disruptiveangels.com']
8
+ s.homepage = 'https://github.com/DisruptiveAngels/administrate-field-jsontable'
9
+ s.summary = 'JSON to table field plugin for Administrate'
10
+ s.description = s.summary
11
+ s.license = 'MIT'
12
+
13
+ s.require_paths = ['lib']
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+
17
+ s.add_dependency 'administrate'
18
+ s.add_dependency 'rails', '>= 4.2', '< 5.1'
19
+ end
@@ -0,0 +1,45 @@
1
+ <%#
2
+ # JSON to table Show Partial
3
+
4
+ This partial renders an JSON to table attribute,
5
+ to be displayed on a resource's show page.
6
+
7
+ By default, the attribute is rendered as a text tag.
8
+
9
+ ## Local variables:
10
+
11
+ - `field`:
12
+ An instance of [Administrate::Field::Jsontable][1].
13
+ A wrapper around the JSON to table attributes pulled from the model.
14
+
15
+ %>
16
+
17
+ <table>
18
+ <thead>
19
+ <tr>
20
+ <% field.data.each do |k,v| %>
21
+ <th><%= k %></th>
22
+ <% end %>
23
+ </tr>
24
+ </thead>
25
+ <tbody>
26
+ <% if field.data.first[1].kind_of?(Array) %>
27
+ <tr>
28
+ <% field.data.each do |k,v| %>
29
+ <td><%= if v[0].blank? then "-" else v[0] end %></td>
30
+ <% end %>
31
+ </tr>
32
+ <tr>
33
+ <% field.data.each do |k,v| %>
34
+ <td><%= if v[1].blank? then "-" else v[1] end %></td>
35
+ <% end %>
36
+ </tr>
37
+ <% else %>
38
+ <tr>
39
+ <% field.data.each do |k,v| %>
40
+ <td><%= if v.blank? then "-" else v end %></td>
41
+ <% end %>
42
+ </tr>
43
+ <% end %>
44
+ </tbody>
45
+ </table>
@@ -0,0 +1,11 @@
1
+ require 'administrate/field/base'
2
+ require 'rails'
3
+
4
+ module Administrate
5
+ module Field
6
+ class Jsontable < Administrate::Field::Base
7
+ class Engine < ::Rails::Engine
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ require 'administrate/field/jsontable'
2
+
3
+ describe Administrate::Field::Jsontable 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::Jsontable.new(:status, 'status', page)
8
+
9
+ path = field.to_partial_path
10
+
11
+ expect(path).to eq("/fields/jsontable/#{page}")
12
+ end
13
+ end
14
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: administrate-field-jsontable
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Enrique Barragan
8
+ - Esteban Arocha
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2017-05-25 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: administrate
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rails
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '4.2'
35
+ - - "<"
36
+ - !ruby/object:Gem::Version
37
+ version: '5.1'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '4.2'
45
+ - - "<"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.1'
48
+ description: JSON to table field plugin for Administrate
49
+ email:
50
+ - enrique@disruptiveangels.com
51
+ - esteban@disruptiveangels.com
52
+ executables: []
53
+ extensions: []
54
+ extra_rdoc_files: []
55
+ files:
56
+ - Gemfile
57
+ - Gemfile.lock
58
+ - LICENSE.md
59
+ - README.md
60
+ - administrate-field-jsontable.gemspec
61
+ - app/views/fields/jsontable/_show.html.erb
62
+ - lib/administrate/field/jsontable.rb
63
+ - spec/lib/administrate/field/jsontable_spec.rb
64
+ homepage: https://github.com/DisruptiveAngels/administrate-field-jsontable
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
+ rubyforge_project:
84
+ rubygems_version: 2.6.12
85
+ signing_key:
86
+ specification_version: 4
87
+ summary: JSON to table field plugin for Administrate
88
+ test_files:
89
+ - spec/lib/administrate/field/jsontable_spec.rb