maglevcms 1.4.0 → 1.5.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.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/app/components/maglev/content/image.rb +1 -1
  3. data/app/controllers/maglev/api/assets_controller.rb +3 -3
  4. data/app/controllers/maglev/application_controller.rb +5 -0
  5. data/app/controllers/maglev/assets_controller.rb +1 -1
  6. data/app/controllers/maglev/editor_controller.rb +12 -3
  7. data/app/frontend/admin/controllers/screenshot_controller.js +5 -1
  8. data/app/frontend/editor/App.vue +1 -1
  9. data/app/frontend/editor/components/dynamic-form/dynamic-input.vue +17 -18
  10. data/app/frontend/editor/components/dynamic-form/index.vue +1 -1
  11. data/app/frontend/editor/components/header-nav/device-toggler.vue +1 -1
  12. data/app/frontend/editor/components/header-nav/index.vue +3 -3
  13. data/app/frontend/editor/components/header-nav/locale-toggler/index.vue +4 -4
  14. data/app/frontend/editor/components/header-nav/preview-toggler.vue +3 -3
  15. data/app/frontend/editor/components/header-nav/publish-button.vue +3 -3
  16. data/app/frontend/editor/components/header-nav/save-button.vue +1 -1
  17. data/app/frontend/editor/components/icon-library/index.vue +1 -1
  18. data/app/frontend/editor/components/image-library/index.vue +2 -2
  19. data/app/frontend/editor/components/image-library/list-item.vue +1 -1
  20. data/app/frontend/editor/components/image-library/uploader.vue +1 -1
  21. data/app/frontend/editor/components/kit/accordion.vue +8 -3
  22. data/app/frontend/editor/components/kit/checkbox-input.vue +1 -1
  23. data/app/frontend/editor/components/kit/collection-item-input.vue +7 -4
  24. data/app/frontend/editor/components/kit/color-input/core-input.vue +17 -12
  25. data/app/frontend/editor/components/kit/color-input/preset-button.vue +14 -10
  26. data/app/frontend/editor/components/kit/color-input/preset-dropdown.vue +8 -7
  27. data/app/frontend/editor/components/kit/color-input.vue +2 -4
  28. data/app/frontend/editor/components/kit/confirmation-button.vue +3 -3
  29. data/app/frontend/editor/components/kit/divider.vue +4 -4
  30. data/app/frontend/editor/components/kit/dropdown.vue +1 -1
  31. data/app/frontend/editor/components/kit/hint.vue +3 -3
  32. data/app/frontend/editor/components/kit/icon-input.vue +4 -4
  33. data/app/frontend/editor/components/kit/icon.vue +7 -2
  34. data/app/frontend/editor/components/kit/image-input.vue +5 -5
  35. data/app/frontend/editor/components/kit/index.js +25 -25
  36. data/app/frontend/editor/components/kit/link-input.vue +6 -6
  37. data/app/frontend/editor/components/kit/list-item-button.vue +2 -2
  38. data/app/frontend/editor/components/kit/modal-root.vue +3 -3
  39. data/app/frontend/editor/components/kit/modal.vue +2 -2
  40. data/app/frontend/editor/components/kit/page-icon.vue +2 -2
  41. data/app/frontend/editor/components/kit/pagination/index.vue +3 -3
  42. data/app/frontend/editor/components/kit/rich-text-input/block-button.vue +10 -10
  43. data/app/frontend/editor/components/kit/rich-text-input/menu-button.vue +1 -1
  44. data/app/frontend/editor/components/kit/rich-text-input/table-button.vue +18 -12
  45. data/app/frontend/editor/components/kit/rich-text-input.vue +1 -1
  46. data/app/frontend/editor/components/kit/search-input.vue +3 -3
  47. data/app/frontend/editor/components/kit/select-input.vue +19 -5
  48. data/app/frontend/editor/components/kit/simple-select.vue +1 -1
  49. data/app/frontend/editor/components/kit/submit-button.vue +4 -4
  50. data/app/frontend/editor/components/kit/tabs.vue +2 -2
  51. data/app/frontend/editor/components/kit/text-input.vue +1 -1
  52. data/app/frontend/editor/components/kit/textarea-input.vue +1 -1
  53. data/app/frontend/editor/components/link-picker/email.vue +1 -1
  54. data/app/frontend/editor/components/link-picker/index.vue +1 -1
  55. data/app/frontend/editor/components/link-picker/page.vue +5 -5
  56. data/app/frontend/editor/components/link-picker/url.vue +2 -2
  57. data/app/frontend/editor/components/page/edit.vue +3 -3
  58. data/app/frontend/editor/components/page/form/main.vue +3 -3
  59. data/app/frontend/editor/components/page/form/seo.vue +5 -5
  60. data/app/frontend/editor/components/page/list/list-item.vue +12 -12
  61. data/app/frontend/editor/components/page/new.vue +3 -3
  62. data/app/frontend/editor/components/section-block-pane/index.vue +1 -1
  63. data/app/frontend/editor/components/section-block-pane/setting-list.vue +1 -1
  64. data/app/frontend/editor/components/section-highlighter/bottom-actions.vue +1 -1
  65. data/app/frontend/editor/components/section-highlighter/top-left-actions.vue +7 -3
  66. data/app/frontend/editor/components/section-highlighter/top-right-actions.vue +9 -6
  67. data/app/frontend/editor/components/section-list/list-item.vue +12 -5
  68. data/app/frontend/editor/components/section-pane/block-list/list-item.vue +3 -3
  69. data/app/frontend/editor/components/section-pane/block-list/new-block-button.vue +4 -4
  70. data/app/frontend/editor/components/section-pane/block-tree/new-nested-block-button.vue +4 -4
  71. data/app/frontend/editor/components/section-pane/block-tree/tree-node.vue +2 -2
  72. data/app/frontend/editor/components/section-pane/index.vue +2 -2
  73. data/app/frontend/editor/components/section-pane/setting-list.vue +1 -1
  74. data/app/frontend/editor/components/sidebar-nav.vue +5 -5
  75. data/app/frontend/editor/components/style-pane/index.vue +1 -1
  76. data/app/frontend/editor/components/theme-section-list/index.vue +2 -2
  77. data/app/frontend/editor/components/theme-section-list/list-item.vue +1 -1
  78. data/app/frontend/editor/layouts/slide-pane.vue +1 -1
  79. data/app/frontend/editor/locales/index.js +5 -2
  80. data/app/frontend/editor/misc/utils.js +10 -7
  81. data/app/frontend/editor/mixins/global.js +1 -1
  82. data/app/frontend/editor/services/api.js +2 -2
  83. data/app/frontend/editor/services/image.js +6 -2
  84. data/app/frontend/editor/services/section.js +1 -0
  85. data/app/frontend/editor/store/actions/page.js +1 -1
  86. data/app/frontend/editor/store/getters.js +1 -1
  87. data/app/frontend/editor/views/content-pane.vue +9 -5
  88. data/app/frontend/editor/views/page-preview.vue +5 -1
  89. data/app/frontend/editor/views/pages/index.vue +1 -1
  90. data/app/frontend/live-preview-client/rails.js +1 -1
  91. data/app/frontend/live-preview-client/run-scripts.js +22 -24
  92. data/app/models/maglev/asset.rb +14 -0
  93. data/app/models/maglev/page/search_concern.rb +2 -1
  94. data/app/models/maglev/page.rb +18 -0
  95. data/app/models/maglev/page_path.rb +17 -0
  96. data/app/models/maglev/site.rb +24 -0
  97. data/db/migrate/20200824085207_create_maglev_sites.rb +2 -1
  98. data/db/migrate/20200824104648_create_maglev_pages.rb +2 -1
  99. data/db/migrate/20201206172020_create_maglev_assets.rb +2 -1
  100. data/db/migrate/20210830085101_create_maglev_page_paths.rb +3 -2
  101. data/lib/maglev/engine.rb +1 -0
  102. data/lib/maglev/migration.rb +20 -0
  103. data/lib/maglev/version.rb +1 -1
  104. data/lib/maglev.rb +7 -0
  105. data/lib/tasks/maglev_tasks.rake +1 -1
  106. data/package.json +21 -17
  107. data/{postcss.config.js → postcss.config.cjs} +1 -1
  108. data/yarn.lock +1171 -1009
  109. metadata +23 -9
  110. data/.eslintrc.js +0 -49
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div>
3
- <accordion
3
+ <uikit-accordion
4
4
  v-for="(category, index) in categories"
5
5
  :key="index"
6
6
  headerClass="px-3 py-3 mb-3 bg-editor-primary text-white rounded-sm"
@@ -26,7 +26,7 @@
26
26
  {{ $t('themeSectionList.emptyCategory') }}
27
27
  </div>
28
28
  </div>
29
- </accordion>
29
+ </uikit-accordion>
30
30
  </div>
31
31
  </template>
32
32
 
@@ -25,7 +25,7 @@
25
25
  class="bg-white w-full h-16 flex items-center justify-center"
26
26
  v-if="isImageNotFound"
27
27
  >
28
- <icon name="ri-bug-line" />
28
+ <uikit-icon name="ri-bug-line" />
29
29
  </div>
30
30
  <div
31
31
  class="flex items-center px-2 bg-editor-primary bg-opacity-5 py-4 w-full font-bold text-sm"
@@ -31,7 +31,7 @@
31
31
 
32
32
  <div class="ml-auto">
33
33
  <router-link :to="{ name: 'editPage' }">
34
- <icon name="ri-close-circle-line" />
34
+ <uikit-icon name="ri-close-circle-line" />
35
35
  </router-link>
36
36
  </div>
37
37
  </div>
@@ -7,11 +7,14 @@ import { deepMerge } from '@/misc/utils'
7
7
  const overriddenEN = window.customTranslations?.en ?? {}
8
8
  const overriddenES = window.customTranslations?.es ?? {}
9
9
  const overriddenFR = window.customTranslations?.fr ?? {}
10
- const overriddenPTBR = (window.customTranslations && window.customTranslations['pt-BR']) ? window.customTranslations['pt-BR'] : {}
10
+ const overriddenPTBR =
11
+ window.customTranslations && window.customTranslations['pt-BR']
12
+ ? window.customTranslations['pt-BR']
13
+ : {}
11
14
 
12
15
  export default {
13
16
  en: deepMerge(EditorEN, overriddenEN),
14
17
  es: deepMerge(EditorES, overriddenES),
15
18
  fr: deepMerge(EditorFR, overriddenFR),
16
- "pt-BR": deepMerge(EditorPTBR, overriddenPTBR),
19
+ 'pt-BR': deepMerge(EditorPTBR, overriddenPTBR),
17
20
  }
@@ -16,7 +16,7 @@ export const camelize = (str) => {
16
16
 
17
17
  export const camelizeKeys = (obj) => {
18
18
  if (Array.isArray(obj)) {
19
- return obj.map(v => camelizeKeys(v));
19
+ return obj.map((v) => camelizeKeys(v))
20
20
  } else if (obj != null && obj.constructor === Object) {
21
21
  return Object.keys(obj).reduce(
22
22
  (result, key) => ({
@@ -24,12 +24,11 @@ export const camelizeKeys = (obj) => {
24
24
  [camelize(key)]: camelizeKeys(obj[key]),
25
25
  }),
26
26
  {},
27
- );
27
+ )
28
28
  }
29
- return obj;
29
+ return obj
30
30
  }
31
31
 
32
-
33
32
  export const numberToHumanSize = (size, i18n) => {
34
33
  if (isBlank(size)) return null
35
34
 
@@ -124,9 +123,13 @@ export const hexToRgb = (hex) => {
124
123
 
125
124
  export const colorVariableToHex = (variable) => {
126
125
  if (!variable) return null
127
- const color = (variable.startsWith('--')
128
- ? getComputedStyle(document.body).getPropertyValue(variable)
129
- : variable).trim().toLowerCase()
126
+ const color = (
127
+ variable.startsWith('--')
128
+ ? getComputedStyle(document.body).getPropertyValue(variable)
129
+ : variable
130
+ )
131
+ .trim()
132
+ .toLowerCase()
130
133
  return color === 'transparent' ? '' : color
131
134
  }
132
135
 
@@ -135,6 +135,6 @@ Vue.mixin({
135
135
  $st(key) {
136
136
  // console.log('$st', key, this.$te(key) ? this.$t(key) : null)
137
137
  return this.$te(key) ? this.$t(key) : null
138
- }
138
+ },
139
139
  },
140
140
  })
@@ -1,4 +1,4 @@
1
- import * as axios from 'axios'
1
+ import axios from 'axios'
2
2
  import camelcaseObjectDeep from 'camelcase-object-deep'
3
3
 
4
4
  let siteHandle = null
@@ -18,7 +18,7 @@ const api = axios.create({
18
18
  Accept: 'application/json',
19
19
  },
20
20
  transformResponse(data) {
21
- // for "security" (even if the Rails API already camelcases the JSON),
21
+ // for "security" (even if the Rails API already camelcases the JSON),
22
22
  // we also camelcase the response in the Editor.
23
23
  // console.log('[DEBUG] API response', data)
24
24
  return data ? camelcaseObjectDeep(JSON.parse(data)) : {}
@@ -15,8 +15,12 @@ export default (api) => ({
15
15
  create: (attributes) => {
16
16
  let formData = new FormData()
17
17
  Object.entries(attributes).forEach(([key, value]) =>
18
- formData.append(`asset[${key}]`, value),
18
+ formData.append(`asset[${key}]`, value)
19
19
  )
20
- return api.post('/assets', formData)
20
+ return api.post('/assets', formData, {
21
+ headers: {
22
+ 'Content-Type': 'multipart/form-data'
23
+ }
24
+ })
21
25
  },
22
26
  })
@@ -175,6 +175,7 @@ export const getBlockLabel = (block, definition, index) => {
175
175
  case 'collection_item':
176
176
  if (!label && !isBlank(value?.label)) label = value.label
177
177
  if (!image && !isBlank(value?.imageUrl)) image = value.imageUrl
178
+ break
178
179
  default:
179
180
  break
180
181
  }
@@ -3,7 +3,7 @@ import { isBlank } from '@/misc/utils'
3
3
  export default (services) => ({
4
4
  // editPage : Action triggered when the user wants to edit another page
5
5
  // or to change the locale of the current page.
6
- editPage({ state, commit, dispatch }, { id, locale }) {
6
+ editPage({ state, dispatch }, { id, locale }) {
7
7
  console.log('editPage', id, locale)
8
8
 
9
9
  // display the loader
@@ -18,7 +18,7 @@ export default (services) => ({
18
18
  }
19
19
  })
20
20
  },
21
- stickySectionList: ({}, { sectionList }) => {
21
+ stickySectionList: (_, { sectionList }) => {
22
22
  return sectionList.filter((section) => section.viewportFixedPosition)
23
23
  },
24
24
  defaultPageAttributes: ({ page }) => {
@@ -15,7 +15,7 @@
15
15
  }"
16
16
  class="flex items-center"
17
17
  >
18
- <icon name="arrow-drop-left" />
18
+ <uikit-icon name="arrow-drop-left" />
19
19
  <span class="text-xs">{{ sectionTitle }}</span>
20
20
  </router-link>
21
21
  </p>
@@ -53,13 +53,17 @@ export default {
53
53
  else return null
54
54
  },
55
55
  sectionTitle() {
56
- return this.$st(`${this.currentSectionI18nScope}.name`) || this.currentSectionDefinition?.name
56
+ return (
57
+ this.$st(`${this.currentSectionI18nScope}.name`) ||
58
+ this.currentSectionDefinition?.name
59
+ )
57
60
  },
58
61
  sectionBlockTitle() {
59
- return this.$st(`${this.currentSectionI18nScope}.blocks.label`) || (
62
+ return (
63
+ this.$st(`${this.currentSectionI18nScope}.blocks.label`) ||
60
64
  this.currentSectionBlockDefinition?.name +
61
- ' ' +
62
- `#${this.currentSectionBlockIndex}`
65
+ ' ' +
66
+ `#${this.currentSectionBlockIndex}`
63
67
  )
64
68
  },
65
69
  isSectionReady() {
@@ -63,7 +63,11 @@
63
63
  class="flex mt-4 text-gray-600"
64
64
  >
65
65
  <template v-slot:icon>
66
- <icon name="add-box-line" size="1.5rem" class="mx-1 text-black" />
66
+ <uikit-icon
67
+ name="add-box-line"
68
+ size="1.5rem"
69
+ class="mx-1 text-black"
70
+ />
67
71
  </template>
68
72
  </i18n>
69
73
  </div>
@@ -6,7 +6,7 @@
6
6
  >
7
7
  <div class="h-full flex flex-col px-4 pb-4">
8
8
  <div class="py-2">
9
- <search-input
9
+ <uikit-search-input
10
10
  @search="search"
11
11
  class="py-4"
12
12
  :placeholder="$t('page.list.searchPlaceholder')"
@@ -1,4 +1,4 @@
1
- import * as axios from 'axios'
1
+ import axios from 'axios'
2
2
  import { debounce } from './utils'
3
3
  import runScripts from './run-scripts'
4
4
 
@@ -1,54 +1,53 @@
1
- export default function(element) {
2
- var scripts;
1
+ export default function (element) {
2
+ var scripts
3
3
 
4
4
  // Get the scripts
5
- scripts = element.getElementsByTagName("script");
5
+ scripts = element.getElementsByTagName('script')
6
6
 
7
7
  // Run them in sequence (remember NodeLists are live)
8
- continueLoading();
8
+ continueLoading()
9
9
 
10
10
  function continueLoading() {
11
- var script, newscript;
11
+ var script, newscript
12
12
 
13
13
  // While we have a script to load...
14
14
  while (scripts.length) {
15
15
  // Get it and remove it from the DOM
16
- script = scripts[0];
17
- script.parentNode.removeChild(script);
16
+ script = scripts[0]
17
+ script.parentNode.removeChild(script)
18
18
 
19
19
  // Create a replacement for it
20
- newscript = document.createElement('script');
20
+ newscript = document.createElement('script')
21
21
 
22
22
  // External?
23
23
  if (script.src) {
24
24
  // Yes, we'll have to wait until it's loaded before continuing
25
- newscript.onerror = continueLoadingOnError;
26
- newscript.onload = continueLoadingOnLoad;
27
- newscript.onreadystatechange = continueLoadingOnReady;
28
- newscript.src = script.src;
29
- }
30
- else {
25
+ newscript.onerror = continueLoadingOnError
26
+ newscript.onload = continueLoadingOnLoad
27
+ newscript.onreadystatechange = continueLoadingOnReady
28
+ newscript.src = script.src
29
+ } else {
31
30
  // No, we can do it right away
32
- newscript.text = script.text;
31
+ newscript.text = script.text
33
32
  }
34
33
 
35
34
  // Start the script
36
- document.documentElement.appendChild(newscript);
35
+ document.documentElement.appendChild(newscript)
37
36
 
38
37
  // If it's external, wait for callback
39
38
  if (script.src) {
40
- return;
39
+ return
41
40
  }
42
41
  }
43
42
 
44
43
  // All scripts loaded
45
- newscript = undefined;
44
+ newscript = undefined
46
45
 
47
46
  // Callback on most browsers when a script is loaded
48
47
  function continueLoadingOnLoad() {
49
48
  // Defend against duplicate calls
50
49
  if (this === newscript) {
51
- continueLoading();
50
+ continueLoading()
52
51
  }
53
52
  }
54
53
 
@@ -56,18 +55,17 @@ export default function(element) {
56
55
  function continueLoadingOnError() {
57
56
  // Defend against duplicate calls
58
57
  if (this === newscript) {
59
- continueLoading();
58
+ continueLoading()
60
59
  }
61
60
  }
62
61
 
63
62
  // Callback on IE when a script's loading status changes
64
63
  function continueLoadingOnReady() {
65
-
66
64
  // Defend against duplicate calls and check whether the
67
65
  // script is complete (complete = loaded or error)
68
- if (this === newscript && this.readyState === "complete") {
69
- continueLoading();
66
+ if (this === newscript && this.readyState === 'complete') {
67
+ continueLoading()
70
68
  }
71
69
  }
72
70
  }
73
- }
71
+ }
@@ -26,3 +26,17 @@ module Maglev
26
26
  end
27
27
  end
28
28
  end
29
+
30
+ # == Schema Information
31
+ #
32
+ # Table name: maglev_assets
33
+ #
34
+ # id :bigint not null, primary key
35
+ # byte_size :integer
36
+ # content_type :string
37
+ # filename :string
38
+ # height :integer
39
+ # width :integer
40
+ # created_at :datetime not null
41
+ # updated_at :datetime not null
42
+ #
@@ -27,7 +27,8 @@ module Maglev::Page::SearchConcern
27
27
 
28
28
  def search_path_clause(query, locale)
29
29
  path = Maglev::PagePath.arel_table[:value]
30
- path.matches(query).and(path.eq(locale))
30
+ path_locale = Maglev::PagePath.arel_table[:locale]
31
+ path.matches(query).and(path_locale.eq(locale))
31
32
  end
32
33
 
33
34
  def search_title_node(locale)
@@ -42,3 +42,21 @@ module Maglev
42
42
  end
43
43
  end
44
44
  end
45
+
46
+ # == Schema Information
47
+ #
48
+ # Table name: maglev_pages
49
+ #
50
+ # id :bigint not null, primary key
51
+ # lock_version :integer
52
+ # meta_description_translations :jsonb
53
+ # og_description_translations :jsonb
54
+ # og_image_url_translations :jsonb
55
+ # og_title_translations :jsonb
56
+ # sections_translations :jsonb
57
+ # seo_title_translations :jsonb
58
+ # title_translations :jsonb
59
+ # visible :boolean default(TRUE)
60
+ # created_at :datetime not null
61
+ # updated_at :datetime not null
62
+ #
@@ -44,3 +44,20 @@ module Maglev
44
44
  end
45
45
  end
46
46
  end
47
+
48
+ # == Schema Information
49
+ #
50
+ # Table name: maglev_page_paths
51
+ #
52
+ # id :bigint not null, primary key
53
+ # canonical :boolean default(TRUE)
54
+ # locale :string not null
55
+ # value :string not null
56
+ # maglev_page_id :bigint
57
+ #
58
+ # Indexes
59
+ #
60
+ # canonical_speed (canonical,locale,value)
61
+ # index_maglev_page_paths_on_maglev_page_id (maglev_page_id)
62
+ # scoped_canonical_speed (canonical,maglev_page_id,locale)
63
+ #
@@ -27,3 +27,27 @@ module Maglev
27
27
  end
28
28
  end
29
29
  end
30
+
31
+ # == Schema Information
32
+ #
33
+ # Table name: maglev_sites
34
+ #
35
+ # id :bigint not null, primary key
36
+ # domain :string
37
+ # handle :string
38
+ # locales :jsonb
39
+ # lock_version :integer
40
+ # name :string
41
+ # navigation :jsonb
42
+ # sections_translations :jsonb
43
+ # siteable_type :string
44
+ # style :jsonb
45
+ # created_at :datetime not null
46
+ # updated_at :datetime not null
47
+ # siteable_id :bigint
48
+ # theme_id :string
49
+ #
50
+ # Indexes
51
+ #
52
+ # index_maglev_sites_on_siteable (siteable_type,siteable_id)
53
+ #
@@ -1,6 +1,7 @@
1
1
  class CreateMaglevSites < ActiveRecord::Migration[6.0]
2
+ include Maglev::Migration
2
3
  def change
3
- create_table :maglev_sites do |t|
4
+ create_table :maglev_sites, id: primary_key_type do |t|
4
5
  t.string :name
5
6
  t.timestamps
6
7
  end
@@ -1,6 +1,7 @@
1
1
  class CreateMaglevPages < ActiveRecord::Migration[6.0]
2
+ include Maglev::Migration
2
3
  def change
3
- create_table :maglev_pages do |t|
4
+ create_table :maglev_pages, id: primary_key_type do |t|
4
5
  t.string :title
5
6
  t.string :path
6
7
  t.string :seo_title
@@ -1,6 +1,7 @@
1
1
  class CreateMaglevAssets < ActiveRecord::Migration[6.0]
2
+ include Maglev::Migration
2
3
  def change
3
- create_table :maglev_assets do |t|
4
+ create_table :maglev_assets, id: primary_key_type do |t|
4
5
  t.string :filename
5
6
  t.string :content_type
6
7
  t.integer :width
@@ -1,7 +1,8 @@
1
1
  class CreateMaglevPagePaths < ActiveRecord::Migration[6.0]
2
+ include Maglev::Migration
2
3
  def change
3
- create_table :maglev_page_paths do |t|
4
- t.references :maglev_page
4
+ create_table :maglev_page_paths, id: primary_key_type do |t|
5
+ t.references :maglev_page, type: foreign_key_type
5
6
  t.string :locale, null: false
6
7
  t.string :value, null: false
7
8
  end
data/lib/maglev/engine.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'vite_ruby'
4
+ require 'maglev/migration'
4
5
 
5
6
  module Maglev
6
7
  class Engine < ::Rails::Engine
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Maglev
4
+ module Migration
5
+ private
6
+
7
+ def primary_key_type
8
+ primary_key_type_setting || :primary_key
9
+ end
10
+
11
+ def foreign_key_type
12
+ primary_key_type_setting || :bigint
13
+ end
14
+
15
+ def primary_key_type_setting
16
+ config = Rails.configuration.generators
17
+ config.options[config.orm][:primary_key_type]
18
+ end
19
+ end
20
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Maglev
4
- VERSION = '1.4.0'
4
+ VERSION = '1.5.1'
5
5
  end
data/lib/maglev.rb CHANGED
@@ -54,5 +54,12 @@ module Maglev
54
54
  def services(overrides = {})
55
55
  ::Maglev::AppContainer.new(config.services.merge(overrides)).call
56
56
  end
57
+
58
+ def uuid_as_primary_key?
59
+ return @uuid_as_primary_key unless @uuid_as_primary_key.nil?
60
+
61
+ config = Rails.configuration.generators
62
+ @uuid_as_primary_key = config.options[config.orm][:primary_key_type] == :uuid
63
+ end
57
64
  end
58
65
  end
@@ -29,7 +29,7 @@ namespace :maglev do
29
29
  ARGV.each { |a| task a.to_sym => :environment do; end }
30
30
  # rubocop:enable Style/BlockDelimiters
31
31
 
32
- locales = ARGV[1..].map do |arg|
32
+ locales = (ARGV[1..] || []).map do |arg|
33
33
  label, prefix = arg.split(':')
34
34
  Maglev::Site::Locale.new(label: label, prefix: prefix)
35
35
  end
data/package.json CHANGED
@@ -2,11 +2,15 @@
2
2
  "name": "maglev",
3
3
  "private": true,
4
4
  "scripts": {
5
+ "lint": "eslint --ext .js,.vue app/frontend/editor",
6
+ "prettier": "prettier --config .prettierrc 'app/frontend/**/*.{vue,js}'",
5
7
  "prettier-format": "prettier --config .prettierrc 'app/frontend/**/*.{vue,js}' --write",
6
8
  "test": "vitest"
7
9
  },
10
+ "version": "0.1.0",
11
+ "type": "module",
8
12
  "dependencies": {
9
- "axios": "^0.21.1",
13
+ "axios": "^1.6.0",
10
14
  "camelcase-object-deep": "^1.1.3",
11
15
  "normalizr": "^3.6.1",
12
16
  "stimulus": "^2.0.0",
@@ -15,31 +19,29 @@
15
19
  "tiptap-extensions": "^1.34.0",
16
20
  "turbolinks": "^5.2.0",
17
21
  "v-tooltip": "^2.1.3",
18
- "vue": "^2.7.13",
22
+ "vue": "^2.7.15",
19
23
  "vue-i18n": "^8.21.1",
20
24
  "vue-router": "^3.4.4",
21
25
  "vue-window-size": "0.6.2",
22
26
  "vuedraggable": "^2.24.3",
23
27
  "vuex": "^3.5.1"
24
28
  },
25
- "version": "0.1.0",
26
29
  "devDependencies": {
27
- "@vitejs/plugin-vue2": "^2.0.0",
28
- "@vue/compiler-dom": "^3.2.41",
30
+ "@vitejs/plugin-vue2": "^2.3.1",
29
31
  "@vue/test-utils": "^1.3.1",
30
32
  "autoprefixer": "^10.4.13",
31
- "eslint": "^8.26.0",
32
- "jsdom": "^20.0.2",
33
- "postcss": "^8.4.18",
34
- "prettier": "^2.3.2",
35
- "sass": "^1.55.0",
33
+ "eslint": "^8.54.0",
34
+ "eslint-plugin-vue": "^9.18.1",
35
+ "eslint-config-prettier": "^9.0.0",
36
+ "jsdom": "^23.0.0",
37
+ "prettier": "^3.1.0",
38
+ "sass": "^1.69.5",
36
39
  "tailwindcss": "^3.2.1",
37
- "vite": "^4.3.0",
38
- "vite-plugin-eslint": "^1.8.1",
39
- "vite-plugin-ruby": "^3.2.0",
40
- "vite-plugin-vue2-svg": "^0.3.0",
41
- "vitest": "^0.24.4",
42
- "vue-template-compiler": "^2.7.13"
40
+ "vite": "^5.0.5",
41
+ "vite-plugin-ruby": "^5.0.0",
42
+ "vite-plugin-vue2-svg": "^0.4.0",
43
+ "vitest": "^0.34.6",
44
+ "vue-template-compiler": "^2.7.15"
43
45
  },
44
46
  "resolutions": {
45
47
  "prosemirror-model": "^1.11.2",
@@ -49,6 +51,8 @@
49
51
  "node-forge": "^1.3.0",
50
52
  "minimist": "^1.2.6",
51
53
  "eventsource": "^1.1.1",
52
- "async": "^2.6.4"
54
+ "async": "^2.6.4",
55
+ "postcss": "^8.4.31",
56
+ "vite": "^5.0.5"
53
57
  }
54
58
  }
@@ -1,6 +1,6 @@
1
1
  module.exports = {
2
2
  plugins: {
3
3
  tailwindcss: {},
4
- autoprefixer: {},
4
+ autoprefixer: {}
5
5
  }
6
6
  }