handy_generators 0.1.8 → 0.1.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7d113f211bbdd551a0fd23fec01458efd1d89b4499716f9680c9c90dffa25a1
4
- data.tar.gz: 8db9774519f008564b2416c58dfea6941a1d687eb4bb0fa4e7a30647e385d0d9
3
+ metadata.gz: '064052909f23ec9f06d4b1308de4ef98a9f73c860207e2d38f1903e82df94af9'
4
+ data.tar.gz: 89f7acd9cc438f741c0155ee3521b28134504208146109550dd62fc0459f8164
5
5
  SHA512:
6
- metadata.gz: e1fc413a078fd5f613c4223b8972b7d6c37e4782eefb59b4dbd01c7e941d0f63ac3958188d8a8aab19596febf91b66898822128d544785f6a720f09da08ce233
7
- data.tar.gz: e1adc6a24e7cd2573a2c23299558546fb6008803744e87fe974256da11033f5eb7c66dbeb8b0b14b284f15cc40e0fd278c187a716e019a48f8c0d39918f8dc49
6
+ metadata.gz: 76226312f7984709f22816bb69a5962146d4ab29cf8e8e7687681c4331847da8df0125da2fe6814ec0497d08ad46c28cdba09d5b0da9191f6e1d19524f1daaab
7
+ data.tar.gz: '08af4099ae504214722b233101959ca85892eeb03652127ff32910decfc126c556ca567e694f7ad7dc611de563656619e9c7c601d04adfd585a553a22bb4f45c'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- handy_generators (0.1.8)
4
+ handy_generators (0.1.9)
5
5
  rails (> 4.0)
6
6
 
7
7
  GEM
@@ -10,7 +10,48 @@ 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 = %q{Run the edit_delete_links generator to add the edit_links helper to your app so you can use pundit (optional) to add edit and delete links to a resource's show page. Just pass the resource as an argument: edit_links(record: @post)}
13
+ spec.description = %q{
14
+ ## Usage
15
+
16
+ ### Edit Links Helper
17
+
18
+ #### Generators
19
+
20
+ ```
21
+ rails generate handy_generators:edit_links_helper
22
+ ```
23
+
24
+ This generator will add a helper and a partial for displaying edit and
25
+ delete links for a record. This uses pundit by default to check
26
+ whether a user should be able to edit and/or delete the record before
27
+ displaying the link. If you'd like to always display these links when
28
+ you use the helper in the view or handle the logic yourself, simply
29
+ add --pundit false to your command.
30
+
31
+ ```
32
+ rails generate handy_generators:edit_links_helper --pundit false
33
+ ```
34
+
35
+ #### Helpers
36
+
37
+ `edit_links(record:, edit_classes: '', delete_classes: '')`
38
+
39
+ The `edit_links` helper receives three parameters `record`, `edit_classes`,
40
+ and `delete_classes`. Record is the only required parameter,
41
+ `edit_classes` and `delete_classes` will be empty by default, if you'd
42
+ like to add classes you can pass them as parameters to the helper. The
43
+ default helper uses pundit, and it will check if the logged in user has
44
+ permission to edit or delete the record before displaying the links. If
45
+ not, it will display the edit or delete links to all users.
46
+
47
+ `edit_record_link(record:, classes: '')`
48
+
49
+ 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.
50
+
51
+ `delete_record_link(record:, classes: '')`
52
+
53
+ 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.
54
+ }
14
55
  spec.homepage = "https://github.com/DakotaLMartinez/handy_generators"
15
56
  spec.license = "MIT"
16
57
 
@@ -1,3 +1,3 @@
1
1
  module HandyGenerators
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: handy_generators
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - DakotaLMartinez
@@ -80,9 +80,27 @@ dependencies:
80
80
  - - ">"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '4.0'
83
- description: 'Run the edit_delete_links generator to add the edit_links helper to
84
- your app so you can use pundit (optional) to add edit and delete links to a resource''s
85
- show page. Just pass the resource as an argument: edit_links(record: @post)'
83
+ description: "\n ## Usage\n\n### Edit Links Helper\n\n#### Generators\n\n```\nrails
84
+ generate handy_generators:edit_links_helper\n```\n\nThis generator will add a helper
85
+ and a partial for displaying edit and\ndelete links for a record. This uses pundit
86
+ by default to check\nwhether a user should be able to edit and/or delete the record
87
+ before\ndisplaying the link. If you'd like to always display these links when\nyou
88
+ use the helper in the view or handle the logic yourself, simply\nadd --pundit false
89
+ to your command.\n\n```\nrails generate handy_generators:edit_links_helper --pundit
90
+ false\n```\n\n#### Helpers\n\n`edit_links(record:, edit_classes: '', delete_classes:
91
+ '')`\n\nThe `edit_links` helper receives three parameters `record`, `edit_classes`,
92
+ \nand `delete_classes`. Record is the only required parameter, \n`edit_classes`
93
+ and `delete_classes` will be empty by default, if you'd \nlike to add classes you
94
+ can pass them as parameters to the helper. The \ndefault helper uses pundit, and
95
+ it will check if the logged in user has\npermission to edit or delete the record
96
+ before displaying the links. If\nnot, it will display the edit or delete links to
97
+ all users.\n\n`edit_record_link(record:, classes: '')`\n\nThe `edit_record_link`
98
+ helper will just display an edit link, it won't check if the user has permission
99
+ before displaying the link. Classes that you pass in as a parameter will be applied
100
+ to the link.\n\n`delete_record_link(record:, classes: '')`\n\nThe `delete_record_link`
101
+ helper will display just display a delete link, with a confirm. It also doesn't
102
+ check if the user has permission before displaying the link. Classes that you pass
103
+ in as a parameter will be applied to the link.\n "
86
104
  email:
87
105
  - dakotaleemusic@gmail.com
88
106
  executables: []