Commit Graph

133 Commits

Author SHA1 Message Date
Kevin Ansfield
145211d875 Updated route-modal pattern for offer route
no issue

- match the updated pattern used in the `design` route
2021-10-06 09:31:42 +01:00
Kevin Ansfield
715ee08100 Added advanced theme settings modal
refs https://github.com/TryGhost/Team/issues/1111

Extracted functionality for listing, downloading, activating, and deleting from the theme controller/template into separate components and services so that they are more composable/reusable in different situations.

- moved theme activation to a new `theme-management` service that uses the `modals` service to open the theme warnings modal or limits upgrade modal as required
  - the activate process is a task so that consumers can store a reference to the task instance and cancel it to close any related warning/limit modals (eg, when navigating away from the route or closing the modal that kicked off the process)
- created new-pattern modals for custom theme limit upgrade, theme errors, and delete confirmation so that we can treat them as promises and close where needed from parent
- duplicated theme table component as `<GhThemeTableLabs>` with an actions redesign and a refactor to handle download, activation, and deletion itself making use of the new theme-management service and modals
- fixed some oddities with design modal's transition/modal close handling by simplifying the async behaviour and being more explicit
- added advanced design modal that contains the new theme table component and linked to it from footer of design modal's sidebar
2021-10-05 20:44:27 +01:00
Kevin Ansfield
2ca57e7624 Removed unused confirm-leave handling from theme settings screen
no issue

- appears to be left-over from copy/paste of an earlier screen re-structure
- cleaning up for easier extraction of functionality to new screens / modals
2021-10-05 11:37:17 +01:00
Kevin Ansfield
37f721d76a Added centralized object for defining modal classNames
refs https://github.com/TryGhost/Team/issues/559

When modals are re-used across the app it's annoying to have to remember the class names that it uses in every location it's used.

- added a `DEFAULT_MODAL_OPTIONS` object to the modals service that's keyed on the modal to be opened and contains any options that are repeated across every instance
- overrode the `modals.open()` method to merge in the default options before calling `super()`
- updated invocation points of shared modals to remove duplicated class name options
2021-10-05 11:19:52 +01:00
Kevin Ansfield
f0f0498360 Fixed incorrect variable name for membership offer modal
no issue

- opened modal was assigned to `this.customizeModal` but the rest of the code expected `this.offerModal` so correct closing behaviour wasn't gauranteed
2021-10-05 11:09:40 +01:00
Kevin Ansfield
cb24eb3827 Fixed background flicker when opening design modal
refs https://github.com/TryGhost/Team/issues/1111

- added override of the `ember-promise-modals` container component so that it doesn't render the background element when `omitBackground` is passed as an option when opening the modal
- fixes the flicker by not having a dark background transition in whilst the white overlay modal is also transitioning in from transparent->opaque
2021-10-04 18:15:11 +01:00
Kevin Ansfield
63b1e1d385 Dropped intermediate design screen and moved to full-overlay modal
refs https://github.com/TryGhost/Team/issues/1111
refs https://github.com/TryGhost/Team/issues/1103

- moved customize modal from a link on the design screen to the main design screen
- changed modal design to be a full-screen overlay with side bar that emulates standard Admin design
- added toggled groups of settings in sidebar
  - added `{{set-has}}` helper for use in conditionals matching when a Set contains an object
  - added grouping of theme settings
- dropped unfinished advanced/change theme modals
2021-10-04 16:34:28 +01:00
Kevin Ansfield
d10e102de4 Wired up saving of custom theme settings
refs https://github.com/TryGhost/Team/issues/1070

- split select form component into it's own component so it's cleaner when we get to additional setting types
  - added change handler that updates the setting record's value when a new option is selected
- added `.isDirty` to the custom-theme-settings service so we can warn of unsaved changes and revert any changed values when needed
- added save of custom theme settings to the customize design modal's save routine
- added missing `notifications` service import to customize design controller
2021-09-28 16:50:28 +01:00
Peter Zimon
6ee2e48c92 Added static list of offers 2021-09-22 17:23:26 +02:00
Peter Zimon
d8c42876a3 Added base files for Offer modal 2021-09-22 16:10:38 +02:00
Kevin Ansfield
7146d9e09a Added non-functional themes table to advanced theme settings modal
refs https://github.com/TryGhost/Team/issues/1045

- prep for use in static design
- useful for inspecting API output when querying themes
2021-09-20 12:13:51 +01:00
Kevin Ansfield
ff636de268 Added blank change-theme and advanced theme options modals
refs https://github.com/TryGhost/Team/issues/1045

- preparation for static design
2021-09-20 11:05:16 +01:00
Kevin Ansfield
bc746cbe9a Fixed unexpected redirect when navigating away from customize modal
refs https://github.com/TryGhost/Team/issues/1045

If the customize modal is open and you manually changed the URL, on navigating the modal would close and a transition to the manually entered URL would start but then you'd be transitioned back to `settings.design`.

The problem occurs because `beforeModalClose` is always called when the modal closes causing the redirect.

- added a `hasConfirmed` boolean that is set to `true` when leaving the customize route if there are no unsaved changes or the changes have been confirmed
- skipped the unsaved changes check and redirect in `beforeModalClose` when `hasConfirmed` is true
2021-09-17 18:26:58 +01:00
Kevin Ansfield
73139ea6dd Added general/theme tabs to customize design modal
refs https://github.com/TryGhost/Team/issues/1045

- added tabs to the the customise design modal's sidebar for general settings and theme settings
  - copied settings from the existing branding modal plus site description from general settings screen into the general settings tab
  - theme settings tab left blank ready for static design
- `saveTask` put on the controller so that we can access it from the route, allowing us to pause modal closing when navigating away (implementation left for later)
2021-09-17 10:27:53 +01:00
Kevin Ansfield
2b0d1ee357 Fixed customize design route-based modal handling + added unsaved change confirmation
refs https://github.com/TryGhost/Team/issues/559
refs https://github.com/TryGhost/Team/issues/1045

- removed need for `{{will-destroy}}` in the modal template by using `willTransition()` in the route that opened the modal instead
- used the property of new modals acting as promises to implement an unsaved changes confirmation modal
  - added `confirmUnsavedChanges()` method that opens a "are you sure you want to leave?" modal that is treated as a promise. If the modal is closed by the "Leave" button the promise returns true in which case we rollback the unsaved changes. The modal is returned so that other behaviour can use this method and wait for the confirmation result
  - added `willTransition()` route hook that calls `confirmUnsavedChanges()` when there are unsaved changes and will only continue to transition if the "Leave" button is pressed
  - added `beforeClose()` hook to the customize modal when opening so that we can prevent the customize modal from closing when "Stay" is clicked in the confirmation modal
- updated `activate()` hook to store the modal instance so it can be closed later
- updated `deactivate()` hook to call `.close()` on the modal instance rather than using private data/methods on the modals service
2021-09-16 20:26:57 +01:00
Kevin Ansfield
6f4e7c3872 Added blank "Customize" modal to new Design screen
refs https://github.com/TryGhost/Team/issues/1045

- added new `settings.design.customize` route
- used the route's `activate` and `deactivate` hooks to trigger and close the customize modal
- added `modals/design/customize` component that uses the existing branding modal design without it's contents as a base
  - has `{{will-destroy}}` hook that transitions back to the settings screen so the route will update when the modal gets closed
2021-09-14 19:32:07 +01:00
Kevin Ansfield
1ad2c05d37 Bumped eslint-plugin-ghost and fixed linter errors
no issue

- new linting rules that needed fixing:
   - calling `super` in lifecycle hooks
   - no usage of String prototype extensions
2021-07-15 15:27:29 +01:00
Thibaut Patel
dc9c812d9c Renamed isAdmin/isOwner/isAdminOrOwner to reduce confusion
issue https://github.com/TryGhost/Team/issues/857

- The goal is to avoid testing for the owner role only is cases where we should be testing for the owner or admin role
- `isOwner` => `isOwnerOnly`
- `isAdmin` => `isAdminOnly`
- `isOwnerOrAdmin` => `isAdmin` (concerns now both Owner and Admins)
2021-07-12 14:55:56 +02:00
Kevin Ansfield
c646e78fff Made session.user a synchronous property rather than a promise
no issue

Having `session.user` return a promise made dealing with it in components difficult because you always had to remember it returned a promise rather than a model and had to handle the async behaviour. It also meant that you couldn't use any current user properties directly inside getters which made refactors to Glimmer/Octane idioms harder to reason about.

`session.user` was a cached computed property so it really made no sense for it to be a promise - it was loaded on first access and then always returned instantly but with a fulfilled promise rather than the  underlying model.

Refactoring to a synchronous property that is loaded as part of the authentication flows (we load the current user to check that we're logged in - we may as well make use of that!) means one less thing to be aware of/remember and provides a nicer migration process to Glimmer components. As part of the refactor, the auth flows and pre-load of required data across other services was also simplified to make it easier to find and follow.

- refactored app setup and `session.user`
  - added `session.populateUser()` that fetches a user model from the current user endpoint and sets it on `session.user`
  - removed knowledge of app setup from the `cookie` authenticator and moved it into = `session.postAuthPreparation()`, this means we have the same post-authentication setup no matter which authenticator is used so we have more consistent behaviour in tests which don't use the `cookie` authenticator
  - switched `session` service to native class syntax to get the expected `super()` behaviour
  - updated `handleAuthentication()` so it populate's `session.user` and performs post-auth setup before transitioning (handles sign-in after app load)
  - updated `application` route to remove duplicated knowledge of app preload behaviour that now lives in `session.postAuthPreparation()` (handles already-authed app load)
  - removed out-of-date attempt at pre-loading data from setup controller as that's now handled automatically via `session.handleAuthentication`
- updated app code to not treat `session.user` as a promise
  - predominant usage was router `beforeModel` hooks that transitioned users without valid permissions, this sets us up for an easier removal of the `current-user-settings` mixin in the future
2021-07-08 14:54:31 +01:00
ceecko
0b31be4c90 🎨 Added error message from limit service to theme upload
no issue

- Addresses 634d2daa13 (r49241896)
- Uses limit service to display the configured error message
2021-05-26 19:05:19 +02:00
Kevin Ansfield
29dc178261 Removed unused members-payments route
no issue

- stripe connect/disconnect functionality has moved to a modal as part of the new membership screen
- removed `settings/members-payments` route and related route/controller/template files
- updated link to stripe connect in product screen to show an alert as a reminder to update to use the new modal (products screens are not usable for now, they'll be worked on again later)
2021-05-21 08:57:28 +01:00
Kevin Ansfield
686dadbeda Fixed errors when closing portal settings modal
no issue

- added actions for handling close/confirm/cancel of portal settings rather than re-using the route-level leave modal because the portal settings modal does not need any knowledge of the route
- added controller reset that is called when the route is exited to ensure no modals are shown when navigating back to the membership screen
- fixed "cannot set on destroyed" error when portal settings are opened and closed quickly
- removed usage of old `{{action}}` helper - this has been replaced with `{{on}}` and `{{fn}}`
2021-05-17 12:41:21 +01:00
Kevin Ansfield
06ff9dfb10 Fixed unsaved confirmation when leaving membership settings screen
refs bdcbfcb92c

- previous commit missed rename of access route to membership
2021-05-14 15:35:07 +01:00
Kevin Ansfield
7b340929ef Refactored members email settings screen
no issue

- simplified query params as they are only used to display a notification
  - removed all controller knowledge and associated reset behaviour for query params
  - moved notification display from `setupController` to `beforeModel` so the raw query params can be pulled off of the transition object
- removed unused service injections from `<GhMembersEmailSetting>`
- removed unused service injections and properties from members-email controller that were left over from a copy/paste
- converted members-email controller to a native class
- fixed "leave settings" confirmation modal behaviour that wasn't moved across in the the settings screen re-org
2021-05-05 16:59:26 +01:00
Rishabh Garg
2555b70456 Wired new Products settings UI to API data (#1930)
refs TryGhost/Team#627

This updates the new Products settings screens to use real data from API for existing Custom Products and Prices to populate them on UI and allow site owners to edit them.

- List all Products of site and allow editing Product name
- List all Prices for a product and allow editing individual Price names
- Add new Prices on a Product
2021-04-26 23:52:04 +05:30
Rishabh Garg
a544005c1f Wired products data to Product settings screen (#1927)
refs https://github.com/TryGhost/Team/issues/627

Wires the real Products data from API to the mock Product settings screen including Product Prices list as well as opening of edit/new price modals. The new Product setting is still behind the developer experiment flag as is under active development, the changes in this commit only allows readonly data but not save/edit upstream.

Co-authored-by: Fabien O'Carroll <fabien@allou.is>
2021-04-22 22:17:19 +05:30
Kevin Ansfield
89b9f6cfc6 Added unsaved changes modal to members-payments screen
no issue

Unsaved changes handling hadn't been moved across fully to the payments screen when settings were re-jigged meaning changes on the payments screen would make settings dirty and show unsaved changes modal unexpectedly on other screens.

- refactored `members-payments` route to use native classes
- used same unsaved changes pattern as `members-access` route/controller
2021-04-20 17:41:21 +01:00
Kevin Ansfield
1dcc83aad5 Removed unused code from members-payments route
no issue

- unused code was left over from settings re-jig copy and paste
2021-04-20 17:23:20 +01:00
Kevin Ansfield
04760132e9 Moved payment settings access control to route
no issue

- having owner-only access control in the template meant the route was accessible but would show a blank page
- updated access control in the `members-payments` route to redirect admins to the settings index screen and non-admins to the default home screen
2021-04-20 17:08:54 +01:00
Peter Zimon
6ee31e206b Added static components for custom products
- added link to Products in Settings main screen
- added product list page with static content
- added product detail page with static content
2021-04-08 14:40:13 +02:00
Kevin Ansfield
c1904d7d84 Added blank members access settings screen behind dev flag
refs https://github.com/TryGhost/Team/issues/579

- empty screen ready for signup access and default post access level settings to be moved to
- has unsaved settings changes modal ready
2021-03-29 12:49:09 +01:00
Kevin Ansfield
5a8753fb8f Added ability to install free themes directly from GitHub (#1837)
refs https://github.com/TryGhost/Ghost/issues/12608
requires https://github.com/TryGhost/Ghost/pull/12635

- adds `/settings/themes/install` route with `source` and `ref` query params that match the API. Shows a confirmation modal when accessed asking to confirm installation and activation
  - does not allow Casper to be installed
  - warns if installing the theme will overwrite an existing one
  - follows similar process to zip uploads for error handling
- adds install/preview links for Massively in the free themes showcase

Co-authored-by: Sanne de Vries <sannedv@protonmail.com>
2021-02-12 09:19:25 +00:00
Peter Zimon
04d9caefed Updated navigation (#1832)
no issue

Updated settings navigation to a completely redesigned flow for Ghost 4.0 🎉

Co-authored-by: Kevin Ansfield <kevin@lookingsideways.co.uk>
Co-authored-by: Fabien O'Carroll <fabien@allou.is>
Co-authored-by: Rish <zrishabhgarg@gmail.com>
2021-02-02 16:08:06 +00:00
Peter Zimon
679dc3c0d6 Separate theme design (#1831)
* Separated theme and design settings
2021-02-02 16:08:04 +00:00
Peter Zimon
c610d3d072 Moved members settings out of labs 2021-02-02 16:08:04 +00:00
Rishabh Garg
464e601c4d Added new FirstPromoter integration (#1825)
no issue

Adds new FirstPromoter integration on the integrations page. FirstPromoter enables sites to launch their own members referral program, and integration allows Site admins to directly add their FirstPromoter tracking ID in the settings to enable FirstPromoter script on their site.
2021-01-15 20:01:40 +05:30
Peter Zimon
6ecba355eb Moved members settings to new page (#1736)
no refs

Moves members related settings in Labs to its own page to improve the overall UX and make it more consistent with the rest of the Admin.
2020-10-22 16:09:00 +05:30
Rish
eefbb55d84 Added new support and reply-to address for members
no issue

- Adds 2 new email address fields for members in email settings section - support address and reply-to address
- Support address - Is used for member auth emails as well as in themes and Portal for allowing members to contact support.
- Reply-to address - Is used to set `reply-to` address for newsletter emails that allows configuring where member's reply to emails will go
- Disabled from address update for empty value
- Updated success toast message and copy for from/support address update
- Changed section title + description for email addresses
- Added "public" to support email description
2020-08-31 18:10:26 +05:30
Rishabh Garg
01e72dc991 Allowed domain change for members "from" address (#1597)
refs TryGhost/Ghost#11414

- Restructures member settings in labs, from address gets its own section
- Removes explicit site domain for fromAddress as we allow updating the full address
- Adds new CTA to trigger magic link for updating members from address
- Adds new confirmation modal for email sent to new from address
- Adds notification banner for from address update redirect link
2020-06-09 01:52:58 +05:30
Rish
0daf5c1883 Cleaned key regeneration message for Zapier on route change
no issue

- After a successful key regeneration, the success message stayed in Zapier integration even on navigating away to different page, this clears up any message state on away transition
2020-05-06 12:43:29 +05:30
Rishabh Garg
2b961df4cb Added regenerate button to integration api keys (#1562)
no issue

- Adds new regenerate button for refreshing custom integration's admin and content api keys
- Adds new regenerate button for refreshing internal Zapier integration's admin key
- Regenerates content or admin API key after confirmation and shows user new key
2020-05-05 23:44:45 +05:30
Kevin Ansfield
a6c005e5be 🐛 Fixed unexpected "unsaved changes" modals when accessing screens
no issue

We weren't correctly clearing state for the "display modal" booleans when leaving screens. This meant that it was possible to end up in a state where where every time you access a screen you get the unsaved changes modal
2019-12-13 17:09:06 +00:00
Peter Zimon
c51bce7358 🎨 Updated admin area design and usability (#1232)
refs. https://github.com/TryGhost/Team/issues/205

Major update to Ghost Admin UI including:
- improved general consistency (typography, colors and contrast, UI components, icons)
- new design for post and pages lists, improved discoverability of filters 
- search moved to modal
- account menu is decoupled from ghost logo
- further usability fixes
2019-06-18 11:47:20 +01:00
Kevin Ansfield
3653cfbfbf Refactored document-title handler
no issue
- moved `document-title` Route extension's functionality into the `ui` service
  - updates the title each time the router service emits a route changed event
  - `ui.updateDocumentTitle()` can now be called directly from components rather than the confusing `this.send('updateDocumentTitle')` bubbling behaviour
- refactored the `titleToken` implementation to use the now-formalised `RouteInfo`'s `metadata` field (https://github.com/emberjs/rfcs/blob/master/text/0398-RouteInfo-Metadata.md#appendix-a)
2019-05-20 16:16:19 +01:00
Kevin Ansfield
bb7df76af0 Refactored styleBody mixin
no issue
- removed `styleBody` mixin in favour of using Ember's `buildRouteInfoMetadata` hook and router events in the `ui` service
- refactored separate CSS classes for each unauthenticated route into a single `.unauthenticated-route` class because hiding mobile nav whilst unauthenticated was the only use for body classes
2019-05-20 14:57:21 +01:00
Kevin Ansfield
9186c84e64 Removed unused body classes added by using the StyleBody mixin
no issue
- many routes were attaching classes to the `<body>` tag via the `StyleBody` mixin but those classes were never used and applied inconsistently throughout the app
2019-05-20 14:15:46 +01:00
Kevin Ansfield
d0c2caec9e Fixed transition-state deprecation on Integration screen
no issue

- https://deprecations.emberjs.com/v3.x/#toc_transition-state
2019-05-07 14:04:16 +01:00
Kevin Ansfield
b51bc4751d Added integration details to Zapier integration screen behind dev flag
no issue
- the new version of our Zapier App uses API Key auth so we need to expose the details on the Zapier integration screen
- extracted `copyTextToClipboard` into a util function
- added `integrationModelHook` method to `settings.integrations` controller to remove duplication in the `settings.integration` and `settings.integration.zapier` routes
- fixed missing "Zapier" title token
2019-04-04 12:25:16 +01:00
Kevin Ansfield
352c4af1d7 Refactored usage of .get('property') with es5 getters
no issue
- ran [es5-getter-ember-codemod](https://github.com/rondale-sc/es5-getter-ember-codemod)
- [es5 getters RFC](https://github.com/emberjs/rfcs/blob/master/text/0281-es5-getters.md)
- updates the majority of `object.get('property')` with `object.property` with exceptions:
  - `.get('nested.property')` - it's not possible to determine if this is relying on "safe" path chaining for when `nested` doesn't exist
  - `.get('config.x')` and `.get('settings.x')` - both our `config` and `settings` services are proxy objects which do not support es5 getters
- this PR is not exhaustive, there are still a number of places where `.get('service.foo')` and similar could be replaced but it gets us a long way there in a quick and automated fashion
2019-03-06 13:54:14 +00:00
Kevin Ansfield
73daa80b7f Migrate to latest ember, ember-mocha and modern ember testing (#1044)
no issue
- upgrade to latest `ember-source` and related dependencies including `ember-cli`
- upgrade to latest `ember-mocha` and modern ember testing setup
    - https://github.com/emberjs/rfcs/blob/master/text/0268-acceptance-testing-refactor.md
    - switch from using global acceptance test helpers and `native-dom-helpers` to using the new `ember-test-helpers` methods
    - use [`chai-dom`](https://github.com/nathanboktae/chai-dom) assertions where in some places (still a lot of places in the tests that could use these)
- pin `ember-in-viewport` to 3.0.x to work around incompatibilities between different versions used in `ember-light-table`, `ember-infinity`, and `ember-sticky-element`
    - incompatibilities manifested as "Invalid value used as weak map key" errors thrown when using `ember-light-table` (subscribers screen)
- pin `ember-power-datepicker` to unreleased version that contains a move from global acceptance test helpers to modern test helpers
2019-01-02 09:58:55 +00:00