ultimate_turbo_modal 2.0.4 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.claude/TM_COMMANDS_GUIDE.md +0 -0
- data/.claude/commands/tm/add-dependency/add-dependency.md +0 -0
- data/.claude/commands/tm/add-subtask/add-subtask.md +0 -0
- data/.claude/commands/tm/add-subtask/convert-task-to-subtask.md +0 -0
- data/.claude/commands/tm/add-task/add-task.md +0 -0
- data/.claude/commands/tm/analyze-complexity/analyze-complexity.md +0 -0
- data/.claude/commands/tm/clear-subtasks/clear-all-subtasks.md +0 -0
- data/.claude/commands/tm/clear-subtasks/clear-subtasks.md +0 -0
- data/.claude/commands/tm/complexity-report/complexity-report.md +0 -0
- data/.claude/commands/tm/expand/expand-all-tasks.md +0 -0
- data/.claude/commands/tm/expand/expand-task.md +0 -0
- data/.claude/commands/tm/fix-dependencies/fix-dependencies.md +0 -0
- data/.claude/commands/tm/generate/generate-tasks.md +0 -0
- data/.claude/commands/tm/help.md +0 -0
- data/.claude/commands/tm/init/init-project-quick.md +0 -0
- data/.claude/commands/tm/init/init-project.md +0 -0
- data/.claude/commands/tm/learn.md +0 -0
- data/.claude/commands/tm/list/list-tasks-by-status.md +0 -0
- data/.claude/commands/tm/list/list-tasks-with-subtasks.md +0 -0
- data/.claude/commands/tm/list/list-tasks.md +0 -0
- data/.claude/commands/tm/models/setup-models.md +0 -0
- data/.claude/commands/tm/models/view-models.md +0 -0
- data/.claude/commands/tm/next/next-task.md +0 -0
- data/.claude/commands/tm/parse-prd/parse-prd-with-research.md +0 -0
- data/.claude/commands/tm/parse-prd/parse-prd.md +0 -0
- data/.claude/commands/tm/remove-dependency/remove-dependency.md +0 -0
- data/.claude/commands/tm/remove-subtask/remove-subtask.md +0 -0
- data/.claude/commands/tm/remove-task/remove-task.md +0 -0
- data/.claude/commands/tm/set-status/to-cancelled.md +0 -0
- data/.claude/commands/tm/set-status/to-deferred.md +0 -0
- data/.claude/commands/tm/set-status/to-done.md +0 -0
- data/.claude/commands/tm/set-status/to-in-progress.md +0 -0
- data/.claude/commands/tm/set-status/to-pending.md +0 -0
- data/.claude/commands/tm/set-status/to-review.md +0 -0
- data/.claude/commands/tm/setup/install-taskmaster.md +0 -0
- data/.claude/commands/tm/setup/quick-install-taskmaster.md +0 -0
- data/.claude/commands/tm/show/show-task.md +0 -0
- data/.claude/commands/tm/status/project-status.md +0 -0
- data/.claude/commands/tm/sync-readme/sync-readme.md +0 -0
- data/.claude/commands/tm/tm-main.md +0 -0
- data/.claude/commands/tm/update/update-single-task.md +0 -0
- data/.claude/commands/tm/update/update-task.md +0 -0
- data/.claude/commands/tm/update/update-tasks-from-id.md +0 -0
- data/.claude/commands/tm/utils/analyze-project.md +0 -0
- data/.claude/commands/tm/validate-dependencies/validate-dependencies.md +0 -0
- data/.claude/commands/tm/workflows/auto-implement-tasks.md +0 -0
- data/.claude/commands/tm/workflows/command-pipeline.md +0 -0
- data/.claude/commands/tm/workflows/smart-workflow.md +0 -0
- data/.cursor/rules/taskmaster/dev_workflow.mdc +424 -0
- data/.cursor/rules/taskmaster/taskmaster.mdc +558 -0
- data/.env.example +0 -0
- data/.taskmaster/CLAUDE.md +0 -0
- data/.taskmaster/config.json +37 -0
- data/.taskmaster/templates/example_prd.txt +0 -0
- data/.tool-versions +1 -1
- data/CHANGELOG.md +8 -0
- data/CLAUDE.md +82 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +51 -125
- data/README.md +62 -98
- data/UPGRADING.md +55 -0
- data/VERSION +1 -1
- data/demo-app/.gitattributes +7 -0
- data/demo-app/.gitignore +34 -0
- data/demo-app/.ruby-version +1 -0
- data/demo-app/.tool-versions +2 -0
- data/demo-app/Gemfile +41 -0
- data/demo-app/Gemfile.lock +248 -0
- data/demo-app/Procfile.dev +3 -0
- data/demo-app/README.md +15 -0
- data/demo-app/Rakefile +6 -0
- data/demo-app/app/assets/builds/.keep +0 -0
- data/demo-app/app/assets/images/.keep +0 -0
- data/demo-app/app/assets/stylesheets/application.css +42 -0
- data/demo-app/app/controllers/application_controller.rb +10 -0
- data/demo-app/app/controllers/concerns/.keep +0 -0
- data/demo-app/app/controllers/concerns/set_flavor.rb +10 -0
- data/demo-app/app/controllers/hide_from_backends_controller.rb +34 -0
- data/demo-app/app/controllers/modal_controller.rb +11 -0
- data/demo-app/app/controllers/posts_controller.rb +69 -0
- data/demo-app/app/controllers/welcome_controller.rb +2 -0
- data/demo-app/app/helpers/application_helper.rb +9 -0
- data/demo-app/app/javascript/application.js +4 -0
- data/demo-app/app/javascript/controllers/application.js +13 -0
- data/demo-app/app/javascript/controllers/dark_mode_controller.js +28 -0
- data/demo-app/app/javascript/controllers/flash_controller.js +9 -0
- data/demo-app/app/javascript/controllers/hello_controller.js +7 -0
- data/demo-app/app/javascript/controllers/index.js +15 -0
- data/demo-app/app/models/application_record.rb +3 -0
- data/demo-app/app/models/concerns/.keep +0 -0
- data/demo-app/app/models/post.rb +4 -0
- data/demo-app/app/views/hide_from_backends/_notice.html.erb +10 -0
- data/demo-app/app/views/hide_from_backends/create.turbo_stream.erb +2 -0
- data/demo-app/app/views/hide_from_backends/new.html.erb +30 -0
- data/demo-app/app/views/layouts/application.html.erb +40 -0
- data/demo-app/app/views/modal/index.html.erb +45 -0
- data/demo-app/app/views/modal/show.html.erb +39 -0
- data/demo-app/app/views/posts/_form.html.erb +36 -0
- data/demo-app/app/views/posts/_post.html.erb +9 -0
- data/demo-app/app/views/posts/edit.html.erb +9 -0
- data/demo-app/app/views/posts/index.html.erb +14 -0
- data/demo-app/app/views/posts/new.html.erb +3 -0
- data/demo-app/app/views/posts/show.html.erb +21 -0
- data/demo-app/app/views/shared/_flash.html.erb +13 -0
- data/demo-app/app/views/welcome/index.html.erb +19 -0
- data/demo-app/bin/bundle +109 -0
- data/demo-app/bin/dev +7 -0
- data/demo-app/bin/rails +4 -0
- data/demo-app/bin/rake +4 -0
- data/demo-app/bin/setup +34 -0
- data/demo-app/config/application.rb +43 -0
- data/demo-app/config/boot.rb +3 -0
- data/demo-app/config/credentials.yml.enc +1 -0
- data/demo-app/config/database.yml +25 -0
- data/demo-app/config/environment.rb +14 -0
- data/demo-app/config/environments/development.rb +51 -0
- data/demo-app/config/environments/production.rb +67 -0
- data/demo-app/config/environments/test.rb +42 -0
- data/demo-app/config/initializers/assets.rb +7 -0
- data/demo-app/config/initializers/content_security_policy.rb +25 -0
- data/demo-app/config/initializers/filter_parameter_logging.rb +8 -0
- data/demo-app/config/initializers/inflections.rb +14 -0
- data/demo-app/config/initializers/new_framework_defaults_8_0.rb +30 -0
- data/demo-app/config/initializers/permissions_policy.rb +11 -0
- data/demo-app/config/initializers/ultimate_turbo_modal.rb +12 -0
- data/demo-app/config/initializers/ultimate_turbo_modal_tailwind.rb +21 -0
- data/demo-app/config/initializers/ultimate_turbo_modal_vanilla.rb +21 -0
- data/demo-app/config/locales/en.yml +33 -0
- data/demo-app/config/puma.rb +41 -0
- data/demo-app/config/routes.rb +9 -0
- data/demo-app/config.ru +6 -0
- data/demo-app/db/migrate/20230331002502_create_posts.rb +10 -0
- data/demo-app/db/migrate/20231031012703_add_post.rb +9 -0
- data/demo-app/db/migrate/20231128141054_add_publish_on_to_posts.rb +5 -0
- data/demo-app/db/schema.rb +22 -0
- data/demo-app/lib/assets/.keep +0 -0
- data/demo-app/lib/tasks/.keep +0 -0
- data/demo-app/log/.keep +0 -0
- data/demo-app/package.json +28 -0
- data/demo-app/postcss.config.js +7 -0
- data/demo-app/public/400.html +114 -0
- data/demo-app/public/404.html +114 -0
- data/demo-app/public/406-unsupported-browser.html +114 -0
- data/demo-app/public/422.html +114 -0
- data/demo-app/public/500.html +114 -0
- data/demo-app/public/apple-touch-icon-precomposed.png +0 -0
- data/demo-app/public/apple-touch-icon.png +0 -0
- data/demo-app/public/favicon.ico +0 -0
- data/demo-app/public/icon.png +0 -0
- data/demo-app/public/icon.svg +3 -0
- data/demo-app/public/img/bootstrap-logo-shadow.png +0 -0
- data/demo-app/public/img/unicat.jpg +0 -0
- data/demo-app/public/img/vanilla.png +0 -0
- data/demo-app/public/robots.txt +1 -0
- data/demo-app/tmp/.keep +0 -0
- data/demo-app/tmp/pids/.keep +0 -0
- data/demo-app/vendor/.keep +0 -0
- data/demo-app/yarn.lock +1022 -0
- data/javascript/modal_controller.js +63 -2
- data/javascript/package.json +4 -2
- data/javascript/yarn.lock +12 -0
- data/lib/ultimate_turbo_modal/configuration.rb +1 -0
- metadata +184 -4
@@ -0,0 +1,30 @@
|
|
1
|
+
<%= modal(title: "My Glorious Form") do %>
|
2
|
+
<% if !inside_modal? %>
|
3
|
+
<div class="px-4 py-5 sm:p-3">
|
4
|
+
<h3 class="text-base font-semibold leading-6 text-gray-900">My Glorious Form</h3>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<div class="mt-2 max-w-xl text-sm text-gray-500 dark:text-white">
|
8
|
+
<p>Upon submission, the modal will be closed from the backend.</p>
|
9
|
+
<p class="mt-2">If no email is entered, the form will be redisplayed with errors.</p>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<% if !form_is_valid? %>
|
13
|
+
<div class="my-4 text-red-700 font-semibold">
|
14
|
+
Email is required!
|
15
|
+
</div>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<%= form_with url: hide_from_backend_path, method: :post, class: "mt-5 sm:flex sm:items-center" do %>
|
19
|
+
<div class="w-full sm:max-w-xs">
|
20
|
+
<label for="email" class="sr-only">Email</label>
|
21
|
+
<input type="email" name="email" id="email" class="block w-full rounded-md border-0 py-1.5 text-gray-900 ring-gray-300 shadow-xs ring-1 ring-inset placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" placeholder="you@example.com">
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<button type="submit" class="mt-3 inline-flex w-full items-center justify-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-xs hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 sm:ml-3 sm:mt-0 sm:w-auto">Save</button>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
<% if !inside_modal? %>
|
28
|
+
</div>
|
29
|
+
<% end %>
|
30
|
+
<% end %>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html class="<%= cookies[:theme] == "dark" ? "dark" : "" %>">
|
3
|
+
<head>
|
4
|
+
<title>Ultimate Turbo Modal</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<%= csrf_meta_tags %>
|
7
|
+
<%= csp_meta_tag %>
|
8
|
+
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
|
9
|
+
<%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>
|
10
|
+
</head>
|
11
|
+
|
12
|
+
<body class="dark:bg-slate-800 dark:text-white transition-colors">
|
13
|
+
<%= turbo_frame_tag "modal" %>
|
14
|
+
<%= render partial: "shared/flash" %>
|
15
|
+
|
16
|
+
<div class="container mx-auto mt-8 px-5 bg-white dark:bg-slate-800 transition-colors">
|
17
|
+
<%= yield %>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<div class="fixed right-4 top-4 h-6 text-black dark:text-white" data-controller="dark-mode">
|
21
|
+
<button data-action="click->dark-mode#toggleTheme">
|
22
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6 dark:hidden">
|
23
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M21.752 15.002A9.718 9.718 0 0118 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 003 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 009.002-5.998z" />
|
24
|
+
</svg>
|
25
|
+
|
26
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6 hidden dark:block">
|
27
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M12 3v2.25m6.364.386l-1.591 1.591M21 12h-2.25m-.386 6.364l-1.591-1.591M12 18.75V21m-4.773-4.227l-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z" />
|
28
|
+
</svg>
|
29
|
+
</button>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<a href="/">
|
33
|
+
<% if UltimateTurboModal.flavor == :tailwind %>
|
34
|
+
<svg class="fixed right-4 bottom-4 h-12" viewBox="0 0 50 31" class="text-slate-900 dark:text-white w-auto h-5"><path fill-rule="evenodd" clip-rule="evenodd" d="M25.517 0C18.712 0 14.46 3.382 12.758 10.146c2.552-3.382 5.529-4.65 8.931-3.805 1.941.482 3.329 1.882 4.864 3.432 2.502 2.524 5.398 5.445 11.722 5.445 6.804 0 11.057-3.382 12.758-10.145-2.551 3.382-5.528 4.65-8.93 3.804-1.942-.482-3.33-1.882-4.865-3.431C34.736 2.92 31.841 0 25.517 0zM12.758 15.218C5.954 15.218 1.701 18.6 0 25.364c2.552-3.382 5.529-4.65 8.93-3.805 1.942.482 3.33 1.882 4.865 3.432 2.502 2.524 5.397 5.445 11.722 5.445 6.804 0 11.057-3.381 12.758-10.145-2.552 3.382-5.529 4.65-8.931 3.805-1.941-.483-3.329-1.883-4.864-3.432-2.502-2.524-5.398-5.446-11.722-5.446z" fill="#38bdf8"></path></svg>
|
35
|
+
<% elsif UltimateTurboModal.flavor == :vanilla %>
|
36
|
+
<img class="fixed right-4 bottom-4 h-16" src="/img/vanilla.png">
|
37
|
+
<% end %>
|
38
|
+
</a>
|
39
|
+
</body>
|
40
|
+
</html>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
<%= render partial: "hide_from_backends/notice" %>
|
2
|
+
<div class="fixed left-3 bottom-3 text-lg text-gray-600">
|
3
|
+
Rendered at <%= Time.now %>
|
4
|
+
</div>
|
5
|
+
|
6
|
+
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
|
7
|
+
<!-- We've used 3xl here, but feel free to try other max-widths based on your needs -->
|
8
|
+
<div class="mx-auto max-w-3xl space-y-24">
|
9
|
+
<div>
|
10
|
+
<h1 class="<%= h1_classes %>">CRUD modals</h1>
|
11
|
+
<ul class="list-disc ml-6 dark:text-white">
|
12
|
+
<li class="py-2"><%= link_to "Show Post", post_path(@post, close_button: 1), data: {turbo_frame: "modal"} %>
|
13
|
+
<li class="py-2"><%= link_to "New Post", new_post_path(Post.new, close_button: 1), data: {turbo_frame: "modal"} %>
|
14
|
+
<li class="py-2"><%= link_to "Show Post (w/ advance history)", post_path(@post, advance: "1", close_button: 1), data: {turbo_frame: "modal"} %>
|
15
|
+
</ul>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div>
|
19
|
+
<h1 class="<%= h1_classes %>">More modals</h1>
|
20
|
+
<ul class="list-disc ml-6 dark:text-white">
|
21
|
+
<li class="py-2">Photo: <%= link_to "without header or padding", modal_path(:photo, padding: 0, advance: 1, close_button: 1), data: {turbo_frame: "modal"} %> | <%= link_to "without close button", modal_path(:photo, padding: 0, advance: 1, close_button: 0), data: {turbo_frame: "modal"} %>
|
22
|
+
<li class="py-2"><%= link_to "Long scrolling content", modal_path(:long, advance: 1, close_button: 1), data: {turbo_frame: "modal"} %>
|
23
|
+
<li class="py-2"><%= link_to "Form closing from backend on success", new_hide_from_backend_path(close_button: 1), data: {turbo_frame: "modal"} %>
|
24
|
+
|
25
|
+
</ul>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
|
30
|
+
|
31
|
+
<div class="mx-auto text-center">
|
32
|
+
<% 30.times do %>
|
33
|
+
<div class="my-48 text-gray-300 mx-auto">
|
34
|
+
This is a long page!
|
35
|
+
</div>
|
36
|
+
<% end %>
|
37
|
+
|
38
|
+
<div>
|
39
|
+
<input type="text" class="rounded border-gray-300 placeholder-gray-300" placeholder="Test for focus trap" />
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div class="my-20 text-center">
|
44
|
+
<%= link_to "Click for a unicat", modal_path(:photo, padding: 0, advance: 1), class: button_classes, data: {turbo_frame: "modal"} %>
|
45
|
+
</div>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<%= modal(padding: @padding, advance: @override_url || @advance, header: @header, close_button: @close_button) do %>
|
2
|
+
<% unless inside_modal? %>
|
3
|
+
<h1 class="text-2xl mb-8">This is not inside a modal</h1>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<% if params[:id] == "long" %>
|
7
|
+
<div class="space-y-2 max-w-3xl">
|
8
|
+
<% 30.times do %>
|
9
|
+
<p><%= Faker::Lorem.paragraph(sentence_count: 50) %></p>
|
10
|
+
<% end %>
|
11
|
+
</div>
|
12
|
+
<% elsif params[:id] == "photo" %>
|
13
|
+
<div class="w-full">
|
14
|
+
<img src="/img/unicat.jpg">
|
15
|
+
</div>
|
16
|
+
<% elsif params[:id] == "photo_no_advance" %>
|
17
|
+
<div class="w-full">
|
18
|
+
<img src="/img/unicat.jpg">
|
19
|
+
</div>
|
20
|
+
<% elsif params[:id] == "form" %>
|
21
|
+
<div class="w-full p-4">
|
22
|
+
<form>
|
23
|
+
<div class="mb-4">
|
24
|
+
<label class="block mb-2" for="fname">First Name:</label>
|
25
|
+
<input class="rounded border-gray-300 border" type="text" id="fname" name="fname" autofocus>
|
26
|
+
</div>
|
27
|
+
<div class="mb-4">
|
28
|
+
<label class="block mb-2" for="lname">Last Name:</label>
|
29
|
+
<input class="rounded border-gray-300 border" type="text" id="lname" name="lname">
|
30
|
+
</div>
|
31
|
+
<button class="rounded-md bg-indigo-600 px-3.5 py-2.5 text-sm font-semibold text-white shadow-xs hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600" type="submit">Submit</button>
|
32
|
+
</form>
|
33
|
+
</div>
|
34
|
+
<% else %>
|
35
|
+
<div class="w-full">
|
36
|
+
Not sure what you're looking for!
|
37
|
+
</div>
|
38
|
+
<% end %>
|
39
|
+
<% end %>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<div class="w-96">
|
2
|
+
<%= form_with(model: post, class: "contents") do |form| %>
|
3
|
+
<% if post.errors.any? %>
|
4
|
+
<div id="error_explanation" class="bg-red-50 text-red-500 px-3 py-2 font-medium rounded-lg mt-3">
|
5
|
+
<h2><%= pluralize(post.errors.count, "error") %> prohibited this post from being saved:</h2>
|
6
|
+
<ul>
|
7
|
+
<% post.errors.each do |error| %>
|
8
|
+
<li><%= error.full_message %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
<div class="my-5">
|
14
|
+
<%= form.label :title %>
|
15
|
+
<%= form.text_field :title, class: "block shadow-sm rounded-md border border-gray-200 outline-hidden px-3 py-2 mt-2 w-full" %>
|
16
|
+
</div>
|
17
|
+
<div class="my-5">
|
18
|
+
<%= form.label :body %>
|
19
|
+
<%= form.text_field :body, class: "block shadow-sm rounded-md border border-gray-200 outline-hidden px-3 py-2 mt-2 w-full" %>
|
20
|
+
</div>
|
21
|
+
<div class="my-5">
|
22
|
+
<%= form.label :publish_on %>
|
23
|
+
<div class="text-xs">Modal will not close when clicking the calendar, even when outside of the modal boundaries.</div>
|
24
|
+
<%= form.text_field :publish_on,
|
25
|
+
class: "block shadow-sm rounded-md border border-gray-200 outline-hidden px-3 py-2 mt-2 w-full",
|
26
|
+
data: {
|
27
|
+
controller: "flatpickr",
|
28
|
+
flatpickr_min_date: Date.current.strftime("%Y-%m-%d"),
|
29
|
+
}
|
30
|
+
%>
|
31
|
+
</div>
|
32
|
+
<div class="inline">
|
33
|
+
<%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
|
34
|
+
</div>
|
35
|
+
<% end %>
|
36
|
+
</div>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<div class="w-full">
|
2
|
+
<% if notice.present? %>
|
3
|
+
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<div class="flex justify-between items-center">
|
7
|
+
<h1 class="font-bold text-4xl">Posts</h1>
|
8
|
+
<%= link_to 'New post', new_post_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div id="posts" class="min-w-full">
|
12
|
+
<%= render @posts %>
|
13
|
+
</div>
|
14
|
+
</div>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%= modal(padding: @padding, advance: @override_url || @advance, title: @modal_title, close_button: @close_button) do |m| %>
|
2
|
+
<%= m.title do %>
|
3
|
+
<div>Custom Header Block</div>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<div class="max-w-3xl">
|
7
|
+
<% if notice.present? %>
|
8
|
+
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<%= render @post %>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<%= m.footer do %>
|
15
|
+
<%= link_to 'Edit this post', edit_post_path(@post), class: "rounded-lg py-3 px-5 bg-blue-800 text-white inline-block font-medium" %>
|
16
|
+
|
17
|
+
<div class="inline-block ml-2">
|
18
|
+
<%= button_to 'Destroy this post', post_path(@post), method: :delete, class: "py-3 px-5 bg-transparent text-red-600" %>
|
19
|
+
</div>
|
20
|
+
<% end %>
|
21
|
+
<% end %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<% if flash.any? %>
|
2
|
+
<div class="px-5 py-2 absolute top-3 right-3" data-controller="flash">
|
3
|
+
<% flash.each do |key, value| %>
|
4
|
+
<% if key == "alert" %>
|
5
|
+
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-sm relative" role="alert">
|
6
|
+
<% else %>
|
7
|
+
<div class="bg-indigo-100 border border-indigo-400 text-indigo-700 px-4 py-3 rounded-sm relative" role="notice">
|
8
|
+
<% end %>
|
9
|
+
<span class="block sm:inline"><%= value %></span>
|
10
|
+
</div>
|
11
|
+
<% end %>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<div class="grid h-screen place-items-center dark:text-white">
|
2
|
+
<dl class="grid grid-cols-1 gap-x-20 gap-y-32 text-center xl:grid-cols-2">
|
3
|
+
<div class="mx-auto">
|
4
|
+
<a href="/modal?flavor=tailwind">
|
5
|
+
<svg class="h-6 sm:h-12 w-auto" viewBox="0 0 248 31" class="text-slate-900 dark:text-white w-auto h-5"><path fill-rule="evenodd" clip-rule="evenodd" d="M25.517 0C18.712 0 14.46 3.382 12.758 10.146c2.552-3.382 5.529-4.65 8.931-3.805 1.941.482 3.329 1.882 4.864 3.432 2.502 2.524 5.398 5.445 11.722 5.445 6.804 0 11.057-3.382 12.758-10.145-2.551 3.382-5.528 4.65-8.93 3.804-1.942-.482-3.33-1.882-4.865-3.431C34.736 2.92 31.841 0 25.517 0zM12.758 15.218C5.954 15.218 1.701 18.6 0 25.364c2.552-3.382 5.529-4.65 8.93-3.805 1.942.482 3.33 1.882 4.865 3.432 2.502 2.524 5.397 5.445 11.722 5.445 6.804 0 11.057-3.381 12.758-10.145-2.552 3.382-5.529 4.65-8.931 3.805-1.941-.483-3.329-1.883-4.864-3.432-2.502-2.524-5.398-5.446-11.722-5.446z" fill="#38bdf8"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M76.546 12.825h-4.453v8.567c0 2.285 1.508 2.249 4.453 2.106v3.463c-5.962.714-8.332-.928-8.332-5.569v-8.567H64.91V9.112h3.304V4.318l3.879-1.143v5.937h4.453v3.713zM93.52 9.112h3.878v17.849h-3.878v-2.57c-1.365 1.891-3.484 3.034-6.285 3.034-4.884 0-8.942-4.105-8.942-9.389 0-5.318 4.058-9.388 8.942-9.388 2.801 0 4.92 1.142 6.285 2.999V9.112zm-5.674 14.636c3.232 0 5.674-2.392 5.674-5.712s-2.442-5.711-5.674-5.711-5.674 2.392-5.674 5.711c0 3.32 2.442 5.712 5.674 5.712zm16.016-17.313c-1.364 0-2.477-1.142-2.477-2.463a2.475 2.475 0 012.477-2.463 2.475 2.475 0 012.478 2.463c0 1.32-1.113 2.463-2.478 2.463zm-1.939 20.526V9.112h3.879v17.849h-3.879zm8.368 0V.9h3.878v26.06h-3.878zm29.053-17.849h4.094l-5.638 17.849h-3.807l-3.735-12.03-3.771 12.03h-3.806l-5.639-17.849h4.094l3.484 12.315 3.771-12.315h3.699l3.734 12.315 3.52-12.315zm8.906-2.677c-1.365 0-2.478-1.142-2.478-2.463a2.475 2.475 0 012.478-2.463 2.475 2.475 0 012.478 2.463c0 1.32-1.113 2.463-2.478 2.463zm-1.939 20.526V9.112h3.878v17.849h-3.878zm17.812-18.313c4.022 0 6.895 2.713 6.895 7.354V26.96h-3.878V16.394c0-2.713-1.58-4.14-4.022-4.14-2.55 0-4.561 1.499-4.561 5.14v9.567h-3.879V9.112h3.879v2.285c1.185-1.856 3.124-2.749 5.566-2.749zm25.282-6.675h3.879V26.96h-3.879v-2.57c-1.364 1.892-3.483 3.034-6.284 3.034-4.884 0-8.942-4.105-8.942-9.389 0-5.318 4.058-9.388 8.942-9.388 2.801 0 4.92 1.142 6.284 2.999V1.973zm-5.674 21.775c3.232 0 5.674-2.392 5.674-5.712s-2.442-5.711-5.674-5.711-5.674 2.392-5.674 5.711c0 3.32 2.442 5.712 5.674 5.712zm22.553 3.677c-5.423 0-9.481-4.105-9.481-9.389 0-5.318 4.058-9.388 9.481-9.388 3.519 0 6.572 1.82 8.008 4.605l-3.34 1.928c-.79-1.678-2.549-2.749-4.704-2.749-3.16 0-5.566 2.392-5.566 5.604 0 3.213 2.406 5.605 5.566 5.605 2.155 0 3.914-1.107 4.776-2.749l3.34 1.892c-1.508 2.82-4.561 4.64-8.08 4.64zm14.472-13.387c0 3.249 9.661 1.285 9.661 7.89 0 3.57-3.125 5.497-7.003 5.497-3.591 0-6.177-1.607-7.326-4.177l3.34-1.927c.574 1.606 2.011 2.57 3.986 2.57 1.724 0 3.052-.571 3.052-2 0-3.176-9.66-1.391-9.66-7.781 0-3.356 2.909-5.462 6.572-5.462 2.945 0 5.387 1.357 6.644 3.713l-3.268 1.82c-.647-1.392-1.904-2.035-3.376-2.035-1.401 0-2.622.607-2.622 1.892zm16.556 0c0 3.249 9.66 1.285 9.66 7.89 0 3.57-3.124 5.497-7.003 5.497-3.591 0-6.176-1.607-7.326-4.177l3.34-1.927c.575 1.606 2.011 2.57 3.986 2.57 1.724 0 3.053-.571 3.053-2 0-3.176-9.66-1.391-9.66-7.781 0-3.356 2.908-5.462 6.572-5.462 2.944 0 5.386 1.357 6.643 3.713l-3.268 1.82c-.646-1.392-1.903-2.035-3.375-2.035-1.401 0-2.622.607-2.622 1.892z" fill="currentColor"></path></svg>
|
6
|
+
</a>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div class="mx-auto">
|
10
|
+
<a href="/modal?flavor=vanilla">
|
11
|
+
<span class="sm:pr-1 h-6 sm:h-12 inline-block">
|
12
|
+
<img class="h-8 sm:h-16 -mt-1 sm:-mt-2" src="/img/vanilla.png">
|
13
|
+
</span>
|
14
|
+
|
15
|
+
<span class="inline-block h-6 sm:h-12 m-0 align-top text-2xl sm:text-5xl leading-6 sm:leading-10 font-semibold sm:mt-0.5 text-black dark:text-white" style='font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue"'>Plain ol' CSS</span>
|
16
|
+
</a>
|
17
|
+
</div>
|
18
|
+
</dl>
|
19
|
+
</div>
|
data/demo-app/bin/bundle
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'bundle' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "rubygems"
|
12
|
+
|
13
|
+
m = Module.new do
|
14
|
+
module_function
|
15
|
+
|
16
|
+
def invoked_as_script?
|
17
|
+
File.expand_path($0) == File.expand_path(__FILE__)
|
18
|
+
end
|
19
|
+
|
20
|
+
def env_var_version
|
21
|
+
ENV["BUNDLER_VERSION"]
|
22
|
+
end
|
23
|
+
|
24
|
+
def cli_arg_version
|
25
|
+
return unless invoked_as_script? # don't want to hijack other binstubs
|
26
|
+
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
27
|
+
bundler_version = nil
|
28
|
+
update_index = nil
|
29
|
+
ARGV.each_with_index do |a, i|
|
30
|
+
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
31
|
+
bundler_version = a
|
32
|
+
end
|
33
|
+
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
34
|
+
bundler_version = $1
|
35
|
+
update_index = i
|
36
|
+
end
|
37
|
+
bundler_version
|
38
|
+
end
|
39
|
+
|
40
|
+
def gemfile
|
41
|
+
gemfile = ENV["BUNDLE_GEMFILE"]
|
42
|
+
return gemfile if gemfile && !gemfile.empty?
|
43
|
+
|
44
|
+
File.expand_path("../Gemfile", __dir__)
|
45
|
+
end
|
46
|
+
|
47
|
+
def lockfile
|
48
|
+
lockfile =
|
49
|
+
case File.basename(gemfile)
|
50
|
+
when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
|
51
|
+
else "#{gemfile}.lock"
|
52
|
+
end
|
53
|
+
File.expand_path(lockfile)
|
54
|
+
end
|
55
|
+
|
56
|
+
def lockfile_version
|
57
|
+
return unless File.file?(lockfile)
|
58
|
+
lockfile_contents = File.read(lockfile)
|
59
|
+
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
60
|
+
Regexp.last_match(1)
|
61
|
+
end
|
62
|
+
|
63
|
+
def bundler_requirement
|
64
|
+
@bundler_requirement ||=
|
65
|
+
env_var_version ||
|
66
|
+
cli_arg_version ||
|
67
|
+
bundler_requirement_for(lockfile_version)
|
68
|
+
end
|
69
|
+
|
70
|
+
def bundler_requirement_for(version)
|
71
|
+
return "#{Gem::Requirement.default}.a" unless version
|
72
|
+
|
73
|
+
bundler_gem_version = Gem::Version.new(version)
|
74
|
+
|
75
|
+
bundler_gem_version.approximate_recommendation
|
76
|
+
end
|
77
|
+
|
78
|
+
def load_bundler!
|
79
|
+
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
80
|
+
|
81
|
+
activate_bundler
|
82
|
+
end
|
83
|
+
|
84
|
+
def activate_bundler
|
85
|
+
gem_error = activation_error_handling do
|
86
|
+
gem "bundler", bundler_requirement
|
87
|
+
end
|
88
|
+
return if gem_error.nil?
|
89
|
+
require_error = activation_error_handling do
|
90
|
+
require "bundler/version"
|
91
|
+
end
|
92
|
+
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
93
|
+
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
94
|
+
exit 42
|
95
|
+
end
|
96
|
+
|
97
|
+
def activation_error_handling
|
98
|
+
yield
|
99
|
+
nil
|
100
|
+
rescue StandardError, LoadError => e
|
101
|
+
e
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
m.load_bundler!
|
106
|
+
|
107
|
+
if m.invoked_as_script?
|
108
|
+
load Gem.bin_path("bundler", "bundle")
|
109
|
+
end
|
data/demo-app/bin/dev
ADDED
data/demo-app/bin/rails
ADDED
data/demo-app/bin/rake
ADDED
data/demo-app/bin/setup
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "fileutils"
|
3
|
+
|
4
|
+
APP_ROOT = File.expand_path("..", __dir__)
|
5
|
+
|
6
|
+
def system!(*args)
|
7
|
+
system(*args, exception: true)
|
8
|
+
end
|
9
|
+
|
10
|
+
FileUtils.chdir APP_ROOT do
|
11
|
+
# This script is a way to set up or update your development environment automatically.
|
12
|
+
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
13
|
+
# Add necessary setup steps to this file.
|
14
|
+
|
15
|
+
puts "== Installing dependencies =="
|
16
|
+
system("bundle check") || system!("bundle install")
|
17
|
+
|
18
|
+
# puts "\n== Copying sample files =="
|
19
|
+
# unless File.exist?("config/database.yml")
|
20
|
+
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
|
21
|
+
# end
|
22
|
+
|
23
|
+
puts "\n== Preparing database =="
|
24
|
+
system! "bin/rails db:prepare"
|
25
|
+
|
26
|
+
puts "\n== Removing old logs and tempfiles =="
|
27
|
+
system! "bin/rails log:clear tmp:clear"
|
28
|
+
|
29
|
+
unless ARGV.include?("--skip-server")
|
30
|
+
puts "\n== Starting development server =="
|
31
|
+
STDOUT.flush # flush the output before exec(2) so that it displays
|
32
|
+
exec "bin/dev"
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require_relative "boot"
|
2
|
+
|
3
|
+
require "rails"
|
4
|
+
# Pick the frameworks you want:
|
5
|
+
require "active_model/railtie"
|
6
|
+
# require "active_job/railtie"
|
7
|
+
require "active_record/railtie"
|
8
|
+
# require "active_storage/engine"
|
9
|
+
require "action_controller/railtie"
|
10
|
+
# require "action_mailer/railtie"
|
11
|
+
# require "action_mailbox/engine"
|
12
|
+
# require "action_text/engine"
|
13
|
+
require "action_view/railtie"
|
14
|
+
# require "action_cable/engine"
|
15
|
+
# require "rails/test_unit/railtie"
|
16
|
+
|
17
|
+
# Require the gems listed in Gemfile, including any gems
|
18
|
+
# you've limited to :test, :development, or :production.
|
19
|
+
Bundler.require(*Rails.groups)
|
20
|
+
|
21
|
+
module UltimateTurboModal
|
22
|
+
class Application < Rails::Application
|
23
|
+
config.autoload_paths << Rails.root.join("app", "views", "components")
|
24
|
+
# Initialize configuration defaults for originally generated Rails version.
|
25
|
+
config.load_defaults 7.0
|
26
|
+
|
27
|
+
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
28
|
+
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
29
|
+
# Common ones are `templates`, `generators`, or `middleware`, for example.
|
30
|
+
config.autoload_lib(ignore: %w[assets tasks])
|
31
|
+
|
32
|
+
# Configuration for the application, engines, and railties goes here.
|
33
|
+
#
|
34
|
+
# These settings can be overridden in specific environments using the files
|
35
|
+
# in config/environments, which are processed later.
|
36
|
+
#
|
37
|
+
# config.time_zone = "Central Time (US & Canada)"
|
38
|
+
# config.eager_load_paths << Rails.root.join("extras")
|
39
|
+
|
40
|
+
# Don't generate system test files.
|
41
|
+
config.generators.system_tests = nil
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
a5bdfDeJOIdOPg9vQawREE40DSR+QV0uJ08GB8VeEzc1lxUuV4q8V0kkjJyVIyjreqrt7U3J4c0K1B0n1Au/Z/K2b1t3tfOlQJe1WdMdg7UNrPCrXEaXorEj6N95D1fiMWmqf16pRwbzKASHXCt8JSq1kT1UQnUpkk70mHKVaugRjYNKKYEpyFopSCnP26rOWtixmD0R0w6UUheb0hdmfP3wyiKmXnSxUsvGl04bWvFqFz85A4jRnj+Ou7UFFprtvC0fO/yVpkjFWh6otqZVd9a0WW1O6bAbFwJ57PWA3k5OBsbkv+o08LfWNpgykOSSyL3ha+fSirdGyMWhI9pIU+s5zYKjn+puRvy0F9KUbFzxsdyD60BxkkLxhS8y4LFEO4ilB4GuzLqixh5EZ0MT4YXVgARv89VGQIc+--pKR/h8Ok35Flu/uI--4gHuVGG4C07WVcLYRE71iA==
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite. Versions 3.8.0 and up are supported.
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem "sqlite3"
|
6
|
+
#
|
7
|
+
default: &default
|
8
|
+
adapter: sqlite3
|
9
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
development:
|
13
|
+
<<: *default
|
14
|
+
database: db/development.sqlite3
|
15
|
+
|
16
|
+
# Warning: The database defined as "test" will be erased and
|
17
|
+
# re-generated from your development database when you run "rake".
|
18
|
+
# Do not set this db to the same as development or production.
|
19
|
+
test:
|
20
|
+
<<: *default
|
21
|
+
database: db/test.sqlite3
|
22
|
+
|
23
|
+
production:
|
24
|
+
<<: *default
|
25
|
+
database: db/production.sqlite3
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Load the Rails application.
|
2
|
+
require_relative "application"
|
3
|
+
|
4
|
+
# Initialize the Rails application.
|
5
|
+
Rails.application.initialize!
|
6
|
+
|
7
|
+
begin
|
8
|
+
# Load seeds on bootup
|
9
|
+
unless Post.any?
|
10
|
+
puts "Seeding database..."
|
11
|
+
Rails.application.load_seed
|
12
|
+
end
|
13
|
+
rescue ActiveRecord::StatementInvalid
|
14
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require "active_support/core_ext/integer/time"
|
2
|
+
|
3
|
+
Rails.application.configure do
|
4
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
5
|
+
|
6
|
+
# Make code changes take effect immediately without server restart.
|
7
|
+
config.enable_reloading = true
|
8
|
+
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
|
+
|
12
|
+
# Show full error reports.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
|
15
|
+
# Enable server timing.
|
16
|
+
config.server_timing = true
|
17
|
+
|
18
|
+
# Enable/disable Action Controller caching. By default Action Controller caching is disabled.
|
19
|
+
# Run rails dev:cache to toggle Action Controller caching.
|
20
|
+
if Rails.root.join("tmp/caching-dev.txt").exist?
|
21
|
+
config.action_controller.perform_caching = true
|
22
|
+
config.action_controller.enable_fragment_cache_logging = true
|
23
|
+
config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" }
|
24
|
+
else
|
25
|
+
config.action_controller.perform_caching = false
|
26
|
+
end
|
27
|
+
|
28
|
+
# Change to :null_store to avoid any caching.
|
29
|
+
config.cache_store = :memory_store
|
30
|
+
|
31
|
+
# Print deprecation notices to the Rails logger.
|
32
|
+
config.active_support.deprecation = :log
|
33
|
+
|
34
|
+
# Raise an error on page load if there are pending migrations.
|
35
|
+
config.active_record.migration_error = :page_load
|
36
|
+
|
37
|
+
# Highlight code that triggered database queries in logs.
|
38
|
+
config.active_record.verbose_query_logs = true
|
39
|
+
|
40
|
+
# Append comments with runtime information tags to SQL queries in logs.
|
41
|
+
config.active_record.query_log_tags_enabled = true
|
42
|
+
|
43
|
+
# Raises error for missing translations.
|
44
|
+
# config.i18n.raise_on_missing_translations = true
|
45
|
+
|
46
|
+
# Annotate rendered view with file names.
|
47
|
+
config.action_view.annotate_rendered_view_with_filenames = true
|
48
|
+
|
49
|
+
# Raise error when a before_action's only/except options reference missing actions.
|
50
|
+
config.action_controller.raise_on_missing_callback_actions = true
|
51
|
+
end
|