pages_core 3.11.0 → 3.11.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.
@@ -8,7 +8,7 @@ import ToastStore from "../../stores/ToastStore";
8
8
  import { useDraggable } from "../drag";
9
9
 
10
10
  export default function Attachment(props) {
11
- const { attributeName, draggable } = props;
11
+ const { attributeName, draggable, locales, locale } = props;
12
12
  const { record } = draggable;
13
13
  const { attachment, uploading } = record;
14
14
 
@@ -30,15 +30,15 @@ export default function Attachment(props) {
30
30
  };
31
31
 
32
32
  const description = () => {
33
- if (attachment.description && attachment.description[props.locale]) {
34
- return attachment.description[props.locale];
33
+ if (attachment.description && attachment.description[locale]) {
34
+ return attachment.description[locale];
35
35
  }
36
36
  return null;
37
37
  };
38
38
 
39
39
  const name = () => {
40
- if (attachment.name && attachment.name[props.locale]) {
41
- return attachment.name[props.locale];
40
+ if (attachment.name && attachment.name[locale]) {
41
+ return attachment.name[locale];
42
42
  }
43
43
  return null;
44
44
  };
@@ -48,8 +48,8 @@ export default function Attachment(props) {
48
48
  ModalStore.dispatch({
49
49
  type: "OPEN",
50
50
  payload: <AttachmentEditor attachment={attachment}
51
- locale={props.locale}
52
- locales={props.locales}
51
+ locale={locale}
52
+ locales={locales}
53
53
  onUpdate={props.onUpdate} />
54
54
  });
55
55
  };
@@ -64,6 +64,8 @@ export default function Attachment(props) {
64
64
 
65
65
  const icon = uploading ? "cloud-upload" : "paperclip";
66
66
 
67
+ const localeDir = (locales && locales[locale].dir) || "ltr";
68
+
67
69
  return (
68
70
  <div className={classes.join(" ")}
69
71
  {...listeners}>
@@ -100,7 +102,8 @@ export default function Attachment(props) {
100
102
  <a href={attachment.url}
101
103
  rel="noreferrer"
102
104
  target="_blank">{attachment.filename}</a>}
103
- {!uploading && description() && <p>{description()}</p>}
105
+ {!uploading && description() &&
106
+ <p dir={localeDir}>{description()}</p>}
104
107
  </div>}
105
108
  </div>
106
109
  );
@@ -6,7 +6,7 @@ import ToastStore from "../../stores/ToastStore";
6
6
  import { putJson } from "../../lib/request";
7
7
 
8
8
  export default function AttachmentEditor(props) {
9
- const { attachment } = props;
9
+ const { attachment, locales } = props;
10
10
 
11
11
  const [locale, setLocale] = useState(props.locale);
12
12
  const [localizations, setLocalizations] = useState({
@@ -45,19 +45,22 @@ export default function AttachmentEditor(props) {
45
45
  ModalStore.dispatch({ type: "CLOSE" });
46
46
  };
47
47
 
48
+ const inputDir = (locales && locales[locale].dir) || "ltr";
49
+
48
50
  return (
49
51
  <div className="attachment-editor">
50
52
  <form>
51
- {props.locales && Object.keys(props.locales).length > 1 && (
53
+ {props.locales && Object.keys(locales).length > 1 && (
52
54
  <div className="field">
53
55
  <label>
54
56
  Locale
55
57
  </label>
56
58
  <select name="locale"
59
+ value={locale}
57
60
  onChange={e => setLocale(e.target.value)}>
58
- {Object.keys(props.locales).map(key => (
61
+ {Object.keys(locales).map(key => (
59
62
  <option key={`locale-${key}`} value={key}>
60
- {props.locales[key]}
63
+ {locales[key].name}
61
64
  </option>
62
65
  ))}
63
66
  </select>
@@ -67,6 +70,8 @@ export default function AttachmentEditor(props) {
67
70
  <label>Name</label>
68
71
  <input type="text"
69
72
  className="name"
73
+ lang={locale}
74
+ dir={inputDir}
70
75
  value={localizations.name[locale] || ""}
71
76
  onChange={updateLocalization("name")} />
72
77
  </div>
@@ -74,6 +79,8 @@ export default function AttachmentEditor(props) {
74
79
  <label>Description</label>
75
80
  <textarea className="description"
76
81
  value={localizations.description[locale] || ""}
82
+ lang={locale}
83
+ dir={inputDir}
77
84
  onChange={updateLocalization("description")} />
78
85
  </div>
79
86
  <div className="field embed-code">
@@ -19,7 +19,7 @@ export default function Form(props) {
19
19
  props.setLocale(evt.target.value);
20
20
  };
21
21
 
22
- const inputDir = locales[locale].dir || "ltr";
22
+ const inputDir = (locales && locales[locale].dir) || "ltr";
23
23
 
24
24
  return (
25
25
  <form>
@@ -1,4 +1,4 @@
1
1
  <%= react_component("PageFiles",
2
2
  locale: @locale,
3
- locales: PagesCore.config.locales,
3
+ locales: locales_with_dir,
4
4
  records: @page.files.map { |pf| Admin::PageFileResource.new(pf).to_hash }) %>
@@ -1,6 +1,6 @@
1
1
  <div class="field">
2
2
  <% if f.object.pathable? %>
3
- <%= labelled_field(f.text_field(:path_segment),
3
+ <%= labelled_field(f.text_field(:path_segment, dir: "ltr", lang: nil),
4
4
  "Path segment",
5
5
  description: "Only alpanumeric characters and dashes " \
6
6
  "are allowed.") %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pages_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.11.0
4
+ version: 3.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Inge Jørgensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-06 00:00:00.000000000 Z
11
+ date: 2022-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara