pages_core 3.15.3 → 3.15.5
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 +4 -4
- data/VERSION +1 -1
- data/app/assets/builds/pages_core/admin-dist.js +1 -1
- data/app/assets/builds/pages_core/admin-dist.js.map +4 -4
- data/app/assets/builds/pages_core/admin.css +378 -253
- data/app/assets/builds/pages_core/mailer.css +41 -6
- data/app/assets/builds/pages_core_fonts/121b837e.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/216e5c23.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/3017b52f.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/489746b9.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/49775483.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/49c9e472.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/4a119645.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/5d56d7a8.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/61ea75a6.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/62cbb778.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/647d26c.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/67764053.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/6bb0fd00.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/6c0194a2.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/71423409.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/7584e61d.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/77bcfa1c.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/7aca0cc5.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/9a09533f.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/a51f5bc8.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/a80b2975.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/a891f617.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/ad6083f3.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/b29a61ff.woff2 +0 -0
- data/app/assets/builds/{fonts/6569749d.ttf → pages_core_fonts/b30b0656.ttf} +0 -0
- data/app/assets/builds/pages_core_fonts/b3a5f48c.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/bc73ee06.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/c38c6d45.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/c5ce0b1f.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/c8d53904.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/ce13c169.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/d43bd0d5.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/e1c7d368.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/e1e8175d.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/e318f796.woff2 +0 -0
- data/app/assets/builds/{fonts/ee32bc60.ttf → pages_core_fonts/e7acb7d9.ttf} +0 -0
- data/app/assets/builds/pages_core_fonts/ee5514c6.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/f4e495e2.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/f736ec65.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/f741c7ba.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/f7767345.woff2 +0 -0
- data/app/assets/builds/pages_core_fonts/fe9eb751.woff2 +0 -0
- data/app/assets/stylesheets/pages_core/admin/components/forms.css +2 -2
- data/app/assets/stylesheets/pages_core/admin/components/header.css +1 -1
- data/app/assets/stylesheets/pages_core/admin/controllers/pages.css +1 -1
- data/app/assets/stylesheets/pages_core/admin/global/fonts.css +38 -38
- data/app/controllers/{pages_core → admin}/admin_controller.rb +1 -3
- data/app/controllers/attachments_controller.rb +40 -0
- data/app/controllers/concerns/pages_core/document_title_controller.rb +16 -0
- data/app/controllers/concerns/pages_core/page_parameters.rb +1 -1
- data/app/controllers/concerns/pages_core/pages/preview_controller.rb +49 -0
- data/app/controllers/concerns/pages_core/pages/rss_controller.rb +43 -0
- data/app/controllers/errors_controller.rb +2 -0
- data/app/controllers/images_controller.rb +13 -0
- data/app/controllers/pages_core/frontend/pages_controller.rb +3 -4
- data/app/controllers/pages_core/frontend_controller.rb +6 -1
- data/app/controllers/pages_core/sitemaps_controller.rb +21 -52
- data/app/helpers/pages_core/admin/image_uploads_helper.rb +1 -1
- data/app/helpers/pages_core/application_helper.rb +0 -3
- data/app/helpers/pages_core/attachments_helper.rb +0 -10
- data/app/helpers/pages_core/feed_tags_helper.rb +31 -0
- data/app/helpers/pages_core/frontend_helper.rb +3 -0
- data/app/helpers/pages_core/head_tags_helper.rb +80 -70
- data/app/helpers/pages_core/page_path_helper.rb +1 -12
- data/app/javascript/components/Attachments/Attachment.tsx +3 -3
- data/app/javascript/components/Attachments/AttachmentEditor.tsx +5 -5
- data/app/javascript/components/Attachments/Deleted.tsx +28 -0
- data/app/javascript/components/Attachments/List.tsx +11 -24
- data/app/javascript/components/Attachments/Placeholder.tsx +0 -2
- data/app/javascript/components/Attachments.tsx +2 -3
- data/app/javascript/components/DateRangeSelect.tsx +13 -10
- data/app/javascript/components/DateTimeSelect.tsx +11 -11
- data/app/javascript/components/EditableImage.tsx +3 -3
- data/app/javascript/components/FileUploadButton.tsx +3 -3
- data/app/javascript/components/ImageCropper/FocalPoint.tsx +10 -14
- data/app/javascript/components/ImageCropper/Image.tsx +19 -25
- data/app/javascript/components/ImageCropper/Toolbar.tsx +27 -26
- data/app/javascript/components/ImageCropper/useContainerSize.ts +25 -0
- data/app/javascript/components/ImageCropper/useCrop.ts +28 -13
- data/app/javascript/components/ImageCropper/useImageCropperContext.ts +13 -0
- data/app/javascript/components/ImageCropper.tsx +24 -83
- data/app/javascript/components/ImageEditor/Form.tsx +25 -28
- data/app/javascript/components/ImageEditor/useImageEditor.ts +63 -0
- data/app/javascript/components/ImageEditor/useImageEditorContext.ts +14 -0
- data/app/javascript/components/ImageEditor.tsx +28 -42
- data/app/javascript/components/ImageGrid/Deleted.tsx +28 -0
- data/app/javascript/components/ImageGrid/DragElement.tsx +5 -5
- data/app/javascript/components/ImageGrid/FilePlaceholder.tsx +0 -2
- data/app/javascript/components/ImageGrid/Grid.tsx +15 -24
- data/app/javascript/components/ImageGrid/GridImage.tsx +4 -4
- data/app/javascript/components/ImageGrid/Placeholder.tsx +2 -4
- data/app/javascript/components/ImageGrid.tsx +2 -4
- data/app/javascript/components/ImageUploader.tsx +5 -5
- data/app/javascript/components/LabelledField.tsx +6 -6
- data/app/javascript/components/Modal.tsx +16 -13
- data/app/javascript/components/PageForm/Block.tsx +3 -3
- data/app/javascript/components/PageForm/Content.tsx +11 -15
- data/app/javascript/components/PageForm/Dates.tsx +3 -11
- data/app/javascript/components/PageForm/Files.tsx +2 -4
- data/app/javascript/components/PageForm/Form.tsx +3 -9
- data/app/javascript/components/PageForm/Images.tsx +2 -4
- data/app/javascript/components/PageForm/LocaleLinks.tsx +4 -11
- data/app/javascript/components/PageForm/Metadata.tsx +8 -13
- data/app/javascript/components/PageForm/Options.tsx +28 -11
- data/app/javascript/components/PageForm/PageDescription.tsx +7 -14
- data/app/javascript/components/PageForm/PathSegment.tsx +5 -10
- data/app/javascript/components/PageForm/TabPanel.tsx +3 -6
- data/app/javascript/components/PageForm/Tabs.tsx +2 -4
- data/app/javascript/components/PageForm/UnconfiguredContent.tsx +7 -12
- data/app/javascript/components/PageForm/pageParams.ts +3 -2
- data/app/javascript/components/PageForm/usePage.ts +1 -46
- data/app/javascript/components/PageForm/usePageFormContext.ts +8 -0
- data/app/javascript/components/PageForm/useTabs.ts +1 -1
- data/app/javascript/components/PageForm/utils.ts +49 -0
- data/app/javascript/components/PageForm.tsx +52 -48
- data/app/javascript/components/PageImages.tsx +1 -3
- data/app/javascript/components/PageTree/Button.tsx +25 -0
- data/app/javascript/components/PageTree/CollapseArrow.tsx +34 -0
- data/app/javascript/components/PageTree/CollapsedLabel.tsx +21 -0
- data/app/javascript/components/PageTree/EditPageName.tsx +68 -0
- data/app/javascript/components/PageTree/Node.tsx +143 -413
- data/app/javascript/components/PageTree/PageName.tsx +6 -4
- data/app/javascript/components/PageTree/StatusLabel.tsx +10 -0
- data/app/javascript/components/PageTree/tree.ts +268 -0
- data/app/javascript/components/PageTree/usePageTree.ts +268 -0
- data/app/javascript/components/PageTree/usePageTreeContext.ts +13 -0
- data/app/javascript/components/PageTree.tsx +194 -214
- data/app/javascript/components/{RichTextToolbarButton.tsx → RichTextArea/ToolbarButton.tsx} +3 -5
- data/app/javascript/components/RichTextArea/actions.ts +106 -0
- data/app/javascript/components/RichTextArea/useMaybeControlledValue.ts +14 -0
- data/app/javascript/components/RichTextArea.tsx +91 -209
- data/app/javascript/components/TagEditor/AddTagForm.tsx +2 -2
- data/app/javascript/components/TagEditor/Editor.tsx +3 -5
- data/app/javascript/components/TagEditor/Tag.tsx +3 -5
- data/app/javascript/components/TagEditor/useTags.ts +7 -4
- data/app/javascript/components/TagEditor.tsx +2 -4
- data/app/javascript/components/Toast.tsx +5 -5
- data/app/javascript/components/drag/draggedOrder.ts +6 -6
- data/app/javascript/components/drag/useDragCollection.ts +21 -25
- data/app/javascript/components/drag/useDragUploader.ts +20 -18
- data/app/javascript/components/drag/useDraggable.ts +3 -3
- data/app/javascript/features/RichText.tsx +0 -1
- data/app/javascript/features/contentTabs.ts +2 -2
- data/app/javascript/stores/useModalStore.ts +1 -1
- data/app/javascript/stores/useToastStore.ts +2 -2
- data/app/javascript/types/Attachments.ts +11 -11
- data/app/javascript/types/Crop.ts +16 -12
- data/app/javascript/types/Drag.ts +21 -23
- data/app/javascript/types/Images.ts +8 -8
- data/app/javascript/types/PageEditor.ts +11 -4
- data/app/javascript/types/Pages.ts +22 -27
- data/app/javascript/types/Tags.ts +5 -6
- data/app/javascript/types/Template.ts +4 -4
- data/app/javascript/types.ts +2 -2
- data/app/models/attachment.rb +5 -9
- data/app/models/autopublisher.rb +1 -1
- data/app/models/concerns/pages_core/page_model/redirectable.rb +1 -2
- data/app/models/concerns/pages_core/page_model/searchable.rb +1 -1
- data/app/models/concerns/pages_core/page_model/status.rb +2 -4
- data/app/models/concerns/pages_core/searchable_document.rb +2 -4
- data/app/models/image.rb +0 -15
- data/app/models/page_builder.rb +4 -6
- data/app/resources/admin/page_resource.rb +2 -2
- data/app/resources/export/page_resource.rb +1 -1
- data/app/services/pages_core/invite_service.rb +1 -2
- data/app/views/layouts/admin.html.erb +1 -0
- data/app/views/pages_core/sitemaps/index.xml.builder +10 -0
- data/config/routes.rb +4 -3
- data/db/migrate/20240917142300_add_skip_index_to_pages.rb +7 -0
- data/lib/pages_core/engine.rb +15 -17
- data/lib/pages_core/sitemap.rb +58 -0
- data/lib/pages_core/templates/configuration_proxy.rb +3 -3
- data/lib/pages_core.rb +7 -4
- data/lib/rails/generators/pages_core/frontend/frontend_generator.rb +2 -2
- data/lib/rails/generators/pages_core/frontend/templates/application.html.erb +13 -5
- data/lib/rails/generators/pages_core/frontend/templates/postcss.config.js +2 -6
- data/lib/rails/generators/pages_core/frontend/templates/stylesheets/components/base.css +3 -1
- data/lib/rails/generators/pages_core/frontend/templates/stylesheets/config.css +2 -3
- data/lib/rails/generators/pages_core/frontend/templates/stylesheets/global/animation.css +1 -1
- data/lib/rails/generators/pages_core/frontend/templates/stylesheets/global/colors.css +6 -5
- data/lib/rails/generators/pages_core/frontend/templates/stylesheets/global/fonts.css +1 -1
- data/lib/rails/generators/pages_core/frontend/templates/stylesheets/global/grid.css +9 -6
- data/lib/rails/generators/pages_core/frontend/templates/stylesheets/global/typography.css +42 -26
- data/lib/rails/generators/pages_core/install/templates/application_controller.rb +0 -6
- data/lib/rails/generators/pages_core/rspec/templates/rails_helper.rb +1 -1
- metadata +81 -49
- data/app/assets/builds/fonts/7b7db107.woff2 +0 -0
- data/app/assets/builds/fonts/921961e9.woff2 +0 -0
- data/app/controller_dummies/admin/admin_controller.rb +0 -6
- data/app/controller_dummies/application_controller.rb +0 -6
- data/app/controller_dummies/attachments_controller.rb +0 -4
- data/app/controller_dummies/frontend_controller.rb +0 -4
- data/app/controller_dummies/images_controller.rb +0 -4
- data/app/controller_dummies/page_files_controller.rb +0 -4
- data/app/controller_dummies/pages_controller.rb +0 -4
- data/app/controller_dummies/sitemaps_controller.rb +0 -4
- data/app/controllers/concerns/pages_core/preview_pages_controller.rb +0 -47
- data/app/controllers/concerns/pages_core/rss_controller.rb +0 -41
- data/app/controllers/pages_core/attachments_controller.rb +0 -42
- data/app/controllers/pages_core/frontend/page_files_controller.rb +0 -25
- data/app/controllers/pages_core/images_controller.rb +0 -15
- data/app/helpers/pages_core/meta_tags_helper.rb +0 -96
- data/app/helpers/pages_core/open_graph_tags_helper.rb +0 -49
- data/app/javascript/components/PageTree/Draggable.tsx +0 -338
- data/app/javascript/lib/Tree.ts +0 -305
- data/app/javascript/types/Trees.ts +0 -19
- data/app/views/sitemaps/show.xml.builder +0 -11
@@ -1,8 +1,8 @@
|
|
1
|
-
import
|
1
|
+
import { DragEvent, useEffect, useRef } from "react";
|
2
2
|
|
3
3
|
import * as Drag from "../../types/Drag";
|
4
4
|
|
5
|
-
export default function useDraggable<T
|
5
|
+
export default function useDraggable<T>(
|
6
6
|
draggable: Drag.Draggable<T>,
|
7
7
|
startDrag: (evt: React.MouseEvent, draggable: Drag.Draggable<T>) => void
|
8
8
|
) {
|
@@ -16,7 +16,7 @@ export default function useDraggable<T = Drag.DraggableRecord>(
|
|
16
16
|
|
17
17
|
useEffect(() => {
|
18
18
|
draggable.ref.current = ref.current;
|
19
|
-
}, []);
|
19
|
+
}, [draggable.ref]);
|
20
20
|
|
21
21
|
return { ref: ref, onDragStart: handleDrag, draggable: true };
|
22
22
|
}
|
@@ -1,30 +1,30 @@
|
|
1
1
|
import * as Drag from "./Drag";
|
2
2
|
import { Locale, LocalizedValue } from "../types";
|
3
3
|
|
4
|
-
export
|
5
|
-
id
|
4
|
+
export type Resource = {
|
5
|
+
id?: number;
|
6
6
|
name: LocalizedValue;
|
7
|
-
description: LocalizedValue;
|
8
|
-
url: string;
|
9
7
|
filename: string;
|
10
|
-
|
8
|
+
description?: LocalizedValue;
|
9
|
+
url?: string;
|
10
|
+
};
|
11
11
|
|
12
|
-
export
|
12
|
+
export type Record = {
|
13
13
|
id?: number;
|
14
14
|
attachment: Resource;
|
15
15
|
uploading?: boolean;
|
16
|
-
}
|
16
|
+
};
|
17
17
|
|
18
|
-
export
|
18
|
+
export type Options = {
|
19
19
|
attribute: string;
|
20
20
|
locale: string;
|
21
21
|
locales: { [index: string]: Locale };
|
22
22
|
showEmbed: boolean;
|
23
|
-
}
|
23
|
+
};
|
24
24
|
|
25
|
-
export
|
25
|
+
export type State = {
|
26
26
|
collection: Drag.Collection<Record>;
|
27
27
|
deleted: Record[];
|
28
28
|
setDeleted: (records: Record[]) => void;
|
29
29
|
update: (records: Record[]) => void;
|
30
|
-
}
|
30
|
+
};
|
@@ -1,36 +1,40 @@
|
|
1
1
|
import * as Images from "./Images";
|
2
2
|
|
3
|
-
export
|
3
|
+
export type Position = {
|
4
4
|
x: number;
|
5
5
|
y: number;
|
6
|
-
}
|
6
|
+
};
|
7
7
|
|
8
|
-
export
|
8
|
+
export type Ratio = number | null;
|
9
|
+
|
10
|
+
export type Size = {
|
9
11
|
width: number;
|
10
12
|
height: number;
|
11
|
-
}
|
13
|
+
};
|
12
14
|
|
13
|
-
export
|
15
|
+
export type Params = {
|
14
16
|
crop_start_x: number;
|
15
17
|
crop_start_y: number;
|
16
18
|
crop_width: number;
|
17
19
|
crop_height: number;
|
18
20
|
crop_gravity_x: number;
|
19
21
|
crop_gravity_y: number;
|
20
|
-
}
|
22
|
+
};
|
21
23
|
|
22
|
-
export
|
24
|
+
export type State = Params & {
|
23
25
|
aspect: number | null;
|
24
26
|
cropping: boolean;
|
25
27
|
image: Images.Resource;
|
26
|
-
|
28
|
+
focalPoint?: Position;
|
29
|
+
};
|
27
30
|
|
28
|
-
export
|
29
|
-
|
30
|
-
|
31
|
+
export type CropSize = Position &
|
32
|
+
Size & {
|
33
|
+
aspect?: number;
|
34
|
+
};
|
31
35
|
|
32
36
|
export type Action =
|
33
37
|
| { type: "completeCrop" | "startCrop" | "toggleFocal" }
|
34
38
|
| { type: "setCrop"; payload: CropSize }
|
35
|
-
| { type: "setAspect"; payload:
|
39
|
+
| { type: "setAspect"; payload: Ratio }
|
36
40
|
| { type: "setFocal"; payload: Position };
|
@@ -1,35 +1,33 @@
|
|
1
|
-
export type
|
2
|
-
|
3
|
-
export interface Draggable<T = DraggableRecord> {
|
1
|
+
export type Draggable<T> = {
|
4
2
|
record: T;
|
5
3
|
ref: React.MutableRefObject<HTMLDivElement>;
|
6
4
|
rect: DOMRect | null;
|
7
5
|
handle: string;
|
8
|
-
}
|
6
|
+
};
|
9
7
|
|
10
|
-
export type
|
8
|
+
export type DraggableOrFiles<T> = Draggable<T> | "Files";
|
11
9
|
|
12
|
-
export type CollectionAction<T
|
13
|
-
| {
|
14
|
-
|
15
|
-
|
16
|
-
}
|
17
|
-
| { type: "update"; payload: Item<T> }
|
10
|
+
export type CollectionAction<T> =
|
11
|
+
| { type: "append" | "insertFiles" | "replace"; payload: Draggable<T>[] }
|
12
|
+
| { type: "prepend" | "reorder"; payload: DraggableOrFiles<T>[] }
|
13
|
+
| { type: "update"; payload: Draggable<T> }
|
18
14
|
| { type: "reinitialize"; payload: Array<T> }
|
19
15
|
| { type: "remove"; payload: Draggable<T> }
|
20
|
-
| { type: "updatePositions"; payload?:
|
16
|
+
| { type: "updatePositions"; payload?: DraggableOrFiles<T> };
|
21
17
|
|
22
|
-
export
|
18
|
+
export type Collection<T> = {
|
23
19
|
ref: React.MutableRefObject<HTMLDivElement>;
|
24
|
-
draggables:
|
25
|
-
dispatch:
|
26
|
-
}
|
20
|
+
draggables: DraggableOrFiles<T>[];
|
21
|
+
dispatch: React.Dispatch<CollectionAction<T>>;
|
22
|
+
};
|
27
23
|
|
28
|
-
export
|
29
|
-
x: number
|
30
|
-
y: number
|
31
|
-
}
|
24
|
+
export type Position = {
|
25
|
+
x: number;
|
26
|
+
y: number;
|
27
|
+
};
|
32
28
|
|
33
|
-
export
|
34
|
-
dragging:
|
35
|
-
|
29
|
+
export type State<T> = {
|
30
|
+
dragging: DraggableOrFiles<T> | false;
|
31
|
+
x?: number;
|
32
|
+
y?: number;
|
33
|
+
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as Drag from "./Drag";
|
2
2
|
import { Locale, LocalizedValue } from "../types";
|
3
3
|
|
4
|
-
export
|
4
|
+
export type Resource = {
|
5
5
|
id: number | null;
|
6
6
|
alternative: LocalizedValue;
|
7
7
|
caption: LocalizedValue;
|
@@ -18,31 +18,31 @@ export interface Resource {
|
|
18
18
|
original_url: string;
|
19
19
|
thumbnail_url: string;
|
20
20
|
uncropped_url: string;
|
21
|
-
}
|
21
|
+
};
|
22
22
|
|
23
|
-
export
|
23
|
+
export type Record = {
|
24
24
|
id?: number;
|
25
25
|
image: Resource;
|
26
26
|
primary?: boolean;
|
27
27
|
src?: string;
|
28
28
|
file?: File;
|
29
|
-
}
|
29
|
+
};
|
30
30
|
|
31
31
|
export type Response = Resource | { status: "error"; error: string };
|
32
32
|
|
33
|
-
export
|
33
|
+
export type GridOptions = {
|
34
34
|
attribute: string;
|
35
35
|
enablePrimary: boolean;
|
36
36
|
locale: string;
|
37
37
|
locales: { [index: string]: Locale };
|
38
38
|
primaryAttribute: string;
|
39
39
|
showEmbed: boolean;
|
40
|
-
}
|
40
|
+
};
|
41
41
|
|
42
|
-
export
|
42
|
+
export type GridState = {
|
43
43
|
primary: Drag.Collection<Record>;
|
44
44
|
images: Drag.Collection<Record>;
|
45
45
|
deleted: Record[];
|
46
46
|
setDeleted: (records: Record[]) => void;
|
47
47
|
update: (records: Record[]) => void;
|
48
|
-
}
|
48
|
+
};
|
@@ -9,7 +9,7 @@ export type Action =
|
|
9
9
|
| { type: "update"; payload: Partial<Pages.Resource> }
|
10
10
|
| { type: "updateBlocks"; payload: Partial<Pages.Blocks> };
|
11
11
|
|
12
|
-
export
|
12
|
+
export type State<T = Pages.Resource> = {
|
13
13
|
locale: string;
|
14
14
|
locales: { [index: string]: Locale };
|
15
15
|
page: T;
|
@@ -17,10 +17,17 @@ export interface State<T = Pages.Resource> {
|
|
17
17
|
datesEnabled?: boolean;
|
18
18
|
inputDir?: "ltr" | "rtl";
|
19
19
|
templateConfig?: Template.Config;
|
20
|
-
}
|
20
|
+
};
|
21
21
|
|
22
|
-
export
|
22
|
+
export type Tab = {
|
23
23
|
id: string;
|
24
24
|
name: string;
|
25
25
|
enabled: boolean;
|
26
|
-
}
|
26
|
+
};
|
27
|
+
|
28
|
+
export type Return = [State, React.Dispatch<Action>];
|
29
|
+
|
30
|
+
export type Context = {
|
31
|
+
state: State;
|
32
|
+
dispatch: React.Dispatch<Action>;
|
33
|
+
};
|
@@ -1,21 +1,20 @@
|
|
1
1
|
import * as Attachments from "./Attachments";
|
2
2
|
import * as Images from "./Images";
|
3
|
-
import * as Trees from "./Trees";
|
4
3
|
import { LocalizedValue, MaybeLocalizedValue } from "../types";
|
5
4
|
|
6
5
|
export type Author = [name: string, id: number];
|
7
6
|
|
8
|
-
export
|
7
|
+
export type Ancestor = {
|
9
8
|
id: number;
|
10
9
|
name: LocalizedValue;
|
11
10
|
path_segment: LocalizedValue;
|
12
|
-
}
|
11
|
+
};
|
13
12
|
|
14
|
-
export
|
13
|
+
export type StatusLabels = {
|
15
14
|
[index: number]: string;
|
16
|
-
}
|
15
|
+
};
|
17
16
|
|
18
|
-
|
17
|
+
type BaseResource = {
|
19
18
|
id?: number;
|
20
19
|
blocks: Blocks;
|
21
20
|
news_page: boolean;
|
@@ -24,22 +23,25 @@ export interface TreeResource {
|
|
24
23
|
pinned: boolean;
|
25
24
|
published_at: Date;
|
26
25
|
status: number;
|
27
|
-
}
|
26
|
+
};
|
28
27
|
|
29
|
-
export
|
28
|
+
export type TreeResource = BaseResource & {
|
29
|
+
editing?: boolean;
|
30
|
+
};
|
31
|
+
|
32
|
+
export type Blocks = {
|
30
33
|
[index: string]: MaybeLocalizedValue;
|
31
34
|
name: LocalizedValue;
|
32
|
-
}
|
35
|
+
};
|
33
36
|
|
34
|
-
export
|
37
|
+
export type MetaImage = {
|
35
38
|
src?: string;
|
36
39
|
image?: Images.Resource;
|
37
|
-
}
|
40
|
+
};
|
38
41
|
|
39
|
-
export
|
42
|
+
export type Resource = BaseResource & {
|
40
43
|
all_day: boolean;
|
41
44
|
ancestors: Ancestor[];
|
42
|
-
blocks: Blocks;
|
43
45
|
enabled_tags: string[];
|
44
46
|
ends_at: Date;
|
45
47
|
errors: { attribute: string; message: string }[];
|
@@ -49,27 +51,20 @@ export interface Resource extends TreeResource {
|
|
49
51
|
page_images: Images.Record[];
|
50
52
|
path_segment: MaybeLocalizedValue;
|
51
53
|
redirect_to: string;
|
54
|
+
skip_index: boolean;
|
52
55
|
starts_at: Date;
|
53
56
|
tags_and_suggestions: string[];
|
54
57
|
template: string;
|
55
58
|
unique_name: string;
|
56
59
|
urls: LocalizedValue;
|
57
60
|
user_id: number;
|
58
|
-
}
|
61
|
+
};
|
59
62
|
|
60
|
-
export
|
61
|
-
|
63
|
+
export type SerializedResource = Omit<
|
64
|
+
Resource,
|
65
|
+
"published_at" | "starts_at" | "ends_at"
|
66
|
+
> & {
|
62
67
|
published_at: string;
|
63
68
|
starts_at: string;
|
64
69
|
ends_at: string;
|
65
|
-
}
|
66
|
-
|
67
|
-
export interface TreeItem extends Partial<TreeResource> {
|
68
|
-
blocks: Blocks;
|
69
|
-
editing?: boolean;
|
70
|
-
permissions?: string[];
|
71
|
-
}
|
72
|
-
|
73
|
-
export interface TreeNode extends TreeItem, Trees.Node {
|
74
|
-
children: TreeNode[];
|
75
|
-
}
|
70
|
+
};
|
@@ -1,9 +1,8 @@
|
|
1
|
-
export
|
2
|
-
type: "addTag" | "toggleTag";
|
3
|
-
payload:
|
4
|
-
}
|
1
|
+
export type Action =
|
2
|
+
| { type: "addTag" | "toggleTag"; payload: string }
|
3
|
+
| { type: "update"; payload: State };
|
5
4
|
|
6
|
-
export
|
5
|
+
export type State = {
|
7
6
|
enabled: string[];
|
8
7
|
tags: string[];
|
9
|
-
}
|
8
|
+
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export
|
1
|
+
export type Block = {
|
2
2
|
name: string;
|
3
3
|
title: string;
|
4
4
|
description?: string;
|
@@ -10,9 +10,9 @@ export interface Block {
|
|
10
10
|
placeholder?: string;
|
11
11
|
options?: [string, string][];
|
12
12
|
type?: string;
|
13
|
-
}
|
13
|
+
};
|
14
14
|
|
15
|
-
export
|
15
|
+
export type Config = {
|
16
16
|
name: string;
|
17
17
|
template_name: string;
|
18
18
|
blocks: Block[];
|
@@ -21,4 +21,4 @@ export interface Config {
|
|
21
21
|
dates: boolean;
|
22
22
|
tags: boolean;
|
23
23
|
files: boolean;
|
24
|
-
}
|
24
|
+
};
|
data/app/javascript/types.ts
CHANGED
data/app/models/attachment.rb
CHANGED
@@ -26,15 +26,13 @@ class Attachment < ApplicationRecord
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def formats
|
29
|
-
{
|
30
|
-
"audio/mpeg" => :mp3,
|
29
|
+
{ "audio/mpeg" => :mp3,
|
31
30
|
"image/gif" => :gif,
|
32
31
|
"image/jpeg" => :jpg,
|
33
32
|
"image/jpg" => :jpg,
|
34
33
|
"image/pjpeg" => :jpg,
|
35
34
|
"image/png" => :png,
|
36
|
-
"application/pdf" => :pdf
|
37
|
-
}
|
35
|
+
"application/pdf" => :pdf }
|
38
36
|
end
|
39
37
|
end
|
40
38
|
|
@@ -53,11 +51,9 @@ class Attachment < ApplicationRecord
|
|
53
51
|
end
|
54
52
|
|
55
53
|
def filename_extension
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
""
|
60
|
-
end
|
54
|
+
return "" unless filename_extension?
|
55
|
+
|
56
|
+
filename.match(/\.([^.]+)$/)[1]
|
61
57
|
end
|
62
58
|
|
63
59
|
def filename_extension?
|
data/app/models/autopublisher.rb
CHANGED
@@ -26,10 +26,8 @@ module PagesCore
|
|
26
26
|
SearchDocument.transaction do
|
27
27
|
record.search_documents.where.not(locale: locales).destroy_all
|
28
28
|
locales.each do |locale|
|
29
|
-
update_index(
|
30
|
-
|
31
|
-
localized_record(locale).search_document_attributes
|
32
|
-
)
|
29
|
+
update_index(locale,
|
30
|
+
localized_record(locale).search_document_attributes)
|
33
31
|
end
|
34
32
|
end
|
35
33
|
end
|
data/app/models/image.rb
CHANGED
@@ -11,21 +11,6 @@ class Image < ApplicationRecord
|
|
11
11
|
attribute :caption
|
12
12
|
end
|
13
13
|
|
14
|
-
def byline
|
15
|
-
ActiveSupport::Deprecation.warn "Image#byline is deprecated, use #caption"
|
16
|
-
caption
|
17
|
-
end
|
18
|
-
|
19
|
-
def byline?
|
20
|
-
ActiveSupport::Deprecation.warn "Image#byline? is deprecated, use #caption?"
|
21
|
-
caption?
|
22
|
-
end
|
23
|
-
|
24
|
-
def byline=(new_caption)
|
25
|
-
ActiveSupport::Deprecation.warn "Image#byline= is deprecated, use #caption="
|
26
|
-
self.caption = new_caption
|
27
|
-
end
|
28
|
-
|
29
14
|
private
|
30
15
|
|
31
16
|
def ensure_max_size
|
data/app/models/page_builder.rb
CHANGED
@@ -18,9 +18,9 @@ class PageBuilder
|
|
18
18
|
attr_reader :user, :locale, :parent
|
19
19
|
|
20
20
|
class << self
|
21
|
-
def build(user, locale: nil, parent: nil, &
|
21
|
+
def build(user, locale: nil, parent: nil, &)
|
22
22
|
new(user, locale:, parent:)
|
23
|
-
.run(&
|
23
|
+
.run(&)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -49,11 +49,9 @@ class PageBuilder
|
|
49
49
|
private
|
50
50
|
|
51
51
|
def default_options
|
52
|
-
{
|
53
|
-
author: user,
|
52
|
+
{ author: user,
|
54
53
|
parent:,
|
55
54
|
status: 2,
|
56
|
-
locale:
|
57
|
-
}
|
55
|
+
locale: }
|
58
56
|
end
|
59
57
|
end
|
@@ -9,7 +9,7 @@ module Admin
|
|
9
9
|
|
10
10
|
attributes :id, :starts_at, :ends_at, :all_day, :status, :published_at,
|
11
11
|
:pinned, :template, :unique_name, :feed_enabled, :news_page,
|
12
|
-
:parent_page_id, :user_id, :redirect_to
|
12
|
+
:parent_page_id, :user_id, :redirect_to, :skip_index
|
13
13
|
|
14
14
|
has_many :page_images, resource: Admin::PageImageResource
|
15
15
|
has_many :page_files, resource: Admin::PageFileResource
|
@@ -79,7 +79,7 @@ module Admin
|
|
79
79
|
return { src: nil, image: nil } unless image
|
80
80
|
|
81
81
|
{ src: dynamic_image_path(image, size: "500x"),
|
82
|
-
image: ::Admin::ImageResource.new(image).
|
82
|
+
image: ::Admin::ImageResource.new(image).to_h }
|
83
83
|
end
|
84
84
|
|
85
85
|
def localized_objects
|
@@ -7,7 +7,7 @@ module Export
|
|
7
7
|
attributes :id, :locale
|
8
8
|
attributes(*PagesCore::Templates::TemplateConfiguration.all_blocks)
|
9
9
|
attributes :created_at, :published_at, :pinned, :template, :redirect_to,
|
10
|
-
:starts_at, :ends_at, :all_day
|
10
|
+
:starts_at, :ends_at, :all_day, :skip_index
|
11
11
|
|
12
12
|
has_many :attachments, resource: Export::AttachmentResource
|
13
13
|
|
@@ -35,8 +35,7 @@ module PagesCore
|
|
35
35
|
def deliver_invite(invite)
|
36
36
|
AdminMailer.invite(
|
37
37
|
invite,
|
38
|
-
admin_invite_with_token_url(invite, invite.token,
|
39
|
-
host:, protocol:)
|
38
|
+
admin_invite_with_token_url(invite, invite.token, host:, protocol:)
|
40
39
|
).deliver_later
|
41
40
|
end
|
42
41
|
end
|
data/config/routes.rb
CHANGED
@@ -19,7 +19,6 @@ Rails.application.routes.draw do
|
|
19
19
|
post "search"
|
20
20
|
post "preview"
|
21
21
|
end
|
22
|
-
resources :files, controller: "page_files"
|
23
22
|
end
|
24
23
|
|
25
24
|
get "/:locale/pages/:id/:page" => "pages#show",
|
@@ -31,8 +30,10 @@ Rails.application.routes.draw do
|
|
31
30
|
get "pages/:locale/*glob" => redirect("/%{locale}/pages/%{glob}"),
|
32
31
|
locale: /\w\w\w/
|
33
32
|
|
34
|
-
#
|
35
|
-
|
33
|
+
# Sitemaps
|
34
|
+
get("sitemap" => "pages_core/sitemaps#index", as: :sitemap_index)
|
35
|
+
get("/sitemap-pages-:locale" => "pages_core/sitemaps#pages",
|
36
|
+
as: :pages_sitemap)
|
36
37
|
|
37
38
|
namespace :admin do
|
38
39
|
get "users/login" => redirect("/admin/login")
|