administrate-field-telephone 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 +7 -0
- data/LICENSE.md +21 -0
- data/README.md +33 -0
- data/administrate-field-telephone.gemspec +19 -0
- data/app/views/fields/telephone/_form.html.erb +18 -0
- data/app/views/fields/telephone/_index.html.erb +17 -0
- data/app/views/fields/telephone/_show.html.erb +17 -0
- data/lib/administrate/field/telephone.rb +15 -0
- data/spec/lib/administrate/field/telephone_spec.rb +14 -0
- metadata +89 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 39d7859cc6cdbc42081f48a5e055742571fe895c
|
4
|
+
data.tar.gz: 9889c03471fbeb8766d927367ccebaa933882b76
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 97aae89a569064cb84527e03389550a32b622f7c34289de8f6dd36e4b1c3bbccf97aea84a857e72ec76ce21fff44af652aaed4cfa467b403d21e176c65fe180c
|
7
|
+
data.tar.gz: 64bf47915ad59c2eaae0d12b002563c9fa4870f7b5fb2854f346bd57263b49a3a462f1e7919ff7f5e68752dcb8912bca040b3b460cc75ce11c3996a7f120ca1d
|
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -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.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Administrate::Field::Telephone
|
2
|
+
|
3
|
+
A plugin to show clickable telephones 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-telephone` | `Administrate::Field::TelePhone` |
|
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-telephone'
|
5
|
+
s.version = '0.0.1'
|
6
|
+
s.authors = ['Adrian Rangel']
|
7
|
+
s.email = ['adrian@disruptiveangels.com']
|
8
|
+
s.homepage = 'https://github.com/DisruptiveAngels/administrate-field-telephone'
|
9
|
+
s.summary = 'Telephone 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,18 @@
|
|
1
|
+
<%#
|
2
|
+
# Telephone Form Partial
|
3
|
+
This partial renders an input element for telephone attributes.
|
4
|
+
By default, the input is a text field.
|
5
|
+
## Local variables:
|
6
|
+
- `f`:
|
7
|
+
A Rails form generator, used to help create the appropriate input fields.
|
8
|
+
- `field`:
|
9
|
+
An instance of [Administrate::Field::Telephone][1].
|
10
|
+
A wrapper around the number pulled from the database.
|
11
|
+
%>
|
12
|
+
|
13
|
+
<div class="field-unit__label">
|
14
|
+
<%= f.label field.attribute %>
|
15
|
+
</div>
|
16
|
+
<div class="field-unit__field">
|
17
|
+
<%= f.telephone_field field.attribute %>
|
18
|
+
</div>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<%#
|
2
|
+
# Telephone Index Partial
|
3
|
+
|
4
|
+
This partial renders a telephone attribute
|
5
|
+
to be displayed on a resource's index page.
|
6
|
+
|
7
|
+
By default, the attribute is rendered as a telephone tag.
|
8
|
+
|
9
|
+
## Local variables:
|
10
|
+
|
11
|
+
- `field`:
|
12
|
+
An instance of [Administrate::Field::Telephone][1].
|
13
|
+
A wrapper around the enum attributes pulled from the model.
|
14
|
+
|
15
|
+
%>
|
16
|
+
|
17
|
+
<%= link_to field.to_s, "tel:#{field.to_s}" %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<%#
|
2
|
+
# Telephone Show Partial
|
3
|
+
|
4
|
+
This partial renders an telephone attribute,
|
5
|
+
to be displayed on a resource's show page.
|
6
|
+
|
7
|
+
By default, the attribute is rendered as a telephone tag.
|
8
|
+
|
9
|
+
## Local variables:
|
10
|
+
|
11
|
+
- `field`:
|
12
|
+
An instance of [Administrate::Field::Telephone][1].
|
13
|
+
A wrapper around the telephone attributes pulled from the model.
|
14
|
+
|
15
|
+
%>
|
16
|
+
|
17
|
+
<%= link_to field.to_s, "tel:#{field.to_s}" %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'administrate/field/base'
|
2
|
+
require 'rails'
|
3
|
+
|
4
|
+
module Administrate
|
5
|
+
module Field
|
6
|
+
class Telephone < Administrate::Field::Base
|
7
|
+
def to_s
|
8
|
+
data.to_s.humanize unless data.nil?
|
9
|
+
end
|
10
|
+
|
11
|
+
class Engine < ::Rails::Engine
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'administrate/field/telephone'
|
2
|
+
|
3
|
+
describe Administrate::Field::Telephone 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::Telephone.new(:status, 'status', page)
|
8
|
+
|
9
|
+
path = field.to_partial_path
|
10
|
+
|
11
|
+
expect(path).to eq('/fields/telephone/#{page}')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: administrate-field-telephone
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adrian Rangel
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-01-20 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'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '4.2'
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '5.1'
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '4.2'
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '5.1'
|
47
|
+
description: Telephone field plugin for Administrate
|
48
|
+
email:
|
49
|
+
- adrian@disruptiveangels.com
|
50
|
+
executables: []
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- Gemfile
|
55
|
+
- LICENSE.md
|
56
|
+
- README.md
|
57
|
+
- administrate-field-telephone.gemspec
|
58
|
+
- app/views/fields/telephone/_form.html.erb
|
59
|
+
- app/views/fields/telephone/_index.html.erb
|
60
|
+
- app/views/fields/telephone/_show.html.erb
|
61
|
+
- lib/administrate/field/telephone.rb
|
62
|
+
- spec/lib/administrate/field/telephone_spec.rb
|
63
|
+
homepage: https://github.com/DisruptiveAngels/administrate-field-telephone
|
64
|
+
licenses:
|
65
|
+
- MIT
|
66
|
+
metadata: {}
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
requirements: []
|
82
|
+
rubyforge_project:
|
83
|
+
rubygems_version: 2.5.2
|
84
|
+
signing_key:
|
85
|
+
specification_version: 4
|
86
|
+
summary: Telephone field plugin for Administrate
|
87
|
+
test_files:
|
88
|
+
- spec/lib/administrate/field/telephone_spec.rb
|
89
|
+
has_rdoc:
|