Skip to content

Commit d56f4d7

Browse files
committed
[F] Split theme settings into content + theme
1 parent 47a8455 commit d56f4d7

File tree

8 files changed

+172
-94
lines changed

8 files changed

+172
-94
lines changed

client/src/backend/containers/route-containers.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ export default {
123123
ExportTargetsEdit: ExportTargets.Edit,
124124
SettingsWrapper: Settings.Wrapper,
125125
SettingsTheme: Settings.Theme,
126+
SettingsContent: Settings.Content,
126127
SettingsIntegrations: Settings.Integrations,
127128
SettingsSubjectsList: Settings.Subjects.List,
128129
SettingsSubjectsNew: Settings.Subjects.New,
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
import React, { PureComponent } from "react";
2+
import PropTypes from "prop-types";
3+
import { withTranslation } from "react-i18next";
4+
import { connect } from "react-redux";
5+
import Layout from "backend/components/layout";
6+
import Form from "global/components/form";
7+
import FormContainer from "global/containers/form";
8+
import { settingsAPI, requests } from "api";
9+
import { select } from "utils/entityUtils";
10+
import PageHeader from "backend/components/layout/PageHeader";
11+
12+
export class SettingsContentContainer extends PureComponent {
13+
static mapStateToProps = state => {
14+
return {
15+
settings: select(requests.settings, state.entityStore)
16+
};
17+
};
18+
19+
static displayName = "Settings.Content";
20+
21+
static propTypes = {
22+
settings: PropTypes.object
23+
};
24+
25+
render() {
26+
if (!this.props.settings) return null;
27+
const t = this.props.t;
28+
return (
29+
<div>
30+
<PageHeader title={t("settings.content.header")} type="settings" />
31+
<Layout.BackendPanel>
32+
<FormContainer.Form
33+
model={this.props.settings}
34+
name="backend-settings"
35+
update={settingsAPI.update}
36+
create={settingsAPI.update}
37+
className="form-secondary"
38+
>
39+
<Form.FieldGroup label={t("settings.content.top_bar_header")}>
40+
<Form.TextInput
41+
label={t("settings.content.text_label")}
42+
name="attributes[theme][topBarText]"
43+
placeholder={t("settings.content.text_placeholder")}
44+
/>
45+
<Form.TextInput
46+
label={t("settings.content.color_label")}
47+
name="attributes[theme][topBarColor]"
48+
placeholder={t("settings.content.color_placeholder")}
49+
instructions={t("settings.content.color_instructions")}
50+
/>
51+
<Form.TextInput
52+
label={t("settings.content.top_bar_url_label")}
53+
name="attributes[theme][topBarUrl]"
54+
placeholder={t("settings.content.top_bar_url_placeholder")}
55+
/>
56+
<Form.Select
57+
label={t("settings.content.mode_label")}
58+
name="attributes[theme][topBarMode]"
59+
options={[
60+
{
61+
label: t("settings.content.mode_options.disabled"),
62+
value: "disabled"
63+
},
64+
{
65+
label: t("settings.content.mode_options.always"),
66+
value: "enforced"
67+
},
68+
{
69+
label: t("settings.content.mode_options.standalone"),
70+
value: "enabled"
71+
}
72+
]}
73+
/>
74+
</Form.FieldGroup>
75+
<Form.FieldGroup
76+
label={t("settings.content.content_signup_header")}
77+
>
78+
<Form.TextInput
79+
wide
80+
label={t("settings.content.string_signup_terms_header")}
81+
name="attributes[theme][stringSignupTermsHeader]"
82+
/>
83+
<Form.TextArea
84+
wide
85+
label={t("settings.content.string_signup_terms_one")}
86+
name="attributes[theme][stringSignupTermsOne]"
87+
/>
88+
<Form.TextArea
89+
wide
90+
label={t("settings.content.string_signup_terms_two")}
91+
name="attributes[theme][stringSignupTermsTwo]"
92+
/>
93+
</Form.FieldGroup>
94+
<Form.FieldGroup
95+
label={t("settings.content.content_data_use_header")}
96+
>
97+
<Form.TextInput
98+
wide
99+
label={t("settings.content.string_data_use_header")}
100+
name="attributes[theme][stringDataUseHeader]"
101+
/>
102+
<Form.TextArea
103+
wide
104+
label={t("settings.content.string_data_use_copy")}
105+
name="attributes[theme][stringDataUseCopy]"
106+
instructions={t("settings.content.data_use_copy_instructions")}
107+
/>
108+
<Form.TextInput
109+
wide
110+
label={t("settings.content.string_cookies_banner_header")}
111+
name="attributes[theme][stringCookiesBannerHeader]"
112+
/>
113+
<Form.TextArea
114+
wide
115+
label={t("settings.content.string_cookies_banner_copy")}
116+
name="attributes[theme][stringCookiesBannerCopy]"
117+
instructions={t(
118+
"settings.content.cookies_banner_copy_instructions"
119+
)}
120+
/>
121+
</Form.FieldGroup>
122+
<Form.Save text={t("settings.save")} />
123+
</FormContainer.Form>
124+
</Layout.BackendPanel>
125+
</div>
126+
);
127+
}
128+
}
129+
130+
export default withTranslation()(
131+
connect(SettingsContentContainer.mapStateToProps)(SettingsContentContainer)
132+
);

client/src/backend/containers/settings/Theme.js

Lines changed: 2 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ export class SettingsThemeContainer extends PureComponent {
8888
placeholder="0"
8989
instructions={t("settings.theme.offset_instructions")}
9090
/>
91+
</Form.FieldGroup>
92+
<Form.FieldGroup label={t("settings.theme.colors_header")}>
9193
<Form.TextInput
9294
label={t("settings.theme.accent_color_label")}
9395
name="attributes[theme][accentColor]"
@@ -126,87 +128,6 @@ export class SettingsThemeContainer extends PureComponent {
126128
placeholder={t("settings.theme.typekit_placeholder")}
127129
/>
128130
</Form.FieldGroup>
129-
<Form.FieldGroup label={t("settings.theme.top_bar_header")}>
130-
<Form.TextInput
131-
label={t("settings.theme.text_label")}
132-
name="attributes[theme][topBarText]"
133-
placeholder={t("settings.theme.text_placeholder")}
134-
/>
135-
<Form.TextInput
136-
label={t("settings.theme.color_label")}
137-
name="attributes[theme][topBarColor]"
138-
placeholder={t("settings.theme.color_placeholder")}
139-
instructions={t("settings.theme.color_instructions")}
140-
/>
141-
<Form.TextInput
142-
label={t("settings.theme.top_bar_url_label")}
143-
name="attributes[theme][topBarUrl]"
144-
placeholder={t("settings.theme.top_bar_url_placeholder")}
145-
/>
146-
<Form.Select
147-
label={t("settings.theme.mode_label")}
148-
name="attributes[theme][topBarMode]"
149-
options={[
150-
{
151-
label: t("settings.theme.mode_options.disabled"),
152-
value: "disabled"
153-
},
154-
{
155-
label: t("settings.theme.mode_options.always"),
156-
value: "enforced"
157-
},
158-
{
159-
label: t("settings.theme.mode_options.standalone"),
160-
value: "enabled"
161-
}
162-
]}
163-
/>
164-
</Form.FieldGroup>
165-
<Form.FieldGroup label={t("settings.theme.content_signup_header")}>
166-
<Form.TextInput
167-
wide
168-
label={t("settings.theme.string_signup_terms_header")}
169-
name="attributes[theme][stringSignupTermsHeader]"
170-
/>
171-
<Form.TextArea
172-
wide
173-
label={t("settings.theme.string_signup_terms_one")}
174-
name="attributes[theme][stringSignupTermsOne]"
175-
/>
176-
<Form.TextArea
177-
wide
178-
label={t("settings.theme.string_signup_terms_two")}
179-
name="attributes[theme][stringSignupTermsTwo]"
180-
/>
181-
</Form.FieldGroup>
182-
<Form.FieldGroup
183-
label={t("settings.theme.content_data_use_header")}
184-
>
185-
<Form.TextInput
186-
wide
187-
label={t("settings.theme.string_data_use_header")}
188-
name="attributes[theme][stringDataUseHeader]"
189-
/>
190-
<Form.TextArea
191-
wide
192-
label={t("settings.theme.string_data_use_copy")}
193-
name="attributes[theme][stringDataUseCopy]"
194-
instructions={t("settings.theme.data_use_copy_instructions")}
195-
/>
196-
<Form.TextInput
197-
wide
198-
label={t("settings.theme.string_cookies_banner_header")}
199-
name="attributes[theme][stringCookiesBannerHeader]"
200-
/>
201-
<Form.TextArea
202-
wide
203-
label={t("settings.theme.string_cookies_banner_copy")}
204-
name="attributes[theme][stringCookiesBannerCopy]"
205-
instructions={t(
206-
"settings.theme.cookies_banner_copy_instructions"
207-
)}
208-
/>
209-
</Form.FieldGroup>
210131
<Form.Save text={t("settings.save")} />
211132
</FormContainer.Form>
212133
</Layout.BackendPanel>

client/src/backend/containers/settings/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Integrations from "./Integrations";
66
import Email from "./Email";
77
import Ingestion from "./Ingestion";
88
import Subjects from "./subjects";
9+
import Content from "./Content";
910

1011
export default {
1112
Properties,
@@ -15,5 +16,6 @@ export default {
1516
Integrations,
1617
Email,
1718
Ingestion,
18-
Subjects
19+
Subjects,
20+
Content
1921
};

client/src/backend/routes.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,6 +1133,13 @@ const routes = {
11331133
path: "/backend/settings/theme",
11341134
helper: () => "/backend/settings/theme"
11351135
},
1136+
{
1137+
name: "backendSettingsContent",
1138+
exact: true,
1139+
component: "SettingsContent",
1140+
path: "/backend/settings/content",
1141+
helper: () => "/backend/settings/content"
1142+
},
11361143
{
11371144
name: "backendSettingsIntegrations",
11381145
exact: true,

client/src/config/app/locale/en-US/json/backend/settings.json

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,21 @@
8282
"typography_header": "Typography",
8383
"typekit_label": "Typekit ID",
8484
"typekit_placeholder": "Enter Typekit ID",
85+
"colors_header": "Colors"
86+
},
87+
"content": {
88+
"header": "Content Settings",
89+
"content_signup_header": "Signup",
90+
"content_data_use_header": "Data Use",
91+
"string_signup_terms_header": "Terms & Conditions Header",
92+
"string_signup_terms_one": "Terms & Conditions First Paragraph",
93+
"string_signup_terms_two": "Terms & Conditions Second Paragraph",
94+
"string_data_use_header": "Page Header",
95+
"string_data_use_copy": "Page Copy",
96+
"data_use_copy_instructions": "This field accepts markdown",
97+
"string_cookies_banner_header": "Cookies Banner Header",
98+
"string_cookies_banner_copy": "Cookies Banner Body",
99+
"cookies_banner_copy_instructions": "This field accepts markdown",
85100
"top_bar_header": "Top Bar",
86101
"text_label": "Text",
87102
"text_placeholder": "Enter Top Bar Text",
@@ -95,18 +110,7 @@
95110
"disabled": "Disabled",
96111
"always": "Always Visible",
97112
"standalone": "Only Visible in Standalone Mode"
98-
},
99-
"content_signup_header": "Content: Signup",
100-
"content_data_use_header": "Content: Data Use",
101-
"string_signup_terms_header": "Terms & Conditions Header",
102-
"string_signup_terms_one": "Terms & Conditions First Paragraph",
103-
"string_signup_terms_two": "Terms & Conditions Second Paragraph",
104-
"string_data_use_header": "Page Header",
105-
"string_data_use_copy": "Page Copy",
106-
"data_use_copy_instructions": "This field accepts markdown",
107-
"string_cookies_banner_header": "Cookies Banner Header",
108-
"string_cookies_banner_copy": "Cookies Banner Body",
109-
"cookies_banner_copy_instructions": "This field accepts markdown"
113+
}
110114
},
111115
"integrations": {
112116
"header": "External Integrations Settings",

client/src/config/app/locale/en-US/json/shared/page-titles.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"assets": "Assets",
99
"collaborators": "People",
1010
"comments": "Comments",
11+
"content": "Content",
1112
"contents": "Table of Contents",
1213
"dashboard": "Dashboard",
1314
"details": "Details",

client/src/helpers/router/navigation.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ class Navigation {
153153
label: "titles.theme",
154154
route: "backendSettingsTheme"
155155
},
156+
{
157+
label: "titles.content",
158+
route: "backendSettingsContent"
159+
},
156160
{
157161
label: "titles.ingestion",
158162
route: "backendSettingsIngestion"
@@ -531,6 +535,12 @@ class Navigation {
531535
entity: "settings",
532536
ability: "update"
533537
},
538+
{
539+
label: "titles.content",
540+
route: "backendSettingsContent",
541+
entity: "settings",
542+
ability: "update"
543+
},
534544
{
535545
label: "titles.integrations",
536546
route: "backendSettingsIntegrations",

0 commit comments

Comments
 (0)