shimmer 0.0.37 → 0.0.39
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce6a8f2755f2ecf1a72a5479b02680ff472fcfa20c6dba2d803b74a890f658ed
|
4
|
+
data.tar.gz: be9cdd04667dcfa600e169fa8de84362bfc49d9a4f9a091cd85e51a956b34079
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b1eabd56dff0492b4bce93b45b5138631d1520c573dd5437787ce20c03d74b7a3f8740c19b9684700f24f4e11658bf7d2ad7c2f20abb0f51dc0468a4320a6d9
|
7
|
+
data.tar.gz: ca0b557d85b89749770a57f4e5b58c6f8ada7ed27b43742a82c23a3e6f46ba5b17c13577ea3fa029c1ce600e40f2ffc021bcaad93533e7750ade24e1192fa24c
|
data/README.md
CHANGED
@@ -187,6 +187,12 @@ a href=popover_path(new_post_path, placement: :left)
|
|
187
187
|
|
188
188
|
This will request `new_post_path` and display it left of the anchor thanks to PopperJS.
|
189
189
|
|
190
|
+
> [!TIP]
|
191
|
+
> If you want to make sure that your modal content is only available if requested through Shimmer, you can use the built in `enfore_modal` method as a `before_action`. It will return a _422 Unprocessable Content_ status if users (or bots) access the page directly.
|
192
|
+
> ```rb
|
193
|
+
> before_action :enforce_modal, only: [:popover]
|
194
|
+
> ```
|
195
|
+
|
190
196
|
### Remote Navigation
|
191
197
|
|
192
198
|
Remote navigation takes Hotwire to the next level with built-in navigation actions, integrated with modals and popovers.
|
@@ -3,8 +3,8 @@
|
|
3
3
|
module Shimmer
|
4
4
|
class SitemapsController < ActionController::Base
|
5
5
|
def show
|
6
|
-
path =
|
7
|
-
filename =
|
6
|
+
path = request.path[1..]
|
7
|
+
filename = path.gsub("/", "-")
|
8
8
|
|
9
9
|
send_data ActiveStorage::Blob.service.download(path), filename: filename, type: "application/gzip", disposition: "attachment"
|
10
10
|
end
|
@@ -4,6 +4,8 @@ module Shimmer
|
|
4
4
|
module RemoteNavigation
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
|
7
|
+
class RemoteNavigationError < StandardError; end
|
8
|
+
|
7
9
|
included do
|
8
10
|
def ui
|
9
11
|
@ui ||= RemoteNavigator.new(self)
|
@@ -45,7 +47,17 @@ module Shimmer
|
|
45
47
|
end
|
46
48
|
|
47
49
|
def enforce_modal
|
48
|
-
|
50
|
+
return if shimmer_request?
|
51
|
+
|
52
|
+
raise RemoteNavigationError.new("You may only render a modal from a Shimmer request.")
|
53
|
+
end
|
54
|
+
|
55
|
+
rescue_from RemoteNavigationError do |exception|
|
56
|
+
if Rails.env.development?
|
57
|
+
render plain: exception.message, status: :unprocessable_entity
|
58
|
+
else
|
59
|
+
head :unprocessable_entity
|
60
|
+
end
|
49
61
|
end
|
50
62
|
end
|
51
63
|
end
|
@@ -4,7 +4,7 @@ module Shimmer
|
|
4
4
|
class SitemapAdapter
|
5
5
|
def write(location, raw_data)
|
6
6
|
SitemapGenerator::FileAdapter.new.write(location, raw_data)
|
7
|
-
ActiveStorage::Blob.service.upload(
|
7
|
+
ActiveStorage::Blob.service.upload(location.path_in_public, File.open(location.path))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
data/lib/shimmer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shimmer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.39
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Ravens
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|