sun-sword 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +1141 -0
  4. data/CHANGELOG.md +5 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +96 -0
  7. data/Rakefile +12 -0
  8. data/lib/generators/sun_sword/USAGE +9 -0
  9. data/lib/generators/sun_sword/frontend_generator.rb +148 -0
  10. data/lib/generators/sun_sword/scaffold_generator.rb +97 -0
  11. data/lib/generators/sun_sword/templates_frontend/Procfile.dev +1 -0
  12. data/lib/generators/sun_sword/templates_frontend/assets/config/manifest.js +1 -0
  13. data/lib/generators/sun_sword/templates_frontend/bin/watch +3 -0
  14. data/lib/generators/sun_sword/templates_frontend/config/database.yml +21 -0
  15. data/lib/generators/sun_sword/templates_frontend/config/vite.json +17 -0
  16. data/lib/generators/sun_sword/templates_frontend/controllers/application_controller.rb.tt +36 -0
  17. data/lib/generators/sun_sword/templates_frontend/controllers/dashboard/site_controller.rb +6 -0
  18. data/lib/generators/sun_sword/templates_frontend/controllers/site_controller.rb +15 -0
  19. data/lib/generators/sun_sword/templates_frontend/env.development +14 -0
  20. data/lib/generators/sun_sword/templates_frontend/frontend/assets/images/.keep +0 -0
  21. data/lib/generators/sun_sword/templates_frontend/frontend/assets/images/kotaro.ico +0 -0
  22. data/lib/generators/sun_sword/templates_frontend/frontend/assets/images/logo.svg +16 -0
  23. data/lib/generators/sun_sword/templates_frontend/frontend/assets/images/profile.jpeg +0 -0
  24. data/lib/generators/sun_sword/templates_frontend/frontend/entrypoints/application.js +17 -0
  25. data/lib/generators/sun_sword/templates_frontend/frontend/entrypoints/stimulus.js +9 -0
  26. data/lib/generators/sun_sword/templates_frontend/frontend/pages/stimulus.js +10 -0
  27. data/lib/generators/sun_sword/templates_frontend/frontend/pages/web.js +122 -0
  28. data/lib/generators/sun_sword/templates_frontend/frontend/stylesheets/application.scss +198 -0
  29. data/lib/generators/sun_sword/templates_frontend/helpers/application_helper.rb +5 -0
  30. data/lib/generators/sun_sword/templates_frontend/package.json +7 -0
  31. data/lib/generators/sun_sword/templates_frontend/postcss.config.js +6 -0
  32. data/lib/generators/sun_sword/templates_frontend/rubocop.yml.tt +1141 -0
  33. data/lib/generators/sun_sword/templates_frontend/tailwind.config.js +39 -0
  34. data/lib/generators/sun_sword/templates_frontend/views/components/_action_destroy.html.erb.tt +48 -0
  35. data/lib/generators/sun_sword/templates_frontend/views/components/_action_edit.html.erb.tt +7 -0
  36. data/lib/generators/sun_sword/templates_frontend/views/components/_action_show.html.erb.tt +8 -0
  37. data/lib/generators/sun_sword/templates_frontend/views/components/_alert.html.erb.tt +66 -0
  38. data/lib/generators/sun_sword/templates_frontend/views/components/_error_form_submit.html.erb.tt +20 -0
  39. data/lib/generators/sun_sword/templates_frontend/views/components/_link_action.html.erb.tt +9 -0
  40. data/lib/generators/sun_sword/templates_frontend/views/components/layouts/_sidebar_logo.html.erb +18 -0
  41. data/lib/generators/sun_sword/templates_frontend/views/layouts/application.html.erb.tt +42 -0
  42. data/lib/generators/sun_sword/templates_frontend/views/layouts/dashboard/_sidebar.html.erb.tt +60 -0
  43. data/lib/generators/sun_sword/templates_frontend/views/layouts/dashboard/application.html.erb.tt +71 -0
  44. data/lib/generators/sun_sword/templates_frontend/views/site/_comment.html.erb.tt +3 -0
  45. data/lib/generators/sun_sword/templates_frontend/views/site/stimulus.html.erb.tt +26 -0
  46. data/lib/generators/sun_sword/templates_frontend/vite.config.ts.tt +27 -0
  47. data/lib/generators/sun_sword/templates_scaffold/controllers/controller.rb.tt +90 -0
  48. data/lib/generators/sun_sword/templates_scaffold/example.rb.tt +2 -0
  49. data/lib/generators/sun_sword/templates_scaffold/views/_form.html.erb.tt +22 -0
  50. data/lib/generators/sun_sword/templates_scaffold/views/components/menu/link.html.erb.tt +1 -0
  51. data/lib/generators/sun_sword/templates_scaffold/views/edit.html.erb.tt +10 -0
  52. data/lib/generators/sun_sword/templates_scaffold/views/index.html.erb.tt +50 -0
  53. data/lib/generators/sun_sword/templates_scaffold/views/new.html.erb.tt +10 -0
  54. data/lib/generators/sun_sword/templates_scaffold/views/show.html.erb.tt +26 -0
  55. data/lib/sun-sword.rb +7 -0
  56. data/lib/sun_sword/version.rb +6 -0
  57. metadata +141 -0
@@ -0,0 +1,39 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ const defaultTheme = require('tailwindcss/defaultTheme')
3
+
4
+ module.exports = {
5
+ content: [
6
+ './app/helpers/**/*.rb',
7
+ './app/views/**/*.{.erb,erb}',
8
+ './app/frontend/**/*.{js, css, scss, ejs}',
9
+ ],
10
+ theme: {
11
+ screens: {
12
+ 'sm': '640px',
13
+ // => @media (min-width: 640px) { ... }
14
+
15
+ 'md': '768px',
16
+ // => @media (min-width: 768px) { ... }
17
+
18
+ 'lg': '1024px',
19
+ // => @media (min-width: 1024px) { ... }
20
+
21
+ 'xl': '1280px',
22
+ // => @media (min-width: 1280px) { ... }
23
+
24
+ '2xl': '1536px',
25
+ // => @media (min-width: 1536px) { ... }
26
+ },
27
+ extend: {
28
+ fontFamily: {
29
+ sans: ['Open Sans', ...defaultTheme.fontFamily.sans],
30
+ },
31
+ },
32
+ },
33
+ plugins: [
34
+ require('@tailwindcss/aspect-ratio'),
35
+ require('@tailwindcss/forms'),
36
+ require('@tailwindcss/typography'),
37
+ ],
38
+ }
39
+
@@ -0,0 +1,48 @@
1
+ <div class="inline-block">
2
+ <button data-action="click->web#confirmationDestroy" data-web-id-param="<%%= value.id %>" class="text-sm font-semibold leading-6 text-gray-900">
3
+ <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-orange-400 hover:text-gray-600" viewBox="0 0 20 20" fill="currentColor">
4
+ <path fill-rule="evenodd" d="M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z" clip-rule="evenodd"/>
5
+ </svg>
6
+ </button>
7
+ <div class="confirmation-destroy-<%%= value.id %> hidden relative z-10" aria-labelledby="modal-title" role="dialog" aria-modal="false">
8
+ <div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity min-h-screen z-100"></div>
9
+ <div class="fixed inset-0 z-100 w-screen overflow-y-auto">
10
+ <div class="flex min-h-full justify-center p-4 text-center items-center sm:p-0">
11
+ <div class="relative transform overflow-hidden rounded-lg bg-white px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg sm:p-6">
12
+ <div class="absolute right-0 top-0 hidden pr-4 pt-4 sm:block">
13
+ <button data-action="click->web#confirmationDestroyCancel" data-web-id-param="<%%= value.id %>" type="button" class="rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">
14
+ <span class="sr-only">Close</span>
15
+ <svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
16
+ <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12"/>
17
+ </svg>
18
+ </button>
19
+ </div>
20
+ <div class="flex flex-row">
21
+ <div class="basis-1/4">
22
+ <div class="mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10">
23
+ <svg class="h-6 w-6 text-red-600" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
24
+ <path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"/>
25
+ </svg>
26
+ </div>
27
+ </div>
28
+
29
+ <div class="ml-4 mt-0 text-left basis-2/3">
30
+ <h3 class="font-semibold leading-6 text-gray-900" id="modal-title">Hapus Data</h3>
31
+ <div class="mt-2">
32
+ <p class="text-sm text-gray-500 whitespace-normal">Data yang di hapus akan terhapus. Apakah kamu ingin menghapus data?</p>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ <div class="mt-5 sm:mt-4 flex flex-row-reverse">
37
+ <form class="button_to" method="post" action="<%%= eval("#{key}_path(id: '#{value.id}')") %>">
38
+ <input type="hidden" name="_method" value="delete" autocomplete="off">
39
+ <button type="submit" class="inline-flex justify-center m-2 class-button">Hapus</button>
40
+ <%%= hidden_field_tag :authenticity_token, form_authenticity_token -%>
41
+ </form>
42
+ <button data-action="click->web#confirmationDestroyCancel" data-web-id-param="<%%= value.id %>" type="button" class="inline-flex justify-center m-2 class-button-outline">Cancel</button>
43
+ </div>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ </div>
@@ -0,0 +1,7 @@
1
+ <div class="inline-block ml-2">
2
+ <%%= link_to eval("edit_#{key}_path(id: '#{value.id}')"), class: "text-sm font-semibold leading-6 text-gray-900" do %>
3
+ <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-gray-400 hover:text-gray-600" viewBox="0 0 20 20" fill="currentColor">
4
+ <path d="M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"/>
5
+ </svg>
6
+ <%% end %>
7
+ </div>
@@ -0,0 +1,8 @@
1
+ <div class="inline-block ml-2">
2
+ <%%= link_to eval("#{key}_path(id: '#{value.id}')"), class: "text-sm font-semibold leading-6 text-gray-900" do %>
3
+ <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-gray-400 hover:text-gray-600" viewBox="0 0 20 20" fill="currentColor">
4
+ <path d="M10 12a2 2 0 100-4 2 2 0 000 4z"/>
5
+ <path fill-rule="evenodd" d="M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10zM14 10a4 4 0 11-8 0 4 4 0 018 0z" clip-rule="evenodd"/>
6
+ </svg>
7
+ <%% end %>
8
+ </div>
@@ -0,0 +1,66 @@
1
+ <%% if flash.present? %>
2
+ <%% case flash_type flash %>
3
+ <%% when "success" %>
4
+ <div class="rounded-md bg-green-50 p-4 mb-3">
5
+ <div class="flex">
6
+ <div class="flex-shrink-0">
7
+ <svg class="h-5 w-5 text-green-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
8
+ <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"/>
9
+ </svg>
10
+ </div>
11
+ <div class="ml-3">
12
+ <h3 class="text-sm font-medium text-green-800">Action completed</h3>
13
+ <div class="mt-2 text-sm text-green-700">
14
+ <%% flash.each do |type, msg| %>
15
+ <p><%%= msg %></p>
16
+ <%% end %>
17
+ </div>
18
+ </div>
19
+ </div>
20
+ </div>
21
+ <%% when "error" %>
22
+ <div class="rounded-md bg-red-50 p-4 mb-3">
23
+ <div class="flex">
24
+ <div class="flex-shrink-0">
25
+ <svg class="h-5 w-5 text-red-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
26
+ <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd"/>
27
+ </svg>
28
+ </div>
29
+ <div class="ml-3">
30
+ <h3 class="text-sm font-medium text-red-800">Action Failed</h3>
31
+ <div class="mt-2 text-sm text-red-700">
32
+ <ul role="list" class="list-disc space-y-1 pl-5">
33
+ <%% flash.each do |type, msg| %>
34
+ <%% if msg.is_a?(Array) %>
35
+ <%% msg.each do |list| %>
36
+ <li><%%= list %></li>
37
+ <%% end %>
38
+ <%% else %>
39
+ <li><%%= msg %></li>
40
+ <%% end %>
41
+ <%% end %>
42
+ </ul>
43
+ </div>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ <%% else %>
48
+ <div class="rounded-md bg-green-50 p-4 mb-3">
49
+ <div class="flex">
50
+ <div class="flex-shrink-0">
51
+ <svg class="h-5 w-5 text-green-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
52
+ <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"/>
53
+ </svg>
54
+ </div>
55
+ <div class="ml-3">
56
+ <h3 class="text-sm font-medium text-green-800">Action completed</h3>
57
+ <div class="mt-2 text-sm text-green-700">
58
+ <%% flash.each do |type, msg| %>
59
+ <p><%%= msg %></p>
60
+ <%% end %>
61
+ </div>
62
+ </div>
63
+ </div>
64
+ </div>
65
+ <%% end %>
66
+ <%% end %>
@@ -0,0 +1,20 @@
1
+ <div class="rounded-md bg-red-50 p-4">
2
+ <div class="flex">
3
+ <div class="flex-shrink-0">
4
+ <svg class="h-5 w-5 text-red-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
5
+ <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd"/>
6
+ </svg>
7
+ </div>
8
+ <div class="ml-3">
9
+ <h3 class="text-sm font-medium text-red-800"><%%= pluralize(resource.errors.count, "error") %> prohibited this
10
+ record from being saved</h3>
11
+ <div class="mt-2 text-sm text-red-700">
12
+ <ul role="list" class="list-disc space-y-1 pl-5">
13
+ <%% resource.errors.each do |error| %>
14
+ <li><%%= error.full_message %></li>
15
+ <%% end %>
16
+ </ul>
17
+ </div>
18
+ </div>
19
+ </div>
20
+ </div>
@@ -0,0 +1,9 @@
1
+ <%% if actions.include?(:show) %>
2
+ <%%= render "components/action_show", key: key, value: value %>
3
+ <%% end %>
4
+ <%% if actions.include?(:edit) %>
5
+ <%%= render "components/action_edit", key: key, value: value %>
6
+ <%% end %>
7
+ <%% if actions.include?(:destroy) %>
8
+ <%%= render "components/action_destroy", key: key, value: value, icon_class: "w-6 h-6", params: params %>
9
+ <%% end %>
@@ -0,0 +1,18 @@
1
+ <div class="items-center mt-8 ml-10">
2
+ <a href="#">
3
+ <svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
4
+ viewBox="0 0 1024 704" class="h-24 w-24 p-3">
5
+ <path d="M759.9,602.1c-15.8,11.4-26.8,26.1-35.4,42.9c-5,9.7-5,9.6-15.4,6.4c-69.1-21-138.3-41.9-207.5-62.8
6
+ c-81.7-24.7-163.4-49.2-245.1-73.9c-75-22.6-150-45.3-225-68c-2.9-0.9-6.2-1.1-8.5-3.6c0.1-2.5,1.9-3.8,3.3-5.3
7
+ c79.8-89.3,172.4-162.3,278.4-218.3c20-10.5,40.3-20.4,60.9-29.5c5-2.2,6.2-4.5,4.7-10c-16.3-57.2,8-115.9,58.2-141.2
8
+ c44.8-22.6,104-7.6,129.9,32.8c6.9,10.8,8.8,23.1,10.6,35.4c0.6,4.1,1.2,8.4,2.6,12.3c4.1,11.4,12.4,17.9,24.5,18.9
9
+ c10.5,0.9,21-0.6,31.6-1.1c18.4-0.8,36.5,2.4,54.5,6.2c27.6,5.8,54,14.7,78.9,28.3c33,18.1,55.2,44.7,66.6,80.8
10
+ c6.3,20,10.2,40.4,13.4,60.9c3.3,21.6,15.9,35.8,35.2,44.6c21.7,9.9,43.8,18.7,67.8,21.5c10.5,1.2,20.9,2.1,31.4,3.2
11
+ c18.3,1.9,27.8,12.9,25,30.9c-4.5,29-11.2,57.6-22.1,84.8c-19.4,48.3-55.9,77.1-106.3,88.4c-14.5,3.3-29.4,2.5-44.1,1.1
12
+ C804,585.5,780.7,586.5,759.9,602.1 M725,357.5c4.3,7.8,9.3,15.1,16.1,21c11.6,10.1,23.4,10.3,35.5,0.7
13
+ c11.2-8.9,17.9-21.1,24.9-33.1c2.7-4.6,2-7.2-2.7-10.1c-23.7-14.2-47.1-28.9-70.6-43.3c-7.1-4.3-13.7-9.4-22.5-13.1
14
+ C707.4,307.2,712,332.9,725,357.5 M980.8,448.6c1.5,2.1,3,4.3,5.2,7.4c5.8-17.4,9.6-33.7,7.4-50.8c-0.8-6.1-4.2-10.8-9.8-13.9
15
+ c-5.7-3.1-11.9-4.1-18.1-4.9c-8.8-1.1-17.7-2.1-28.1-3.2C952.2,405.7,966.2,426.8,980.8,448.6z"/>
16
+ </svg>
17
+ </a>
18
+ </div>
@@ -0,0 +1,42 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title><%= Rails.application.class.module_parent_name %></title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <meta name="mobile-web-app-capable" content="yes">
7
+ <meta name="viewport" content="width=device-width">
8
+ <meta name="theme-color" content="#000000"/>
9
+ <link rel="preconnect" href="https://fonts.googleapis.com">
10
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
11
+ <link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap" rel="stylesheet">
12
+ <link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&family=Preahvihear&display=swap" rel="stylesheet">
13
+ <link rel="icon" type="image/x-icon" href="<%%= vite_asset_path('assets/images/kotaro.ico') %>">
14
+
15
+ <%%= csrf_meta_tags %>
16
+ <%%= csp_meta_tag %>
17
+
18
+ <%%= vite_client_tag %>
19
+ <%%= vite_stylesheet_tag 'application.scss', data: { "turbo-track": "reload" } %>
20
+ <%%= vite_javascript_tag 'application' %>
21
+ </head>
22
+
23
+ <body class="h-full" data-turbo="true">
24
+ <div id="root" data-controller="web" class="flex flex-col h-screen" >
25
+ <div id="BASE_URL" class="hidden" data-base-url="<%%= ENV['BASE_URL'] %>"></div>
26
+ <main>
27
+ <div class="mx-auto max-w-full px-2 sm:px-2 lg:px-8">
28
+ <div id="root">
29
+ <%%= yield %>
30
+ </div>
31
+ </div>
32
+ </main>
33
+ <footer class="mt-auto">
34
+ <div class="mx-auto max-w-7xl overflow-hidden px-6 py-20 sm:py-24 lg:px-8">
35
+ <p class="mt-10 text-center text-xs leading-5 text-gray-500">&copy; <%%= Date.today.year %> Kotaroisme. All rights
36
+ reserved.</p>
37
+ </div>
38
+ <p class="mt-3 text-center text-xs leading-5 text-gray-500">version <%%= <%= Rails.application.class.module_parent_name %>::VERSION %></p>
39
+ </footer>
40
+ </div>
41
+ </body>
42
+ </html>
@@ -0,0 +1,60 @@
1
+ <!-- Sidebar component, swap this element with another sidebar if you like -->
2
+ <div class="flex grow flex-col gap-y-5 overflow-y-auto px-6 pb-2">
3
+ <div class="flex h-16 shrink-0 items-center">
4
+ <%%= render 'components/layouts/sidebar_logo' %>
5
+ </div>
6
+ <nav class="flex flex-1 flex-col">
7
+ <ul role="list" class="flex flex-1 flex-col gap-y-7">
8
+ <li>
9
+ <ul role="list" class="-mx-2 space-y-1">
10
+ <li>
11
+ <div>
12
+ <button type="button" class="flex items-center w-full text-left rounded-md p-2 gap-x-3 text-sm leading-6 font-semibold text-gray-700" aria-controls="sub-menu-1" aria-expanded="false">
13
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6">
14
+ <path d="M2.273 5.625A4.483 4.483 0 015.25 4.5h13.5c1.141 0 2.183.425 2.977 1.125A3 3 0 0018.75 3H5.25a3 3 0 00-2.977 2.625zM2.273 8.625A4.483 4.483 0 015.25 7.5h13.5c1.141 0 2.183.425 2.977 1.125A3 3 0 0018.75 6H5.25a3 3 0 00-2.977 2.625zM5.25 9a3 3 0 00-3 3v6a3 3 0 003 3h13.5a3 3 0 003-3v-6a3 3 0 00-3-3H15a.75.75 0 00-.75.75 2.25 2.25 0 01-4.5 0A.75.75 0 009 9H5.25z"/>
15
+ </svg>
16
+ Manages
17
+ </button>
18
+ <!-- Expandable link section, show/hide based on state. -->
19
+ <ul class="mt-1 px-2" id="sub-menu-1">
20
+ <%# generate_link %>
21
+ </ul>
22
+ </div>
23
+ </li>
24
+
25
+ </ul>
26
+ </li>
27
+ </ul>
28
+ </nav>
29
+ <nav class="flex flex-1 flex-col">
30
+ <ul role="list" class="flex flex-1 flex-col gap-y-7">
31
+ <li class="-mx-4 mt-auto">
32
+ <div class="profile-<%%= from %> hidden mt-2.5 mb-5 w-32 rounded-md bg-white shadow-lg ring-1 ring-gray-900/5 focus:outline-none">
33
+ <!-- Active: "bg-gray-50", Not Active: "" -->
34
+ <div class="mt-3 w-60 rounded-lg bg-white text-sm font-normal text-slate-900 shadow-md ring-1 ring-slate-900/5 focus:outline-none sm:-mr-3.5">
35
+ <div class="truncate px-3.5 py-3" role="none">
36
+ <div class="text-xs text-gray-500">Signed in as</div>
37
+ <div class="mt-3 font-semibold">kotaroisme@gmail.com</div>
38
+ </div>
39
+ <div class="divide-y divide-gray-100 ">
40
+ <div></div>
41
+ <div class="py-1.5" role="none">
42
+ <a class="block py-1.5 px-3.5 hover:bg-slate-100" href="#">Changelog</a>
43
+ <a class="block py-1.5 px-3.5 hover:bg-slate-100" href="#">idea</a>
44
+ </div>
45
+ <div class="py-1.5" role="none">
46
+ <a href="<%%#= destroy_auth_session_path %>" class="block w-full py-1.5 text-left px-3.5 hover:bg-slate-100" data-turbo="false">Sign
47
+ out</a>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ </div>
52
+ <div data-action="click->web#profileSetting" class="flex cursor-pointer items-center gap-x-4 px-6 py-3 text-sm/6 font-semibold text-gray-900 hover:bg-gray-200">
53
+ <img class="size-8 rounded-full bg-gray-50" src="<%%= vite_asset_path('assets/images/profile.jpeg') %>" alt="Kotaro Minami">
54
+ <span class="sr-only">Your profile</span>
55
+ <span aria-hidden="true">Kotaro Minami</span>
56
+ </div>
57
+ </li>
58
+ </ul>
59
+ </nav>
60
+ </div>
@@ -0,0 +1,71 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Jendral Jack</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <meta name="mobile-web-app-capable" content="yes">
7
+ <meta name="viewport" content="width=device-width">
8
+ <meta name="theme-color" content="#000000"/>
9
+ <link rel="preconnect" href="https://fonts.googleapis.com">
10
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
11
+ <link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap" rel="stylesheet">
12
+ <link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&family=Preahvihear&display=swap" rel="stylesheet">
13
+ <link rel="icon" type="image/x-icon" href="<%%= vite_asset_path('assets/images/kotaro.ico') %>">
14
+
15
+ <%%= csrf_meta_tags %>
16
+ <%%= csp_meta_tag %>
17
+
18
+ <%%= vite_client_tag %>
19
+ <%%= vite_javascript_tag 'application', data: { "turbo-track": "reload" } %>
20
+ </head>
21
+
22
+ <body class="h-full" data-turbo="true">
23
+ <div id="root" data-controller="web" class="flex flex-col h-screen">
24
+ <div id="BASE_URL" class="hidden" data-base-url="<%%= ENV['BASE_URL'] %>"></div>
25
+ <main>
26
+ <div class="mx-auto max-w-full">
27
+ <div class="relative isolate flex min-h-svh w-full bg-white max-lg:flex-col lg:bg-zinc-100 dark:bg-zinc-900 dark:lg:bg-zinc-950">
28
+
29
+ <%%# mobile %>
30
+ <div class="fixed bg-white rounded-2xl m-2 inset-y-0 w-64 -left-[300px] lg:hidden sidebar side_hide z-50" data-action="click->web#onSidebarClick">
31
+ <nav class="flex h-full min-h-0 flex-col">
32
+ <%%= render "layouts/dashboard/sidebar", from: :mobile %>
33
+ </nav>
34
+ </div>
35
+
36
+ <%%# browser %>
37
+ <div class="fixed inset-y-0 w-64 max-lg:hidden">
38
+ <nav class="flex h-full min-h-0 flex-col">
39
+ <%%= render "layouts/dashboard/sidebar", from: :browser %>
40
+ </nav>
41
+ </div>
42
+
43
+ <%%# Sidebar Toggle %>
44
+ <div class="z-50 relative flex items-center px-4 lg:hidden">
45
+ <div class="py-2.5">
46
+ <button type="button" class="-m-2.5 p-2.5 text-gray-700 lg:hidden cursor-pointer" data-action="click->web#sidebarToggle">
47
+ <span class="sr-only">Open sidebar</span>
48
+ <svg class="sidebar-toggle-close w-6 h-6 hidden" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
49
+ <path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"/>
50
+ </svg>
51
+ <svg class="sidebar-toggle-open w-6 h-6" data-slot="icon" viewBox="0 0 20 20" aria-hidden="true">
52
+ <path d="M2 6.75C2 6.33579 2.33579 6 2.75 6H17.25C17.6642 6 18 6.33579 18 6.75C18 7.16421 17.6642 7.5 17.25 7.5H2.75C2.33579 7.5 2 7.16421 2 6.75ZM2 13.25C2 12.8358 2.33579 12.5 2.75 12.5H17.25C17.6642 12.5 18 12.8358 18 13.25C18 13.6642 17.6642 14 17.25 14H2.75C2.33579 14 2 13.6642 2 13.25Z"></path>
53
+ </svg>
54
+ </button>
55
+ </div>
56
+ </div>
57
+
58
+ <main class="flex flex-1 flex-col pb-2 lg:min-w-0 lg:pl-64 lg:pr-2 lg:pt-2">
59
+ <div class="fixed inset-0 bg-gray-900/60 backdrop-blur-sm backdrop-active opacity-0 hidden lg:hidden" aria-hidden="true"></div>
60
+ <div class="grow p-6 lg:rounded-lg lg:bg-white lg:p-10 lg:shadow-sm lg:ring-1 lg:ring-zinc-950/5 dark:lg:bg-zinc-900 dark:lg:ring-white/10">
61
+ <div class="mx-auto max-w-6xl">
62
+ <%%= yield %>
63
+ </div>
64
+ </div>
65
+ </main>
66
+ </div>
67
+ </div>
68
+ </main>
69
+ </div>
70
+ </body>
71
+ </html>
@@ -0,0 +1,3 @@
1
+ <%%= turbo_frame_tag "comment_show" do %>
2
+ <p class="text-white"><%%= @comment %></p>
3
+ <%% end %>
@@ -0,0 +1,26 @@
1
+ <!--HTML from anywhere-->
2
+ <container class="flex flex-col h-screen items-center justify-center bg-orange-500" data-controller="site-stimulus">
3
+ <div class="w-full">
4
+ <div class="font-bold flex items-center justify-center">
5
+ <input data-site-stimulus-target="name" type="text" name="name" id="name" class="rounded-md border-0 py-1.5 text-orange-900 shadow-sm ring-1 ring-inset ring-orange-500 placeholder:text-orange-400 focus:ring-2 focus:ring-inset focus:ring-orange-500 mr-5" placeholder="Kotaro">
6
+ <button data-action="click->site-stimulus#greet" type="button" class="rounded-full bg-white p-2 text-orange-500 shadow-sm hover:bg-white-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-orange-500">
7
+ <svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" data-slot="icon">
8
+ <path d="M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z"/>
9
+ </svg>
10
+ </button>
11
+ </div>
12
+ <br>
13
+ <div class="font-bold flex items-center justify-center">
14
+ <span class="text-white text-[2rem]" data-site-stimulus-target="output">. . .</span><br/>
15
+ </div>
16
+ </div>
17
+ <div class="w-full">
18
+ <div class="comment flex items-center justify-center">
19
+ <%%= render partial: "site/comment" %>
20
+ </div>
21
+ <div class="action flex items-center justify-center">
22
+ <%%= link_to "Kotaro", site_jadi_a_path, class: "class-button-outline m-2", data: { turbo_frame: "comment_show" } %>
23
+ <%%= link_to "Minami", site_jadi_b_path, class: "class-button-outline m-2", data: { turbo_frame: "comment_show" } %>
24
+ </div>
25
+ </div>
26
+ </container>
@@ -0,0 +1,27 @@
1
+ import {defineConfig} from 'vite'
2
+ import RubyPlugin from 'vite-plugin-ruby'
3
+ import FullReload from 'vite-plugin-full-reload'
4
+ import StimulusHMR from 'vite-plugin-stimulus-hmr';
5
+ export default defineConfig({
6
+ plugins: [
7
+ RubyPlugin(),
8
+ FullReload(['config/routes.rb', 'app/views/**/*', 'app/frontend/pages/**/*']),
9
+ StimulusHMR()
10
+ ],
11
+ root: './app/frontend',
12
+ build: {
13
+ manifest: true,
14
+ rollupOptions: {
15
+ input: {
16
+ application: 'app/frontend/entrypoints/application.js'
17
+ }
18
+ }
19
+ },
20
+ css: {
21
+ preprocessorOptions: {
22
+ scss: {
23
+ api: 'modern-compiler' // or "modern"
24
+ }
25
+ }
26
+ }
27
+ })
@@ -0,0 +1,90 @@
1
+ # Template for the controller (controllers/controller.rb.tt)
2
+ class <%= [@route_scope_class, @scope_class].join("::") %>Controller < ApplicationController
3
+ before_action :set_<%= @variable_subject %>, only: %i[show edit update destroy]
4
+ layout :set_layouts
5
+
6
+ # GET /<%= [@route_scope_path, @scope_path].join("/") %>
7
+ def index
8
+ use_case = Core::UseCases::<%= [@route_scope_class, @scope_class, build_usecase_filename('list')].join("::") %>
9
+ contract = use_case.contract!(build_contract({}))
10
+ result = use_case.new(contract).result
11
+ @<%= @scope_path %> = Dry::Matcher::ResultMatcher.call(result) do |matcher|
12
+ matcher.success { |response| response }
13
+ matcher.failure { |errors| errors }
14
+ end
15
+ render '<%= @route_scope_path %>/<%= @scope_path %>/index'
16
+ end
17
+
18
+ # GET /<%= [@route_scope_path, @scope_path, ":uuid"].join("/") %>
19
+ def show
20
+ end
21
+
22
+ # GET /<%= [@route_scope_path, @scope_path, "new"].join("/") %>
23
+ def new
24
+ @<%= @variable_subject %> = <%= @model_class %>.new
25
+ end
26
+
27
+ # GET /<%= [@route_scope_path, @scope_path, ":uuid", "edit"].join("/") %>
28
+ def edit
29
+ end
30
+
31
+ # POST /<%= @route_scope_path %>/<%= @scope_path %>
32
+ def create
33
+ use_case = Core::UseCases::<%= [@route_scope_class, @scope_class, build_usecase_filename('create')].join("::") %>
34
+ contract = use_case.contract!(build_contract(<%= @variable_subject %>_params))
35
+ result = use_case.new(contract).result
36
+ Dry::Matcher::ResultMatcher.call(result) do |matcher|
37
+ matcher.success do |response|
38
+ redirect_to <%= [@route_scope_path, @variable_subject].join("_") %>_url(id: response.id), success: '<%= @subject_class %> was successfully created.'
39
+ end
40
+ matcher.failure do |errors|
41
+ @<%= @variable_subject %> = build_form_errors(<%= @variable_subject %>_params, <%= @model_class %>.new, errors)
42
+ render '<%= [@route_scope_path, @scope_path, "new"].join("/") %>', status: :unprocessable_entity
43
+ end
44
+ end
45
+ end
46
+
47
+ # PATCH/PUT /<%= [@route_scope_path, @scope_path, ":uuid"].join("/") %>
48
+ def update
49
+ use_case = Core::UseCases::<%= [@route_scope_class, @scope_class, build_usecase_filename('update')].join("::") %>
50
+ contract = use_case.contract!(build_contract(<%= @variable_subject %>_params).merge({ id: params[:id] }))
51
+ result = use_case.new(contract).result
52
+ Dry::Matcher::ResultMatcher.call(result) do |matcher|
53
+ matcher.success do |response|
54
+ redirect_to <%= [@route_scope_path, @variable_subject].join("_") %>_url(id: response.id), success: '<%= @subject_class %> was successfully updated.'
55
+ end
56
+ matcher.failure do |errors|
57
+ @<%= @variable_subject %> = build_form_errors(<%= @variable_subject %>_params, <%= @model_class %>.find(params[:id]), errors)
58
+ render '<%= [@route_scope_path, @scope_path, "edit"].join("/") %>', status: :unprocessable_entity
59
+ end
60
+ end
61
+ end
62
+
63
+ # DELETE /<%= [@route_scope_path, @scope_path, ":uuid"].join("/") %>
64
+ def destroy
65
+ use_case = Core::UseCases::<%= [@route_scope_class, @scope_class, build_usecase_filename('destroy')].join("::") %>
66
+ contract = use_case.contract!(build_contract({ id: params[:id] }))
67
+ result = use_case.new(contract).result
68
+ Dry::Matcher::ResultMatcher.call(result) do |matcher|
69
+ matcher.success do |response|
70
+ redirect_to <%= [@route_scope_path, @scope_path].join("_") %>_url, notice: '<%= @subject_class %> was successfully destroyed.'
71
+ end
72
+ matcher.failure do |errors|
73
+ redirect_to <%= [@route_scope_path, @scope_path].join("_") %>_url, error: '<%= @subject_class %> could not be destroyed.'
74
+ end
75
+ end
76
+ end
77
+
78
+ private
79
+
80
+ # Use callbacks to share common setup or constraints between actions.
81
+ def set_<%= @variable_subject %>
82
+ @<%= @variable_subject %> = <%= @model_class %>.find_by(id: params[:id])
83
+ redirect_to <%= [@route_scope_path, @scope_path].join("_") %>_url, error: '<%= @subject_class %> not found.' if @<%= @variable_subject %>.nil?
84
+ end
85
+
86
+ # Only allow a list of trusted parameters through.
87
+ def <%= @variable_subject %>_params
88
+ params.require(:models_<%= @subject_class.underscore %>).permit(<%= strong_params %>)
89
+ end
90
+ end
@@ -0,0 +1,2 @@
1
+ <%=@resource_name.titleize%>
2
+ <%=options.skip_columns%>
@@ -0,0 +1,22 @@
1
+ <%%= form_with(model: <%= @variable_subject %>, url: ((["new", "create"].include? action_name) ? <%= [@route_scope_path, @scope_path].join("_") %>_path : <%= [@route_scope_path, @scope_path.singularize].join("_") %>_path(<%= @variable_subject %>)), class: "contents") do |form| %>
2
+
3
+ <%%= render "components/error_form_submit", resource: <%= @variable_subject %> if <%= @variable_subject %>.errors.any? %>
4
+
5
+ <div class="space-y-12 sm:space-y-16">
6
+ <div>
7
+ <div class="mt-10 space-y-8 pb-12 sm:space-y-0 sm:pb-0 p-4 class-card-container">
8
+ <div class="class-input">
9
+ <%%= form.label :name, class: "class-label" %>
10
+ <div class="mt-2 sm:col-span-2 sm:mt-0">
11
+ <%%= form.text_field :name, class: "class-text-field" %>
12
+ </div>
13
+ </div>
14
+ </div>
15
+ </div>
16
+ </div>
17
+
18
+ <div class="mt-6 flex items-center justify-end gap-x-6">
19
+ <%%= link_to "Back", <%= [@route_scope_path, @scope_path].join("_") %>_path, class: "inline-flex justify-center class-button" %>
20
+ <%%= form.submit class: "inline-flex justify-center class-button" %>
21
+ </div>
22
+ <%% end %>
@@ -0,0 +1 @@
1
+ <a data-remote="true" id="<%= [@route_scope_path, @scope_path].join("_")%>" href="<%%=<%= [@route_scope_path, @scope_path].join("_")%>_path %>#<%= [@route_scope_path, @scope_path].join("_")%>" class="<%%= ['<%= [@route_scope_path, @scope_path].join("_")%>_index'].include?("#{controller_name}_#{action_name}") ? "class-menu-active-link" : "class-menu-link" %>"><%= @variable_subject.titleize%></a>
@@ -0,0 +1,10 @@
1
+ <div>
2
+ <div class="flow-root class-card-container">
3
+ <div class="flex items-center p-2 mb-10">
4
+ <div class="flex-auto">
5
+ <h1 class="font-semibold text-gray-900">Editing User</h1>
6
+ </div>
7
+ </div>
8
+ <%%= render "form", <%= @variable_subject %>: @<%= @variable_subject %> %>
9
+ </div>
10
+ </div>