ruby_lotus 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/CHANGELOG.md +0 -0
- data/Gemfile +6 -0
- data/LICENSE +21 -0
- data/README.md +0 -0
- data/app/controllers/ruby_lotus/ruby_lotus_controller.rb +17 -0
- data/app/views/ruby_lotus/ruby_lotus/_models.html.erb +47 -0
- data/app/views/ruby_lotus/ruby_lotus/_route_panel.html.erb +34 -0
- data/app/views/ruby_lotus/ruby_lotus/_routes.html.erb +44 -0
- data/app/views/ruby_lotus/ruby_lotus/_routes_v2.html.erb +47 -0
- data/app/views/ruby_lotus/ruby_lotus/_routes_v3.html.erb +32 -0
- data/app/views/ruby_lotus/ruby_lotus/_styles.html.erb +145 -0
- data/app/views/ruby_lotus/ruby_lotus/index.html.erb +28 -0
- data/app/views/ruby_lotus/ruby_lotus/v2.html.erb +51 -0
- data/config/routes.rb +4 -0
- data/lib/ruby_lotus/engine.rb +3 -0
- data/lib/ruby_lotus/route.rb +36 -0
- data/lib/ruby_lotus/version.rb +5 -0
- data/lib/ruby_lotus.rb +3 -0
- data/ruby_lotus.gemspec +30 -0
- metadata +65 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e793a4b2801351b048e98469b66311eb3e50e6f66a1a3903fd84ffba53c14c8e
|
4
|
+
data.tar.gz: c9f9f42f8e53da677811bc92534c53578e2f08098e41e2e994c5a9f86fd3f0c9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d526b980a0c6e93fdf3ddd47b4db9de37df54617040cd93dcd211321ed9cc797512a46c0df3f8acb8cb542a027871f0c8fec4beeae0fe7afe6c36d0b992b3f18
|
7
|
+
data.tar.gz: 6af106951a891004efdad1365c0227a42738e6f882342fb11e160ab3e3ceaf43f675bce7dad31967349b84493bb8255a1d5f4d880012c1b1aae24cddd1c88a80
|
data/CHANGELOG.md
ADDED
File without changes
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2024 Abvgdejg
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
File without changes
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<% Rails.application.eager_load! %>
|
2
|
+
<% models = ApplicationRecord.descendants %>
|
3
|
+
<% models.each_with_index do |model, i| %>
|
4
|
+
<% columns = model.columns %>
|
5
|
+
|
6
|
+
<% css_type = model %>
|
7
|
+
<% css_type = 'getpost' if css_type == 'get|post' %>
|
8
|
+
|
9
|
+
<div class="l_row l_color-<%= css_type %>">
|
10
|
+
<div class="l_data" data-bs-toggle="collapse" data-bs-target="#model-<%= i %>" aria-expanded="true" aria-controls="model-<%= i %>">
|
11
|
+
<div class="l_method l_bg-<%= css_type %> text-black">
|
12
|
+
<div class='bi bi-person'> </div>
|
13
|
+
</div>
|
14
|
+
<div class='l_body'>
|
15
|
+
<div class='l_name'> <%= model %> </div>
|
16
|
+
<div class='l_desc'> <%# route_path %> </div>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
<div id="model-<%= i %>" class="accordion-collapse collapse">
|
20
|
+
<div class="accordion-body">
|
21
|
+
<div class='container'>
|
22
|
+
<% columns.each_with_index do |column, i| %>
|
23
|
+
<% css_type = column.type %>
|
24
|
+
<% css_type = 'getpost' if css_type == 'get|post' %>
|
25
|
+
|
26
|
+
<div class="l_row l_color-<%= css_type %>">
|
27
|
+
<div class="l_data">
|
28
|
+
<div class="l_method l_bg-<%= css_type %>">
|
29
|
+
<%= column.type %>
|
30
|
+
</div>
|
31
|
+
<div class='l_body'>
|
32
|
+
<div class='l_name'> <%= column.name %> </div>
|
33
|
+
<div class='l_desc'> <%# route_path %> </div>
|
34
|
+
</div>
|
35
|
+
<div class='l_controller'>
|
36
|
+
<div class='first'>null: <%= column.null %></div>
|
37
|
+
<div class='middle'> # </div>
|
38
|
+
<div class='last'>default: <%= column.default %></div>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
<% end %>
|
43
|
+
</div>
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
</div>
|
47
|
+
<% end %>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<div class="tab-pane info-panel-body fade l_color-<%= route.method.downcase %>" id="route-<%= route.id %>-tab" role="tabpanel" aria-labelledby="routes-<%= route.id %>-tab-button">
|
2
|
+
<div class='info-panel-content'>
|
3
|
+
<div class='info-panel-header d-flex justify-content-around'>
|
4
|
+
<div> name: <%= route.name %> </div>
|
5
|
+
<div> path: <%= route.path %> </div>
|
6
|
+
</div>
|
7
|
+
<div class='info-panel-header d-flex justify-content-around'>
|
8
|
+
<div> controller: <%= route.controller %> </div>
|
9
|
+
<div> action: <%= route.action %> </div>
|
10
|
+
</div>
|
11
|
+
<div class='info-panel-header d-flex justify-content-around'>
|
12
|
+
<button onclick="send_test_req('<%= route.path %>','<%= route.method %>', '<%= route.id %>')"> TEST </button>
|
13
|
+
</div>
|
14
|
+
<div class='info-panel-respone-<%= route.id %>'></div>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<script>
|
19
|
+
function send_test_req(path, method, id) {
|
20
|
+
fetch(path, {
|
21
|
+
method: method,
|
22
|
+
headers: {
|
23
|
+
'Accept': 'application/json',
|
24
|
+
'Content-Type': 'application/json'
|
25
|
+
},
|
26
|
+
}).then(data=>{
|
27
|
+
let res = document.getElementsByClassName(`info-panel-respone-${id}`)[0]
|
28
|
+
if (data.ok) {
|
29
|
+
data.json().then(r=>{res.innerHTML = `status: ${data.status}\nresponse: ${JSON.stringify(r)}`})
|
30
|
+
}
|
31
|
+
else {res.innerHTML = `status: ${data.status}`}
|
32
|
+
})
|
33
|
+
}
|
34
|
+
</script>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
<% routes = Rails.application.routes.routes %>
|
2
|
+
<% routes.each_with_index do |route, i| %>
|
3
|
+
<% route_path = route.ast.to_s %>
|
4
|
+
<% route_method = route.verb %>
|
5
|
+
<% route_name = route.name %>
|
6
|
+
<% route_controller = route.defaults[:controller] %>
|
7
|
+
<% route_action = route.defaults[:action] %>
|
8
|
+
<% route_params = route.parts %>
|
9
|
+
<% route_constraints = route.constraints %>
|
10
|
+
|
11
|
+
<% next if route_path&.match?('rails') %>
|
12
|
+
<% next if route_path&.match?('assets') %>
|
13
|
+
<% next if route_path&.match?('cable') %>
|
14
|
+
<% next if route_path&.match?('historical_location') %>
|
15
|
+
<%# next if route_controller&.match?('rails/') %>
|
16
|
+
|
17
|
+
<% css_type = route_method.downcase %>
|
18
|
+
<% css_type = 'getpost' if css_type == 'get|post' %>
|
19
|
+
|
20
|
+
<div class="l_row l_color-<%= css_type %>">
|
21
|
+
<div class="l_data" data-bs-toggle="collapse" data-bs-target="#route-<%= i %>" aria-expanded="true" aria-controls="route-<%= i %>">
|
22
|
+
<div class="l_method l_bg-<%= css_type %>">
|
23
|
+
<%= route_method %>
|
24
|
+
</div>
|
25
|
+
<div class='l_body'>
|
26
|
+
<div class='l_name'> <%= route_name %> </div>
|
27
|
+
<div class='l_desc'> <%= route_path %> </div>
|
28
|
+
</div>
|
29
|
+
<div class='l_controller'>
|
30
|
+
<div class='first'><%= route_controller %></div>
|
31
|
+
<div class='middle'> # </div>
|
32
|
+
<div class='last'><%= route_action %></div>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
<div id="route-<%= i %>" class="accordion-collapse collapse">
|
36
|
+
<div class="accordion-body">
|
37
|
+
<div class='container'>
|
38
|
+
<%= route_params %>
|
39
|
+
<%= route_constraints %>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
<% end %>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<div class="nav d-block" id="lotus-tab-buttons">
|
2
|
+
<% routes = Rails.application.routes.routes %>
|
3
|
+
<% routes.each_with_index do |route, i| %>
|
4
|
+
<% route_path = route.ast.to_s %>
|
5
|
+
<% route_method = route.verb %>
|
6
|
+
<% route_name = route.name %>
|
7
|
+
<% route_controller = route.defaults[:controller] %>
|
8
|
+
<% route_action = route.defaults[:action] %>
|
9
|
+
<% route_params = route.parts %>
|
10
|
+
<% route_constraints = route.constraints %>
|
11
|
+
|
12
|
+
<% next if route_path&.match?('rails') %>
|
13
|
+
<% next if route_path&.match?('assets') %>
|
14
|
+
<% next if route_path&.match?('cable') %>
|
15
|
+
<% next if route_path&.match?('historical_location') %>
|
16
|
+
<%# next if route_controller&.match?('rails/') %>
|
17
|
+
|
18
|
+
<% css_type = route_method.downcase %>
|
19
|
+
<% css_type = 'getpost' if css_type == 'get|post' %>
|
20
|
+
|
21
|
+
|
22
|
+
<div class="l_row l_color-<%= css_type %>">
|
23
|
+
<div class="l_data" id="route-<%= i %>-tab-button" data-bs-toggle="tab" data-bs-target="#route-<%= i %>-tab" aria-controls="route-<%= i %>-tab">
|
24
|
+
<div class="l_method l_bg-<%= css_type %>">
|
25
|
+
<%= route_method %>
|
26
|
+
</div>
|
27
|
+
<div class='l_body'>
|
28
|
+
<div class='l_name'> <%= route_name %> </div>
|
29
|
+
<div class='l_desc'> <%= route_path %> </div>
|
30
|
+
</div>
|
31
|
+
<div class='l_controller'>
|
32
|
+
<div class='first'><%= route_controller %></div>
|
33
|
+
<div class='middle'> # </div>
|
34
|
+
<div class='last'><%= route_action %></div>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
<div id="route-<%= i %>" class="accordion-collapse collapse">
|
38
|
+
<div class="accordion-body">
|
39
|
+
<div class='container'>
|
40
|
+
<%= route_params %>
|
41
|
+
<%= route_constraints %>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
<% end %>
|
47
|
+
</div>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<div class="nav d-block" id="lotus-tab-buttons">
|
2
|
+
<% @routes.each do |route| %>
|
3
|
+
<% css_type = route.method.downcase %>
|
4
|
+
<% css_type = 'getpost' if css_type == 'get|post' %>
|
5
|
+
|
6
|
+
|
7
|
+
<div class="l_row l_color-<%= css_type %>">
|
8
|
+
<div class="l_data" id="route-<%= route.id %>-tab-button" data-bs-toggle="tab" data-bs-target="#route-<%= route.id %>-tab" aria-controls="route-<%= route.id %>-tab">
|
9
|
+
<div class="l_method l_bg-<%= css_type %>">
|
10
|
+
<%= route.method %>
|
11
|
+
</div>
|
12
|
+
<div class='l_body'>
|
13
|
+
<div class='l_name'> <%= route.name %> </div>
|
14
|
+
<div class='l_desc'> <%= route.path %> </div>
|
15
|
+
</div>
|
16
|
+
<div class='l_controller'>
|
17
|
+
<div class='first'><%= route.controller %></div>
|
18
|
+
<div class='middle'> # </div>
|
19
|
+
<div class='last'><%= route.action %></div>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
<div id="route-<%= route.id %>" class="accordion-collapse collapse">
|
23
|
+
<div class="accordion-body">
|
24
|
+
<div class='container'>
|
25
|
+
<%= route.params %>
|
26
|
+
<%= route.constraints %>
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
<% end %>
|
32
|
+
</div>
|
@@ -0,0 +1,145 @@
|
|
1
|
+
<style>
|
2
|
+
|
3
|
+
:root {
|
4
|
+
--lotus-get: rgb(25, 135, 84);
|
5
|
+
--lotus-get-rgb: 25, 135, 84;
|
6
|
+
--lotus-post: rgb(251, 140, 84);
|
7
|
+
--lotus-post-rgb: 251, 140, 84;
|
8
|
+
--lotus-delete: rgb(255, 0, 0);
|
9
|
+
--lotus-delete-rgb: 255, 0, 0;
|
10
|
+
--lotus-put: rgb(255, 0, 255);
|
11
|
+
--lotus-put-rgb: 255, 0, 255;
|
12
|
+
--lotus-patch: rgb(0, 255, 255);
|
13
|
+
--lotus-patch-rgb: 0, 255, 255;
|
14
|
+
--lotus-getpost: rgb(0, 0, 0);
|
15
|
+
--lotus-getpost-rgb: 0, 0, 0;
|
16
|
+
}
|
17
|
+
.l_bg-get, .l_bg-integer {
|
18
|
+
background: var(--lotus-get) !important;
|
19
|
+
}
|
20
|
+
.l_color-get, .l_color-integer {
|
21
|
+
background: rgba(var(--lotus-get-rgb), .2) !important;
|
22
|
+
}
|
23
|
+
|
24
|
+
.l_bg-post, .l_bg-string {
|
25
|
+
background: var(--lotus-post) !important;
|
26
|
+
}
|
27
|
+
.l_color-post, .l_color-string {
|
28
|
+
background: rgba(var(--lotus-post-rgb), .2) !important;
|
29
|
+
}
|
30
|
+
|
31
|
+
.l_bg-delete, .l_bg-datetime {
|
32
|
+
background: var(--lotus-delete) !important;
|
33
|
+
}
|
34
|
+
.l_color-delete, .l_color-datetime {
|
35
|
+
background: rgba(var(--lotus-delete-rgb), .2) !important;
|
36
|
+
}
|
37
|
+
|
38
|
+
.l_bg-put, .l_bg-boolean {
|
39
|
+
background: var(--lotus-put) !important;
|
40
|
+
}
|
41
|
+
.l_color-put, .l_color-boolean {
|
42
|
+
background: rgba(var(--lotus-put-rgb), .2) !important;
|
43
|
+
}
|
44
|
+
|
45
|
+
.l_bg-patch {
|
46
|
+
background: var(--lotus-patch) !important;
|
47
|
+
}
|
48
|
+
.l_color-patch {
|
49
|
+
background: rgba(var(--lotus-patch-rgb), .2) !important;
|
50
|
+
}
|
51
|
+
|
52
|
+
.l_bg-getpost {
|
53
|
+
background: var(--lotus-getpost) !important;
|
54
|
+
}
|
55
|
+
.l_color-getpost {
|
56
|
+
background: rgba(var(--lotus-getpost-rgb), .2) !important;
|
57
|
+
}
|
58
|
+
|
59
|
+
.l_row {
|
60
|
+
border: 1px solid #000;
|
61
|
+
border-radius: 4px;
|
62
|
+
box-shadow: 0 0 3px rgba(0,0,0,.19);
|
63
|
+
margin: 0 0 15px;
|
64
|
+
}
|
65
|
+
.l_data {
|
66
|
+
align-items: center;
|
67
|
+
cursor: pointer;
|
68
|
+
display: flex;
|
69
|
+
padding: 5px;
|
70
|
+
}
|
71
|
+
.l_body {
|
72
|
+
align-items: center;
|
73
|
+
display: flex;
|
74
|
+
flex-direction: row;
|
75
|
+
flex-wrap: wrap;
|
76
|
+
gap: 0 10px;
|
77
|
+
padding: 0 10px;
|
78
|
+
width: 100%;
|
79
|
+
}
|
80
|
+
.l_name {
|
81
|
+
align-items: center;
|
82
|
+
color: #3b4151;
|
83
|
+
display: flex;
|
84
|
+
font-family: monospace;
|
85
|
+
font-size: 16px;
|
86
|
+
font-weight: 600;
|
87
|
+
word-break: break-word;
|
88
|
+
}
|
89
|
+
.l_desc {
|
90
|
+
color: #3b4151;
|
91
|
+
font-family: sans-serif;
|
92
|
+
font-size: 13px;
|
93
|
+
word-break: break-word;
|
94
|
+
}
|
95
|
+
.l_controller {
|
96
|
+
align-items: center;
|
97
|
+
display: flex;
|
98
|
+
justify-content: center;
|
99
|
+
position: static;
|
100
|
+
right: 100px;
|
101
|
+
width: auto;
|
102
|
+
text-wrap: nowrap;
|
103
|
+
font-family: sans-serif;
|
104
|
+
}
|
105
|
+
.l_controller .first {
|
106
|
+
border-top-left-radius: 4px;
|
107
|
+
border-bottom-left-radius: 4px;
|
108
|
+
background: black;
|
109
|
+
color: white;
|
110
|
+
padding: 6px 3px 6px 10px;
|
111
|
+
transition: color .5s;
|
112
|
+
}
|
113
|
+
.l_controller .middle {
|
114
|
+
border-radius: 0;
|
115
|
+
background: black;
|
116
|
+
color: white;
|
117
|
+
padding: 6px 3px 6px 3px;
|
118
|
+
|
119
|
+
}
|
120
|
+
.l_controller .last {
|
121
|
+
border-top-right-radius: 4px;
|
122
|
+
border-bottom-right-radius: 4px;
|
123
|
+
background: black;
|
124
|
+
color: white;
|
125
|
+
padding: 6px 10px 6px 3px;
|
126
|
+
|
127
|
+
transition: color .5s;
|
128
|
+
}
|
129
|
+
.l_controller .last:hover, .l_controller .first:hover {
|
130
|
+
color: red;
|
131
|
+
}
|
132
|
+
.l_method {
|
133
|
+
/* background: #000; */
|
134
|
+
border-radius: 3px;
|
135
|
+
color: #fff;
|
136
|
+
font-family: sans-serif;
|
137
|
+
font-size: 14px;
|
138
|
+
font-weight: 700;
|
139
|
+
min-width: 80px;
|
140
|
+
padding: 6px 0;
|
141
|
+
text-align: center;
|
142
|
+
text-shadow: 0 1px 0 rgba(0,0,0,.1);
|
143
|
+
}
|
144
|
+
|
145
|
+
</style>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<div class='container'>
|
2
|
+
|
3
|
+
<ul class="nav nav-pills my-3" id="lotus-tab-buttons" role="tablist">
|
4
|
+
<li class="nav-item" role="presentation">
|
5
|
+
<button class="nav-link active" id="routes-tab-button" data-bs-toggle="pill" data-bs-target="#routes-tab" type="button" role="tab" aria-controls="routes-tab" aria-selected="true">
|
6
|
+
Routes
|
7
|
+
</button>
|
8
|
+
</li>
|
9
|
+
<li class="nav-item" role="presentation">
|
10
|
+
<button class="nav-link" id="models-tab-button" data-bs-toggle="pill" data-bs-target="#models-tab" type="button" role="tab" aria-controls="models-tab" aria-selected="false">
|
11
|
+
Models
|
12
|
+
</button>
|
13
|
+
</li>
|
14
|
+
</ul>
|
15
|
+
|
16
|
+
<div class="tab-content" id="lotus-tab-panels">
|
17
|
+
<div class="tab-pane fade show active" id="routes-tab" role="tabpanel" aria-labelledby="routes-tab-button">
|
18
|
+
<%= render partial: 'routes' %>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<div class="tab-pane fade" id="models-tab" role="tabpanel" aria-labelledby="models-tab-button">
|
22
|
+
<%= render partial: 'models' %>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<%= render partial: 'styles' %>
|
27
|
+
|
28
|
+
</div>
|
@@ -0,0 +1,51 @@
|
|
1
|
+
|
2
|
+
<div class='d-flex'>
|
3
|
+
<div class='col-6 p-3'>
|
4
|
+
<ul class="nav nav-pills mb-3" id="lotus-tab-buttons" role="tablist">
|
5
|
+
<li class="nav-item" role="presentation">
|
6
|
+
<button class="nav-link active" id="routes-tab-button" data-bs-toggle="pill" data-bs-target="#routes-tab" type="button" role="tab" aria-controls="routes-tab" aria-selected="true">
|
7
|
+
Routes
|
8
|
+
</button>
|
9
|
+
</li>
|
10
|
+
<li class="nav-item" role="presentation">
|
11
|
+
<button class="nav-link" id="models-tab-button" data-bs-toggle="pill" data-bs-target="#models-tab" type="button" role="tab" aria-controls="models-tab" aria-selected="false">
|
12
|
+
Models
|
13
|
+
</button>
|
14
|
+
</li>
|
15
|
+
</ul>
|
16
|
+
|
17
|
+
<div class="tab-content" id="lotus-tab-panels">
|
18
|
+
<div class="tab-pane fade show active" id="routes-tab" role="tabpanel" aria-labelledby="routes-tab-button">
|
19
|
+
<%= render partial: 'routes_v3' %>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<div class="tab-pane fade" id="models-tab" role="tabpanel" aria-labelledby="models-tab-button">
|
23
|
+
<%= render partial: 'models' %>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<div class='info-panel col-6 p-3'>
|
29
|
+
<div class="tab-content w-100" id="lotus-tab-panels">
|
30
|
+
<% @routes.each do |route| %>
|
31
|
+
<%= render partial: 'route_panel', locals: {route: } %>
|
32
|
+
<% end%>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
<%= render partial: 'styles' %>
|
37
|
+
|
38
|
+
<style>
|
39
|
+
.info-panel {
|
40
|
+
display: flex;
|
41
|
+
height: 100vh;
|
42
|
+
}
|
43
|
+
.info-panel-body {
|
44
|
+
width: 100%;
|
45
|
+
height: 100%;
|
46
|
+
background: rgba(0,0,0,0.8);
|
47
|
+
border: 3px solid black;
|
48
|
+
border-radius: 35px;
|
49
|
+
padding: 20px;
|
50
|
+
}
|
51
|
+
</style>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
module RubyLotus
|
2
|
+
class Route
|
3
|
+
EXCLUDE_PATHS = %w[rails assets cable historical_location].freeze
|
4
|
+
attr_reader :path, :method, :name, :controller, :action, :params, :constraints, :id
|
5
|
+
|
6
|
+
def initialize(path:, method:, name:, controller:, action:, params:, constraints:, id: nil)
|
7
|
+
@path = path
|
8
|
+
@method = method
|
9
|
+
@name = name
|
10
|
+
@controller = controller
|
11
|
+
@action = action
|
12
|
+
@params = params
|
13
|
+
@constraints = constraints
|
14
|
+
@id = id if id
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.from_rails_routes
|
18
|
+
routes = Rails.application.routes.routes
|
19
|
+
routes.each_with_index.map { |route, id| from_rails_route(route, id:) }.compact
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.from_rails_route(route, id:)
|
23
|
+
path = route.ast.to_s.gsub("(.:format)", "")
|
24
|
+
return nil if path.match?(/#{EXCLUDE_PATHS.join('|')}/)
|
25
|
+
|
26
|
+
method = route.verb
|
27
|
+
name = route.name
|
28
|
+
controller = route.defaults[:controller]
|
29
|
+
action = route.defaults[:action]
|
30
|
+
params = route.parts
|
31
|
+
constraints = route.constraints
|
32
|
+
|
33
|
+
new(path:, method:, name:, controller:, action:, params:, constraints:, id:)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/ruby_lotus.rb
ADDED
data/ruby_lotus.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.expand_path('lib/ruby_lotus/version', __dir__)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'ruby_lotus'
|
7
|
+
spec.version = RubyLotus::VERSION
|
8
|
+
spec.authors = ['Danila Fedorov']
|
9
|
+
spec.email = ['dan2065@mail.ru']
|
10
|
+
spec.summary = ''
|
11
|
+
spec.description = ''
|
12
|
+
spec.homepage = 'https://github.com/Abvgdejg/ruby_lotus'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
spec.platform = Gem::Platform::RUBY
|
15
|
+
spec.required_ruby_version = '>= 3.0'
|
16
|
+
|
17
|
+
spec.files = Dir['README.md', 'LICENSE',
|
18
|
+
'CHANGELOG.md', 'lib/**/*.rb',
|
19
|
+
'app/**/*.rb', 'app/**/*.erb',
|
20
|
+
'config/**/*.rb',
|
21
|
+
'ruby_lotus.gemspec',
|
22
|
+
'Gemfile']
|
23
|
+
spec.extra_rdoc_files = ['README.md']
|
24
|
+
spec.require_paths = ['app', 'lib']
|
25
|
+
|
26
|
+
|
27
|
+
spec.metadata = {
|
28
|
+
'rubygems_mfa_required' => 'true'
|
29
|
+
}
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruby_lotus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Danila Fedorov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-03-04 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: ''
|
14
|
+
email:
|
15
|
+
- dan2065@mail.ru
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files:
|
19
|
+
- README.md
|
20
|
+
files:
|
21
|
+
- CHANGELOG.md
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE
|
24
|
+
- README.md
|
25
|
+
- app/controllers/ruby_lotus/ruby_lotus_controller.rb
|
26
|
+
- app/views/ruby_lotus/ruby_lotus/_models.html.erb
|
27
|
+
- app/views/ruby_lotus/ruby_lotus/_route_panel.html.erb
|
28
|
+
- app/views/ruby_lotus/ruby_lotus/_routes.html.erb
|
29
|
+
- app/views/ruby_lotus/ruby_lotus/_routes_v2.html.erb
|
30
|
+
- app/views/ruby_lotus/ruby_lotus/_routes_v3.html.erb
|
31
|
+
- app/views/ruby_lotus/ruby_lotus/_styles.html.erb
|
32
|
+
- app/views/ruby_lotus/ruby_lotus/index.html.erb
|
33
|
+
- app/views/ruby_lotus/ruby_lotus/v2.html.erb
|
34
|
+
- config/routes.rb
|
35
|
+
- lib/ruby_lotus.rb
|
36
|
+
- lib/ruby_lotus/engine.rb
|
37
|
+
- lib/ruby_lotus/route.rb
|
38
|
+
- lib/ruby_lotus/version.rb
|
39
|
+
- ruby_lotus.gemspec
|
40
|
+
homepage: https://github.com/Abvgdejg/ruby_lotus
|
41
|
+
licenses:
|
42
|
+
- MIT
|
43
|
+
metadata:
|
44
|
+
rubygems_mfa_required: 'true'
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options: []
|
47
|
+
require_paths:
|
48
|
+
- app
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
requirements: []
|
61
|
+
rubygems_version: 3.3.3
|
62
|
+
signing_key:
|
63
|
+
specification_version: 4
|
64
|
+
summary: ''
|
65
|
+
test_files: []
|