alchemy_cms 8.1.3 → 8.1.4

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.
@@ -222,11 +222,7 @@ module Alchemy
222
222
  end
223
223
 
224
224
  def flush
225
- @current_language.pages.flushables.update_all(published_at: Time.current)
226
- # We need to ensure, that also all layoutpages get the +published_at+ timestamp set,
227
- # but not set to public true, because the cache_key for an element is +published_at+
228
- # and we don't want the layout pages to be present in +Page.published+ scope.
229
- @current_language.pages.flushable_layoutpages.update_all(published_at: Time.current)
225
+ PageVersion.where(page_id: @current_language.pages.select(:id)).published.touch_all
230
226
  respond_to { |format| format.turbo_stream }
231
227
  end
232
228
 
@@ -29,9 +29,7 @@ export default class PictureThumbnail extends HTMLElement {
29
29
  }
30
30
 
31
31
  connectedCallback() {
32
- if (this.image) {
33
- this.replaceChildren(this.image)
34
- }
32
+ this.#setImage()
35
33
  }
36
34
 
37
35
  disconnectedCallback() {
@@ -77,22 +75,31 @@ export default class PictureThumbnail extends HTMLElement {
77
75
 
78
76
  #onError(evt) {
79
77
  const message = `Could not load ${this.image.src}`
78
+ const hoist = this.closest(".ingredient-editor")
80
79
  this.spinner.stop()
81
80
  this.innerHTML = `
82
- <sl-tooltip content="${message}">
81
+ <sl-tooltip content="${message}" ${hoist ? "hoist" : ""}>
83
82
  <alchemy-icon name="alert" class="error"></alchemy-icon>
84
83
  </sl-tooltip>
85
84
  `
86
85
  console.error(message, evt)
87
86
  }
88
87
 
88
+ #setImage() {
89
+ if (this.image?.complete) {
90
+ this.replaceChildren(this.image)
91
+ } else if (this.image) {
92
+ this.append(this.image)
93
+ }
94
+ }
95
+
89
96
  set loading(value) {
90
97
  value ? this.load() : this.stop()
91
98
  }
92
99
 
93
100
  set src(src) {
94
101
  this.start(src)
95
- this.replaceChildren(this.image)
102
+ this.#setImage()
96
103
  }
97
104
 
98
105
  get name() {
@@ -78,18 +78,6 @@ module Alchemy
78
78
  #
79
79
  scope :contentpages, -> { where(layoutpage: [false, nil]) }
80
80
 
81
- # Returns all public contentpages that are not locked.
82
- #
83
- # Used for flushing all pages caches at once.
84
- #
85
- scope :flushables, -> { not_locked.published.contentpages }
86
-
87
- # Returns all layoutpages that are not locked.
88
- #
89
- # Used for flushing all pages caches at once.
90
- #
91
- scope :flushable_layoutpages, -> { not_locked.layoutpages }
92
-
93
81
  # All searchable pages
94
82
  #
95
83
  scope :searchables, -> { not_restricted.published.contentpages }
@@ -49,7 +49,7 @@ alchemy-uploader {
49
49
  text-decoration: none;
50
50
  }
51
51
 
52
- alchemy-icon {
52
+ alchemy-icon:not(.error) {
53
53
  display: flex;
54
54
  width: var(--picture-width);
55
55
  height: var(--picture-height);
@@ -12,7 +12,7 @@ alchemy-icon {
12
12
  }
13
13
 
14
14
  &.error {
15
- padding: 2rem;
15
+ padding: 0;
16
16
  }
17
17
  }
18
18
 
@@ -307,6 +307,12 @@ sl-tooltip {
307
307
  border-radius: var(--border-radius_medium);
308
308
  box-shadow: var(--tooltip-box-shadow);
309
309
  }
310
+
311
+ @media (pointer: coarse) {
312
+ &::part(base__popup) {
313
+ display: none;
314
+ }
315
+ }
310
316
  }
311
317
 
312
318
  sl-button {
@@ -35,7 +35,8 @@
35
35
  }
36
36
 
37
37
  .menubar:hover,
38
- .menubar:focus-within {
38
+ .menubar:focus-within,
39
+ .menubar.is-open {
39
40
  left: 0;
40
41
  }
41
42
 
@@ -121,9 +122,32 @@
121
122
  }
122
123
 
123
124
  connectedCallback() {
124
- const bar = this.shadowRoot.querySelector(".menubar")
125
- const width = bar.offsetWidth
126
- bar.style = `--panel-width: ${width}px; --left-offset: calc(var(--icon-size) + 32px);`
125
+ const width = this.bar.offsetWidth
126
+ this.bar.style = `--panel-width: ${width}px; --left-offset: calc(var(--icon-size) + 32px);`
127
+ this.bar.addEventListener("touchstart", this, { passive: false })
128
+ document.addEventListener("touchstart", this, { passive: true })
129
+ }
130
+
131
+ handleEvent(event) {
132
+ // click on menubar
133
+ if (event.currentTarget === this.bar) {
134
+ if (!this.bar.classList.contains("is-open")) {
135
+ event.preventDefault()
136
+ this.bar.classList.add("is-open")
137
+ }
138
+ // click outside of menubar
139
+ } else if (!event.composedPath().includes(this.bar)) {
140
+ this.bar.classList.remove("is-open")
141
+ }
142
+ }
143
+
144
+ disconnectedCallback() {
145
+ this.bar.removeEventListener("touchstart", this)
146
+ document.removeEventListener("touchstart", this)
147
+ }
148
+
149
+ get bar() {
150
+ return this.shadowRoot.querySelector(".menubar")
127
151
  }
128
152
  }
129
153
 
@@ -21,8 +21,8 @@
21
21
  <%= button_to(
22
22
  render_icon(:eraser),
23
23
  alchemy.flush_admin_pages_path,
24
- "turbo-method": :post,
25
- class: "icon_button please_wait"
24
+ "data-turbo-confirm": Alchemy.t(:confirm_to_flush_cache),
25
+ class: "icon_button"
26
26
  ) %>
27
27
  </sl-tooltip>
28
28
  </div>
@@ -399,6 +399,7 @@ en:
399
399
  confirm_to_delete_menu: "Do you really want to delete this menu?"
400
400
  confirm_to_delete_node: "Do you really want to delete this menu node?"
401
401
  confirm_to_delete_page: "Do you really want to delete this page?"
402
+ confirm_to_flush_cache: "Do you really want to flush the page cache? This will might take a while and can make first page requests slow."
402
403
  ingredient_validations_headline: "Please check marked fields below"
403
404
  copy: "copy"
404
405
  copy_element: "Copy this element"
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "8.1.3"
4
+ VERSION = "8.1.4"
5
5
 
6
6
  def self.version
7
7
  VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.1.3
4
+ version: 8.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen