diff --git a/ghost/admin/app/controllers/settings/product.js b/ghost/admin/app/controllers/settings/product.js new file mode 100644 index 0000000000..3a80a394dd --- /dev/null +++ b/ghost/admin/app/controllers/settings/product.js @@ -0,0 +1,37 @@ +import Controller from '@ember/controller'; +import {action} from '@ember/object'; +import {inject as service} from '@ember/service'; +import {task} from 'ember-concurrency-decorators'; +import {tracked} from '@glimmer/tracking'; + +export default class ProductController extends Controller { + @service settings; + + @tracked showLeaveSettingsModal = false; + + leaveRoute(transition) { + if (this.settings.get('hasDirtyAttributes')) { + transition.abort(); + this.leaveSettingsTransition = transition; + this.showLeaveSettingsModal = true; + } + } + + @action + async confirmLeave() { + this.settings.rollbackAttributes(); + this.showLeaveSettingsModal = false; + this.leaveSettingsTransition.retry(); + } + + @action + cancelLeave() { + this.showLeaveSettingsModal = false; + this.leaveSettingsTransition = null; + } + + @task({drop: true}) + *saveTask() { + return yield this.settings.save(); + } +} diff --git a/ghost/admin/app/controllers/settings/products.js b/ghost/admin/app/controllers/settings/products.js new file mode 100644 index 0000000000..f8e81e3dff --- /dev/null +++ b/ghost/admin/app/controllers/settings/products.js @@ -0,0 +1,3 @@ +import Controller from '@ember/controller'; + +export default class ProductsController extends Controller {} diff --git a/ghost/admin/app/router.js b/ghost/admin/app/router.js index b099228274..677e8b7f27 100644 --- a/ghost/admin/app/router.js +++ b/ghost/admin/app/router.js @@ -52,6 +52,11 @@ Router.map(function () { this.route('settings.members-email', {path: '/settings/members-email'}); this.route('settings.members-payments', {path: '/settings/members-payments'}); this.route('settings.code-injection', {path: '/settings/code-injection'}); + + this.route('settings.products', {path: '/settings/products'}); + this.route('settings.product', {path: '/settings/product'}); + this.route('settings.price', {path: '/settings/price'}); + this.route('settings.theme', {path: '/settings/theme'}, function () { this.route('uploadtheme'); this.route('install'); diff --git a/ghost/admin/app/routes/settings/product.js b/ghost/admin/app/routes/settings/product.js new file mode 100644 index 0000000000..56cc7b45b6 --- /dev/null +++ b/ghost/admin/app/routes/settings/product.js @@ -0,0 +1,22 @@ +import AuthenticatedRoute from 'ghost-admin/routes/authenticated'; +import {inject as service} from '@ember/service'; + +export default class ProductRoute extends AuthenticatedRoute { + @service settings; + + model() { + this.settings.reload(); + } + + actions = { + willTransition(transition) { + return this.controller.leaveRoute(transition); + } + } + + buildRouteInfoMetadata() { + return { + titleToken: 'Settings - Products' + }; + } +} diff --git a/ghost/admin/app/routes/settings/products.js b/ghost/admin/app/routes/settings/products.js new file mode 100644 index 0000000000..ea74f0fea4 --- /dev/null +++ b/ghost/admin/app/routes/settings/products.js @@ -0,0 +1,9 @@ +import AuthenticatedRoute from 'ghost-admin/routes/authenticated'; + +export default class ProductsRoute extends AuthenticatedRoute { + buildRouteInfoMetadata() { + return { + titleToken: 'Settings - Products' + }; + } +} diff --git a/ghost/admin/app/styles/app-dark.css b/ghost/admin/app/styles/app-dark.css index 6eb9956915..ef5a222017 100644 --- a/ghost/admin/app/styles/app-dark.css +++ b/ghost/admin/app/styles/app-dark.css @@ -66,6 +66,7 @@ @import "layouts/fullscreen-wizard.css"; @import "layouts/post-preview.css"; @import "layouts/dashboard.css"; +@import "layouts/products.css"; :root { diff --git a/ghost/admin/app/styles/app.css b/ghost/admin/app/styles/app.css index e912c1d343..09f89892b5 100644 --- a/ghost/admin/app/styles/app.css +++ b/ghost/admin/app/styles/app.css @@ -66,6 +66,7 @@ @import "layouts/fullscreen-wizard.css"; @import "layouts/post-preview.css"; @import "layouts/dashboard.css"; +@import "layouts/products.css"; /* ---------------------------✈️----------------------------- */ diff --git a/ghost/admin/app/styles/layouts/main.css b/ghost/admin/app/styles/layouts/main.css index df1a4cbfe2..5ece60d263 100644 --- a/ghost/admin/app/styles/layouts/main.css +++ b/ghost/admin/app/styles/layouts/main.css @@ -1108,6 +1108,10 @@ padding: 0; } +.gh-main-section-block.span-2 { + grid-column: span 2; +} + .gh-main-section-block.with-margin, .gh-main-section-block:not(:last-of-type) { margin-bottom: 32px; @@ -1135,6 +1139,12 @@ border-radius: 3px; } +.gh-main-section-content.bordered { + padding: 24px; + border: 1px solid var(--whitegrey); + border-radius: 3px; +} + .gh-main-section-content.columns-2 { grid-template-columns: 1fr 1fr; grid-column-gap: 40px; @@ -1145,6 +1155,7 @@ grid-column-gap: 24px; } + .gh-main-section-content.grey { background: var(--main-color-content-greybg); } diff --git a/ghost/admin/app/styles/layouts/products.css b/ghost/admin/app/styles/layouts/products.css new file mode 100644 index 0000000000..e4c56b95ff --- /dev/null +++ b/ghost/admin/app/styles/layouts/products.css @@ -0,0 +1,83 @@ +/* Product list */ +.gh-product-list-chevron { + padding-right: 0; +} + +.gh-product-chevron { + display: flex; + align-items: center; + justify-content: flex-end; + color: var(--midgrey); +} + +.gh-product-chevron span { + line-height: 0; +} + +/* Product details */ +.gh-product-details { + display: grid; + grid-template-columns: 2fr 1fr; + grid-gap: 32px; + margin-bottom: 3vw; +} + +.gh-product-details-form { + display: flex; + flex-grow: 1; + align-items: flex-start; + padding-top: 20px !important; +} + +.gh-product-icon-container { + width: unset; + padding-bottom: 0; + margin-bottom: 0; +} + +.gh-product-icon { + display: flex; + align-items: center; + justify-content: center; + background: var(--white); + width: 124px; + height: 124px; + margin-right: 24px; + border: 1px solid var(--whitegrey); + border-radius: 3px; +} + +.gh-product-details-fields { + width: 100%; +} + +.gh-product-description-container { + padding-bottom: 0; + margin-bottom: 0; +} + +.gh-product-details section { + display: flex; + flex-direction: column; + justify-content: stretch; +} + +.gh-product-stat-container { + display: flex; + flex-direction: column; + flex-grow: 1; + border: 1px solid var(--whitegrey); + padding: 24px; + border-radius: 3px; +} + +.gh-product-chart { + color: var(--whitegrey); + border: 1px solid var(--whitegrey); + border-top-color: transparent; + height: 90px; + display: flex; + align-items: center; + justify-content: center; + margin: 12px 0; +} \ No newline at end of file diff --git a/ghost/admin/app/templates/settings.hbs b/ghost/admin/app/templates/settings.hbs index feb2e28c6c..86aeb1df1b 100644 --- a/ghost/admin/app/templates/settings.hbs +++ b/ghost/admin/app/templates/settings.hbs @@ -48,9 +48,16 @@

Configure members usage and default access levels

+ + {{svg-jar "module"}} +
+

Products

+

Set up subscription products and prices

+
+
{{/if}}