handy_generators 0.1.11 → 0.2.0
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +5 -11
- data/handy_generators.gemspec +2 -40
- data/lib/handy_generators/version.rb +1 -1
- metadata +5 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 930ba1215f071a332e6742ed636b03ba07f08d54060eedcd6483b008842f89b7
|
4
|
+
data.tar.gz: 0f03c6dd96c3736bd613028fbe4b7132972eb1d63c79ab05e8beccf60ad4198b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34a6a10fa9b9a070d38bbefd99b345c877e1d46931754e1a5812fc0fc47a94f90be0533a8cb1cc24dfb6587a20ee0e24d07f16580cc7fbb0f5f7c4addb5e24af
|
7
|
+
data.tar.gz: cc0805784a93c331fa231a2fbf460bac3cf772305648a6052736fec21079a369430960124c5e145411550ce5da0f5e99c40d70ba1134cb3ba34283c1bb9ea495
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -14,12 +14,10 @@ And then execute:
|
|
14
14
|
|
15
15
|
$ bundle
|
16
16
|
|
17
|
-
Or install it yourself as:
|
18
|
-
|
19
|
-
$ gem install handy_generators
|
20
|
-
|
21
17
|
## Usage
|
22
18
|
|
19
|
+
After you add the gem to your Gemfile and run bundle, you'll have access to the following generators.
|
20
|
+
|
23
21
|
### Edit Links Helper
|
24
22
|
|
25
23
|
#### Generators
|
@@ -39,17 +37,13 @@ add --pundit false to your command.
|
|
39
37
|
rails generate handy_generators:edit_links_helper --pundit false
|
40
38
|
```
|
41
39
|
|
40
|
+
Running this generator will add the following helpers to your Rails app.
|
41
|
+
|
42
42
|
#### Helpers
|
43
43
|
|
44
44
|
`edit_links(record:, edit_classes: '', delete_classes: '')`
|
45
45
|
|
46
|
-
The `edit_links` helper receives three parameters `record`, `edit_classes`,
|
47
|
-
and `delete_classes`. Record is the only required parameter,
|
48
|
-
`edit_classes` and `delete_classes` will be empty by default, if you'd
|
49
|
-
like to add classes you can pass them as parameters to the helper. The
|
50
|
-
default helper uses pundit, and it will check if the logged in user has
|
51
|
-
permission to edit or delete the record before displaying the links. If
|
52
|
-
not, it will display the edit or delete links to all users.
|
46
|
+
The `edit_links` helper receives three parameters `record`, `edit_classes`, and `delete_classes`. Record is the only required parameter, `edit_classes` and `delete_classes` will be empty by default, if you'd like to add classes you can pass them as parameters to the helper. The default helper uses pundit, and it will check if the logged in user has permission to edit or delete the record before displaying the links. If not, it will display the edit or delete links to all users.
|
53
47
|
|
54
48
|
`edit_record_link(record:, classes: '')`
|
55
49
|
|
data/handy_generators.gemspec
CHANGED
@@ -10,46 +10,8 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["dakotaleemusic@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{Add rails generators to add a helper to add edit and delete links that work for multiple resources}
|
13
|
-
spec.description = %
|
14
|
-
|
15
|
-
|
16
|
-
### Edit Links Helper
|
17
|
-
|
18
|
-
|
19
|
-
rails generate handy_generators:edit_links_helper
|
20
|
-
|
21
|
-
\r\n
|
22
|
-
This generator will add a helper and a partial for displaying edit and
|
23
|
-
delete links for a record. This uses pundit by default to check
|
24
|
-
whether a user should be able to edit and/or delete the record before
|
25
|
-
displaying the link. If you'd like to always display these links when
|
26
|
-
you use the helper in the view or handle the logic yourself, simply
|
27
|
-
add --pundit false to your command.
|
28
|
-
\r\n
|
29
|
-
|
30
|
-
rails generate handy_generators:edit_links_helper --pundit false
|
31
|
-
|
32
|
-
\n
|
33
|
-
\r\n
|
34
|
-
|
35
|
-
edit_links(record:, edit_classes: '', delete_classes: '')
|
36
|
-
\r\n
|
37
|
-
The `edit_links` helper receives three parameters `record`, `edit_classes`,
|
38
|
-
and `delete_classes`. Record is the only required parameter,
|
39
|
-
`edit_classes` and `delete_classes` will be empty by default, if you'd
|
40
|
-
like to add classes you can pass them as parameters to the helper. The
|
41
|
-
default helper uses pundit, and it will check if the logged in user has
|
42
|
-
permission to edit or delete the record before displaying the links. If
|
43
|
-
not, it will display the edit or delete links to all users.
|
44
|
-
\r\n
|
45
|
-
`edit_record_link(record:, classes: '')`
|
46
|
-
\r\n
|
47
|
-
The `edit_record_link` helper will just display an edit link, it won't check if the user has permission before displaying the link. Classes that you pass in as a parameter will be applied to the link.
|
48
|
-
\r\n
|
49
|
-
`delete_record_link(record:, classes: '')`
|
50
|
-
\r\n
|
51
|
-
The `delete_record_link` helper will display just display a delete link, with a confirm. It also doesn't check if the user has permission before displaying the link. Classes that you pass in as a parameter will be applied to the link.
|
52
|
-
}
|
13
|
+
spec.description = %q{
|
14
|
+
Run rails generate --help to see a list of generators that were added by installing the gem to your Rails Gemfile. After that, you can check the github for documentation.}
|
53
15
|
spec.homepage = "https://github.com/DakotaLMartinez/handy_generators"
|
54
16
|
spec.license = "MIT"
|
55
17
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: handy_generators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DakotaLMartinez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,26 +80,9 @@ dependencies:
|
|
80
80
|
- - ">"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '4.0'
|
83
|
-
description:
|
84
|
-
|
85
|
-
|
86
|
-
to edit and/or delete the record before\ndisplaying the link. If you'd like to always
|
87
|
-
display these links when\nyou use the helper in the view or handle the logic yourself,
|
88
|
-
simply\nadd --pundit false to your command.\n\r\n\n\nrails generate handy_generators:edit_links_helper
|
89
|
-
--pundit false\n\n\n\n\r\n\n\nedit_links(record:, edit_classes: '', delete_classes:
|
90
|
-
'')\n\r\n\nThe `edit_links` helper receives three parameters `record`, `edit_classes`,\nand
|
91
|
-
`delete_classes`. Record is the only required parameter, \n`edit_classes` and `delete_classes`
|
92
|
-
will be empty by default, if you'd \nlike to add classes you can pass them as parameters
|
93
|
-
to the helper. The \ndefault helper uses pundit, and it will check if the logged
|
94
|
-
in user has\npermission to edit or delete the record before displaying the links.
|
95
|
-
If\nnot, it will display the edit or delete links to all users.\n\r\n\n`edit_record_link(record:,
|
96
|
-
classes: '')`\n\r\n\nThe `edit_record_link` helper will just display an edit link,
|
97
|
-
it won't check if the user has permission before displaying the link. Classes that
|
98
|
-
you pass in as a parameter will be applied to the link.\n\r\n\n`delete_record_link(record:,
|
99
|
-
classes: '')`\n\r\n\nThe `delete_record_link` helper will display just display a
|
100
|
-
delete link, with a confirm. It also doesn't check if the user has permission before
|
101
|
-
displaying the link. Classes that you pass in as a parameter will be applied to
|
102
|
-
the link.\n "
|
83
|
+
description: |2-
|
84
|
+
|
85
|
+
Run rails generate --help to see a list of generators that were added by installing the gem to your Rails Gemfile. After that, you can check the github for documentation.
|
103
86
|
email:
|
104
87
|
- dakotaleemusic@gmail.com
|
105
88
|
executables: []
|