wallaby-view 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +30 -1
- data/lib/wallaby/view/custom_prefixes.rb +8 -6
- data/lib/wallaby/view/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbb2b53edfd05292aa8277741b572b703f952befd6048c4592f9f1eea60e6cb0
|
4
|
+
data.tar.gz: 57fb94ffc44a1b6cd67a9e20939c3535b74d6c5a2283237f69548551d437eb44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fe5edfe3875669399eab479e38cab13b549926348f0d402796f66b5f19c914e95e3f15b088e91292575436cb838cdfd57cf82ed980e493859602ee16d2c3e68
|
7
|
+
data.tar.gz: 5e3557307cc24027184dc95eca8eb6945815f7b5b99a0182618a4ccee64fcd083b401421d5fd08c5eb71a3c2ecea7594ee53329b318399ac21d7e1cb0f2d8e4c
|
data/README.md
CHANGED
@@ -50,7 +50,7 @@ end
|
|
50
50
|
# app/controllers/admin/users_controller
|
51
51
|
class Admin::UsersController < Admin::ApplicationController
|
52
52
|
self.theme_name = 'account'
|
53
|
-
self.
|
53
|
+
self.prefix_options = { mapping_actions: { edit: 'form' } }
|
54
54
|
end
|
55
55
|
```
|
56
56
|
|
@@ -77,17 +77,46 @@ but still can be rendered by `admin/application#edit` action
|
|
77
77
|
For `admin/users#edit` action, since `mapping_actions` option is set, `edit` will be mapped to `form`.
|
78
78
|
Therefore, the lookup folder order of `admin/users#edit` becomes:
|
79
79
|
|
80
|
+
- app/views/admin/users/edit
|
80
81
|
- app/views/admin/users/form
|
81
82
|
- app/views/admin/users
|
83
|
+
- app/views/secure/edit
|
82
84
|
- app/views/secure/form
|
83
85
|
- app/views/secure
|
86
|
+
- app/views/admin/application/edit
|
84
87
|
- app/views/admin/application/form
|
85
88
|
- app/views/admin/application
|
89
|
+
- app/views/secure/edit
|
86
90
|
- app/views/secure/form
|
87
91
|
- app/views/secure
|
92
|
+
- app/views/application/edit
|
88
93
|
- app/views/application/form
|
89
94
|
- app/views/application
|
90
95
|
|
96
|
+
## Advanced Usage
|
97
|
+
|
98
|
+
It is possible to override the `_prefixes` method to make more changes to the prefixes:
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
class ApplicationController < ActionController::Base
|
102
|
+
include Wallaby::View
|
103
|
+
|
104
|
+
def _prefixes
|
105
|
+
super do |prefixes|
|
106
|
+
prefixes << 'last_resort'
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
```
|
111
|
+
|
112
|
+
Then the lookup folder order of `application#edit` becomes:
|
113
|
+
|
114
|
+
- app/views/application/edit
|
115
|
+
- app/views/application
|
116
|
+
- app/views/last_resort/edit
|
117
|
+
- app/views/last_resort
|
118
|
+
|
119
|
+
|
91
120
|
## Documentation
|
92
121
|
|
93
122
|
- [API Reference](https://www.rubydoc.info/gems/wallaby-view)
|
@@ -88,8 +88,9 @@ module Wallaby
|
|
88
88
|
# @return [Array<String>]
|
89
89
|
def execute(&block)
|
90
90
|
new_prefixes(&block).each_with_object([]) do |prefix, array|
|
91
|
-
# Extend the prefix with
|
92
|
-
array << "#{prefix}/#{
|
91
|
+
# Extend the prefix with actions
|
92
|
+
actions.each { |action| array << "#{prefix}/#{action}" }
|
93
|
+
array << prefix
|
93
94
|
end
|
94
95
|
end
|
95
96
|
|
@@ -110,13 +111,14 @@ module Wallaby
|
|
110
111
|
end
|
111
112
|
end
|
112
113
|
|
113
|
-
# Action name
|
114
|
-
# @return [
|
115
|
-
def
|
116
|
-
@
|
114
|
+
# Action name actions
|
115
|
+
# @return [Array<String>]
|
116
|
+
def actions
|
117
|
+
@actions ||= [action_name, mapped_action_name].compact
|
117
118
|
end
|
118
119
|
|
119
120
|
# Insert theme name into the prefixes
|
121
|
+
# @param [Array] array
|
120
122
|
def insert_themes_into(array)
|
121
123
|
themes.each do |theme|
|
122
124
|
index = array.index theme[:theme_path]
|
data/lib/wallaby/view/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wallaby-view
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tian Chen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|