administrate-field-password 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/Gemfile +3 -0
- data/README.md +36 -0
- data/administrate-field-password.gemspec +21 -0
- data/app/views/fields/password/_form.html.erb +20 -0
- data/app/views/fields/password/_index.html.erb +17 -0
- data/app/views/fields/password/_show.html.erb +17 -0
- data/lib/administrate/field/password.rb +26 -0
- data/spec/lib/administrate/field/password_spec.rb +14 -0
- metadata +83 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 857877cf689b7b7382232cbe4846a7f6efd6fd57
|
4
|
+
data.tar.gz: 5e8544ea9aaa150ca6c7cbc621a1f610b5e4ec08
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 737c5142d3043160558eaed4ba33d80d21b441d06bed93020751a8ce51f49b04b0e3eff2b7f70c1bb51479ba27d7473f7162cb6589d1ab07d47d39fdefc83844
|
7
|
+
data.tar.gz: 0a8bcfbee43000ce9b645147f82bf65ed98f393a3f14ee164a7e6f52b1190eeda285ab38f4a52bbdd270387f6e2329f2924ea17f2933b0e3ff336c9d61babe4e
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# AdministrateRefileField
|
2
|
+
|
3
|
+
All you need to integrate Refile with Administrate.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'administrate-field-refile'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
```
|
15
|
+
$ bundle
|
16
|
+
```
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
In your Dashboard `ATTRIBUTE_TYPES` use the field type `RefileField`. i.e.
|
21
|
+
```ruby
|
22
|
+
ATTRIBUTE_TYPES = {
|
23
|
+
images_files: FieldRefile
|
24
|
+
}
|
25
|
+
```
|
26
|
+
|
27
|
+
By default all `Refile` options are false, you can set them to true like this:
|
28
|
+
```ruby
|
29
|
+
ATTRIBUTE_TYPES = {
|
30
|
+
images_files: FieldRefile.with_options(direct: true, presigned: true, multiple: true)
|
31
|
+
}
|
32
|
+
```
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/DisruptiveAngels/administrate_refile_field.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
2
|
+
|
3
|
+
require 'administrate/field/password'
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = 'administrate-field-password'
|
7
|
+
gem.version = Administrate::Field::Password::VERSION
|
8
|
+
gem.authors = ['Adrian Rangel']
|
9
|
+
gem.email = ['adrian@disruptiveangels.com']
|
10
|
+
gem.homepage = 'https://github.com/disruptiveangels/administrate-field-password'
|
11
|
+
gem.summary = 'Add Password fields to Administrate'
|
12
|
+
gem.description = 'Easily add Password fields to your administrate views'
|
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.1.2'
|
20
|
+
gem.add_dependency 'rails', '~> 4.2'
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<%#
|
2
|
+
# Password Form Partial
|
3
|
+
|
4
|
+
This partial renders a password element for an attribute.
|
5
|
+
By default, the input is a password field.
|
6
|
+
|
7
|
+
## Local variables:
|
8
|
+
- `f`:
|
9
|
+
A Rails form generator, used to help create the appropriate input fields.
|
10
|
+
- `field`:
|
11
|
+
An instance of [Administrate::Field::Password][1].
|
12
|
+
A wrapper around the Password pulled from the database.
|
13
|
+
|
14
|
+
%>
|
15
|
+
<div class="field-unit__label">
|
16
|
+
<%= f.label field.attribute %>
|
17
|
+
</div>
|
18
|
+
<div class="field-unit__field">
|
19
|
+
<%= f.password_field field.attribute %>
|
20
|
+
</div>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<%#
|
2
|
+
# Password Index Partial
|
3
|
+
|
4
|
+
This partial renders a password attribute
|
5
|
+
to be displayed on a resource's index page.
|
6
|
+
|
7
|
+
By default, the attribute is rendered as a truncated string of `*`.
|
8
|
+
|
9
|
+
## Local variables:
|
10
|
+
|
11
|
+
- `field`:
|
12
|
+
An instance of [Administrate::Field::Password][1].
|
13
|
+
A wrapper around the Password pulled from the database.
|
14
|
+
|
15
|
+
%>
|
16
|
+
|
17
|
+
<%= field.truncate %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<%#
|
2
|
+
# Password Show Partial
|
3
|
+
|
4
|
+
This partial renders a password attribute,
|
5
|
+
to be displayed on a resource's show page.
|
6
|
+
|
7
|
+
By default, the attribute is rendered as a truncated string of `*`
|
8
|
+
|
9
|
+
## Local variables:
|
10
|
+
|
11
|
+
- `field`:
|
12
|
+
An instance of [Administrate::Field::Password][1].
|
13
|
+
A wrapper around the Password pulled from the database.
|
14
|
+
|
15
|
+
%>
|
16
|
+
|
17
|
+
<%= field.truncate %>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'administrate/field/base'
|
2
|
+
require 'rails'
|
3
|
+
|
4
|
+
module Administrate
|
5
|
+
module Field
|
6
|
+
class Password < Administrate::Field::Base
|
7
|
+
VERSION = '0.0.1'
|
8
|
+
class Engine < ::Rails::Engine
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.searchable?
|
12
|
+
false
|
13
|
+
end
|
14
|
+
|
15
|
+
def truncate
|
16
|
+
pretty_data.to_s[0...6]
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def pretty_data
|
22
|
+
data.gsub(/./, "•") unless data.nil?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'administrate/field/password'
|
2
|
+
|
3
|
+
describe Administrate::Field::Password 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::Password.new(:password, '3lkajsd', page)
|
8
|
+
|
9
|
+
path = field.to_partial_path
|
10
|
+
|
11
|
+
expect(path).to eq("/field/password/#{page}")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: administrate-field-password
|
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: 2016-02-26 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.1.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.1.2
|
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
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '4.2'
|
41
|
+
description: Easily add Password fields to your administrate views
|
42
|
+
email:
|
43
|
+
- adrian@disruptiveangels.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- README.md
|
51
|
+
- administrate-field-password.gemspec
|
52
|
+
- app/views/fields/password/_form.html.erb
|
53
|
+
- app/views/fields/password/_index.html.erb
|
54
|
+
- app/views/fields/password/_show.html.erb
|
55
|
+
- lib/administrate/field/password.rb
|
56
|
+
- spec/lib/administrate/field/password_spec.rb
|
57
|
+
homepage: https://github.com/disruptiveangels/administrate-field-password
|
58
|
+
licenses:
|
59
|
+
- MIT
|
60
|
+
metadata: {}
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 2.5.1
|
78
|
+
signing_key:
|
79
|
+
specification_version: 4
|
80
|
+
summary: Add Password fields to Administrate
|
81
|
+
test_files:
|
82
|
+
- spec/lib/administrate/field/password_spec.rb
|
83
|
+
has_rdoc:
|