plutonium 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (346) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.ruby-version +1 -0
  4. data/.standard.yml +4 -0
  5. data/.vscode/extensions.json +15 -0
  6. data/.vscode/launch.json +7 -0
  7. data/.vscode/settings.json +35 -0
  8. data/CHANGELOG.md +5 -0
  9. data/LICENSE.txt +21 -0
  10. data/README copy.md +84 -0
  11. data/README.md +67 -0
  12. data/Rakefile +8 -0
  13. data/app/views/layouts/resource.html.erb +43 -0
  14. data/app/views/resource/_color_modes.html.erb +55 -0
  15. data/app/views/resource/_details.html.erb +6 -0
  16. data/app/views/resource/_empty_card.html.erb +12 -0
  17. data/app/views/resource/_flash.html.erb +9 -0
  18. data/app/views/resource/_form.html.erb +32 -0
  19. data/app/views/resource/_header.html.erb +8 -0
  20. data/app/views/resource/_interactive_resource_action_form.html.erb +67 -0
  21. data/app/views/resource/_messages.html.erb +1 -0
  22. data/app/views/resource/_metric_card.html.erb +16 -0
  23. data/app/views/resource/_nav_user.html.erb +4 -0
  24. data/app/views/resource/_pagination.html.erb +6 -0
  25. data/app/views/resource/_pagy_pagination.html.erb +15 -0
  26. data/app/views/resource/_resource.html.erb +1 -0
  27. data/app/views/resource/_resource.rabl +5 -0
  28. data/app/views/resource/_sidebar.html.erb +11 -0
  29. data/app/views/resource/_sidebar_menu.html.erb +1 -0
  30. data/app/views/resource/_tab_menu.html.erb +13 -0
  31. data/app/views/resource/_table.html.erb +78 -0
  32. data/app/views/resource/_table_actions.html.erb +15 -0
  33. data/app/views/resource/_toast.html.erb +26 -0
  34. data/app/views/resource/_toolbar.html.erb +22 -0
  35. data/app/views/resource/_toolbar_actions.html.erb +16 -0
  36. data/app/views/resource/_toolbar_breadcrumbs.html.erb +32 -0
  37. data/app/views/resource/_toolbar_search_input.erb +27 -0
  38. data/app/views/resource/edit.html.erb +10 -0
  39. data/app/views/resource/errors.rabl +3 -0
  40. data/app/views/resource/index.html.erb +19 -0
  41. data/app/views/resource/index.rabl +3 -0
  42. data/app/views/resource/interactive_resource_collection_action.html.erb +11 -0
  43. data/app/views/resource/interactive_resource_record_action.html.erb +11 -0
  44. data/app/views/resource/interactive_resource_recordless_action.html.erb +11 -0
  45. data/app/views/resource/new.html.erb +11 -0
  46. data/app/views/resource/readme.md +16 -0
  47. data/app/views/resource/show.html.erb +14 -0
  48. data/app/views/resource/show.rabl +3 -0
  49. data/brakeman.ignore +51 -0
  50. data/lib/active_model/validations/array_validator.rb +74 -0
  51. data/lib/active_model/validations/attached_validator.rb +17 -0
  52. data/lib/active_model/validations/url_validator.rb +51 -0
  53. data/lib/generators/pu/core/install/install_generator.rb +43 -0
  54. data/lib/generators/pu/core/install/templates/.keep +0 -0
  55. data/lib/generators/pu/core/install/templates/app/controllers/resource_controller.rb.tt +2 -0
  56. data/lib/generators/pu/core/install/templates/app/interactions/resource_interaction.rb.tt +2 -0
  57. data/lib/generators/pu/core/install/templates/app/models/resource_record.rb.tt +5 -0
  58. data/lib/generators/pu/core/install/templates/app/policies/resource_policy.rb.tt +2 -0
  59. data/lib/generators/pu/core/install/templates/app/presenters/resource_presenter.rb.tt +2 -0
  60. data/lib/generators/pu/core/install/templates/config/initializers/plutonium.rb +2 -0
  61. data/lib/generators/pu/core/install/templates/config/packages.rb +3 -0
  62. data/lib/generators/pu/gem/pagy/pagy_generator.rb +25 -0
  63. data/lib/generators/pu/gem/pagy/templates/.keep +0 -0
  64. data/lib/generators/pu/gem/pagy/templates/config/initializers/pagy.rb +4 -0
  65. data/lib/generators/pu/gem/rabl/rabl_generator.rb +25 -0
  66. data/lib/generators/pu/gem/rabl/templates/.keep +0 -0
  67. data/lib/generators/pu/gem/rabl/templates/config/initializers/rabl.rb +60 -0
  68. data/lib/generators/pu/gem/simple_form/simple_form_generator.rb +25 -0
  69. data/lib/generators/pu/gem/simple_form/templates/.keep +0 -0
  70. data/lib/generators/pu/gen/pug/pug_generator.rb +43 -0
  71. data/lib/generators/pu/gen/pug/templates/pug.rb.tt +23 -0
  72. data/lib/generators/pu/pkg/app/app_generator.rb +60 -0
  73. data/lib/generators/pu/pkg/app/templates/app/controllers/resource_controller.rb.tt +26 -0
  74. data/lib/generators/pu/pkg/app/templates/app/interactions/resource_interaction.rb.tt +4 -0
  75. data/lib/generators/pu/pkg/app/templates/app/policies/resource_policy.rb.tt +4 -0
  76. data/lib/generators/pu/pkg/app/templates/app/presenters/resource_presenter.rb.tt +4 -0
  77. data/lib/generators/pu/pkg/app/templates/config/routes.rb.tt +17 -0
  78. data/lib/generators/pu/pkg/app/templates/lib/engine.rb.tt +14 -0
  79. data/lib/generators/pu/pkg/feature/feature_generator.rb +44 -0
  80. data/lib/generators/pu/pkg/feature/templates/.keep +0 -0
  81. data/lib/generators/pu/pkg/feature/templates/app/controllers/resource_controller.rb.tt +7 -0
  82. data/lib/generators/pu/pkg/feature/templates/app/interactions/resource_interaction.rb.tt +4 -0
  83. data/lib/generators/pu/pkg/feature/templates/app/models/resource_record.rb.tt +5 -0
  84. data/lib/generators/pu/pkg/feature/templates/app/policies/resource_policy.rb.tt +4 -0
  85. data/lib/generators/pu/pkg/feature/templates/app/presenters/resource_presenter.rb.tt +4 -0
  86. data/lib/generators/pu/pkg/feature/templates/lib/engine.rb.tt +8 -0
  87. data/lib/generators/pu/resource/conn/conn_generator.rb +54 -0
  88. data/lib/generators/pu/resource/conn/templates/.keep +0 -0
  89. data/lib/generators/pu/resource/conn/templates/app/controllers/resource_controller.rb.tt +3 -0
  90. data/lib/generators/pu/resource/conn/templates/app/policies/resource_policy.rb.tt +3 -0
  91. data/lib/generators/pu/resource/conn/templates/app/presenters/resource_presenter.rb.tt +3 -0
  92. data/lib/generators/pu/resource/model/USAGE +113 -0
  93. data/lib/generators/pu/resource/model/model_generator.rb +163 -0
  94. data/lib/generators/pu/resource/model/templates/controller.rb.tt +5 -0
  95. data/lib/generators/pu/resource/model/templates/create_table_migration.rb.tt +26 -0
  96. data/lib/generators/pu/resource/model/templates/model.rb.tt +53 -0
  97. data/lib/generators/pu/resource/model/templates/module.rb.tt +7 -0
  98. data/lib/generators/pu/resource/model/templates/policy.rb.tt +4 -0
  99. data/lib/generators/pu/resource/model/templates/presenter.rb.tt +4 -0
  100. data/lib/generators/pu/resource/scaffold/scaffold_generator.rb +219 -0
  101. data/lib/generators/pu/resource/scaffold/templates/app/controllers/admin_resources/resource_controller.rb.tt +7 -0
  102. data/lib/generators/pu/resource/scaffold/templates/app/controllers/entity_resources/resource_controller.rb.tt +7 -0
  103. data/lib/generators/pu/resource/scaffold/templates/app/policies/resources/admin/resource_policy.rb.tt +22 -0
  104. data/lib/generators/pu/resource/scaffold/templates/app/policies/resources/entity/resource_policy.rb.tt +22 -0
  105. data/lib/generators/pu/resource/scaffold/templates/app/policies/resources/resource_policy.rb.tt +13 -0
  106. data/lib/generators/pu/resource/scaffold/templates/app/resources/resource/admin_presenter.rb.tt +7 -0
  107. data/lib/generators/pu/resource/scaffold/templates/app/resources/resource/entity_presenter.rb.tt +7 -0
  108. data/lib/generators/pu/resource/scaffold/templates/app/resources/resource/presenter.rb.tt +23 -0
  109. data/lib/generators/pu/resource/scaffold/templates/app/views/resources/resource/_resource.html.erb.tt +3 -0
  110. data/lib/generators/pu/resource/scaffold/templates/app/views/resources/resource/_resource.rabl +7 -0
  111. data/lib/generators/pu/rodauth/account_generator.rb +120 -0
  112. data/lib/generators/pu/rodauth/concerns/account_selector.rb +22 -0
  113. data/lib/generators/pu/rodauth/concerns/configuration.rb +211 -0
  114. data/lib/generators/pu/rodauth/concerns/feature_selector.rb +125 -0
  115. data/lib/generators/pu/rodauth/install_generator.rb +69 -0
  116. data/lib/generators/pu/rodauth/migration/active_record/account_expiration.erb +8 -0
  117. data/lib/generators/pu/rodauth/migration/active_record/active_sessions.erb +7 -0
  118. data/lib/generators/pu/rodauth/migration/active_record/audit_logging.erb +16 -0
  119. data/lib/generators/pu/rodauth/migration/active_record/base.erb +22 -0
  120. data/lib/generators/pu/rodauth/migration/active_record/disallow_password_reuse.erb +5 -0
  121. data/lib/generators/pu/rodauth/migration/active_record/email_auth.erb +8 -0
  122. data/lib/generators/pu/rodauth/migration/active_record/jwt_refresh.erb +7 -0
  123. data/lib/generators/pu/rodauth/migration/active_record/lockout.erb +13 -0
  124. data/lib/generators/pu/rodauth/migration/active_record/otp.erb +8 -0
  125. data/lib/generators/pu/rodauth/migration/active_record/password_expiration.erb +6 -0
  126. data/lib/generators/pu/rodauth/migration/active_record/recovery_codes.erb +6 -0
  127. data/lib/generators/pu/rodauth/migration/active_record/remember.erb +7 -0
  128. data/lib/generators/pu/rodauth/migration/active_record/reset_password.erb +8 -0
  129. data/lib/generators/pu/rodauth/migration/active_record/separate_passwords.erb +5 -0
  130. data/lib/generators/pu/rodauth/migration/active_record/single_session.erb +6 -0
  131. data/lib/generators/pu/rodauth/migration/active_record/sms_codes.erb +9 -0
  132. data/lib/generators/pu/rodauth/migration/active_record/verify_account.erb +8 -0
  133. data/lib/generators/pu/rodauth/migration/active_record/verify_login_change.erb +8 -0
  134. data/lib/generators/pu/rodauth/migration/active_record/webauthn.erb +13 -0
  135. data/lib/generators/pu/rodauth/migration/sequel/account_expiration.erb +7 -0
  136. data/lib/generators/pu/rodauth/migration/sequel/active_sessions.erb +8 -0
  137. data/lib/generators/pu/rodauth/migration/sequel/audit_logging.erb +17 -0
  138. data/lib/generators/pu/rodauth/migration/sequel/base.erb +25 -0
  139. data/lib/generators/pu/rodauth/migration/sequel/disallow_password_reuse.erb +6 -0
  140. data/lib/generators/pu/rodauth/migration/sequel/email_auth.erb +7 -0
  141. data/lib/generators/pu/rodauth/migration/sequel/jwt_refresh.erb +8 -0
  142. data/lib/generators/pu/rodauth/migration/sequel/lockout.erb +11 -0
  143. data/lib/generators/pu/rodauth/migration/sequel/otp.erb +7 -0
  144. data/lib/generators/pu/rodauth/migration/sequel/password_expiration.erb +5 -0
  145. data/lib/generators/pu/rodauth/migration/sequel/recovery_codes.erb +6 -0
  146. data/lib/generators/pu/rodauth/migration/sequel/remember.erb +6 -0
  147. data/lib/generators/pu/rodauth/migration/sequel/reset_password.erb +7 -0
  148. data/lib/generators/pu/rodauth/migration/sequel/separate_passwords.erb +6 -0
  149. data/lib/generators/pu/rodauth/migration/sequel/single_session.erb +5 -0
  150. data/lib/generators/pu/rodauth/migration/sequel/sms_codes.erb +8 -0
  151. data/lib/generators/pu/rodauth/migration/sequel/verify_account.erb +7 -0
  152. data/lib/generators/pu/rodauth/migration/sequel/verify_login_change.erb +7 -0
  153. data/lib/generators/pu/rodauth/migration/sequel/webauthn.erb +13 -0
  154. data/lib/generators/pu/rodauth/migration_generator.rb +190 -0
  155. data/lib/generators/pu/rodauth/templates/INSTRUCTIONS +52 -0
  156. data/lib/generators/pu/rodauth/templates/app/controllers/plugin_controller.rb.tt +6 -0
  157. data/lib/generators/pu/rodauth/templates/app/controllers/rodauth_controller.rb.tt +3 -0
  158. data/lib/generators/pu/rodauth/templates/app/mailers/account_mailer.rb.tt +4 -0
  159. data/lib/generators/pu/rodauth/templates/app/mailers/rodauth_mailer.rb.tt +62 -0
  160. data/lib/generators/pu/rodauth/templates/app/misc/account_rodauth_plugin.rb.tt +255 -0
  161. data/lib/generators/pu/rodauth/templates/app/misc/rodauth_app.rb.tt +24 -0
  162. data/lib/generators/pu/rodauth/templates/app/misc/rodauth_plugin.rb.tt +234 -0
  163. data/lib/generators/pu/rodauth/templates/app/models/account.rb.tt +40 -0
  164. data/lib/generators/pu/rodauth/templates/app/views/rodauth/_email_auth_request_form.html.erb +7 -0
  165. data/lib/generators/pu/rodauth/templates/app/views/rodauth/_login_form.html.erb +26 -0
  166. data/lib/generators/pu/rodauth/templates/app/views/rodauth/_login_form_footer.html.erb +9 -0
  167. data/lib/generators/pu/rodauth/templates/app/views/rodauth/add_recovery_codes.html.erb +6 -0
  168. data/lib/generators/pu/rodauth/templates/app/views/rodauth/change_login.html.erb +27 -0
  169. data/lib/generators/pu/rodauth/templates/app/views/rodauth/change_password.html.erb +27 -0
  170. data/lib/generators/pu/rodauth/templates/app/views/rodauth/close_account.html.erb +13 -0
  171. data/lib/generators/pu/rodauth/templates/app/views/rodauth/confirm_password.html.erb +11 -0
  172. data/lib/generators/pu/rodauth/templates/app/views/rodauth/create_account.html.erb +35 -0
  173. data/lib/generators/pu/rodauth/templates/app/views/rodauth/email_auth.html.erb +5 -0
  174. data/lib/generators/pu/rodauth/templates/app/views/rodauth/login.html.erb +4 -0
  175. data/lib/generators/pu/rodauth/templates/app/views/rodauth/logout.html.erb +14 -0
  176. data/lib/generators/pu/rodauth/templates/app/views/rodauth/multi_phase_login.html.erb +3 -0
  177. data/lib/generators/pu/rodauth/templates/app/views/rodauth/otp_auth.html.erb +15 -0
  178. data/lib/generators/pu/rodauth/templates/app/views/rodauth/otp_disable.html.erb +13 -0
  179. data/lib/generators/pu/rodauth/templates/app/views/rodauth/otp_setup.html.erb +41 -0
  180. data/lib/generators/pu/rodauth/templates/app/views/rodauth/recovery_auth.html.erb +11 -0
  181. data/lib/generators/pu/rodauth/templates/app/views/rodauth/recovery_codes.html.erb +13 -0
  182. data/lib/generators/pu/rodauth/templates/app/views/rodauth/remember.html.erb +22 -0
  183. data/lib/generators/pu/rodauth/templates/app/views/rodauth/reset_password.html.erb +19 -0
  184. data/lib/generators/pu/rodauth/templates/app/views/rodauth/reset_password_request.html.erb +17 -0
  185. data/lib/generators/pu/rodauth/templates/app/views/rodauth/sms_auth.html.erb +15 -0
  186. data/lib/generators/pu/rodauth/templates/app/views/rodauth/sms_confirm.html.erb +15 -0
  187. data/lib/generators/pu/rodauth/templates/app/views/rodauth/sms_disable.html.erb +13 -0
  188. data/lib/generators/pu/rodauth/templates/app/views/rodauth/sms_request.html.erb +5 -0
  189. data/lib/generators/pu/rodauth/templates/app/views/rodauth/sms_setup.html.erb +23 -0
  190. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/_email_auth_request_form.html.erb +5 -0
  191. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/_login_form.html.erb +24 -0
  192. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/_login_form_footer.html.erb +7 -0
  193. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/add_recovery_codes.html.erb +16 -0
  194. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/change_login.html.erb +25 -0
  195. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/change_password.html.erb +25 -0
  196. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/close_account.html.erb +11 -0
  197. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/confirm_password.html.erb +19 -0
  198. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/create_account.html.erb +33 -0
  199. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/email_auth.html.erb +3 -0
  200. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/login.html.erb +5 -0
  201. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/logout.html.erb +10 -0
  202. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/multi_phase_login.html.erb +5 -0
  203. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/otp_auth.html.erb +9 -0
  204. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/otp_disable.html.erb +11 -0
  205. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/otp_setup.html.erb +32 -0
  206. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/recovery_auth.html.erb +9 -0
  207. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/recovery_codes.html.erb +11 -0
  208. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/remember.html.erb +18 -0
  209. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/reset_password.html.erb +17 -0
  210. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/reset_password_request.html.erb +17 -0
  211. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/sms_auth.html.erb +9 -0
  212. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/sms_confirm.html.erb +9 -0
  213. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/sms_disable.html.erb +11 -0
  214. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/sms_request.html.erb +3 -0
  215. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/sms_setup.html.erb +17 -0
  216. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/two_factor_auth.html.erb +5 -0
  217. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/two_factor_disable.html.erb +11 -0
  218. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/two_factor_manage.html.erb +26 -0
  219. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/unlock_account.html.erb +15 -0
  220. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/unlock_account_request.html.erb +9 -0
  221. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/verify_account.html.erb +19 -0
  222. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/verify_account_resend.html.erb +17 -0
  223. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/verify_login_change.html.erb +3 -0
  224. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/webauthn_auth.html.erb +13 -0
  225. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/webauthn_autofill.html.erb +10 -0
  226. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/webauthn_remove.html.erb +21 -0
  227. data/lib/generators/pu/rodauth/templates/app/views/rodauth/tailwind/webauthn_setup.html.erb +21 -0
  228. data/lib/generators/pu/rodauth/templates/app/views/rodauth/two_factor_auth.html.erb +5 -0
  229. data/lib/generators/pu/rodauth/templates/app/views/rodauth/two_factor_disable.html.erb +13 -0
  230. data/lib/generators/pu/rodauth/templates/app/views/rodauth/two_factor_manage.html.erb +22 -0
  231. data/lib/generators/pu/rodauth/templates/app/views/rodauth/unlock_account.html.erb +15 -0
  232. data/lib/generators/pu/rodauth/templates/app/views/rodauth/unlock_account_request.html.erb +9 -0
  233. data/lib/generators/pu/rodauth/templates/app/views/rodauth/verify_account.html.erb +21 -0
  234. data/lib/generators/pu/rodauth/templates/app/views/rodauth/verify_account_resend.html.erb +17 -0
  235. data/lib/generators/pu/rodauth/templates/app/views/rodauth/verify_login_change.html.erb +5 -0
  236. data/lib/generators/pu/rodauth/templates/app/views/rodauth/webauthn_auth.html.erb +15 -0
  237. data/lib/generators/pu/rodauth/templates/app/views/rodauth/webauthn_autofill.html.erb +10 -0
  238. data/lib/generators/pu/rodauth/templates/app/views/rodauth/webauthn_remove.html.erb +23 -0
  239. data/lib/generators/pu/rodauth/templates/app/views/rodauth/webauthn_setup.html.erb +23 -0
  240. data/lib/generators/pu/rodauth/templates/app/views/rodauth_mailer/email_auth.text.erb +5 -0
  241. data/lib/generators/pu/rodauth/templates/app/views/rodauth_mailer/password_changed.text.erb +2 -0
  242. data/lib/generators/pu/rodauth/templates/app/views/rodauth_mailer/reset_password.text.erb +5 -0
  243. data/lib/generators/pu/rodauth/templates/app/views/rodauth_mailer/reset_password_notify.text.erb +2 -0
  244. data/lib/generators/pu/rodauth/templates/app/views/rodauth_mailer/unlock_account.text.erb +5 -0
  245. data/lib/generators/pu/rodauth/templates/app/views/rodauth_mailer/verify_account.text.erb +4 -0
  246. data/lib/generators/pu/rodauth/templates/app/views/rodauth_mailer/verify_login_change.text.erb +10 -0
  247. data/lib/generators/pu/rodauth/templates/config/initializers/rodauth.rb.tt +3 -0
  248. data/lib/generators/pu/rodauth/templates/db/migrate/create_rodauth.rb.tt +13 -0
  249. data/lib/generators/pu/rodauth/views_generator.rb +125 -0
  250. data/lib/plutonium/auth/public_access.rb +17 -0
  251. data/lib/plutonium/auth/rodauth.rb +35 -0
  252. data/lib/plutonium/auth.rb +12 -0
  253. data/lib/plutonium/config.rb +11 -0
  254. data/lib/plutonium/core/.DS_Store +0 -0
  255. data/lib/plutonium/core/action.rb +46 -0
  256. data/lib/plutonium/core/actions/basic_action.rb +16 -0
  257. data/lib/plutonium/core/actions/collection.rb +33 -0
  258. data/lib/plutonium/core/actions/destroy_action.rb +21 -0
  259. data/lib/plutonium/core/actions/edit_action.rb +19 -0
  260. data/lib/plutonium/core/actions/interactive_action.rb +64 -0
  261. data/lib/plutonium/core/actions/new_action.rb +18 -0
  262. data/lib/plutonium/core/actions/show_action.rb +17 -0
  263. data/lib/plutonium/core/actions.rb +17 -0
  264. data/lib/plutonium/core/app_controller.rb +121 -0
  265. data/lib/plutonium/core/autodiscovery/discoverer.rb +15 -0
  266. data/lib/plutonium/core/autodiscovery/input_discoverer.rb +33 -0
  267. data/lib/plutonium/core/autodiscovery/renderer_discoverer.rb +33 -0
  268. data/lib/plutonium/core/autodiscovery.rb +13 -0
  269. data/lib/plutonium/core/controllers/authorizable.rb +56 -0
  270. data/lib/plutonium/core/controllers/bootable.rb +44 -0
  271. data/lib/plutonium/core/controllers/crud_actions.rb +128 -0
  272. data/lib/plutonium/core/controllers/entity_scoping.rb +69 -0
  273. data/lib/plutonium/core/controllers/interactive_actions.rb +210 -0
  274. data/lib/plutonium/core/controllers/presentable.rb +59 -0
  275. data/lib/plutonium/core/controllers.rb +16 -0
  276. data/lib/plutonium/core/definers/action_definer.rb +25 -0
  277. data/lib/plutonium/core/definers/field_definer.rb +19 -0
  278. data/lib/plutonium/core/definers/input_definer.rb +37 -0
  279. data/lib/plutonium/core/definers/renderer_definer.rb +35 -0
  280. data/lib/plutonium/core/definers.rb +14 -0
  281. data/lib/plutonium/core/fields/inputs/association_input.rb +26 -0
  282. data/lib/plutonium/core/fields/inputs/basic_input.rb +42 -0
  283. data/lib/plutonium/core/fields/inputs/belongs_to_input.rb +15 -0
  284. data/lib/plutonium/core/fields/inputs/factory.rb +58 -0
  285. data/lib/plutonium/core/fields/inputs/has_many_input.rb +15 -0
  286. data/lib/plutonium/core/fields/inputs/noop_input.rb +19 -0
  287. data/lib/plutonium/core/fields/inputs.rb +18 -0
  288. data/lib/plutonium/core/fields/renderers/association_renderer.rb +25 -0
  289. data/lib/plutonium/core/fields/renderers/basic_renderer.rb +27 -0
  290. data/lib/plutonium/core/fields/renderers/factory.rb +52 -0
  291. data/lib/plutonium/core/fields/renderers.rb +15 -0
  292. data/lib/plutonium/core/fields.rb +12 -0
  293. data/lib/plutonium/core/ui/collection.rb +14 -0
  294. data/lib/plutonium/core/ui/detail.rb +11 -0
  295. data/lib/plutonium/core/ui/form.rb +11 -0
  296. data/lib/plutonium/core/ui.rb +13 -0
  297. data/lib/plutonium/core.rb +16 -0
  298. data/lib/plutonium/helpers/action_buttons_helper.rb +32 -0
  299. data/lib/plutonium/helpers/application_helper.rb +22 -0
  300. data/lib/plutonium/helpers/attachment_helper.rb +62 -0
  301. data/lib/plutonium/helpers/content_helper.rb +66 -0
  302. data/lib/plutonium/helpers/display_helper.rb +83 -0
  303. data/lib/plutonium/helpers/form_helper.rb +24 -0
  304. data/lib/plutonium/helpers/menu_helper.rb +69 -0
  305. data/lib/plutonium/helpers/pagination_helper.rb +9 -0
  306. data/lib/plutonium/helpers/turbo_helper.rb +13 -0
  307. data/lib/plutonium/helpers/turbo_stream_actions_helper.rb +9 -0
  308. data/lib/plutonium/helpers.rb +31 -0
  309. data/lib/plutonium/initializers/TODO +2 -0
  310. data/lib/plutonium/initializers/pagy.rb +5 -0
  311. data/lib/plutonium/initializers/patches.rb +2 -0
  312. data/lib/plutonium/initializers/rabl.rb +60 -0
  313. data/lib/plutonium/initializers/simple_form.rb +405 -0
  314. data/lib/plutonium/lib/after_commit.rb +34 -0
  315. data/lib/plutonium/lib/bit_flags.rb +36 -0
  316. data/lib/plutonium/packaging/app.rb +125 -0
  317. data/lib/plutonium/packaging/feature.rb +18 -0
  318. data/lib/plutonium/packaging/package.rb +22 -0
  319. data/lib/plutonium/packaging.rb +9 -0
  320. data/lib/plutonium/policy/initializer.rb +22 -0
  321. data/lib/plutonium/policy/scope.rb +19 -0
  322. data/lib/plutonium/policy.rb +8 -0
  323. data/lib/plutonium/preserved__/field.rb +65 -0
  324. data/lib/plutonium/preserved__/input.rb +93 -0
  325. data/lib/plutonium/reactor/core.rb +61 -0
  326. data/lib/plutonium/reactor/resource_context.rb +15 -0
  327. data/lib/plutonium/reactor/resource_controller.rb +108 -0
  328. data/lib/plutonium/reactor/resource_interaction.rb +8 -0
  329. data/lib/plutonium/reactor/resource_policy.rb +105 -0
  330. data/lib/plutonium/reactor/resource_presenter.rb +42 -0
  331. data/lib/plutonium/reactor/resource_record.rb +123 -0
  332. data/lib/plutonium/reactor.rb +13 -0
  333. data/lib/plutonium/refinements/parameter_refinements.rb +26 -0
  334. data/lib/plutonium/simple_form_components/attachment_component.rb +77 -0
  335. data/lib/plutonium/simple_form_components/input_group_component.rb +14 -0
  336. data/lib/plutonium/version.rb +3 -0
  337. data/lib/plutonium.rb +31 -0
  338. data/plutonium.gemspec +47 -0
  339. data/public/.keep +0 -0
  340. data/public/plutonium-assets/application.css +24280 -0
  341. data/public/plutonium-assets/application.js +31420 -0
  342. data/public/plutonium-assets/fonts/bootstrap-icons.woff +0 -0
  343. data/public/plutonium-assets/fonts/bootstrap-icons.woff2 +0 -0
  344. data/public/plutonium-assets/logo.png +0 -0
  345. data/sig/plutonium.rbs +4 -0
  346. metadata +519 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b91e22fa0430a2ca94704f472ac5ae688c50140c82bec3ef8db7a0d9571418f4
4
+ data.tar.gz: 76c32ee40e384bdef1de3aeda5dbece07841a7898260beffb3a3841e8c0f0c27
5
+ SHA512:
6
+ metadata.gz: 5f78a1c9dd3978b92dd9e33ca8c594f24895dd6a18ac25563cd50a1a85bc222199ed830d574c55409e99c76c90a37104f9cf5daa9a024dfc86ad49ec43a3dd48
7
+ data.tar.gz: 7df604d36bbc6191068299d91cf141f5c08bb671513a3853146cc90646c262a56e26fb0fd73316491758a3e56e73f0e22718382dbc3d96efb4d186b45587e78e
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.2.2
data/.standard.yml ADDED
@@ -0,0 +1,4 @@
1
+ # For available configuration options, see:
2
+ # https://github.com/standardrb/standard
3
+ ---
4
+ ruby_version: 3.2.2
@@ -0,0 +1,15 @@
1
+ {
2
+ "recommendations": [
3
+ "redhat.vscode-yaml",
4
+ "mickey.code-copy-ruby-ref",
5
+ "ghbozz.hashtag",
6
+ "kaiwood.endwise",
7
+ "castwide.solargraph",
8
+ "aliariff.vscode-erb-beautify",
9
+ "jbockle.jbockle-format-files",
10
+ "esbenp.prettier-vscode",
11
+ "pavlitsky.yard",
12
+ "testdouble.vscode-standard-ruby",
13
+ "shopify.ruby-lsp"
14
+ ]
15
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": []
7
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "git.enableSmartCommit": true,
3
+ "editor.formatOnSave": true,
4
+ "editor.renderControlCharacters": true,
5
+ "editor.semanticHighlighting.enabled": true,
6
+ "editor.tabSize": 2,
7
+ "editor.insertSpaces": true,
8
+ "files.trimTrailingWhitespace": true,
9
+ "files.insertFinalNewline": true,
10
+ "files.trimFinalNewlines": true,
11
+ "editor.rulers": [
12
+ 80,
13
+ 120
14
+ ],
15
+ "solargraph.formatting": true,
16
+ "[yaml]": {
17
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
18
+ "editor.formatOnSave": true
19
+ },
20
+ "[ruby]": {
21
+ "editor.defaultFormatter": "testdouble.vscode-standard-ruby",
22
+ "editor.formatOnSave": true
23
+ },
24
+ "[erb]": {
25
+ "editor.defaultFormatter": "aliariff.vscode-erb-beautify",
26
+ "editor.formatOnSave": false
27
+ },
28
+ "files.associations": {
29
+ "*.html.erb": "erb",
30
+ "Gemfile": "ruby",
31
+ },
32
+ "rubyLsp.enabledFeatures": {
33
+ "diagnostics": false, // uses rubocop. our projects uses standard
34
+ }
35
+ }
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2024-01-01
4
+
5
+ - Initial release
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Stefan Froelich
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
13
+ all 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
21
+ THE SOFTWARE.
data/README copy.md ADDED
@@ -0,0 +1,84 @@
1
+ # Plutonium
2
+
3
+ Plutonium is a rapid application development toolkit built on top of rails. It is a generator based framework that gives you full control over your application.
4
+
5
+ It builds upon years of frustration re-implementing almost identical applications over and over.
6
+
7
+ After trying out lots of dashboard gems and starter kits, we always found them lacking.
8
+ Either they did way too much and customizing them was close to impossible, or they did too little and were still had to customize.
9
+
10
+ We set out to solve a one problem.
11
+
12
+ Create something that did 90% of what we wanted, while allowing us the freedom of achieving the remainder.
13
+
14
+ Plutonium takes care of
15
+
16
+ 1. Authentication
17
+ 2. Authorization
18
+ 3. CRUD including tables, details, forms, pagination, actions, fully customizable fields and inputs, search and filtering, routing, nested resources etc.
19
+ 4. Modularizating i.e it includes a packaging system based on rails engines and adds improved namespacing supporting
20
+ 5. Advanced generators to handle repetitive tasks
21
+
22
+ # Design Choices
23
+
24
+ Like Rails itself, Plutonium is [omakase](https://dhh.dk/2012/rails-is-omakase.html).
25
+ We provide a few conventions outside of which you are able to write your application just like you would a normal rails app.
26
+
27
+ While traditional admin dashboard tools ship as a rails engine, Plutonium integrates into your project, generating integration points to the core library. Similar to how Rails provides an Application which inherits ActiveRecord::Base, Plutonium adds a few base classes. This is the cost of plugging the leak in the abstraction.
28
+
29
+ Plutonium is MVC. It is the most productive way to build that I have found. Coupled with [hotwire](TODO), we are able to build an interactive,responsive and extremely robust functionality. Most of our features are progressively enhanced, allowing them to be used with hotwire turned off. Features requiring hotwire will be indicated.
30
+
31
+ The same principle of progressive enhancement applies to how features are built. Features start as basic plumbing, exposing a fully customizable api. The framework then builds nicer layers on top of this. This makes us consumers of our own api forcing us to improve upon it when we hit a roadblock. If you can't do it, that means we can't do it either. Let us know, we are committed to improving customizability.
32
+
33
+ A Plutonium app is a rails app. We reuse the same patterns used for controllers, routing and models. If you know rails, picking up plutonium requires only learning a few new concepts.
34
+
35
+ Rails does an amazing number of things right. Especially around view resolution and how it handles inheritance.
36
+ We have leveraged this such that you can apply customizations granularly, from groups of resources to individual resources.
37
+ If you don't like how we do something, easy, override a method or a view and voila.
38
+
39
+ A lot of our functionality is built on and inspired by gems we carefully considered for robustness and customizability.
40
+
41
+ - [ActiveInteraction](https://github.com/AaronLasseigne/active_interaction): 💼 Manage application specific business logic. Powers [actions](TODO).
42
+ - [Pagy](https://github.com/ddnexus/pagy): 🏆 The Best Pagination Ruby Gem 🥇. Powers [collection view](TODO)
43
+ - [Pundit](https://github.com/varvet/pundit): Minimal authorization through OO design and pure Ruby classes. Powers [authorization](TODO).
44
+ - [ransack](https://github.com/activerecord-hackery/ransack): Object-based searching. Powers [search](TODO).
45
+ - [Simple Form](https://github.com/heartcombo/simple_form): Forms made easy for Rails! It's tied to a simple DSL, with no opinion on markup. Powers [inputs](TODO). Heavily inspired the fields api 💡💡💡.
46
+ - [Rodauth\*](https://github.com/jeremyevans/rodauth): Ruby's Most Advanced Authentication Framework. Used via the [rodauth-rails](https://github.com/janko/rodauth-rails) gem. Powers [authentication](TODO). \*Rodauth is optional. You can bring your own auth.
47
+
48
+ ## Installation
49
+
50
+ Add to your gemfile
51
+
52
+ gem "plutonium", github: "radioactive-labs/plutonium-core"
53
+ gem "plutonium_generators", github: "radioactive-labs/plutonium-generators", group: [:development, :test]
54
+
55
+ <!--
56
+ gem "plutonium", path: "/Users/stefan/code/plutonium/starters/plutonium/"
57
+ gem "plutonium_generators", path: "/Users/stefan/code/plutonium/plutonium_generators", group: [:development, :test]
58
+ -->
59
+
60
+ Install new gems
61
+
62
+ bundle
63
+
64
+ Setup Plutonium in your application
65
+
66
+ rails g pu:core:install
67
+
68
+ ## Usage
69
+
70
+ TODO: Write usage instructions here
71
+
72
+ ## Development
73
+
74
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
75
+
76
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
77
+
78
+ ## Contributing
79
+
80
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/plutonium.
81
+
82
+ ## License
83
+
84
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # Plutonium: Nuclear Powered Rails Application Development
2
+
3
+ **Plutonium** transforms the way you build applications with Rails, offering a powerful toolkit for rapid application development.
4
+ It's a culmination of lessons learned from years of developing nearly identical applications and is designed to save you from the drudgery of re-implementation.
5
+
6
+ **Why Choose Plutonium?**
7
+
8
+ - **Efficiency by Design:** Plutonium is built for developers who demand efficiency without compromise. It automates 90% of your application needs while giving you the flexibility to tailor the remaining 10% to your specific requirements.
9
+ - **Comprehensive Features:** From authentication and authorization to CRUD operations, and beyond, Plutonium covers a wide array of functionalities out of the box:
10
+ - Authentication & Authorization
11
+ - Complete CRUD operations with advanced features: customizable tables, forms, pagination, actions, search, filtering, and nested resources.
12
+ - Modular architecture leveraging Rails engines for improved packaging and namespacing.
13
+ - Time-saving generators for boilerplate tasks.
14
+ - **Omakase with a Twist:** Inspired by Rails' omakase philosophy, Plutonium delivers a convention-based approach but doesn't box you in. It's seamlessly integrated into your project, allowing you to write your application as you would with vanilla Rails but with powerful extensions.
15
+ - **MVC and Beyond:** Plutonium adopts the MVC pattern, enhanced with modern web technologies like [hotwire](TODO), to deliver an interactive and robust user experience. It emphasizes progressive enhancement, ensuring a smooth development process and end-user experience.
16
+ - **Rails Harmony:** A Plutonium app is a Rails app at its core. It respects and builds upon Rails' conventions, making it intuitive for Rails developers. If you know Rails, learning Plutonium requires only a few new concepts.
17
+ - **Effortless Customization:** Plutonium is designed for easy customization to meet your unique requirements. Whether adjusting the functionality of entire resource groups or fine-tuning individual elements, our accessible low-level APIs and the familiar Rails conventions offer unparalleled flexibility. This ensures that any modifications you need to make can be implemented swiftly and smoothly, reducing complexity and enhancing your development experience.
18
+ - **Community-Driven Dependencies:** Plutonium stands on the shoulders of giants, integrating with well-established gems known for their robustness and flexibility, including:
19
+ - [ActiveInteraction](https://github.com/AaronLasseigne/active_interaction) for business logic
20
+ - [Pagy](https://github.com/ddnexus/pagy) for pagination
21
+ - [Pundit](https://github.com/varvet/pundit) for authorization
22
+ - [ransack](https://github.com/activerecord-hackery/ransack) for searching
23
+ - [Simple Form](https://github.com/heartcombo/simple_form) for forms
24
+ - [Rodauth](https://github.com/jeremyevans/rodauth) (via [rodauth-rails](https://github.com/janko/rodauth-rails)) for authentication. Rodauth is optional, allowing flexibility in choosing your auth solution
25
+
26
+ ## Quick Start
27
+
28
+ Get Plutonium up and running in your Rails application with these simple steps:
29
+
30
+ 1. **Add Plutonium to your Gemfile:**
31
+
32
+ ```ruby
33
+ gem "plutonium"
34
+ gem "plutonium_generators", github: "radioactive-labs/plutonium-generators", group: [:development, :test]
35
+ ```
36
+
37
+ 2. **Bundle Install:**
38
+
39
+ ```shell
40
+ bundle
41
+ ```
42
+
43
+ 3. **Install Plutonium:**
44
+
45
+ ```shell
46
+ rails g pu:core:install
47
+ ```
48
+
49
+ Start building your Rails applications faster, with more flexibility and less boilerplate. **Plutonium** is here to revolutionize your development process.
50
+
51
+ ## Usage
52
+
53
+ TODO: Write usage instructions here
54
+
55
+ ## Development
56
+
57
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
58
+
59
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
60
+
61
+ ## Contributing
62
+
63
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/plutonium.
64
+
65
+ ## License
66
+
67
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ require "standard/rake"
7
+
8
+ task default: %i[spec standard]
@@ -0,0 +1,43 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" data-bs-theme="auto">
3
+ <head>
4
+ <title><%= page_title @page_title %></title>
5
+ <meta charset="utf-8">
6
+ <meta name="viewport" content="width=device-width,initial-scale=1">
7
+ <meta name="turbo-cache-control" content="no-cache">
8
+ <%= csrf_meta_tags %>
9
+ <%= csp_meta_tag %>
10
+ <%= yield(:meta) %>
11
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/quill/1.3.7/quill.snow.min.css" integrity="sha512-/FHUK/LsH78K9XTqsR9hbzr21J8B8RwHR/r8Jv9fzry6NVAOVIGFKQCNINsbhK7a1xubVu2r5QZcz2T9cKpubw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
12
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/quill/1.3.7/quill.min.js" integrity="sha512-P2W2rr8ikUPfa31PLBo5bcBQrsa+TNj8jiKadtaIrHQGMo6hQM6RdPjQYxlNguwHz8AwSQ28VkBK6kHBLgd/8g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
13
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/slim-select/2.6.0/slimselect.min.css" integrity="sha512-GvqWM4KWH8mbgWIyvwdH8HgjUbyZTXrCq0sjGij9fDNiXz3vJoy3jCcAaWNekH2rJe4hXVWCJKN+bEW8V7AAEQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
14
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/slim-select/2.6.0/slimselect.min.js" integrity="sha512-0E8oaoA2v32h26IycsmRDShtQ8kMgD91zWVBxdIvUCjU3xBw81PV61QBsBqNQpWkp/zYJZip8Ag3ifmzz1wCKQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
15
+ <link rel="stylesheet" href="/plutonium-assets/application.css" />
16
+ <script src="/plutonium-assets/application.js"></script>
17
+ <script src="/plutonium-assets/application.css"></script>
18
+ <%= yield(:head) %>
19
+ </head>
20
+ <body class="bg-body-tertiary">
21
+ <%= modal_frame_tag do %>
22
+ <%= yield(:modal) %>
23
+ <% end %>
24
+ <%= render "messages" %>
25
+ <%= content_for?(:header) ? yield(:header) : render("header") %>
26
+ <div class="container-fluid">
27
+ <div class="row">
28
+ <div class="col-12 col-sm-3 col-xl-2 pt-2">
29
+ <%= render 'sidebar' %>
30
+ </div>
31
+ <div class="col-12 col-sm-9 col-xl-10 pt-2">
32
+ <div class="container-fluid">
33
+ <turbo-frame id="content" data-turbo-action="advance">
34
+ <%= yield(:toolbar) %>
35
+ <%= yield %>
36
+ </turbo-frame>
37
+ </div>
38
+ </div>
39
+ </div>
40
+ </div>
41
+ <%= render 'color_modes' %>
42
+ </body>
43
+ </html>
@@ -0,0 +1,55 @@
1
+ <%# Give some space at the bottom so content does not overlap the mode toggle %>
2
+ <div class="color-mode-separator"></div>
3
+ <svg xmlns="http://www.w3.org/2000/svg" class="d-none">
4
+ <symbol id="check2" viewBox="0 0 16 16">
5
+ <path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>
6
+ </symbol>
7
+ <symbol id="circle-half" viewBox="0 0 16 16">
8
+ <path d="M8 15A7 7 0 1 0 8 1v14zm0 1A8 8 0 1 1 8 0a8 8 0 0 1 0 16z"/>
9
+ </symbol>
10
+ <symbol id="moon-stars-fill" viewBox="0 0 16 16">
11
+ <path d="M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278z"/>
12
+ <path d="M10.794 3.148a.217.217 0 0 1 .412 0l.387 1.162c.173.518.579.924 1.097 1.097l1.162.387a.217.217 0 0 1 0 .412l-1.162.387a1.734 1.734 0 0 0-1.097 1.097l-.387 1.162a.217.217 0 0 1-.412 0l-.387-1.162A1.734 1.734 0 0 0 9.31 6.593l-1.162-.387a.217.217 0 0 1 0-.412l1.162-.387a1.734 1.734 0 0 0 1.097-1.097l.387-1.162zM13.863.099a.145.145 0 0 1 .274 0l.258.774c.115.346.386.617.732.732l.774.258a.145.145 0 0 1 0 .274l-.774.258a1.156 1.156 0 0 0-.732.732l-.258.774a.145.145 0 0 1-.274 0l-.258-.774a1.156 1.156 0 0 0-.732-.732l-.774-.258a.145.145 0 0 1 0-.274l.774-.258c.346-.115.617-.386.732-.732L13.863.1z"/>
13
+ </symbol>
14
+ <symbol id="sun-fill" viewBox="0 0 16 16">
15
+ <path d="M8 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z"/>
16
+ </symbol>
17
+ <symbol id="bootstrap" viewBox="0 0 118 94">
18
+ <title>Bootstrap</title>
19
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M24.509 0c-6.733 0-11.715 5.893-11.492 12.284.214 6.14-.064 14.092-2.066 20.577C8.943 39.365 5.547 43.485 0 44.014v5.972c5.547.529 8.943 4.649 10.951 11.153 2.002 6.485 2.28 14.437 2.066 20.577C12.794 88.106 17.776 94 24.51 94H93.5c6.733 0 11.714-5.893 11.491-12.284-.214-6.14.064-14.092 2.066-20.577 2.009-6.504 5.396-10.624 10.943-11.153v-5.972c-5.547-.529-8.934-4.649-10.943-11.153-2.002-6.484-2.28-14.437-2.066-20.577C105.214 5.894 100.233 0 93.5 0H24.508zM80 57.863C80 66.663 73.436 72 62.543 72H44a2 2 0 01-2-2V24a2 2 0 012-2h18.437c9.083 0 15.044 4.92 15.044 12.474 0 5.302-4.01 10.049-9.119 10.88v.277C75.317 46.394 80 51.21 80 57.863zM60.521 28.34H49.948v14.934h8.905c6.884 0 10.68-2.772 10.68-7.727 0-4.643-3.264-7.207-9.012-7.207zM49.948 49.2v16.458H60.91c7.167 0 10.964-2.876 10.964-8.281 0-5.406-3.903-8.178-11.425-8.178H49.948z"></path>
20
+ </symbol>
21
+ </svg>
22
+ <div data-controller="color-modes" class="dropdown position-fixed bottom-0 end-0 mb-3 me-3" style="z-index: 1500;">
23
+ <button class="btn btn-dark py-2 dropdown-toggle d-flex align-items-center"
24
+ id="bd-theme"
25
+ type="button"
26
+ aria-expanded="false"
27
+ data-bs-toggle="dropdown"
28
+ aria-label="Toggle theme (auto)">
29
+ <svg class="bi my-1 theme-icon-active" width="1em" height="1em"><use href="#circle-half"></use></svg>
30
+ <span class="visually-hidden" id="bd-theme-text">Toggle theme</span>
31
+ </button>
32
+ <ul class="dropdown-menu dropdown-menu-end shadow dropdown-menu-dark" aria-labelledby="bd-theme-text">
33
+ <li>
34
+ <button type="button" class="dropdown-item d-flex align-items-center" data-bs-theme-value="light" aria-pressed="false">
35
+ <svg class="bi me-2 opacity-50 theme-icon" width="1em" height="1em"><use href="#sun-fill"></use></svg>
36
+ Light
37
+ <svg class="bi ms-auto d-none" width="1em" height="1em"><use href="#check2"></use></svg>
38
+ </button>
39
+ </li>
40
+ <li>
41
+ <button type="button" class="dropdown-item d-flex align-items-center" data-bs-theme-value="dark" aria-pressed="false">
42
+ <svg class="bi me-2 opacity-50 theme-icon" width="1em" height="1em"><use href="#moon-stars-fill"></use></svg>
43
+ Dark
44
+ <svg class="bi ms-auto d-none" width="1em" height="1em"><use href="#check2"></use></svg>
45
+ </button>
46
+ </li>
47
+ <li>
48
+ <button type="button" class="dropdown-item d-flex align-items-center active" data-bs-theme-value="auto" aria-pressed="true">
49
+ <svg class="bi me-2 opacity-50 theme-icon" width="1em" height="1em"><use href="#circle-half"></use></svg>
50
+ Auto
51
+ <svg class="bi ms-auto d-none" width="1em" height="1em"><use href="#check2"></use></svg>
52
+ </button>
53
+ </li>
54
+ </ul>
55
+ </div>
@@ -0,0 +1,6 @@
1
+ <div class="row row-gap-2">
2
+ <% details.fields.each do |name, field| %>
3
+ <dt class="col-md-3"><%= field.label %></dt>
4
+ <dd class="col-md-9"><%= field.render self, details.record %></dd>
5
+ <% end %>
6
+ </div>
@@ -0,0 +1,12 @@
1
+ <%#
2
+ locals: {
3
+ message: "message to display",
4
+ }
5
+ yields: true
6
+ %>
7
+ <div class="card text-center py-4">
8
+ <div class="card-body">
9
+ <div class="my-2"><%= message %></div>
10
+ <%= yield %>
11
+ </div>
12
+ </div>
@@ -0,0 +1,9 @@
1
+ <% flash.each do |type, msg| %>
2
+ <%
3
+ type = { alert: :danger, warning: :warning, success: :success }[type.to_sym] || :primary
4
+ %>
5
+ <div class="alert alert-<%= type %> alert-dismissible fade show" role="alert" data-turbo-temporary>
6
+ <%= msg %>
7
+ <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
8
+ </div>
9
+ <% end %>
@@ -0,0 +1,32 @@
1
+ <%#
2
+ locals: {
3
+ form: "instance of Plutonium::UI::Builder::Form"
4
+ }
5
+ %>
6
+ <%= resource_form_for adapt_route_args(form.record) do |f| %>
7
+ <div class="row row-gap-2">
8
+ <div class="container">
9
+ <div class="form-errors">
10
+ <%= f.error_notification %>
11
+ <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>
12
+ <% f.object.errors.full_messages.each do |message| %>
13
+ <%= f.error_notification message: message %>
14
+ <% end %>
15
+ </div>
16
+ </div>
17
+ <div class="row py-2">
18
+ <div class="col-12 text-end">
19
+ <%= f.button :submit, class: "btn btn-sm btn-outline-primary" %>
20
+ </div>
21
+ </div>
22
+ <div class="form-inputs">
23
+ <% form.inputs.values.each do |input| %>
24
+ <%= input.render f, form.record %>
25
+ <% end %>
26
+ </div>
27
+ <div class="form-actions">
28
+ <%#= f.button :button, class: "btn btn-outline-secondary", formaction: "", formmethod: :get %>
29
+ <%= f.button :submit, class: "btn btn-outline-primary" %>
30
+ </div>
31
+ </div>
32
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <header>
2
+ <nav class="navbar navbar-expand-md bg-body-tertiary">
3
+ <div class="container-fluid">
4
+ <p class="navbar-brand text-bg-danger text-warning px-2">plutonium<p>
5
+ <%= render 'nav_user' %>
6
+ </div>
7
+ </nav>
8
+ </header>
@@ -0,0 +1,67 @@
1
+ <%#
2
+ locals: {
3
+ interactive_action
4
+ }
5
+ %>
6
+ <% if current_turbo_frame == 'modal' %>
7
+ <%= turbo_frame_tag "modal" do %>
8
+ <div class="modal " tabindex="-1" data-controller="modal">
9
+ <div class="modal-dialog modal-dialog-scrollable modal-lg">
10
+ <%= resource_form_for @interaction, as: :interaction,
11
+ method: :post,
12
+ turbo_frame: :modal,
13
+ url: "" do |f| %>
14
+ <div class="modal-content">
15
+ <div class="modal-header">
16
+ <h1 class="modal-title fs-5"><%= interactive_action.name.to_s.titleize %></h1>
17
+ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
18
+ </div>
19
+ <div class="modal-body">
20
+ <div class="container">
21
+ <div class="form-errors">
22
+ <%= f.error_notification %>
23
+ <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>
24
+ <% f.object.errors.full_messages.each do |message| %>
25
+ <%= f.error_notification message: message %>
26
+ <% end %>
27
+ </div>
28
+ </div>
29
+ <div class="form-inputs">
30
+ <% interactive_action.inputs.values.each do |input| %>
31
+ <%= input.render f, @interaction %>
32
+ <% end %>
33
+ </div>
34
+ </div>
35
+ <div class="modal-footer">
36
+ <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
37
+ <%= f.button :submit, interactive_action.label, class: "btn btn-outline-primary" %>
38
+ </div>
39
+ </div>
40
+ <% end %>
41
+ </div>
42
+ </div>
43
+ <% end %>
44
+ <% else%>
45
+ <%= resource_form_for @interaction, as: :interaction, method: :post, url: "" do |f| %>
46
+ <div class="row row-gap-2">
47
+ <div class="container">
48
+ <div class="form-errors">
49
+ <%= f.error_notification %>
50
+ <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>
51
+ <% f.object.errors.full_messages.each do |message| %>
52
+ <%= f.error_notification message: message %>
53
+ <% end %>
54
+ </div>
55
+ </div>
56
+ <div class="form-inputs">
57
+ <% interactive_action.inputs.values.each do |input| %>
58
+ <%= input.render f, @interaction %>
59
+ <% end %>
60
+ </div>
61
+ <div class="form-actions">
62
+ <%#= f.button :button, class: "btn btn-outline-secondary", formaction: "", formmethod: :get %>
63
+ <%= f.button :submit, interactive_action.label, class: "btn btn-outline-primary" %>
64
+ </div>
65
+ </div>
66
+ <% end %>
67
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render "toast" %>
@@ -0,0 +1,16 @@
1
+ <%#
2
+ locals: {
3
+ title: "metric title",
4
+ value: "metric value",
5
+ }
6
+ %>
7
+ <div class="col-sm-6 col-md-4 col-xl-3">
8
+ <div class="card text-center">
9
+ <div class="card-header">
10
+ <%= title %>
11
+ </div>
12
+ <div class="card-body">
13
+ <p class="card-text fs-1"><%= value %></p>
14
+ </div>
15
+ </div>
16
+ </div>
@@ -0,0 +1,4 @@
1
+ <%= display_name_of current_user %>
2
+ <% if respond_to? :logout_url -%>
3
+ <%= link_to "Sign out", "/", class: "btn btn-outline-primary", data: { turbo: false } %>
4
+ <% end -%>
@@ -0,0 +1,6 @@
1
+ <%#
2
+ locals: {
3
+ pagination: "pagination instance",
4
+ }
5
+ %>
6
+ <%= render 'pagy_pagination', pagy: pagination %>
@@ -0,0 +1,15 @@
1
+ <%#
2
+ locals: {
3
+ pagy: "pagy instance",
4
+ }
5
+ %>
6
+ <div class="row row-gap-1 text-center mt-3">
7
+ <% if pagy.pages > 1 %>
8
+ <div class="col-12">
9
+ <%== pagy_bootstrap_nav pagy %>
10
+ </div>
11
+ <% end %>
12
+ <div class="col-12">
13
+ <small><%== pagy_info(pagy) %></small>
14
+ </div>
15
+ </div>
@@ -0,0 +1 @@
1
+ <%= render 'details', details: details %>
@@ -0,0 +1,5 @@
1
+ attributes :id
2
+ attributes(*permitted_attributes)
3
+ attributes :created_at, :updated_at
4
+
5
+ node(:url) { |resource| url_for(adapt_route_args(resource)) }
@@ -0,0 +1,11 @@
1
+ <div class="offcanvas-md offcanvas-start" tabindex="-1" id="sidebar" aria-labelledby="sidebarLabel">
2
+ <div class="offcanvas-header">
3
+ <h5 class="offcanvas-title" id="sidebarLabel"> </h5>
4
+ <button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#sidebar" aria-label="Close"></button>
5
+ </div>
6
+ <div class="offcanvas-body">
7
+ <div class="flex-shrink-0 ps-3">
8
+ <%= render "sidebar_menu", sidebar_menu: @sidebar_menu %>
9
+ </div>
10
+ </div>
11
+ </div>
@@ -0,0 +1 @@
1
+ <%= build_sidebar_menu sidebar_menu %>
@@ -0,0 +1,13 @@
1
+ <%#
2
+ locals: {
3
+ resource: "resource to render tabs for",
4
+ }
5
+ %>
6
+ <ul class="nav flex-column nav-pills nav-tabs-dropdown me-3" id="v-pills-tab" role="tablist" aria-orientation="vertical">
7
+ <li class="nav-item">
8
+ <a class="nav-link text-start active" href="#" data-bs-toggle="pill" role="tab" aria-selected="true">Details</a>
9
+ </li>
10
+ <li class="nav-item">
11
+ <a class="nav-link text-start" href="#" data-bs-toggle="pill" role="tab" aria-selected="false">Entities</a>
12
+ </li>
13
+ </ul>