micro_admin 0.1.5 → 0.1.6
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/README.md +111 -4
- data/lib/micro_admin/dashboard/base/index.erb +0 -1
- data/lib/micro_admin/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67fdf7523cedeec8776488acd5dfd1b3f9c0d0d8d886f5967c490c5e02b1e112
|
4
|
+
data.tar.gz: 623606a57c857de3963253988eda1b8f2d12f387008beb838962c4a4077e06dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5189b8d0519ff39e50736a2498ce517124bd47c6df0c45e23588a7e2d4a804c5dd96e63db8c8f79917a010e09b465666ca44a5b53654159d524e2eacecc2561b
|
7
|
+
data.tar.gz: edd93c060aa66a20ec848579dfd6a7d64ea25fb030de695e521d179d6d3fbe6dc5576dd44ee4c2372e258eea0aa5552cb7742e63560a4e0c9fef805f82dbc48e
|
data/README.md
CHANGED
@@ -50,37 +50,144 @@ end
|
|
50
50
|
`/app/views/dashboards/user_dashboard/new/name.erb`:
|
51
51
|
|
52
52
|
```html
|
53
|
-
<input type="text" name="name">
|
53
|
+
<input type="text" name="name" class="form-control">
|
54
54
|
```
|
55
55
|
|
56
56
|
`/app/views/dashboards/user_dashboard/edit/name.erb`:
|
57
57
|
|
58
58
|
```html
|
59
|
-
<input type="text" name="name" value="<%= value %>">
|
59
|
+
<input type="text" name="name" value="<%= value %>" class="form-control">
|
60
60
|
```
|
61
61
|
|
62
62
|
```ruby
|
63
63
|
smith = User.new(id: 1, name: "Smith")
|
64
|
-
|
64
|
+
james = User.new(id: 1, name: "James")
|
65
65
|
dashboard = UserDashboard.new
|
66
66
|
```
|
67
67
|
|
68
68
|
```erb
|
69
|
-
<%= dashboard.index([smith,
|
69
|
+
<%= dashboard.index([smith, james]) %>
|
70
70
|
```
|
71
71
|
|
72
|
+
output:
|
73
|
+
```html
|
74
|
+
<header class="navbar border-bottom p-4">
|
75
|
+
<h2 class="m-0">User</h2>
|
76
|
+
<div>
|
77
|
+
<a href="/admin/user/new" class="btn btn-primary">
|
78
|
+
new
|
79
|
+
</a>
|
80
|
+
</div>
|
81
|
+
</header>
|
82
|
+
|
83
|
+
<main class="p-4">
|
84
|
+
<table class="table">
|
85
|
+
<thead>
|
86
|
+
<tr>
|
87
|
+
<th scope="col">id</th>
|
88
|
+
<th scope="col">name</th>
|
89
|
+
<th scope="col">show</th>
|
90
|
+
<th scope="col">edit</th>
|
91
|
+
</tr>
|
92
|
+
</thead>
|
93
|
+
<tbody>
|
94
|
+
<tr>
|
95
|
+
<td>1</td>
|
96
|
+
<td>Smith</td>
|
97
|
+
<td><a href="/admin/user/1">show</a></td>
|
98
|
+
<td><a href="/admin/user/1/edit">edit</a>
|
99
|
+
</td>
|
100
|
+
</tr>
|
101
|
+
<tr>
|
102
|
+
<td>2</td>
|
103
|
+
<td>James</td>
|
104
|
+
<td><a href="/admin/user/2">show</a></td>
|
105
|
+
<td><a href="/admin/user/2/edit">edit</a>
|
106
|
+
</td>
|
107
|
+
</tr>
|
108
|
+
</tbody>
|
109
|
+
</table>
|
110
|
+
</main>
|
111
|
+
```
|
112
|
+
|
113
|
+
|
72
114
|
```erb
|
73
115
|
<%= dashboard.show(smith) %>
|
74
116
|
```
|
75
117
|
|
118
|
+
output:
|
119
|
+
|
120
|
+
```html
|
121
|
+
<header class="navbar border-bottom p-4">
|
122
|
+
<h2 class="m-0">Show User</h2>
|
123
|
+
<div>
|
124
|
+
<a href="/admin/user" class="btn btn-primary">
|
125
|
+
Back
|
126
|
+
</a>
|
127
|
+
</div>
|
128
|
+
</header>
|
129
|
+
|
130
|
+
<main class="p-4">
|
131
|
+
<dl>
|
132
|
+
<dt>id></dt>
|
133
|
+
<dd>1</dd>
|
134
|
+
<dt>name</dt>
|
135
|
+
<dd>Smith</dd>
|
136
|
+
</dl>
|
137
|
+
</main>
|
138
|
+
```
|
139
|
+
|
76
140
|
```erb
|
77
141
|
<%= dashboard.new(errors: ["Name is required!"]) %>
|
78
142
|
```
|
79
143
|
|
144
|
+
output:
|
145
|
+
```html
|
146
|
+
<header class="navbar border-bottom py-4">
|
147
|
+
<h2 class="m-0">Create User</h2>
|
148
|
+
<div>
|
149
|
+
<a href="/admin/user" class="btn btn-primary">
|
150
|
+
Back to index
|
151
|
+
</a>
|
152
|
+
</div>
|
153
|
+
</header>
|
154
|
+
<main class="p-4">
|
155
|
+
<ul class="alert alert-danger">
|
156
|
+
<li class="ml-3">Name is required</li>
|
157
|
+
</ul>
|
158
|
+
<form method="post" action="/admin/user">
|
159
|
+
<div class="mb-3">
|
160
|
+
<label for="name" class="form-label">name</label>
|
161
|
+
<input type="text" name="name" class="form-control"/>
|
162
|
+
</div>
|
163
|
+
</form>
|
164
|
+
</main>
|
165
|
+
```
|
166
|
+
|
80
167
|
```erb
|
81
168
|
<%= dashboard.edit(id: 1, values: {name: "Smith"}, errors: []) %>
|
82
169
|
```
|
83
170
|
|
171
|
+
output:
|
172
|
+
```html
|
173
|
+
<header class="navbar border-bottom py-4">
|
174
|
+
<h2 class="m-0">Create User</h2>
|
175
|
+
<div>
|
176
|
+
<a href="/admin/user" class="btn btn-primary">
|
177
|
+
Back to index
|
178
|
+
</a>
|
179
|
+
</div>
|
180
|
+
</header>
|
181
|
+
<main class="p-4">
|
182
|
+
<form method="patch" action="/admin/user/1">
|
183
|
+
<div class="mb-3">
|
184
|
+
<label for="name" class="form-label">name</label>
|
185
|
+
<input type="text" name="name" value="test" class="form-control"/>
|
186
|
+
</div>
|
187
|
+
</form>
|
188
|
+
</main>
|
189
|
+
```
|
190
|
+
|
84
191
|
**You can decorate table and forms with [Bootstrap](https://getbootstrap.com/docs/5.0/getting-started/download/)!**
|
85
192
|
|
86
193
|
## Development
|
data/lib/micro_admin/version.rb
CHANGED