maglevcms 1.7.2 → 1.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5401431fff19c66c1e16efa7c35c779bd10bd023f869bfe820fffd8afb586830
4
- data.tar.gz: e59d727dd373a1a328967ee000e5ea3be1f3af479f3e55d35e9cf3fcb31d0c9e
3
+ metadata.gz: 7a5b69c183e753d7c6e87e9904d992bbe039901a35d5b0c2cc2c779bb1546469
4
+ data.tar.gz: '09c9e5973720db3a1038855d0e0e9417f8f9f5d678a7c89651941aa08afff560'
5
5
  SHA512:
6
- metadata.gz: e718feab604a111fd21a2037f364d6d52a814c42998ee648e004cb6f0f41c24e23ab15861054e064f5c8997076114cd4b938fc4b157295e9cd9f752d8f1a129c
7
- data.tar.gz: 13c3563774639c79b5b8da19422a4645ea47ac510080ced169582525c40e05172a41d74b2a35a18769020609924ad953cae073ab30c7289ca24089f210bb9056
6
+ metadata.gz: c56abbaa2a811d82eeb9894de80a708f640f8c38689c06ffac91a4eb806484f42dfa28123daab5d5651bbc86ab934f68525f00763a339f2395030ae2454311e2
7
+ data.tar.gz: b08119217e120672a3da43bd56aab08399940521f0052bffe25407e4b7a99eb17fe6b23d2aac72767b02785566acd8105728c7ef21fe5cc2b6aae74a7f94e2ef
Binary file
@@ -14,6 +14,8 @@ module Maglev
14
14
  rescue_from ActiveRecord::RecordInvalid, with: :record_errors
15
15
  rescue_from ActiveRecord::RecordNotFound, with: :not_found
16
16
  rescue_from ActiveRecord::StaleObjectError, with: :stale_record
17
+ rescue_from Maglev::Errors::UnknownSection, with: :exception_message
18
+ rescue_from Maglev::Errors::UnknownSetting, with: :exception_message
17
19
  rescue_from Maglev::Errors::NotAuthorized, with: :unauthorized
18
20
 
19
21
  helper_method :maglev_site, :maglev_theme
@@ -3,6 +3,7 @@ import {
3
3
  simpleContentSection,
4
4
  navContentSection,
5
5
  } from '@/spec/__mocks__/section'
6
+ import { theme } from '@/spec/__mocks__/theme'
6
7
 
7
8
  describe('SectionService', () => {
8
9
  describe('#normalize', () => {
@@ -181,4 +181,4 @@ export const getBlockLabel = (block, definition, index) => {
181
181
  }
182
182
  })
183
183
  return [isBlank(label) ? `${definition.name} #${index}` : label, image]
184
- }
184
+ }
@@ -5,4 +5,4 @@ export const buildCategories = (theme) => {
5
5
  .filter((section) => section.category == category.id)
6
6
  .sort((a, b) => a.name.localeCompare(b.name)),
7
7
  }))
8
- }
8
+ }
@@ -14,7 +14,7 @@ const siteService = {
14
14
  }
15
15
 
16
16
  const themeService = {
17
- buildCategories: vi.fn(),
17
+ buildCategories: vi.fn()
18
18
  }
19
19
 
20
20
  const pageService = {
@@ -33,6 +33,7 @@ export default (services) => ({
33
33
  sections,
34
34
  blocks: sectionBlocks,
35
35
  })
36
+
36
37
  const siteSections = pageContent.sections.filter(
37
38
  (sectionContent) => getSectiondefinition(sectionContent).siteScoped,
38
39
  )
@@ -58,7 +59,7 @@ export default (services) => ({
58
59
  ({ theme }) =>
59
60
  (sectionContent) => {
60
61
  return theme.sections.find(
61
- (definition) => definition['id'] === sectionContent['type'],
62
+ (definition) => definition['id'] === sectionContent['type']
62
63
  )
63
64
  },
64
65
  sectionSettings:
@@ -19,8 +19,8 @@ const store = new Vuex.Store({
19
19
 
20
20
  store.dispatch('fetchEditorSettings')
21
21
  store.dispatch('fetchSite', true)
22
- store.dispatch('setPage', window.page)
23
22
  store.dispatch('setTheme', window.theme)
23
+ store.dispatch('setPage', window.page)
24
24
  store.dispatch('setLocale', window.locale)
25
25
 
26
26
  if (store.state.editorSettings.sitePublishable)
@@ -6,7 +6,7 @@ class Maglev::SettingTypes::Link < Maglev::SettingTypes::Base
6
6
  if value.is_a?(String)
7
7
  { text: 'Link', link_type: 'url', href: value }
8
8
  else
9
- { text: 'Link', link_type: 'url', href: '#' }.merge(value)
9
+ { text: 'Link', link_type: 'url', href: '#' }.merge(value.symbolize_keys)
10
10
  end
11
11
  end
12
12
  end
@@ -23,7 +23,7 @@ module Maglev
23
23
  def call
24
24
  (page_sections || page.sections || []).map do |section|
25
25
  transform_section(section.dup)
26
- end
26
+ end.compact
27
27
  end
28
28
 
29
29
  protected
@@ -39,7 +39,7 @@ module Maglev
39
39
  def transform_section(section)
40
40
  definition = theme.sections.find(section['type'])
41
41
 
42
- raise "Unknown Maglev section type (#{section['type']})" unless definition
42
+ raise_unknown_section_error(section['type']) unless definition
43
43
 
44
44
  transform_if_site_scoped(section, definition)
45
45
  transform_section_blocks(section['blocks'], definition)
@@ -76,8 +76,11 @@ module Maglev
76
76
  end
77
77
 
78
78
  def transform_section_settings(section, definition)
79
+ remove_unused_settings(section, definition)
80
+
79
81
  definition.settings.each do |setting|
80
82
  section_setting = find_section_setting(section, setting.id)
83
+
81
84
  next unless section_setting
82
85
 
83
86
  transform_content_setting(section_setting, setting)
@@ -95,9 +98,23 @@ module Maglev
95
98
  end
96
99
  end
97
100
 
101
+ def remove_unused_settings(section, definition)
102
+ section['settings'].select! do |setting|
103
+ definition.settings.any? do |definition_setting|
104
+ definition_setting.id == setting['id']
105
+ end
106
+ end
107
+ end
108
+
98
109
  def find_section_setting(section, setting_id)
99
110
  # NOTE: works for both sections and blocks
100
111
  section['settings'].find { |setting| setting['id'] == setting_id }
101
112
  end
113
+
114
+ def raise_unknown_section_error(type)
115
+ raise ::Maglev::Errors::UnknownSection, "Unknown Maglev section type (#{type})" unless Rails.env.production?
116
+
117
+ Rails.logger.warn "[#{theme.id}] unknown Maglev section type (#{type})"
118
+ end
102
119
  end
103
120
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Maglev
4
- VERSION = '1.7.2'
4
+ VERSION = '1.7.3'
5
5
  end
data/package.json CHANGED
@@ -37,8 +37,8 @@
37
37
  "prettier": "^3.1.0",
38
38
  "sass": "^1.69.5",
39
39
  "tailwindcss": "^3.4.1",
40
- "vite": "^5.0.12",
41
- "vite-plugin-ruby": "^5.0.0",
40
+ "vite": "^5.4.5",
41
+ "vite-plugin-ruby": "^5.1.0",
42
42
  "vite-plugin-vue2-svg": "^0.4.0",
43
43
  "vitest": "^0.34.6",
44
44
  "vue-template-compiler": "^2.7.16"
@@ -52,7 +52,7 @@
52
52
  "minimist": "^1.2.6",
53
53
  "eventsource": "^1.1.1",
54
54
  "async": "^2.6.4",
55
- "vite": "^5.0.5"
55
+ "vite": "^5.4.5"
56
56
  },
57
57
  "packageManager": "yarn@4.4.0"
58
58
  }
data/yarn.lock CHANGED
@@ -2570,8 +2570,8 @@ __metadata:
2570
2570
  tiptap-extensions: "npm:^1.34.0"
2571
2571
  turbolinks: "npm:^5.2.0"
2572
2572
  v-tooltip: "npm:^2.1.3"
2573
- vite: "npm:^5.0.12"
2574
- vite-plugin-ruby: "npm:^5.0.0"
2573
+ vite: "npm:^5.4.5"
2574
+ vite-plugin-ruby: "npm:^5.1.0"
2575
2575
  vite-plugin-vue2-svg: "npm:^0.4.0"
2576
2576
  vitest: "npm:^0.34.6"
2577
2577
  vue: "npm:^2.7.15"
@@ -3235,7 +3235,7 @@ __metadata:
3235
3235
  languageName: node
3236
3236
  linkType: hard
3237
3237
 
3238
- "postcss@npm:^8.4.14, postcss@npm:^8.4.23, postcss@npm:^8.4.40, postcss@npm:^8.4.41":
3238
+ "postcss@npm:^8.4.14, postcss@npm:^8.4.23, postcss@npm:^8.4.40":
3239
3239
  version: 8.4.41
3240
3240
  resolution: "postcss@npm:8.4.41"
3241
3241
  dependencies:
@@ -3246,6 +3246,17 @@ __metadata:
3246
3246
  languageName: node
3247
3247
  linkType: hard
3248
3248
 
3249
+ "postcss@npm:^8.4.43":
3250
+ version: 8.4.45
3251
+ resolution: "postcss@npm:8.4.45"
3252
+ dependencies:
3253
+ nanoid: "npm:^3.3.7"
3254
+ picocolors: "npm:^1.0.1"
3255
+ source-map-js: "npm:^1.2.0"
3256
+ checksum: 10c0/ad6f8b9b1157d678560373696109745ab97a947d449f8a997acac41c7f1e4c0f3ca4b092d6df1387f430f2c9a319987b1780dbdc27e35800a88cde9b606c1e8f
3257
+ languageName: node
3258
+ linkType: hard
3259
+
3249
3260
  "prelude-ls@npm:^1.2.1":
3250
3261
  version: 1.2.1
3251
3262
  resolution: "prelude-ls@npm:1.2.1"
@@ -4320,15 +4331,15 @@ __metadata:
4320
4331
  languageName: node
4321
4332
  linkType: hard
4322
4333
 
4323
- "vite-plugin-ruby@npm:^5.0.0":
4324
- version: 5.0.0
4325
- resolution: "vite-plugin-ruby@npm:5.0.0"
4334
+ "vite-plugin-ruby@npm:^5.1.0":
4335
+ version: 5.1.0
4336
+ resolution: "vite-plugin-ruby@npm:5.1.0"
4326
4337
  dependencies:
4327
4338
  debug: "npm:^4.3.4"
4328
4339
  fast-glob: "npm:^3.3.2"
4329
4340
  peerDependencies:
4330
4341
  vite: ">=5.0.0"
4331
- checksum: 10c0/2ff117e6c39339b8954e4ba1a4b0e0a8960f646e355b9c196d2e29a3768a32ce70fa5a303065b2268929c018a38d46ac6ac7928b85e85e765dead60c9bdadcc4
4342
+ checksum: 10c0/4c4b3193ee506a5054adbf9c08d38519b04522f88603f80c7822d2073b53bf1e3f3a3ec9459b76cb613b4eafce0991baa781fdeb297ea4acb68a7c1e2eeea0de
4332
4343
  languageName: node
4333
4344
  linkType: hard
4334
4345
 
@@ -4344,13 +4355,13 @@ __metadata:
4344
4355
  languageName: node
4345
4356
  linkType: hard
4346
4357
 
4347
- "vite@npm:^5.0.5":
4348
- version: 5.4.2
4349
- resolution: "vite@npm:5.4.2"
4358
+ "vite@npm:^5.4.5":
4359
+ version: 5.4.5
4360
+ resolution: "vite@npm:5.4.5"
4350
4361
  dependencies:
4351
4362
  esbuild: "npm:^0.21.3"
4352
4363
  fsevents: "npm:~2.3.3"
4353
- postcss: "npm:^8.4.41"
4364
+ postcss: "npm:^8.4.43"
4354
4365
  rollup: "npm:^4.20.0"
4355
4366
  peerDependencies:
4356
4367
  "@types/node": ^18.0.0 || >=20.0.0
@@ -4383,7 +4394,7 @@ __metadata:
4383
4394
  optional: true
4384
4395
  bin:
4385
4396
  vite: bin/vite.js
4386
- checksum: 10c0/23e347ca8aa6f0a774227e4eb7abae228f12c6806a727b046aa75e7ee37ffc2d68cff74360e12a42c347f79adc294e2363bc723b957bf4b382b5a8fb39e4df9d
4397
+ checksum: 10c0/89c6459452fc238cdf8e99681b30996af171c9c557af476f96408a18a639fb5a0a6ee2d2257e005b21dc284edceb604595c34920cd4a007ad18f7ebafb654c76
4387
4398
  languageName: node
4388
4399
  linkType: hard
4389
4400
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maglevcms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.2
4
+ version: 1.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Didier Lafforgue
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-30 00:00:00.000000000 Z
11
+ date: 2024-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jbuilder