wobapphelpers 4.1.1 → 4.1.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df7c5424fa0826e39dd85f4f4e0e9ba738f4712db237a2b5b8373d34b5f5285e
|
4
|
+
data.tar.gz: d4841615915834333aa3ed44f0f550482cd50ac6c6c194bab9346fa7a80712df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 670963ebb79163383d2f6c39ab47d6ef811bb35663440d3677e1b854729e27514ec6bdc0ab9e27a7e828ca26a4614542c86c59fd0633265cc31d06e531cf3620
|
7
|
+
data.tar.gz: c7b647442b09ae16373becf5d72b55196feec5e5e75a28f4938154836b3e614cc59f597856f958e3d6dd55896fd696caf3c895d3cc6db21e35672ed368fb9d83
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<% if namespaced? -%>
|
2
|
+
require_dependency "<%= namespaced_file_path %>/application_controller"
|
3
|
+
|
4
|
+
<% end -%>
|
5
|
+
<% module_namespacing do -%>
|
6
|
+
class <%= controller_class_name %>Controller < ApplicationController
|
7
|
+
before_action :set_<%= singular_table_name %>, only: [:show, :edit, :update, :destroy]
|
8
|
+
before_action :add_breadcrumb_show, only: [:show]
|
9
|
+
|
10
|
+
# GET <%= route_url %>
|
11
|
+
def index
|
12
|
+
@<%= plural_table_name %> = <%= orm_class.all(class_name) %>
|
13
|
+
respond_with(@<%= plural_table_name %>)
|
14
|
+
end
|
15
|
+
|
16
|
+
# GET <%= route_url %>/1
|
17
|
+
def show
|
18
|
+
respond_with(@<%= singular_table_name %>)
|
19
|
+
end
|
20
|
+
|
21
|
+
# GET <%= route_url %>/new
|
22
|
+
def new
|
23
|
+
@<%= singular_table_name %> = <%= orm_class.build(class_name) %>
|
24
|
+
respond_with(@<%= singular_table_name %>)
|
25
|
+
end
|
26
|
+
|
27
|
+
# GET <%= route_url %>/1/edit
|
28
|
+
def edit
|
29
|
+
end
|
30
|
+
|
31
|
+
# POST <%= route_url %>
|
32
|
+
def create
|
33
|
+
@<%= singular_table_name %> = <%= orm_class.build(class_name, "#{singular_table_name}_params") %>
|
34
|
+
|
35
|
+
@<%= orm_instance.save %>
|
36
|
+
respond_with(@<%= singular_table_name %>)
|
37
|
+
end
|
38
|
+
|
39
|
+
# PATCH/PUT <%= route_url %>/1
|
40
|
+
def update
|
41
|
+
@<%= orm_instance.update("#{singular_table_name}_params") %>
|
42
|
+
respond_with(@<%= singular_table_name %>)
|
43
|
+
end
|
44
|
+
|
45
|
+
# DELETE <%= route_url %>/1
|
46
|
+
def destroy
|
47
|
+
@<%= orm_instance.destroy %>
|
48
|
+
respond_with(@<%= singular_table_name %>)
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
# Use callbacks to share common setup or constraints between actions.
|
53
|
+
def set_<%= singular_table_name %>
|
54
|
+
@<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>
|
55
|
+
end
|
56
|
+
|
57
|
+
# Only allow a trusted parameter "white list" through.
|
58
|
+
def <%= "#{singular_table_name}_params" %>
|
59
|
+
<%- if attributes_names.empty? -%>
|
60
|
+
params[:<%= singular_table_name %>]
|
61
|
+
<%- else -%>
|
62
|
+
params.require(:<%= singular_table_name %>).permit(<%= attributes_names.map { |name| ":#{name}" }.join(', ') %>)
|
63
|
+
<%- end -%>
|
64
|
+
end
|
65
|
+
end
|
66
|
+
<% end -%>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wobapphelpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wolfgang Barth
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sassc-rails
|
@@ -365,7 +365,7 @@ files:
|
|
365
365
|
- test/integration/helper_delivery_test.rb
|
366
366
|
- test/responders/flash_test.rb
|
367
367
|
- test/test_helper.rb
|
368
|
-
- test/tmp/
|
368
|
+
- test/tmp/lib/templates/rails/scaffold_controller/controller.rb
|
369
369
|
- test/translate_test.rb
|
370
370
|
- test/wobapphelpers_test.rb
|
371
371
|
homepage: http://github.com/swobspace/wobapphelpers
|
@@ -392,7 +392,7 @@ signing_key:
|
|
392
392
|
specification_version: 4
|
393
393
|
summary: Rails helpers and more shared between wob's rails applications
|
394
394
|
test_files:
|
395
|
-
- test/tmp/
|
395
|
+
- test/tmp/lib/templates/rails/scaffold_controller/controller.rb
|
396
396
|
- test/wobapphelpers_test.rb
|
397
397
|
- test/helpers/can_view_helper_test.rb
|
398
398
|
- test/helpers/action_view_helper_test.rb
|
@@ -1,18 +0,0 @@
|
|
1
|
-
Wobapphelpers.setup do |config|
|
2
|
-
#
|
3
|
-
# exclude some controllers from breadcrumbs
|
4
|
-
# the given string must match controller.controller_name
|
5
|
-
#
|
6
|
-
# example:
|
7
|
-
# config.breadcrumb_controller_blacklist = ["user_sessions"]
|
8
|
-
# default:
|
9
|
-
# config.breadcrumb_controller_blacklist = []
|
10
|
-
#
|
11
|
-
# show action links only if has ability to execute the action
|
12
|
-
# * :none : always present action links
|
13
|
-
# * :cancan1 : for cancancan '~>1.7.0' or cancan '~>1.6.0'
|
14
|
-
# * :cancan2 : for cancan '~>2.0.0', untested
|
15
|
-
#
|
16
|
-
# default:
|
17
|
-
# config.cancan = :none
|
18
|
-
end
|