Commit Graph

300 Commits

Author SHA1 Message Date
Kevin Ansfield
265a19f550 Added initial view-theme modal for installing from themes list
refs https://github.com/TryGhost/Team/issues/1130

- added new route for viewing themes so back/forward buttons can be used
  - takes theme name as a parameter
  - opens a fullscreen modal with an iframe containing the theme demo
- changed installable themes list to link to new route
- swapped `previewUrl` in theme data to point at the real demo rather than the ghost.org demo page
2021-10-12 14:28:05 +01:00
Kevin Ansfield
fee190eb08 Removed unneeded customThemes limit check
no issue

- the first check when uploading a theme is the same as the second but without returning a specific error message so it shouldn't be necessary
2021-10-12 08:27:25 +01:00
Kevin Ansfield
13f9cb85fa Refactored theme upload process and linked from design screens
refs https://github.com/TryGhost/Team/issues/1130

- copied theme upload modal to new modals system and refactored for Octane syntax
  -  updated to use `themeManagement` service rather than passed in actions so the modal-based process can be opened from any screen
  - added default `beforeClose()` for the modal to the modals service so it won't close if an upload is in-progress (defaults were moved directly into the class so it had access to services)
- added `themeManagement.upload` action for triggering the upload modal and providing a central place for limit checks
- added upload-triggering buttons to change-theme and advanced design screens
2021-10-11 19:30:58 +01:00
Kevin Ansfield
595018098d Switched design screen from modals to standard routes
refs https://github.com/TryGhost/Team/issues/1130

- added `ui.contextualNavMenu` property that when set will switch the main nav menu between components, if it's not set then it will show the default "main" menu component
- added `design` menu sub-component of `gh-nav-menu` ready for use via `contextualNavMenu`
  - moved sidebar contents from the design modal into this component
- updated design route to set/reset `ui.contextualNavMenu` to `design` on entering/leaving the route
  - all other design routes are sub-routes so this works across all other design screens
- moved base design modal preview into the `settings/design/index` controller/template
  - using index means that it's the default screen for `/settings/design` but will be automatically replaced by any other `design.x` routes
- moved `design/advanced` modal content into the `settings.design.advanced` controller/template and removed the modal handling from the route
2021-10-11 15:24:46 +01:00
Kevin Ansfield
7eda410dc3 Fixed html attributes not showing in design settings preview
no issue

- by using `innerHTML` we were missing the lang and class attributes on the `<html>` element that are added by themes, breaking things like dark mode
- switching to `outerHTML` includes the `<html>` element and is handled automatically by iframes when writing to the `contentWindow`
2021-10-11 15:03:49 +01:00
Naz
4f3e340c03 Promoted email-only feature to general availability
refs https://github.com/TryGhost/Team/issues/1125

-- Email-only is not considered a general availability feature and can be used without special flags.
- It allows to publish a new post type "email only" that only goes out as an email newletter and is available through an undescoverable URL (does not appear anywhere publicly similarly to preview posts) on the site.
- The new "send" option in the post publishing menu allows to send this new type of post.
2021-10-07 12:07:48 +02:00
Kevin Ansfield
ef97be3ffb Fixed custom theme settings disappearing after save
refs https://github.com/TryGhost/Team/issues/1111

- on saving, `customThemeSettings.settings` was set to the `hasMany` reference on the `customThemeSettingsList` model instance but the model is then immediately unloaded and the reference goes with it
- switched to using `.toArray()` on the hasMany so that we get a stable reference to the `customThemeSetting` model instances
2021-10-05 21:45:11 +01:00
Kevin Ansfield
221db9f11e Fixed design preview and settings not updating when changing theme
refs https://github.com/TryGhost/Team/issues/1111

We now have a situation where we have modals on modals and we've lost the straightforward built-in "Data down, actions up" communication methods that we'd have workaround across nested routes/controllers. The upshot of that is we didn't have a way to trigger a refresh of the preview when a new theme was activated.

- moved the task responsible for fetching preview html from the design modal onto the `theme-management` service and adjusted it to set a tracked `previewHtml` property rather than updating an iframe directly
- added a `<GhHtmlIframe>` component that renders a basic iframe element and updates it's contents each time the `@html` argument changes
- updated design modal preview to use the new iframe component
2021-10-05 21:32:42 +01:00
Kevin Ansfield
640f028ae9 Fixed theme errors modal positioning
refs https://github.com/TryGhost/Team/issues/1111

- missed the modal classes on the newly added modal
2021-10-05 20:49:15 +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
fe48f7ed80 Added utils service with downloadFile() method
no issue

- pattern of downloading a file by creating an iframe and setting the `src` attribute was repeated throughout the codebase and was using a mix of native and jQuery patterns
- added a `utils` service for housing one-off utility methods like this to avoid repetition and mixed patterns becoming more widespread (we want to get rid of jQuery usage)
2021-10-05 14:21:19 +01:00
Kevin Ansfield
bf3a5198e4 Fixed missing return when opening modals
refs 37f721d76a

- change was missed from the previous commit 🤦🏻‍♂️ without it we don't get a modal reference back for managing confirmation and closing behaviour
2021-10-05 11:30:42 +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
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
Fabien O'Carroll
592e3df794 Added Members Filtering feature
no-issue

This adds the ability to apply complex filters to members, as well as to
perform bulk actions on the filtered set, including unsubscribing,
adding & removing labels.
2021-10-01 14:16:28 +02:00
Kevin Ansfield
179855ae38 Fixed unexpected unsaved changes modal when saving custom theme settings
no issue

- `customThemeSettings.settings` was not being updated with the latest models after saving so `customThemeSettings.isDirty` was still reporting `true` even though the save had completed
2021-09-30 16:29:41 +01:00
Aileen Nowak
3ec373e33f Show notifications for overdue subscriptions and exceeded limits
no issue

- Overdue subscriptions: when a subscription is in overdue state, we'd like to inform the customers so that the owner is aware and can take action
- Exceeded limits:
    - Show a warning when the members limit is exceeded so users are aware before trying to publish a post and hitting the limit
    - Allow to redirect directly to a child route in the Ghost(Pro) app, so plan updates get easier
2021-09-30 14:00:32 +01:00
Kevin Ansfield
dab672c7b8 Wired up custom theme settings form to preview updates
refs https://github.com/TryGhost/Team/issues/1097

- added `customThemeSettings.keyValueObject` which returns a plain object with setting values assign to the setting keys on the object
- updated customize modal's preview data generation to use `customThemeSettings.keyValueObject` to assign a JSON-stringified version to the `custom` param on the `x-ghost-preview` header
- updated theme settings `<Select>` component to call the passed through `updatePreview()` action when the value changes
2021-09-30 13:30:06 +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
Kevin Ansfield
1e8e0485e3 Added customThemeSettings service with all-records-in-one save request
refs https://github.com/TryGhost/Team/issues/1070

- adds a `customThemeSettings` service that handles overall setting loading and saving to avoid components having to know any of the intricacies of the model setup
- adds `custom-theme-setting-list` model so that we can save multiple setting records as embedded relations
  - custom adapter ensures requests go to the `/custom_theme_settings` base route as a `PUT` request
  - custom serializer drops the default `models: []` wrapper in the save request data so the format matches the `PUT /settings` endpoint, then converts the response to look like a `custom-theme-setting-list` response
2021-09-28 16:50:28 +01:00
Peter Zimon
01524cb735 Added offers Alpha flag 2021-09-22 13:20:15 +02:00
Kevin Ansfield
4f2af95afe Moved modals service to manual handling of click and escape-to-close
refs https://github.com/TryGhost/Team/issues/559

Click-to-close and escape-to-close functionality in `ember-promise-modals` was deferred to `focus-trap`. For some of our use-cases that wasn't ideal because there was nowhere to hook in if we wanted to abort modal closing for any reason (eg, to show an unsaved changes confirmation)

- bumped the custom fork version of `ember-promise-modals` to allow all focus-trap close-inducing behaviour to be disabled
  - also adds a `beforeClose()` option when opening modals for future use
- changed modals service options that are passed through to `focus-trap` so that all close-inducing behaviour is disabled
- when the first modal is opened add event handlers for clicks and <kbd>Escape</kbd> key presses that should close modals and manually call `.close()` on the top-most modal in the stack
- remove event handlers when the last modal is removed
2021-09-16 20:26:57 +01:00
Rishabh
3bd4336bc4 Added membersActivity labs feature
refs https://github.com/TryGhost/Team/issues/1060

- adds `feature` service flag and toggle to labs section for new `membersActivity` feature
2021-09-16 11:50:25 +05:30
Kevin Ansfield
e795692e6b Added customThemeSettings labs feature
refs https://github.com/TryGhost/Team/issues/1045

- added `feature` service flag and toggle to labs page
2021-09-14 18:35:52 +01:00
Kevin Ansfield
b540d9f066 Removed labs dashboard and feature flag
no issue

The updated dashboard is shelved for now whilst the underlying analytics architecture is improved.
2021-09-14 10:12:16 +01:00
Kevin Ansfield
5ce67c7892 Initial ember-promise-modals implementation
refs https://github.com/TryGhost/Team/issues/559

We want to get rid of our existing modals implementation because it doesn't play well with Glimmer compoments and the animation library it uses is now unmaintained and blocking our Ember.js upgrades.

- installed addon using customised fork
  - fork allows passthrough of `allowOutsideClick` to `focus-trap` so we can allow clicks on dropdowns and other wormholed content inside of a modal
- extended the `modals` service locally so we can customise click-outside-to-close behaviour and tie in with our `dropdowns` service
- set up styles in `modals-new.css`, mostly copied from `modals.css` with a few specific overrides
  - once all modals are converted we can drop the old `modals.css` and rename `modals-new.css`
2021-09-13 13:01:12 +01:00
Aileen Nowak
101b0061b5 Avoided reloading billing iframe
no issue

- Clicking on the Ghost(Pro) item in the navigation would always reload the billing management app and enforcing to fetch all data again, even tho it has been fetched and cached before
- This commit removed loc that replaces the iframe content every time we click on the button
- Renamed `setBillingWindowOpen` to `toggleProWindow` as it's more accurate in its description
- Removed `closeBillingWindow` as it's unused throughout the app
2021-09-10 15:26:42 +01:00
Rishabh
c9f1a6bc48 Added new Tiers feature to Beta features section
refs https://github.com/TryGhost/Team/issues/1026

Tiers is being released as a beta feature with an early-access opt-in flow. Site owners can now opt-in for early access to Tiers feature in Ghost by enabling it from the Beta features section, but note it's a one way door and its not possible to switch it off once enabled. This is to ensure that sites don't break in any unexpected ways once the tiers feature is enabled by switching it off.
2021-09-09 17:08:33 +05:30
Kevin Ansfield
922c304e3b Added "Email call to action" card for an email-only CTA targeting free or paid members (#2080)
refs https://github.com/TryGhost/Team/issues/993

The new editor card allows you to add styled content along with an optional button that will only be visible to free or paid members when the post is emailed. Useful for encouraging free members to sign up to a paid account for example.

- removed labs flag and conditionals to make the feature is available by default
- cleaned up CSS that re-used the `.email-card` class or was referencing `labs`
2021-09-02 13:11:15 +01:00
Kevin Ansfield
4e30da6c70 Added ability to update snippet contents (#2073)
refs https://github.com/TryGhost/Team/issues/1008

To update a snippet, select the content in the editor that you want as your snippet text and click the snippet icon as per creating a snippet. Once the snippet name input shows, start typing the name of an existing snippet to be able to select it for update.

- replaced main snippet input component with the labs component
- removed the feature flag and associated labs screen toggle
- removed original/labs snippet input conditional in the editor
2021-09-01 09:09:40 +01:00
Kevin Ansfield
06e63d371c 🎨 Added ability to upload a feature image by drag and dropping an image file
refs https://github.com/TryGhost/Team/issues/884

Drop-to-upload functionality was lost in the first version of the new feature image uploader inside the main editor area, this adds it back in.

- fixed dropzone flickering issue by switching the event listeners to the capture rather than bubble phase so we can indicate a drag is occurring on the body without each individual drag/drop handler needing to know about it
- moved the event handler init/cleanup to the `ui` service
- moved the event handler init call to the application service as it no longer requires auth to have occurred for access to the labs flag setting
- removed the `featureImgDragDrop` labs flag
2021-08-31 14:21:25 +01:00
Kevin Ansfield
e7501ece33 🎨 Added a "saved" indicator for autosaved draft posts
refs https://github.com/TryGhost/Team/issues/779

For draft posts the editor autosaves after each change but if you didn't see the "Saving..." indicator it wasn't clear what the save status of the post was. The editor will now always show "Saved" when there are no unsaved changes.

- removed indicator from published and scheduled posts because there's no autosave there
- removed the labs flag
2021-08-31 09:57:04 +01:00
Naz
99328ab145 Moved email list check to GA
refs https://github.com/TryGhost/Team/issues/906

- The feature has moved to GA from behind alpha flag. It's skipping the beta phase as it's not needed in this specific situation
2021-08-20 18:09:19 +04:00
Kevin Ansfield
8f21f0d4fa Added pre-filled options to email-cta card's button url input
refs https://github.com/TryGhost/Team/issues/992

- swapped input element for `<GhInputWithSelect>`
- added `config.getSiteUrl()` method for generating front-end URLs including subdomain
- added example suggested URLs to email-cta card to pass as options to button url input
2021-08-20 14:33:30 +01:00
Kevin Ansfield
53c83ffea4 Added snippetReplacements alpha labs feature
refs https://github.com/TryGhost/Team/issues/973

- adds feature flag and labs screen toggle for alpha feature that allows for replacing a snippet's contents without manually deleting and recreating
2021-08-16 10:44:13 +01:00
Rishabh
948934da2d 🐛 Fixed incorrect MRR value on dashboard
closes https://github.com/TryGhost/Team/issues/950

- fixes the mrr value/chart on dashboard when a site has no new mrr events in more than 30 days shown as 0
- adds tests to cover more mrr event scenarios
2021-08-09 17:47:09 +05:30
Kevin Ansfield
cf6ef942a5 Added dashboardTwo labs flag
no issue

- added `dashboardTwo` feature flag and labs screen toggle
- added `dashboard-labs` route with duplicated dashboard controller/template
- added redirect to `dashboard` route so it transitions to `dashboard-labs` when the feature is enabled
2021-08-04 11:22:19 +01:00
Naz
55785d0958 Added toggle for the emailOnlyPosts flag
closes https://github.com/TryGhost/Team/issues/902

- Toggle will control the `emailOnlyPosts` labs flag enabling "email-only posts" feature
2021-08-02 13:32:03 +04:00
Kevin Ansfield
45d4036faf Fixed incorrect text color for accent-color backgrounds for some accent colors
refs https://github.com/TryGhost/Team/issues/928

- text color was being selected based on original rather than adjusted accent color
2021-07-29 15:41:36 +01:00
Kevin Ansfield
0d092c2e32 Switched to extracted @tryghost/color-utils package
refs https://github.com/TryGhost/Team/issues/928

- we want to make use of the same color adjustments and contrast selection for accent colors we use in Admin on the server-side for emails so utility functions have been extracted to an external package
2021-07-29 11:35:15 +01:00
Kevin Ansfield
eed299d1f6 Matched Portal's contrast threshold for white/black text on background color
refs https://github.com/TryGhost/Team/issues/928

- switched to using `color` for color conversion and adjustments rather than maintaining our own limited utils (preparation to extract our own utils to separate library)
- changed contrast threshold for yiq-based contrast adjustment from `128` to `186` to match Portal's current behaviour
2021-07-28 17:14:33 +01:00
Kevin Ansfield
4e0473a93e Added CTA button and URL input to email-cta card
refs https://github.com/TryGhost/Team/issues/927

- added CTA `button and url inputs to email-cta card
- added `textColorForBackgroundColor` color util and used it to add a white/black text color variable that can be used when the accent color is used as a background color
- added `{{hex-adjust}}` helper for modifying lightness and saturation of a hex color
- adjusted inline power-select dropdown styling
2021-07-26 17:03:17 +01:00
Kevin Ansfield
9cfb024a5f Moved adjusted accent color properties to ui service
refs https://github.com/TryGhost/Team/issues/927

- we'll soon need access to adjusted accent colours outside of the application controller so they're now available on the `ui` service
2021-07-26 17:03:17 +01:00
Naz
75f0589fab Added toggle for the email check flag
refs https://github.com/TryGhost/Team/issues/912

- The toggle is needed to experiment with email verification
2021-07-23 20:00:27 +04:00
Rishabh
ad3126b632 Added alpha feature flag for members filtering feature
refs https://github.com/TryGhost/Team/issues/925
2021-07-21 21:21:50 +05:30
Thibaut Patel
a7f47b30b7 Added a feature flag to the oauth login feature
issue https://github.com/TryGhost/Team/issues/614

- Makes the feature confiration more similar to other feature flags
2021-07-20 23:18:45 +02:00
Kevin Ansfield
876c2b6cdd Added first pass at feature image drag+drop uploading
refs https://github.com/TryGhost/Team/issues/884

- add `[data-user-is-dragging]` to `body` element when any drag is occurring so that we can make drop zones active
- added dropzone and drop handling to feature image component
2021-07-16 15:01:00 +01:00
Kevin Ansfield
9bc799258d Fixed more tests
refs 8630be5a87

- referenced commit skipped current user and proxy service population when `skipAuthSuccessHandler` was set but the population is needed during setup
- `skipAuthSuccessHandler` is used for skipping the post-authentication transition rather than skipping all post-auth behaviour so the the post-auth behaviour was reintroduced but put in a guard so we don't try to do it again when it's already been run
2021-07-14 13:15:59 +01:00
Kevin Ansfield
a7dc63cfab Fixed tests
refs 8630be5a87

- referenced commit introduced an early return when invalidating session on a failed ajax request so that error alerts weren't shown when re-authenticating. This had an unintended side-effect of breaking invalidation when not re-authenticating and redirecting to signin screen
2021-07-14 12:55:23 +01:00
Kevin Ansfield
8630be5a87 🐛 Fixed re-authenticate modal not showing when saving in editor
closes https://github.com/TryGhost/Team/issues/865

Ghost now returns a forbidden error rather than an unauthorized error when saving whilst logged out so the session invalidation was not being triggered.

- added forbidden check to ajax service to trigger session invalidation
- added automatic retry of save in editor when re-authenticating
- fixed re-population of user and proxy services when re-authenticating, it's not needed at that point because nothing has been cleared
2021-07-14 12:28:09 +01:00