super 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +165 -0
  3. data/README.md +102 -8
  4. data/app/assets/config/super_manifest.js +1 -0
  5. data/app/assets/javascripts/super/application.js +3483 -0
  6. data/app/assets/stylesheets/super/application.css +35265 -0
  7. data/app/controllers/super/application_controller.rb +84 -0
  8. data/app/views/layouts/super/application.html.erb +39 -0
  9. data/app/views/super/application/_form.html.erb +13 -0
  10. data/app/views/super/application/_form_field.html.erb +7 -0
  11. data/app/views/super/application/_form_generic_select.html.erb +19 -0
  12. data/app/views/super/application/_form_generic_text.html.erb +7 -0
  13. data/app/views/super/application/_index.html.erb +58 -0
  14. data/app/views/super/application/edit.html.erb +7 -0
  15. data/app/views/super/application/index.html.erb +1 -0
  16. data/app/views/super/application/new.html.erb +7 -0
  17. data/app/views/super/application/show.html.erb +10 -0
  18. data/app/views/super/feather/README.md +32 -0
  19. data/app/views/super/feather/_chevron_down.svg +1 -0
  20. data/frontend/super-frontend/build.js +34 -0
  21. data/frontend/super-frontend/dist/application.css +35265 -0
  22. data/frontend/super-frontend/dist/application.js +3483 -0
  23. data/frontend/super-frontend/package.json +14 -0
  24. data/frontend/super-frontend/postcss.config.js +6 -0
  25. data/frontend/super-frontend/src/javascripts/super/application.js +11 -0
  26. data/frontend/super-frontend/src/stylesheets/super/application.css +14 -0
  27. data/frontend/super-frontend/tailwind.config.js +7 -0
  28. data/frontend/super-frontend/yarn.lock +5355 -0
  29. data/lib/generators/super/install/USAGE +32 -0
  30. data/lib/generators/super/install/install_generator.rb +47 -0
  31. data/lib/generators/super/install/templates/base_controller.rb.tt +2 -0
  32. data/lib/generators/super/install/templates/initializer.rb.tt +5 -0
  33. data/lib/generators/super/resource/USAGE +9 -0
  34. data/lib/generators/super/resource/resource_generator.rb +54 -0
  35. data/lib/generators/super/resource/templates/resource_dashboard.rb.tt +65 -0
  36. data/lib/generators/super/resource/templates/resources_controller.rb.tt +9 -0
  37. data/lib/generators/super/webpacker/USAGE +14 -0
  38. data/lib/generators/super/webpacker/templates/pack_super_application.js.erb.tt +2 -0
  39. data/lib/generators/super/webpacker/webpacker_generator.rb +17 -0
  40. data/lib/super.rb +17 -4
  41. data/lib/super/assets.rb +62 -0
  42. data/lib/super/configuration.rb +88 -0
  43. data/lib/super/controls.rb +25 -0
  44. data/lib/super/display.rb +9 -0
  45. data/lib/super/display/schema_types.rb +41 -0
  46. data/lib/super/engine.rb +5 -0
  47. data/lib/super/error.rb +8 -0
  48. data/lib/super/form/schema_types.rb +47 -0
  49. data/lib/super/inline_callback.rb +82 -0
  50. data/lib/super/navigation/automatic.rb +69 -0
  51. data/lib/super/pagination.rb +59 -0
  52. data/lib/super/plugin.rb +89 -0
  53. data/lib/super/schema.rb +24 -0
  54. data/lib/super/test_support/fixtures/members.yml +336 -0
  55. data/lib/super/test_support/fixtures/ships.yml +10 -0
  56. data/lib/super/test_support/setup.rb +79 -0
  57. data/lib/super/test_support/starfleet_seeder.rb +49 -0
  58. data/lib/super/test_support/templates/20190216224956_create_members.rb +11 -0
  59. data/lib/super/test_support/templates/20190803143320_create_ships.rb +11 -0
  60. data/lib/super/test_support/templates/20190806014121_add_ship_to_members.rb +5 -0
  61. data/lib/super/test_support/templates/admin/members_controller.rb +9 -0
  62. data/lib/super/test_support/templates/admin/ships_controller.rb +9 -0
  63. data/lib/super/test_support/templates/admin_controller.rb +2 -0
  64. data/lib/super/test_support/templates/member.rb +16 -0
  65. data/lib/super/test_support/templates/member_dashboard.rb +90 -0
  66. data/lib/super/test_support/templates/routes.rb +10 -0
  67. data/lib/super/test_support/templates/seeds.rb +2 -0
  68. data/lib/super/test_support/templates/ship.rb +3 -0
  69. data/lib/super/test_support/templates/ship_dashboard.rb +79 -0
  70. data/lib/super/version.rb +1 -1
  71. data/lib/super/view.rb +25 -0
  72. metadata +131 -12
  73. data/LICENSE.txt +0 -40
@@ -0,0 +1,24 @@
1
+ module Super
2
+ # The Schema is a general purpose container for describing the "schema"
3
+ # for various purposes. It primarily exists to provide a cohesive user-facing
4
+ # API for defining schemas.
5
+ #
6
+ # The various "schema types" are likely of more interest
7
+ class Schema
8
+ # @param schema_type [Display::SchemaTypes, Form::SchemaTypes]
9
+ def initialize(schema_type)
10
+ @schema_type = schema_type
11
+ @fields = {}
12
+
13
+ if block_given?
14
+ yield(@fields, @schema_type)
15
+ end
16
+ end
17
+
18
+ attr_reader :fields
19
+
20
+ def field_keys
21
+ fields.keys
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,336 @@
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
@@ -0,0 +1,10 @@
1
+ ---
2
+ uss_enterprise_d:
3
+ name: USS Enterprise
4
+ registry: NCC-1701-D
5
+ class_name: Galaxy
6
+
7
+ uss_jenolan:
8
+ name: USS Jenolan
9
+ registry: NCC-2010
10
+ class_name: Sydney
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "fileutils"
4
+ require "pathname"
5
+
6
+ def help!
7
+ puts "usage: #{$0} path/to/dest/app"
8
+ exit
9
+ end
10
+
11
+ def assert(message)
12
+ if !yield
13
+ puts message
14
+ exit(1)
15
+ end
16
+ end
17
+
18
+ def act(message, if_not:)
19
+ if !if_not.call
20
+ yield
21
+ puts message
22
+ end
23
+ end
24
+
25
+ if ARGV.size != 1
26
+ help!
27
+ end
28
+
29
+ dest = ARGV.first
30
+ dest = File.expand_path(dest, Dir.pwd)
31
+ dest = Pathname.new(dest)
32
+
33
+ src = File.expand_path("templates", __dir__)
34
+ src = Pathname.new(src)
35
+
36
+ assert("Path doesn't exist: #{dest.join("app")}") do
37
+ dest.join("app").exist?
38
+ end
39
+
40
+ assert("Path doesn't exist: #{dest.join("app/models")}") do
41
+ dest.join("app/models").exist?
42
+ end
43
+
44
+ FileUtils.cp(src.join("member.rb"), dest.join("app/models/member.rb"))
45
+ FileUtils.cp(src.join("ship.rb"), dest.join("app/models/ship.rb"))
46
+
47
+ assert("Path doesn't exist: #{dest.join("app/controllers")}") do
48
+ dest.join("app/controllers").exist?
49
+ end
50
+
51
+ FileUtils.cp(src.join("admin_controller.rb"), dest.join("app/controllers/admin_controller.rb"))
52
+
53
+ act "Created #{dest.join("app/controllers/admin")}", if_not: -> { dest.join("app/controllers/admin").exist? } do
54
+ FileUtils.mkdir(dest.join("app/controllers/admin"))
55
+ end
56
+
57
+ FileUtils.cp(src.join("admin/members_controller.rb"), dest.join("app/controllers/admin/members_controller.rb"))
58
+ FileUtils.cp(src.join("admin/ships_controller.rb"), dest.join("app/controllers/admin/ships_controller.rb"))
59
+
60
+ act "Created #{dest.join("app/super")}", if_not: -> { dest.join("app/super").exist? } do
61
+ FileUtils.mkdir(dest.join("app/super"))
62
+ end
63
+
64
+ FileUtils.cp(src.join("member_dashboard.rb"), dest.join("app/super/member_dashboard.rb"))
65
+ FileUtils.cp(src.join("ship_dashboard.rb"), dest.join("app/super/ship_dashboard.rb"))
66
+
67
+ act "Created #{dest.join("db/migrate")}", if_not: -> { dest.join("db/migrate").exist? } do
68
+ FileUtils.mkdir(dest.join("db/migrate"))
69
+ end
70
+
71
+ FileUtils.cp(src.join("20190216224956_create_members.rb"), dest.join("db/migrate/20190216224956_create_members.rb"))
72
+ FileUtils.cp(src.join("20190803143320_create_ships.rb"), dest.join("db/migrate/20190803143320_create_ships.rb"))
73
+ FileUtils.cp(src.join("20190806014121_add_ship_to_members.rb"), dest.join("db/migrate/20190806014121_add_ship_to_members.rb"))
74
+
75
+ FileUtils.cp(src.join("seeds.rb"), dest.join("db/seeds.rb"))
76
+
77
+ FileUtils.cp(src.join("routes.rb"), dest.join("config/routes.rb"))
78
+
79
+ puts "Done!"