super 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +2 -1
- data/README.md +55 -23
- data/app/assets/javascripts/super/application.js +1062 -261
- data/app/assets/stylesheets/super/application.css +72775 -50711
- data/app/controllers/super/application_controller.rb +39 -50
- data/app/helpers/super/application_helper.rb +24 -17
- data/app/views/layouts/super/application.html.erb +4 -0
- data/app/views/super/application/{_resources_header.html.erb → _collection_header.html.erb} +5 -6
- data/app/views/super/application/_flash.html.erb +13 -13
- data/app/views/super/application/_form_field_select.html.erb +1 -1
- data/app/views/super/application/_form_has_many.html.erb +1 -1
- data/app/views/super/application/{_resource_header.html.erb → _member_header.html.erb} +6 -6
- data/app/views/super/application/_super_layout.html.erb +7 -12
- data/app/views/super/application/_super_panel.html.erb +2 -6
- data/app/views/super/application/_super_schema_display_actions.html.erb +5 -0
- data/app/views/super/application/_super_schema_display_index.html.erb +39 -0
- data/app/views/super/application/_super_schema_display_show.html.erb +8 -0
- data/app/views/super/application/{_form.html.erb → _super_schema_form.html.erb} +2 -4
- data/app/views/super/application/edit.html.erb +2 -2
- data/app/views/super/application/index.html.erb +2 -2
- data/app/views/super/application/new.html.erb +2 -2
- data/app/views/super/application/show.html.erb +2 -2
- data/app/views/super/feather/{_chevron_down.svg → _chevron_down.html} +0 -0
- data/config/locales/en.yml +5 -0
- data/docs/cheat.md +41 -0
- data/docs/webpacker.md +1 -1
- data/frontend/super-frontend/dist/application.css +72775 -50711
- data/frontend/super-frontend/dist/application.js +1062 -261
- data/frontend/super-frontend/package.json +1 -1
- data/frontend/super-frontend/src/javascripts/super/apply_template_controller.ts +6 -8
- data/frontend/super-frontend/tailwind.config.js +7 -1
- data/frontend/super-frontend/yarn.lock +1103 -1195
- data/lib/generators/super/install/install_generator.rb +16 -0
- data/lib/super.rb +2 -2
- data/lib/super/action_inquirer.rb +2 -2
- data/lib/super/client_error.rb +43 -0
- data/lib/super/configuration.rb +1 -1
- data/lib/super/controls.rb +17 -101
- data/lib/super/controls/optional.rb +65 -0
- data/lib/super/controls/required.rb +41 -0
- data/lib/super/controls/steps.rb +115 -0
- data/lib/super/display/schema_types.rb +45 -2
- data/lib/super/error.rb +8 -9
- data/lib/super/form.rb +48 -0
- data/lib/super/form/schema_types.rb +8 -1
- data/lib/super/layout.rb +28 -0
- data/lib/super/link.rb +55 -32
- data/lib/super/panel.rb +13 -0
- data/lib/super/partial/resolving.rb +24 -0
- data/lib/super/schema.rb +19 -5
- data/lib/super/version.rb +1 -1
- data/lib/super/view_helper.rb +1 -1
- metadata +40 -15
- data/app/views/super/application/_index.html.erb +0 -45
- data/app/views/super/application/_show.html.erb +0 -10
- data/docs/controls.md +0 -39
- data/lib/super/display.rb +0 -9
- data/lib/super/step.rb +0 -36
- data/lib/tasks/super_tasks.rake +0 -4
data/lib/super/view_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: super
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zach Ahn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -70,16 +70,22 @@ dependencies:
|
|
70
70
|
name: puma
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '4.3'
|
73
76
|
- - ">="
|
74
77
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
78
|
+
version: 4.3.6
|
76
79
|
type: :development
|
77
80
|
prerelease: false
|
78
81
|
version_requirements: !ruby/object:Gem::Requirement
|
79
82
|
requirements:
|
83
|
+
- - "~>"
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '4.3'
|
80
86
|
- - ">="
|
81
87
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
88
|
+
version: 4.3.6
|
83
89
|
- !ruby/object:Gem::Dependency
|
84
90
|
name: sqlite3
|
85
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,6 +170,20 @@ dependencies:
|
|
164
170
|
- - ">="
|
165
171
|
- !ruby/object:Gem::Version
|
166
172
|
version: '0'
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
name: i18n-debug
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0'
|
180
|
+
type: :development
|
181
|
+
prerelease: false
|
182
|
+
version_requirements: !ruby/object:Gem::Requirement
|
183
|
+
requirements:
|
184
|
+
- - ">="
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
167
187
|
description:
|
168
188
|
email:
|
169
189
|
- engineering@zachahn.com
|
@@ -181,8 +201,8 @@ files:
|
|
181
201
|
- app/controllers/super/application_controller.rb
|
182
202
|
- app/helpers/super/application_helper.rb
|
183
203
|
- app/views/layouts/super/application.html.erb
|
204
|
+
- app/views/super/application/_collection_header.html.erb
|
184
205
|
- app/views/super/application/_flash.html.erb
|
185
|
-
- app/views/super/application/_form.html.erb
|
186
206
|
- app/views/super/application/_form_field__destroy.html.erb
|
187
207
|
- app/views/super/application/_form_field_select.html.erb
|
188
208
|
- app/views/super/application/_form_field_text.html.erb
|
@@ -190,22 +210,24 @@ files:
|
|
190
210
|
- app/views/super/application/_form_has_many.html.erb
|
191
211
|
- app/views/super/application/_form_has_one.html.erb
|
192
212
|
- app/views/super/application/_form_inline_errors.html.erb
|
193
|
-
- app/views/super/application/
|
194
|
-
- app/views/super/application/_resource_header.html.erb
|
195
|
-
- app/views/super/application/_resources_header.html.erb
|
196
|
-
- app/views/super/application/_show.html.erb
|
213
|
+
- app/views/super/application/_member_header.html.erb
|
197
214
|
- app/views/super/application/_super_layout.html.erb
|
198
215
|
- app/views/super/application/_super_panel.html.erb
|
216
|
+
- app/views/super/application/_super_schema_display_actions.html.erb
|
217
|
+
- app/views/super/application/_super_schema_display_index.html.erb
|
218
|
+
- app/views/super/application/_super_schema_display_show.html.erb
|
219
|
+
- app/views/super/application/_super_schema_form.html.erb
|
199
220
|
- app/views/super/application/edit.html.erb
|
200
221
|
- app/views/super/application/index.html.erb
|
201
222
|
- app/views/super/application/new.html.erb
|
202
223
|
- app/views/super/application/nothing.html.erb
|
203
224
|
- app/views/super/application/show.html.erb
|
204
225
|
- app/views/super/feather/README.md
|
205
|
-
- app/views/super/feather/_chevron_down.
|
226
|
+
- app/views/super/feather/_chevron_down.html
|
227
|
+
- config/locales/en.yml
|
206
228
|
- config/routes.rb
|
207
229
|
- docs/README.md
|
208
|
-
- docs/
|
230
|
+
- docs/cheat.md
|
209
231
|
- docs/faq.md
|
210
232
|
- docs/quick_start.md
|
211
233
|
- docs/webpacker.md
|
@@ -236,13 +258,17 @@ files:
|
|
236
258
|
- lib/super.rb
|
237
259
|
- lib/super/action_inquirer.rb
|
238
260
|
- lib/super/assets.rb
|
261
|
+
- lib/super/client_error.rb
|
239
262
|
- lib/super/compatibility.rb
|
240
263
|
- lib/super/configuration.rb
|
241
264
|
- lib/super/controls.rb
|
242
|
-
- lib/super/
|
265
|
+
- lib/super/controls/optional.rb
|
266
|
+
- lib/super/controls/required.rb
|
267
|
+
- lib/super/controls/steps.rb
|
243
268
|
- lib/super/display/schema_types.rb
|
244
269
|
- lib/super/engine.rb
|
245
270
|
- lib/super/error.rb
|
271
|
+
- lib/super/form.rb
|
246
272
|
- lib/super/form/schema_types.rb
|
247
273
|
- lib/super/layout.rb
|
248
274
|
- lib/super/link.rb
|
@@ -250,12 +276,11 @@ files:
|
|
250
276
|
- lib/super/pagination.rb
|
251
277
|
- lib/super/panel.rb
|
252
278
|
- lib/super/partial.rb
|
279
|
+
- lib/super/partial/resolving.rb
|
253
280
|
- lib/super/plugin.rb
|
254
281
|
- lib/super/schema.rb
|
255
|
-
- lib/super/step.rb
|
256
282
|
- lib/super/version.rb
|
257
283
|
- lib/super/view_helper.rb
|
258
|
-
- lib/tasks/super_tasks.rake
|
259
284
|
homepage:
|
260
285
|
licenses:
|
261
286
|
- LGPL-3.0-only
|
@@ -275,7 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
275
300
|
- !ruby/object:Gem::Version
|
276
301
|
version: '0'
|
277
302
|
requirements: []
|
278
|
-
rubygems_version: 3.1.
|
303
|
+
rubygems_version: 3.1.4
|
279
304
|
signing_key:
|
280
305
|
specification_version: 4
|
281
306
|
summary: A simple, powerful, zero dependency Rails admin framework
|
@@ -1,45 +0,0 @@
|
|
1
|
-
<% schema = controls.display_schema(action: action_inquirer) %>
|
2
|
-
|
3
|
-
<div class="mt-4 -mx-5 overflow-x-auto">
|
4
|
-
<table class="w-full">
|
5
|
-
<thead>
|
6
|
-
<tr class="text-left text-sm uppercase font-bold tracking-wide">
|
7
|
-
<% schema.field_keys.each do |column| %>
|
8
|
-
<th class="p-2 first:pl-5"><%= column.to_s.humanize %></th>
|
9
|
-
<% end %>
|
10
|
-
<th class="p-2 pr-5">Actions</th>
|
11
|
-
</tr>
|
12
|
-
</thead>
|
13
|
-
<tbody class="border-gray-400 border-solid border-t-2">
|
14
|
-
<% @resources.each do |resource| %>
|
15
|
-
<tr id="resource-pk-<%= resource.id %>" class="border-b border-gray-400">
|
16
|
-
<% schema.field_keys.each do |column| %>
|
17
|
-
<td class="p-2 first:pl-5"><%= Super::Display.format(schema, resource, column) %></td>
|
18
|
-
<% end %>
|
19
|
-
<td class="p-2 pr-5" style="word-spacing: 0.25rem">
|
20
|
-
<% controls.resource_actions(resource, params: params, action: action_inquirer).each do |link| %>
|
21
|
-
<%= link_to(link.text, link.href, link.options) %>
|
22
|
-
<% end %>
|
23
|
-
</td>
|
24
|
-
</tr>
|
25
|
-
<% end %>
|
26
|
-
</tbody>
|
27
|
-
</table>
|
28
|
-
</div>
|
29
|
-
|
30
|
-
<% if @pagination.necessary? %>
|
31
|
-
<div class="flex justify-end mr-2">
|
32
|
-
<div class="mt-4">
|
33
|
-
<% @pagination.each do |page_query_params, is_current_page, display| %>
|
34
|
-
<%= link_to(
|
35
|
-
display,
|
36
|
-
polymorphic_path(
|
37
|
-
Super.configuration.path_parts(controls.model),
|
38
|
-
page_query_params
|
39
|
-
),
|
40
|
-
class: "inline-block ml-2 text-lg #{is_current_page ? " text-gray-900" : ""}"
|
41
|
-
) %>
|
42
|
-
<% end %>
|
43
|
-
</div>
|
44
|
-
</div>
|
45
|
-
<% end %>
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<% schema = controls.display_schema(action: action_inquirer) %>
|
2
|
-
|
3
|
-
<table class="max-w-full leading-loose mt-4">
|
4
|
-
<% schema.field_keys.each do |column| %>
|
5
|
-
<tr>
|
6
|
-
<th class="text-right px-4"><%= column.to_s.humanize %></th>
|
7
|
-
<td><%= Super::Display.format(schema, @resource, column) %></td>
|
8
|
-
</tr>
|
9
|
-
<% end %>
|
10
|
-
</table>
|
data/docs/controls.md
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
# @title Controls
|
3
|
-
-->
|
4
|
-
|
5
|
-
# Controls
|
6
|
-
|
7
|
-
Controls are the primary way to "control" the behavior of your admin pages.
|
8
|
-
|
9
|
-
Controls have several required and optional methods.
|
10
|
-
|
11
|
-
<dl>
|
12
|
-
<dt><code>#model</code> (required)</dt>
|
13
|
-
<dd>The model</dd>
|
14
|
-
|
15
|
-
<dt><code>#permitted_params</code> (required)</dt>
|
16
|
-
<dd>The strong parameters definition</dd>
|
17
|
-
|
18
|
-
<dt><code>#display_schema</code> (required)</dt>
|
19
|
-
<dd>The display definition for the <code>#index</code> and <code>#show</code> pages</dd>
|
20
|
-
|
21
|
-
<dt><code>#form_schema</code> (required)</dt>
|
22
|
-
<dd>The form definition for the <code>#new</code> and <code>#edit</code> pages</dd>
|
23
|
-
|
24
|
-
<dt><code>#title</code> (optional)</dt>
|
25
|
-
<dd>The title to show on the main panel</dd>
|
26
|
-
|
27
|
-
<dt><code>#resources_actions</code> (optional)</dt>
|
28
|
-
<dd>The list of collection-level links</dd>
|
29
|
-
|
30
|
-
<dt><code>#resource_actions</code> (optional)</dt>
|
31
|
-
<dd>The list of member-level links</dd>
|
32
|
-
|
33
|
-
<dt><code>#scope</code> (optional)</dt>
|
34
|
-
<dd>The starting point of the query/relation. Defaults to <code>#all</code></dd>
|
35
|
-
</dl>
|
36
|
-
|
37
|
-
|
38
|
-
For more information, it may be helpful to look at the implementation of
|
39
|
-
`Super::Controls`.
|
data/lib/super/display.rb
DELETED
data/lib/super/step.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
module Super
|
2
|
-
module Step
|
3
|
-
module_function
|
4
|
-
|
5
|
-
def load_resources(controls, _params, action_inquirer)
|
6
|
-
controls.scope(action: action_inquirer)
|
7
|
-
end
|
8
|
-
|
9
|
-
def initialize_pagination(resources, query_params, limit: Super.configuration.index_resources_per_page)
|
10
|
-
Pagination.new(
|
11
|
-
total_count: resources.size,
|
12
|
-
limit: limit,
|
13
|
-
query_params: query_params,
|
14
|
-
page_query_param: :page
|
15
|
-
)
|
16
|
-
end
|
17
|
-
|
18
|
-
def paginate_resources(resources, pagination)
|
19
|
-
resources
|
20
|
-
.limit(pagination.limit)
|
21
|
-
.offset(pagination.offset)
|
22
|
-
end
|
23
|
-
|
24
|
-
def load_resource(controls, params, action_inquirer)
|
25
|
-
controls.scope(action: action_inquirer).find(params[:id])
|
26
|
-
end
|
27
|
-
|
28
|
-
def build_resource(controls, action_inquirer)
|
29
|
-
controls.scope(action: action_inquirer).build
|
30
|
-
end
|
31
|
-
|
32
|
-
def build_resource_with_params(controls, action_inquirer, create_permitted_params)
|
33
|
-
controls.scope(action: action_inquirer).build(create_permitted_params)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
data/lib/tasks/super_tasks.rake
DELETED