ultimate_turbo_modal 2.1.2 → 2.2.2

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.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/.tool-versions +1 -1
  3. data/CHANGELOG.md +17 -0
  4. data/CLAUDE.md +188 -2
  5. data/Gemfile.lock +1 -1
  6. data/README.md +22 -0
  7. data/VERSION +1 -1
  8. data/javascript/index.js +12 -3
  9. data/javascript/modal_controller.js +16 -4
  10. data/javascript/package.json +2 -1
  11. data/javascript/styles/vanilla.css +86 -0
  12. data/lib/generators/ultimate_turbo_modal/base.rb +117 -0
  13. data/lib/generators/ultimate_turbo_modal/install_generator.rb +46 -95
  14. data/lib/generators/ultimate_turbo_modal/templates/flavors/custom.rb +29 -2
  15. data/lib/generators/ultimate_turbo_modal/templates/flavors/tailwind.rb +30 -3
  16. data/lib/generators/ultimate_turbo_modal/templates/flavors/tailwind3.rb +29 -2
  17. data/lib/generators/ultimate_turbo_modal/templates/flavors/vanilla.rb +31 -3
  18. data/lib/generators/ultimate_turbo_modal/update_generator.rb +109 -0
  19. data/lib/ultimate_turbo_modal/base.rb +35 -14
  20. data/lib/ultimate_turbo_modal.rb +2 -0
  21. data/script/build_and_release.sh +20 -7
  22. metadata +8 -99
  23. data/demo-app/.gitattributes +0 -7
  24. data/demo-app/.gitignore +0 -34
  25. data/demo-app/.ruby-version +0 -1
  26. data/demo-app/.tool-versions +0 -2
  27. data/demo-app/Gemfile +0 -41
  28. data/demo-app/Gemfile.lock +0 -248
  29. data/demo-app/Procfile.dev +0 -3
  30. data/demo-app/README.md +0 -15
  31. data/demo-app/Rakefile +0 -6
  32. data/demo-app/app/assets/builds/.keep +0 -0
  33. data/demo-app/app/assets/images/.keep +0 -0
  34. data/demo-app/app/assets/stylesheets/application.css +0 -42
  35. data/demo-app/app/controllers/application_controller.rb +0 -10
  36. data/demo-app/app/controllers/concerns/.keep +0 -0
  37. data/demo-app/app/controllers/concerns/set_flavor.rb +0 -10
  38. data/demo-app/app/controllers/hide_from_backends_controller.rb +0 -34
  39. data/demo-app/app/controllers/modal_controller.rb +0 -11
  40. data/demo-app/app/controllers/posts_controller.rb +0 -69
  41. data/demo-app/app/controllers/welcome_controller.rb +0 -2
  42. data/demo-app/app/helpers/application_helper.rb +0 -9
  43. data/demo-app/app/javascript/application.js +0 -4
  44. data/demo-app/app/javascript/controllers/application.js +0 -13
  45. data/demo-app/app/javascript/controllers/dark_mode_controller.js +0 -28
  46. data/demo-app/app/javascript/controllers/flash_controller.js +0 -9
  47. data/demo-app/app/javascript/controllers/hello_controller.js +0 -7
  48. data/demo-app/app/javascript/controllers/index.js +0 -15
  49. data/demo-app/app/models/application_record.rb +0 -3
  50. data/demo-app/app/models/concerns/.keep +0 -0
  51. data/demo-app/app/models/post.rb +0 -4
  52. data/demo-app/app/views/hide_from_backends/_notice.html.erb +0 -10
  53. data/demo-app/app/views/hide_from_backends/create.turbo_stream.erb +0 -2
  54. data/demo-app/app/views/hide_from_backends/new.html.erb +0 -30
  55. data/demo-app/app/views/layouts/application.html.erb +0 -40
  56. data/demo-app/app/views/modal/index.html.erb +0 -45
  57. data/demo-app/app/views/modal/show.html.erb +0 -39
  58. data/demo-app/app/views/posts/_form.html.erb +0 -36
  59. data/demo-app/app/views/posts/_post.html.erb +0 -9
  60. data/demo-app/app/views/posts/edit.html.erb +0 -9
  61. data/demo-app/app/views/posts/index.html.erb +0 -14
  62. data/demo-app/app/views/posts/new.html.erb +0 -3
  63. data/demo-app/app/views/posts/show.html.erb +0 -21
  64. data/demo-app/app/views/shared/_flash.html.erb +0 -13
  65. data/demo-app/app/views/welcome/index.html.erb +0 -19
  66. data/demo-app/bin/bundle +0 -109
  67. data/demo-app/bin/dev +0 -18
  68. data/demo-app/bin/rails +0 -4
  69. data/demo-app/bin/rake +0 -4
  70. data/demo-app/bin/setup +0 -34
  71. data/demo-app/config/application.rb +0 -43
  72. data/demo-app/config/boot.rb +0 -3
  73. data/demo-app/config/credentials.yml.enc +0 -1
  74. data/demo-app/config/database.yml +0 -25
  75. data/demo-app/config/environment.rb +0 -14
  76. data/demo-app/config/environments/development.rb +0 -51
  77. data/demo-app/config/environments/production.rb +0 -67
  78. data/demo-app/config/environments/test.rb +0 -42
  79. data/demo-app/config/initializers/assets.rb +0 -7
  80. data/demo-app/config/initializers/content_security_policy.rb +0 -25
  81. data/demo-app/config/initializers/filter_parameter_logging.rb +0 -8
  82. data/demo-app/config/initializers/inflections.rb +0 -14
  83. data/demo-app/config/initializers/new_framework_defaults_8_0.rb +0 -30
  84. data/demo-app/config/initializers/permissions_policy.rb +0 -11
  85. data/demo-app/config/initializers/ultimate_turbo_modal.rb +0 -12
  86. data/demo-app/config/initializers/ultimate_turbo_modal_tailwind.rb +0 -21
  87. data/demo-app/config/initializers/ultimate_turbo_modal_vanilla.rb +0 -21
  88. data/demo-app/config/locales/en.yml +0 -33
  89. data/demo-app/config/puma.rb +0 -41
  90. data/demo-app/config/routes.rb +0 -9
  91. data/demo-app/config.ru +0 -6
  92. data/demo-app/db/migrate/20230331002502_create_posts.rb +0 -10
  93. data/demo-app/db/migrate/20231031012703_add_post.rb +0 -9
  94. data/demo-app/db/migrate/20231128141054_add_publish_on_to_posts.rb +0 -5
  95. data/demo-app/db/schema.rb +0 -22
  96. data/demo-app/lib/assets/.keep +0 -0
  97. data/demo-app/lib/tasks/.keep +0 -0
  98. data/demo-app/log/.keep +0 -0
  99. data/demo-app/package.json +0 -28
  100. data/demo-app/postcss.config.js +0 -7
  101. data/demo-app/public/400.html +0 -114
  102. data/demo-app/public/404.html +0 -114
  103. data/demo-app/public/406-unsupported-browser.html +0 -114
  104. data/demo-app/public/422.html +0 -114
  105. data/demo-app/public/500.html +0 -114
  106. data/demo-app/public/apple-touch-icon-precomposed.png +0 -0
  107. data/demo-app/public/apple-touch-icon.png +0 -0
  108. data/demo-app/public/favicon.ico +0 -0
  109. data/demo-app/public/icon.png +0 -0
  110. data/demo-app/public/icon.svg +0 -3
  111. data/demo-app/public/img/bootstrap-logo-shadow.png +0 -0
  112. data/demo-app/public/img/unicat.jpg +0 -0
  113. data/demo-app/public/img/vanilla.png +0 -0
  114. data/demo-app/public/robots.txt +0 -1
  115. data/demo-app/tmp/.keep +0 -0
  116. data/demo-app/tmp/pids/.keep +0 -0
  117. data/demo-app/vendor/.keep +0 -0
  118. data/demo-app/yarn.lock +0 -1035
@@ -1,69 +0,0 @@
1
- class PostsController < ApplicationController
2
- before_action :set_post, only: %i[show edit update destroy]
3
- before_action :set_modal_properties
4
-
5
- # GET /posts
6
- def index
7
- @posts = Post.all
8
- end
9
-
10
- # GET /posts/1
11
- def show
12
- @modal_title = @post.title
13
- end
14
-
15
- # GET /posts/new
16
- def new
17
- @post = Post.new
18
- @modal_title = "New Post"
19
- end
20
-
21
- # GET /posts/1/edit
22
- def edit
23
- @modal_title = "Edit Post"
24
- end
25
-
26
- # POST /posts
27
- def create
28
- @post = Post.new(post_params)
29
- @modal_title = "New Post"
30
-
31
- if @post.save
32
- redirect_to "/",
33
- notice: "Post was successfully created.",
34
- status: :see_other
35
- else
36
- render :new, status: :unprocessable_entity
37
- end
38
- end
39
-
40
- # PATCH/PUT /posts/1
41
- def update
42
- if @post.update(post_params)
43
- redirect_to "/",
44
- notice: "Post was successfully updated.",
45
- status: :see_other
46
- else
47
- render :edit, status: :unprocessable_entity
48
- end
49
- end
50
-
51
- # DELETE /posts/1
52
- def destroy
53
- redirect_to "/",
54
- notice: "Post was successfully destroyed. (but not really)",
55
- status: :see_other
56
- end
57
-
58
- private
59
-
60
- # Use callbacks to share common setup or constraints between actions.
61
- def set_post
62
- @post = Post.find(params[:id])
63
- end
64
-
65
- # Only allow a list of trusted parameters through.
66
- def post_params
67
- params.require(:post).permit(:title, :body)
68
- end
69
- end
@@ -1,2 +0,0 @@
1
- class WelcomeController < ApplicationController
2
- end
@@ -1,9 +0,0 @@
1
- module ApplicationHelper
2
- def h1_classes
3
- "text-2xl font-bold tracking-tight text-gray-900 sm:text-4xl border-b mb-2 dark:text-white"
4
- end
5
-
6
- def button_classes
7
- "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"
8
- end
9
- end
@@ -1,4 +0,0 @@
1
- import { Turbo } from "@hotwired/turbo-rails";
2
- import "./controllers";
3
-
4
- window.Turbo = Turbo;
@@ -1,13 +0,0 @@
1
- import { Application } from "@hotwired/stimulus"
2
-
3
- const application = Application.start()
4
-
5
- // Configure Stimulus development experience
6
- application.debug = false
7
- window.Stimulus = application
8
-
9
- // Flatpickr
10
- import Flatpickr from "stimulus-flatpickr"
11
- application.register('flatpickr', Flatpickr)
12
-
13
- export { application }
@@ -1,28 +0,0 @@
1
- import { Controller } from "@hotwired/stimulus"
2
-
3
- export default class extends Controller {
4
- static targets = ["toggle"];
5
-
6
- toggleTheme() {
7
- // Toggle the dark class on the html element
8
- if (document.documentElement.classList.contains('dark')) {
9
- document.documentElement.classList.remove('dark');
10
- this.setCookie('theme', 'light');
11
- } else {
12
- document.documentElement.classList.add('dark');
13
- this.setCookie('theme', 'dark');
14
- }
15
- }
16
-
17
- setCookie(name, value, days = 7) {
18
- const expires = new Date(Date.now() + days * 864e5).toUTCString();
19
- document.cookie = `${name}=${value};expires=${expires};path=/`;
20
- }
21
-
22
- getCookie(name) {
23
- const value = `; ${document.cookie}`;
24
- const parts = value.split(`; ${name}=`);
25
- if (parts.length === 2) return parts.pop().split(';').shift();
26
- return null;
27
- }
28
- }
@@ -1,9 +0,0 @@
1
- import { Controller } from "@hotwired/stimulus"
2
-
3
- export default class extends Controller {
4
- connect() {
5
- setTimeout(() => {
6
- this.element.remove()
7
- }, 3000)
8
- }
9
- }
@@ -1,7 +0,0 @@
1
- import { Controller } from "@hotwired/stimulus"
2
-
3
- export default class extends Controller {
4
- connect() {
5
- this.element.textContent = "Hello World!"
6
- }
7
- }
@@ -1,15 +0,0 @@
1
- // This file is auto-generated by ./bin/rails stimulus:manifest:update
2
- // Run that command whenever you add a new controller or create them with
3
- // ./bin/rails generate stimulus controllerName
4
-
5
- import { application } from "./application"
6
-
7
- import DarkModeController from "./dark_mode_controller"
8
- application.register("dark-mode", DarkModeController)
9
-
10
- import FlashController from "./flash_controller"
11
- application.register("flash", FlashController)
12
-
13
- // import { UltimateTurboModalController } from "../../../../ultimate_turbo_modal-rails/javascript/dist/ultimate_turbo_modal.js"
14
- import { UltimateTurboModalController } from "ultimate_turbo_modal"
15
- application.register("modal", UltimateTurboModalController)
@@ -1,3 +0,0 @@
1
- class ApplicationRecord < ActiveRecord::Base
2
- primary_abstract_class
3
- end
File without changes
@@ -1,4 +0,0 @@
1
- class Post < ApplicationRecord
2
- validates :title, presence: true
3
- validates :body, presence: true
4
- end
@@ -1,10 +0,0 @@
1
- <% if local_assigns[:message] %>
2
- <div id="ts-notice">
3
- <%= local_assigns[:message] %>
4
- <div class="mt-3 font-medium">
5
- <a href="#" onclick="document.getElementById('ts-notice').innerHTML=''; return false;">Close</a>
6
- </div>
7
- </div>
8
- <% else %>
9
- <div id="ts-notice"></div>
10
- <% end %>
@@ -1,2 +0,0 @@
1
- <%= turbo_stream.modal(:hide) %>
2
- <%= turbo_stream.replace "ts-notice", partial: "notice", locals: { message: "Modal close was triggered by the backend via Turbo Stream @ #{Time.now}!" } %>
@@ -1,30 +0,0 @@
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 %>
@@ -1,40 +0,0 @@
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>
@@ -1,45 +0,0 @@
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>
@@ -1,39 +0,0 @@
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 %>
@@ -1,36 +0,0 @@
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>
@@ -1,9 +0,0 @@
1
- <div id="<%= dom_id post %>">
2
- <% if !inside_modal? %>
3
- <h3 class="mb-5 text-lg font-semibold"><%= @post.title %></h3>
4
- <% end %>
5
-
6
- <p class="my-5">
7
- <%= post.body %>
8
- </p>
9
- </div>
@@ -1,9 +0,0 @@
1
- <%= modal(title: "Editing Post") do |m| %>
2
- <div class="mx-auto w-96">
3
- <% if !inside_modal? %>
4
- <h1 class="font-bold text-4xl">Editing post</h1>
5
- <% end %>
6
-
7
- <%= render "form", post: @post, modal: m %>
8
- </div>
9
- <% end %>
@@ -1,14 +0,0 @@
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>
@@ -1,3 +0,0 @@
1
- <%= modal(padding: @padding, advance: @override_url || @advance, title: @modal_title, close_button: @close_button) do %>
2
- <%= render "form", post: @post %>
3
- <% end %>
@@ -1,21 +0,0 @@
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 %>
@@ -1,13 +0,0 @@
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 %>
@@ -1,19 +0,0 @@
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 DELETED
@@ -1,109 +0,0 @@
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 DELETED
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # Build the ultimate_turbo_modal JavaScript package
4
- echo "Building ultimate_turbo_modal JavaScript package..."
5
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6
- DEMO_APP_DIR="$SCRIPT_DIR/.."
7
- (cd "$DEMO_APP_DIR/../javascript" && yarn build)
8
-
9
- # Reinstall to pick up the latest changes
10
- echo "Installing latest ultimate_turbo_modal in demo app..."
11
- yarn install --force
12
-
13
- # Start the development servers
14
- if command -v overmind &> /dev/null; then
15
- overmind start -f $DEMO_APP_DIR/Procfile.dev "$@"
16
- else
17
- foreman start -f $DEMO_APP_DIR/Procfile.dev "$@"
18
- fi
data/demo-app/bin/rails DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path("../config/application", __dir__)
3
- require_relative "../config/boot"
4
- require "rails/commands"
data/demo-app/bin/rake DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require_relative "../config/boot"
3
- require "rake"
4
- Rake.application.run