super 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +10 -0
  3. data/README.md +9 -64
  4. data/app/assets/stylesheets/super/application.css +53890 -25613
  5. data/app/controllers/super/application_controller.rb +9 -28
  6. data/app/views/super/application/_form_field__destroy.html.erb +6 -2
  7. data/app/views/super/application/_form_field_select.html.erb +10 -4
  8. data/app/views/super/application/_form_field_text.html.erb +13 -5
  9. data/app/views/super/application/_form_has_many.html.erb +2 -2
  10. data/app/views/super/application/_form_inline_errors.html.erb +1 -1
  11. data/app/views/super/application/_index.html.erb +2 -2
  12. data/app/views/super/application/edit.html.erb +6 -1
  13. data/app/views/super/application/index.html.erb +6 -1
  14. data/app/views/super/application/new.html.erb +6 -1
  15. data/app/views/super/application/show.html.erb +6 -1
  16. data/docs/README.md +6 -0
  17. data/docs/controls.md +39 -0
  18. data/docs/faq.md +44 -0
  19. data/docs/quick_start.md +45 -0
  20. data/docs/webpacker.md +17 -0
  21. data/docs/yard_customizations.rb +41 -0
  22. data/frontend/super-frontend/dist/application.css +53890 -25613
  23. data/frontend/super-frontend/tailwind.config.js +1 -1
  24. data/frontend/super-frontend/yarn.lock +1048 -974
  25. data/lib/generators/super/webpacker/webpacker_generator.rb +8 -0
  26. data/lib/super.rb +5 -5
  27. data/lib/super/compatibility.rb +13 -0
  28. data/lib/super/controls.rb +0 -141
  29. data/lib/super/step.rb +36 -0
  30. data/lib/super/version.rb +1 -1
  31. data/lib/super/view_helper.rb +43 -0
  32. metadata +56 -25
  33. data/lib/super/action.rb +0 -22
  34. data/lib/super/action/step.rb +0 -36
  35. data/lib/super/test_support/copy_app_templates/controllers/favorite_things_controller.rb +0 -50
  36. data/lib/super/test_support/copy_app_templates/controllers/members_controller.rb +0 -74
  37. data/lib/super/test_support/copy_app_templates/controllers/ships_controller.rb +0 -47
  38. data/lib/super/test_support/copy_app_templates/migrations/20190216224956_create_members.rb +0 -11
  39. data/lib/super/test_support/copy_app_templates/migrations/20190803143320_create_ships.rb +0 -11
  40. data/lib/super/test_support/copy_app_templates/migrations/20190806014121_add_ship_to_members.rb +0 -5
  41. data/lib/super/test_support/copy_app_templates/migrations/20191126050453_create_favorite_things.rb +0 -10
  42. data/lib/super/test_support/copy_app_templates/models/favorite_thing.rb +0 -7
  43. data/lib/super/test_support/copy_app_templates/models/member.rb +0 -23
  44. data/lib/super/test_support/copy_app_templates/models/ship.rb +0 -3
  45. data/lib/super/test_support/copy_app_templates/routes.rb +0 -11
  46. data/lib/super/test_support/copy_app_templates/seeds.rb +0 -2
  47. data/lib/super/test_support/copy_app_templates/views/members/_favorite_things.html.erb +0 -11
  48. data/lib/super/test_support/fixtures/favorite_things.yml +0 -9
  49. data/lib/super/test_support/fixtures/members.yml +0 -336
  50. data/lib/super/test_support/fixtures/ships.yml +0 -10
  51. data/lib/super/test_support/generate_copy_app.rb +0 -42
  52. data/lib/super/test_support/generate_dummy.rb +0 -93
  53. data/lib/super/test_support/starfleet_seeder.rb +0 -50
@@ -1,36 +0,0 @@
1
- module Super
2
- class Action
3
- def self.steps
4
- @steps ||= {}
5
- end
6
-
7
- steps[:new_resource] = proc do
8
- @resource = controls.scope(action: action_inquirer).build
9
- end
10
-
11
- steps[:create_resource] = proc do
12
- @resource = controls.scope(action: action_inquirer).build(create_permitted_params)
13
- end
14
-
15
- steps[:load_resource] = proc do
16
- @resource = controls.scope(action: action_inquirer).find(params[:id])
17
- end
18
-
19
- steps[:load_resources] = proc do
20
- @resources = controls.scope(action: action_inquirer)
21
- end
22
-
23
- steps[:paginate] = proc do
24
- @pagination = Pagination.new(
25
- total_count: @resources.size,
26
- limit: Super.configuration.index_resources_per_page,
27
- query_params: request.GET,
28
- page_query_param: :page
29
- )
30
-
31
- @resources = @resources
32
- .limit(@pagination.limit)
33
- .offset(@pagination.offset)
34
- end
35
- end
36
- end
@@ -1,50 +0,0 @@
1
- module Admin
2
- class FavoriteThingsController < AdminController
3
- private
4
-
5
- def new_controls
6
- Controls.new
7
- end
8
-
9
- class Controls
10
- def title
11
- FavoriteThing.name.pluralize
12
- end
13
-
14
- def model
15
- FavoriteThing
16
- end
17
-
18
- def scope(action:)
19
- FavoriteThing.all
20
- end
21
-
22
- def permitted_params(params, action:)
23
- params.require(:favorite_thing).permit(:name, member_attributes: [:id, :name, :rank, :position, :ship_id])
24
- end
25
-
26
- def display_schema(action:)
27
- Super::Schema.new(Super::Display::SchemaTypes.new) do |fields, type|
28
- fields[:name] = type.dynamic(&:itself)
29
- fields[:member] = type.dynamic { |member| "#{member.name} (member ##{member.id})" }
30
- end
31
- end
32
-
33
- def form_schema(action:)
34
- Super::Schema.new(Super::Form::SchemaTypes.new) do |fields, type|
35
- fields[:name] = type.generic("form_field_text")
36
-
37
- fields[:member_attributes] = type.belongs_to(:member) do
38
- fields[:name] = type.generic("form_field_text")
39
- fields[:rank] = type.generic("form_field_select", collection: Member.ranks.keys)
40
- fields[:position] = type.generic("form_field_text")
41
- fields[:ship_id] = type.generic(
42
- "form_field_select",
43
- collection: Ship.all.map { |s| ["#{s.name} (Ship ##{s.id})", s.id] },
44
- )
45
- end
46
- end
47
- end
48
- end
49
- end
50
- end
@@ -1,74 +0,0 @@
1
- module Admin
2
- class MembersController < AdminController
3
- private
4
-
5
- def new_controls
6
- Controls.new
7
- end
8
-
9
- class Controls
10
- def title
11
- Member.name.pluralize
12
- end
13
-
14
- def model
15
- Member
16
- end
17
-
18
- def scope(action:)
19
- Member.all
20
- end
21
-
22
- def show
23
- Super::Action.new(
24
- steps: [
25
- :load_resource,
26
- ],
27
- page: Super::Layout.new(
28
- mains: [
29
- Super::Panel.new(
30
- Super::Partial.new("resource_header"),
31
- Super::Partial.new("show")
32
- ),
33
- Super::Partial.new("favorite_things")
34
- ]
35
- )
36
- )
37
- end
38
-
39
- def permitted_params(params, action:)
40
- params.require(:member).permit(:name, :rank, :position, :ship_id, favorite_things_attributes: [:id, :name, :_destroy])
41
- end
42
-
43
- def display_schema(action:)
44
- Super::Schema.new(Super::Display::SchemaTypes.new) do |fields, type|
45
- fields[:name] = type.dynamic(&:itself)
46
- fields[:rank] = type.dynamic(&:itself)
47
- fields[:position] = type.dynamic(&:itself)
48
- fields[:ship] = type.dynamic { |ship| "#{ship.name} (Ship ##{ship.id})" }
49
- fields[:created_at] = type.dynamic(&:iso8601)
50
- if action.show?
51
- fields[:updated_at] = type.dynamic(&:iso8601)
52
- end
53
- end
54
- end
55
-
56
- def form_schema(action:)
57
- Super::Schema.new(Super::Form::SchemaTypes.new) do |fields, type|
58
- fields[:name] = type.generic("form_field_text")
59
- fields[:rank] = type.generic("form_field_select", collection: Member.ranks.keys)
60
- fields[:position] = type.generic("form_field_text")
61
- fields[:ship_id] = type.generic(
62
- "form_field_select",
63
- collection: Ship.all.map { |s| ["#{s.name} (Ship ##{s.id})", s.id] },
64
- )
65
-
66
- fields[:favorite_things_attributes] = type.has_many(:favorite_things) do
67
- fields[:name] = type.generic("form_field_text")
68
- fields[:_destroy] = type._destroy
69
- end
70
- end
71
- end
72
- end
73
- end
74
- end
@@ -1,47 +0,0 @@
1
- module Admin
2
- class ShipsController < AdminController
3
- private
4
-
5
- def new_controls
6
- Controls.new
7
- end
8
-
9
- class Controls
10
- def title
11
- Ship.name.pluralize
12
- end
13
-
14
- def model
15
- Ship
16
- end
17
-
18
- def scope(action:)
19
- Ship.all
20
- end
21
-
22
- def permitted_params(params, action:)
23
- params.require(:ship).permit(:name, :registry, :class_name)
24
- end
25
-
26
- def display_schema(action:)
27
- Super::Schema.new(Super::Display::SchemaTypes.new) do |fields, type|
28
- fields[:name] = type.dynamic(&:itself)
29
- fields[:registry] = type.dynamic(&:itself)
30
- fields[:class_name] = type.dynamic(&:itself)
31
- if action.show?
32
- fields[:created_at] = type.dynamic(&:iso8601)
33
- fields[:updated_at] = type.dynamic(&:iso8601)
34
- end
35
- end
36
- end
37
-
38
- def form_schema(action:)
39
- Super::Schema.new(Super::Form::SchemaTypes.new) do |fields, type|
40
- fields[:name] = type.generic("form_field_text")
41
- fields[:registry] = type.generic("form_field_text")
42
- fields[:class_name] = type.generic("form_field_text")
43
- end
44
- end
45
- end
46
- end
47
- end
@@ -1,11 +0,0 @@
1
- class CreateMembers < ActiveRecord::Migration[5.0]
2
- def change
3
- create_table :members do |t|
4
- t.string :name, null: false
5
- t.string :rank, null: false
6
- t.string :position
7
-
8
- t.timestamps
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- class CreateShips < ActiveRecord::Migration[5.0]
2
- def change
3
- create_table :ships do |t|
4
- t.string :name
5
- t.string :registry
6
- t.string :class_name
7
-
8
- t.timestamps
9
- end
10
- end
11
- end
@@ -1,5 +0,0 @@
1
- class AddShipToMembers < ActiveRecord::Migration[5.0]
2
- def change
3
- add_reference :members, :ship, foreign_key: true
4
- end
5
- end
@@ -1,10 +0,0 @@
1
- class CreateFavoriteThings < ActiveRecord::Migration[5.0]
2
- def change
3
- create_table :favorite_things do |t|
4
- t.references :member, null: false, foreign_key: true
5
- t.text :name
6
-
7
- t.timestamps
8
- end
9
- end
10
- end
@@ -1,7 +0,0 @@
1
- class FavoriteThing < ApplicationRecord
2
- belongs_to :member
3
-
4
- validates :name, presence: true
5
-
6
- accepts_nested_attributes_for :member
7
- end
@@ -1,23 +0,0 @@
1
- class Member < ApplicationRecord
2
- enum rank: {
3
- captain: "Captain",
4
- commander: "Commander",
5
- lieutenant_commander: "Lieutenant Commander",
6
- lieutenant: "Lieutenant",
7
- lieutenant_junior_grade: "Lieutenant Junior Grade",
8
- ensign: "Ensign",
9
- nco: "NCO",
10
- }
11
-
12
- belongs_to :ship
13
- has_many :favorite_things, dependent: :delete_all
14
-
15
- accepts_nested_attributes_for(
16
- :favorite_things,
17
- allow_destroy: true,
18
- reject_if: -> (record) { record[:name].blank? }
19
- )
20
-
21
- validates :name, presence: true
22
- validates :rank, presence: true
23
- end
@@ -1,3 +0,0 @@
1
- class Ship < ApplicationRecord
2
- has_many :members
3
- end
@@ -1,11 +0,0 @@
1
- Rails.application.routes.draw do
2
- namespace :admin do
3
- resources :members
4
- resources :ships
5
- resources :favorite_things
6
-
7
- root to: redirect("admin/members", status: 302)
8
- end
9
-
10
- root to: redirect("admin/members", status: 302)
11
- end
@@ -1,2 +0,0 @@
1
- require "super/test_support/starfleet_seeder"
2
- StarfleetSeeder.seed
@@ -1,11 +0,0 @@
1
- <% if @resource.favorite_things.any? %>
2
- <%= render(Super::Panel.new) do %>
3
- <h1 class="text-xl">Favorite Things</h1>
4
-
5
- <ul class="list-disc list-outside mt-4">
6
- <% @resource.favorite_things.each do |favorite_thing| %>
7
- <li class="ml-6"><%= favorite_thing.name %></li>
8
- <% end %>
9
- </ul>
10
- <% end %>
11
- <% end %>
@@ -1,9 +0,0 @@
1
- # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
-
3
- tea:
4
- member: picard
5
- name: Tea, earl grey, hot
6
-
7
- spot:
8
- member: data
9
- name: Spot
@@ -1,336 +0,0 @@
1
- ---
2
- picard:
3
- name: Jean-Luc Picard
4
- rank: Captain
5
- position: Commanding Officer
6
- ship: uss_enterprise_d
7
-
8
- riker:
9
- name: William T. Riker
10
- rank: Commander
11
- position: First Officer
12
- ship: uss_enterprise_d
13
-
14
- data:
15
- name: Data
16
- rank: Lieutenant Commander
17
- position: Second Officer
18
- ship: uss_enterprise_d
19
-
20
- crusher:
21
- name: Beverly Crusher
22
- rank: Commander
23
- position: Chief Medical Officer
24
- ship: uss_enterprise_d
25
-
26
- worf:
27
- name: Worf
28
- rank: Lieutenant Commander
29
- position: Chief of Security
30
- ship: uss_enterprise_d
31
-
32
- la_forge:
33
- name: Geordi La Forge
34
- rank: Lieutenant Commander
35
- position: Chief Engineering Officer
36
- ship: uss_enterprise_d
37
-
38
- troi:
39
- name: Deanna Troi
40
- rank: Commander
41
- position: Counselor
42
- ship: uss_enterprise_d
43
-
44
- tasha:
45
- name: Natasha Yar
46
- rank: Lieutenant
47
- position: Chief of Security
48
- ship: uss_enterprise_d
49
-
50
- miles:
51
- name: Miles O'Brien
52
- rank: NCO
53
- position: Transporter Chief
54
- ship: uss_enterprise_d
55
-
56
- guinan:
57
- name: Guinan
58
- rank: NCO
59
- position: Bartender
60
- ship: uss_enterprise_d
61
-
62
- sepulveda:
63
- name: Fernando Sepulveda
64
- rank: Lieutenant
65
- position: Ops engineer
66
- ship: uss_enterprise_d
67
-
68
- jaxa:
69
- name: Sito Jaxa
70
- rank: Ensign
71
- position: Security officer
72
- ship: uss_enterprise_d
73
-
74
- calloway:
75
- name: Maddy Calloway
76
- rank: Ensign
77
- position: Medical technician
78
- ship: uss_enterprise_d
79
-
80
- mayter:
81
- name: Van Mayter
82
- rank: NCO
83
- position: Engineer
84
- ship: uss_enterprise_d
85
-
86
- sutter:
87
- name: Daniel Sutter
88
- rank: Ensign
89
- position: Engineer
90
- ship: uss_enterprise_d
91
-
92
- bernard:
93
- name: Harry Bernard, Sr.
94
- rank: Lieutenant
95
- position: Oceanographer
96
- ship: uss_enterprise_d
97
-
98
- dangelo:
99
- name: Dick D'Angelo
100
- rank: Lieutenant
101
- position: Ops Engineer
102
- ship: uss_enterprise_d
103
-
104
- ogawa:
105
- name: Alyssa Ogawa
106
- rank: Lieutenant
107
- position: Nurse
108
- ship: uss_enterprise_d
109
-
110
- nesterowicz:
111
- name: John Nesterowicz
112
- rank: Lieutenant
113
- position: WarpField Tech 2
114
- ship: uss_enterprise_d
115
-
116
- keiko:
117
- name: Keiko O'Brien
118
- rank: NCO
119
- position: Botanist
120
- ship: uss_enterprise_d
121
-
122
- anaya:
123
- name: April Anaya
124
- rank: Ensign
125
- position: Flight controller
126
- ship: uss_enterprise_d
127
-
128
- ziff:
129
- name: Anaanda Ziff
130
- rank: Lieutenant
131
- position: Specialist
132
- ship: uss_enterprise_d
133
-
134
- tarses:
135
- name: Simon Tarses
136
- rank: NCO
137
- position: Medical technician
138
- ship: uss_enterprise_d
139
-
140
- wallace:
141
- name: Darien Wallace
142
- rank: Lieutenant
143
- position: Crewmember
144
- ship: uss_enterprise_d
145
-
146
- giddings:
147
- name: Diana Giddings
148
- rank: Lieutenant
149
- position: Junior engineer
150
- ship: uss_enterprise_d
151
-
152
- pulaski:
153
- name: Katherine Pulaski
154
- rank: Commander
155
- position: Medical officer
156
- ship: uss_enterprise_d
157
-
158
- dumont:
159
- name: Suzanne Dumont
160
- rank: Ensign
161
- position: Crewmember
162
- ship: uss_enterprise_d
163
-
164
- tsu:
165
- name: Lian T'Su
166
- rank: Ensign
167
- position: Operations officer
168
- ship: uss_enterprise_d
169
-
170
- lynch:
171
- name: Leland T. Lynch
172
- rank: Lieutenant Commander
173
- position: Chief engineer
174
- ship: uss_enterprise_d
175
-
176
- dsora:
177
- name: Jenna D'Sora
178
- rank: Lieutenant Junior Grade
179
- position: Security officer
180
- ship: uss_enterprise_d
181
-
182
- macdougal:
183
- name: Sarah MacDougal
184
- rank: Lieutenant Commander
185
- position: Chief engineer
186
- ship: uss_enterprise_d
187
-
188
- shimoda:
189
- name: Jim Shimoda
190
- rank: NCO
191
- position: Assistant chief engineer
192
- ship: uss_enterprise_d
193
-
194
- solis:
195
- name: Orfil Solis
196
- rank: Lieutenant Junior Grade
197
- position: Flight controller
198
- ship: uss_enterprise_d
199
-
200
- rhodes:
201
- name: Sandra Rhodes
202
- rank: Lieutenant
203
- position: Security officer
204
- ship: uss_enterprise_d
205
-
206
- fratis:
207
- name: Jeffrey Fratis
208
- rank: Lieutenant
209
- position: Crewmember
210
- ship: uss_enterprise_d
211
-
212
- mees:
213
- name: Jim Mees
214
- rank: Lieutenant Commander
215
- position: Crewmember
216
- ship: uss_enterprise_d
217
-
218
- hubbell:
219
- name: Maggie Hubbell
220
- rank: Ensign
221
- position: Transporter chief
222
- ship: uss_enterprise_d
223
-
224
- rager:
225
- name: Sariel Rager
226
- rank: Ensign
227
- position: Helmsman
228
- ship: uss_enterprise_d
229
-
230
- robinson:
231
- name: B.G. Robinson
232
- rank: Lieutenant
233
- position: Transporter chief
234
- ship: uss_enterprise_d
235
-
236
- allenby:
237
- name: Tess Allenby
238
- rank: Ensign
239
- position: Flight controller
240
- ship: uss_enterprise_d
241
-
242
- brooks:
243
- name: Janet Brooks
244
- rank: Ensign
245
- position: Crewmember
246
- ship: uss_enterprise_d
247
-
248
- foster:
249
- name: Don Foster, Jr.
250
- rank: Lieutenant
251
- position: WarpField Tech 1
252
- ship: uss_enterprise_d
253
-
254
- lefler:
255
- name: Robin Lefler
256
- rank: Ensign
257
- position: Mission Specialist
258
- ship: uss_enterprise_d
259
-
260
- lavelle:
261
- name: Sam Lavelle
262
- rank: Lieutenant Junior Grade
263
- position: Operations officer
264
- ship: uss_enterprise_d
265
-
266
- prieto:
267
- name: Ben Prieto
268
- rank: Lieutenant
269
- position: Shuttlecraft Pilot
270
- ship: uss_enterprise_d
271
-
272
- pacelli:
273
- name: Alfonse Pacelli
274
- rank: Ensign
275
- position: Specialist
276
- ship: uss_enterprise_d
277
-
278
- aster:
279
- name: Marla Aster
280
- rank: Lieutenant
281
- position: Archaeologist
282
- ship: uss_enterprise_d
283
-
284
- barclay:
285
- name: Reginald Barclay
286
- rank: Lieutenant
287
- position: Systems diagnostic engineer
288
- ship: uss_enterprise_d
289
-
290
- salvatore:
291
- name: Bruno Salvatore
292
- rank: Ensign
293
- position: Specialist in biomechanical research
294
- ship: uss_enterprise_d
295
-
296
- juarez:
297
- name: Francisca Juarez
298
- rank: Lieutenant
299
- position: Crewmember
300
- ship: uss_enterprise_d
301
-
302
- finks:
303
- name: Wilbur Finks
304
- rank: Lieutenant
305
- position: Safety officer
306
- ship: uss_enterprise_d
307
-
308
- larson:
309
- name: Linda Larson
310
- rank: Lieutenant Junior Grade
311
- position: Engineer
312
- ship: uss_enterprise_d
313
-
314
- gomez:
315
- name: Sonya Gomez
316
- rank: Ensign
317
- position: Engineer
318
- ship: uss_enterprise_d
319
-
320
- hagler:
321
- name: Edward Hagler
322
- rank: Lieutenant
323
- position: Crewmember
324
- ship: uss_enterprise_d
325
-
326
- lin:
327
- name: Peter Lin
328
- rank: Ensign
329
- position: Flight controller
330
- ship: uss_enterprise_d
331
-
332
- kwan:
333
- name: Daniel Kwan
334
- rank: Lieutenant Junior Grade
335
- position: Specialist
336
- ship: uss_enterprise_d