Commit Graph

118 Commits

Author SHA1 Message Date
Kevin Ansfield
21f2a58a8a Refactored post email preview modal
refs https://github.com/TryGhost/Team/issues/559
refs https://github.com/TryGhost/Team/issues/1277

- switched modal implementation to the newer promise-modal style
- added `<GhEmailPreviewLink>` component that renders a link that when clicked opens the modal
  - removes the need for templates/controllers to manually handle modal opening/closing and to pass actions down from parents
  - updated all places we were triggering an email preview modal to use `<GhEmailPreviewLink>`
2022-01-25 13:17:05 +00:00
Kevin Ansfield
57b1ab4800 Ran ember-cli-update --run-codemods (#2219)
no issue

- part of ember upgrades
- removed all unnecessary usage of `.get`
- cleaned up imports where we had imports from the same module across multiple lines
- standardized on importing specific computed helpers rather than using `computed.foo`
- switched tests from using `wait()` to `settled()`
2022-01-21 19:25:47 +00:00
Kevin Ansfield
d0f6dd7fef Refactored custom integration creation and limits modals
refs https://github.com/TryGhost/Team/issues/559

- switched to new ember-promise-modals pattern
- removed controller and template in favor of opening modals directly from the route
- removed unused `mousedown` event handlers - they are only necessary when an input blur would trigger validation errors
- fixed Enter key not triggering create action by adding an `{{on-key "Enter"}}` event handler to the name input
- fixed scroll not resetting to top of integrations screens when navigating between them by adding `{{scroll-top}}` element modifier to the main content sections
2022-01-13 13:16:13 +00:00
Kevin Ansfield
6a43cb27c3 Refactored leave-editor confirmation modal
refs https://github.com/TryGhost/Team/issues/559

- switched to new ember-promise-modals pattern
- simplified `willTransition` handling because we can now wait on the promise returned from opening the modal
  - the modal content was changed to use `{{on "click" (fn @close true)}}` on the "leave" button so we can check for that return value for leave confirmation
2022-01-12 10:18:25 +00:00
Kevin Ansfield
d3cebeec50 Refactored search modal
refs https://github.com/TryGhost/Team/issues/559

- changed modal to use new modal pattern
- fixes padding jump when opening due to improved animation behaviour not using duplicated elements
2022-01-11 17:59:48 +00:00
Kevin Ansfield
e8cb144317 Renamed offer modals
no issue

- offer-related modals were split across the top-level `modals` directory and the `modals/offers` directory
- normalized to the `modals/offers` directory
2022-01-11 17:45:10 +00:00
Kevin Ansfield
6a673ce8e1 🐛 Fixed confusing wording change whilst saving in publish confirmation modal
no issue

- after clicking the "Publish and send" button in the publish confirmation modal the post is saved and an email is created which caused the wording to change to automatically switch to the "publish only" state because posts with existing emails can't be sent again
- changed the wording-choice data to be set statically based on data available when the modal is triggered rather than auto-updated based on overall system state
2022-01-04 18:05:34 +00:00
Kevin Ansfield
35c8be787c Changed confirm publish modal wording
refs https://github.com/TryGhost/Team/issues/1169

- switched from "no members" to "0 members"
2021-12-09 12:12:46 +00:00
Kevin Ansfield
8db9bc9f2e Fixed upgrade button not closing modal when attempting theme upload
no issue

- the upgrade button is a link rather than a button so was not triggering the modal's close behaviour
- added an `{{on "click" @close}}` handler to the link. `@close` does not preventDefault so the link's transition will still occur
2021-12-07 14:20:16 +00:00
Kevin Ansfield
98b5506d64 🎨 Added confirmation dialog any time a post/page will be published
refs https://github.com/TryGhost/Team/issues/1169

Previously we were only showing a confirmation dialog if a publish action would trigger an email which was inconsistent and did not instil confidence when publishing.

- replaced old `modal-confirm-email-send` modal with the newer-style `modals/editor/confirm-publish` component
  - updated to handle standard publish in addition to email publish
  - updated copy
  - added "error" state when attempting to send email-only post to no members
- updated publish menu `save` task to open the confirm modal when going from `draft` to `published` or `scheduled`
  - underlying save with email polling moved to `_saveTask` so it can be re-used across `save` task (when not publishing) and when confirming from the modal
2021-12-07 00:18:24 +00:00
Fabien 'egg' O'Carroll
b3d2fb8b96 Allowed popups from email preview to escape sandbox (#2168)
refs https://github.com/TryGhost/Team/issues/1001

Our email newsletter preview is rendered inside of an iframe with
javascript disabled. When opening links from the preview, the new
window/tab inherits this property - which breaks links to twitter.
2021-12-06 18:48:04 +02:00
Kevin Ansfield
0c4f9c8c6a 🐛 Fixed Casper not being installable from themes list
no issue

- fixed typo in the install-theme modal that meant we weren't correctly identifying Casper as the default theme meaning an attempt to install it was made instead of activating it
2021-11-17 22:49:00 +00:00
Kevin Ansfield
5f7c79d04e Fixed "Attempted to handle event deleteRecord on <page:x> .." error
refs https://github.com/TryGhost/Team/issues/1121

Double-clicking the delete button in the confirmation modal could trigger a second attempt to delete the post/page when it had already been deleted resulting in an ugly/incomprehensible error bubbling up.

- added `{drop:true}` to the task instance so it can't be called again whilst it's currently running
- added a guard for `isDeleted` so we don't attempt to destroy an already deleted record
- added a `true` return so the button indicates a successful state rather than an error state whilst the modal is closing
2021-11-16 17:59:59 +00:00
Kevin Ansfield
e289b391f1 🐛 Fixed install of free themes from the marketplace that aren't in the built-in list
no issue

When we were given a source+ref we were using that to find a theme object from the built-in list of marketplace themes and if it wasn't found redirecting to the change-theme screen. That redirect didn't need to happen because we only need the `ref` and can determine the theme name from that.

- passed `ref` through to the install modal as a data argument
- updated install modal to get theme name from passed in theme or extracted from passed in `ref` when theme is not known
- adjusted "isDefaultTheme" so it always checks against Casper rather than using the `ref: 'default'` value from the list of marketplace themes
2021-11-12 12:57:25 +00:00
Kevin Ansfield
f253e2523d Fixed tests expecting old theme settings screen
refs https://github.com/TryGhost/Team/issues/1164

- removed conditional logic for links on settings index now that the old theme settings routes do not exist
- updated error handling test to use new design settings screens
  - modified templates' test attributes to work with new design
- fixed `enableLabsFlag()` test helper error when fixtures have already been loaded
2021-11-10 12:45:26 +00:00
Kevin Ansfield
35bcab00fe 🐛 Fixed preview modal showing outdated content if opened before autosave is triggered
refs https://github.com/TryGhost/Team/issues/609

There's a 3 second timeout before a background save is triggered after the last edit, if the preview modal is opened in that timeframe it would show outdated content.

- added a task that is triggered when the preview modal is opened
  - if a save task is already running it will wait for it to finish
  - otherwise if the post is a draft and the editor has dirty attributes it will trigger a save
- modal shows a loading spinner whilst waiting for the save to finish so the preview contents always match the latest editor changes
2021-11-10 08:55:34 +00:00
Kevin Ansfield
396b99ecb0 Fixed upgrade modal not showing when theme uploads are not allowed
closes https://github.com/TryGhost/Team/issues/1193

- there was a typo in the limits modal component name that is shown when the limits service check fails when opening the upload theme modal
- added acceptance test with associated fix of modal name test selector in the template
2021-11-01 18:35:21 +00:00
Kevin Ansfield
7251b1acac Added acceptance tests for new design screen
no issue

- moved navigation settings tests from old settings/design tests to a separate file and unskipped them
- added happy-path acceptance tests for
  - rendering design screen
  - installing an official theme from the themes list
  - uploading a custom theme
2021-11-01 17:48:49 +00:00
Kevin Ansfield
f6ec42959a Ensured preview iframes always include doctype and html attributes
closes https://github.com/TryGhost/Ghost/issues/13684
refs 7eda410dc3

- ensures any `<DOCTYPE html>` (or equivalent) served when fetching preview html is passed through when replacing iframe contents
- replicates across all previews the fix for missing attributes on the `<html>` element that was put in for the design settings preview - using `documentElement.outerHTML` in place of `documentElement.innerHTML`
2021-10-28 14:53:40 +01:00
Peter Zimon
f76174c4df Fixed redirect of archiving offers 2021-10-22 16:19:58 +02:00
Sanne de Vries
ee0646ce68 Updated design settings sidebar hover states 2021-10-21 16:44:46 +02:00
Peter Zimon
328a59466c Making archive offer button less scary 2021-10-21 13:56:30 +02:00
Sanne de Vries
3f642eeb7c Updated design settings page
- Changed modal copy
- Increased menu transition speed
- Updated sidenav tabs visually
2021-10-20 16:44:54 +02:00
Peter Zimon
24b51d7f77 Copy updates for Offers 2021-10-20 10:10:09 +02:00
Kevin Ansfield
93768ef678 Added navigation back to design settings index after activating uploaded theme
refs https://github.com/TryGhost/Team/issues/1149

- added a `@data.onActivationSuccess` option to the upload-theme modal that if present is called when activation of a theme is completed as part of the upload process
- added a `startThemeUpload()` action to the `change-theme` controller so that we can pass in an `onActivationSuccess` which transitions to the `design.settings.index` screen
- removed unnecessary `@tracked` decorators on class properties that have `store.peekAll('theme')` assigned to them
2021-10-19 19:43:36 +01:00
Kevin Ansfield
a5475f1519 Fixed re-upload of theme not working after deleting
no issue

- if a theme was uploaded with the same name as a previously deleted theme it was not being shown in the themes list, and if activated could not be found/seen as active breaking the design menu
2021-10-19 19:35:03 +01:00
Rishabh
87742482fa Updated copy for archive offer confirmation popup
no refs
2021-10-19 13:38:10 +05:30
Kevin Ansfield
3f0dbb0e8b Added desktop/mobile toggle to view-theme screen
refs https://github.com/TryGhost/Team/issues/1149

- re-used same desktop/mobile toggle that the main design settings screen uses
2021-10-18 17:22:45 +01:00
Kevin Ansfield
8e648420e8 Added Casper to the themes list
refs https://github.com/TryGhost/Team/issues/1149

- added Casper to the hardcoded official themes list with a ref of `'default'` so that the install theme process knows to process it differently
- updated the install-theme modal
  - removed the `willOverwriteDefault` getter because it's a path that can't be reached and is now handled differently
  - changed `installThemeTask` to only perform an activation when a default theme is passed in
2021-10-18 13:02:35 +01:00
Peter Zimon
be5ef010a5 Offers archive/active refinements
- added empty archive screen
- added indication of archive offer on detail page
- set default dropdown style to non-selected
- removed archive button for new offers
2021-10-15 12:49:42 +02:00
Rishabh
2645bb895c Updated copy for archive/reactivate offers
refs https://github.com/TryGhost/Team/issues/1148
2021-10-14 00:53:31 +05:30
Rishabh
667a4b6e78 Added (un)archive button to offer detail screen
refs https://github.com/TryGhost/Team/issues/1136

- adds option to archive/unarchive an offer
- adds new modals for confirmation of archive or unarchive of offer
- wired (un)archiving of offers to API
2021-10-13 21:23:30 +05:30
Sanne de Vries
5767fe0f43 Fixed responsive icons in theme preview not displaying in Chrome 2021-10-13 15:59:14 +02:00
Sanne de Vries
67fa946bff Updated theme preview page 2021-10-13 15:33:53 +02:00
Sanne de Vries
2c173e6212 Updated copy for theme-install modals 2021-10-13 14:57:39 +02:00
Sanne de Vries
34e4add038 Updated advanced section on new themes page 2021-10-13 12:59:49 +02:00
Kevin Ansfield
569e4576d5 Added install+activate process to view theme screen
closes https://github.com/TryGhost/Team/issues/1130

- migrated install theme process to new modal system and changed to install+activate
- added "Use theme" button that opens the new install+activate modal
- when the view theme screen opens the install modal, an `onSuccess` callback is passed which sets a property that will skip closing the install modal when the view theme modal is closed and transitions to the `settings.design` route leaving the "success" modal state on screen
- added a `skipErrors` option to `themeManage.activateThemeTask` so that it can be used from processes that already handle theme errors without opening extra modals on top
2021-10-12 16:47:44 +01:00
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
b2177e636e Fixed enter key not triggering confirm action in delete theme modal
no issue

- added missing key handler
2021-10-12 07:26:18 +01:00
Kevin Ansfield
870cf94b7a Fixed linting error
refs 13f9cb85fa

- `[i]` was left over after switching from `for` to `forEach()`
2021-10-11 19:36:58 +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
42e493bb81 Initial pass at new change theme screen
refs https://github.com/TryGhost/Team/issues/1130

- added link to design sidebar
- dropped change-theme modal and associated route behaviour
- copied basic themes marketplace list into the change-theme controller/template
2021-10-11 17:14:18 +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
Sanne de Vries
de5674ebd4 Updated design page
Refs https://github.com/TryGhost/Team/issues/1130
2021-10-11 15:13:16 +02:00
Rishabh
267889993f Updated shareable offer link UI on list screen
refs https://github.com/TryGhost/Team/issues/1084

- updates shareable offer link UI to to open directly instead of route
- calculates offer url from code and updates in link modal
- wires copy button on link modal
- removes route based link code for modal
2021-10-08 09:28:17 +05:30
Peter Zimon
e244304538 Offer list and detail improvements
- added icon to offer value
- added link popup to list
- renamed "Delete offer" to "Archive offer"
2021-10-07 11:21:53 +02: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
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
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
Peter Zimon
96ec92a47b Update offer details structure
- Added static UI to offer details page
- Deleted offer modal
2021-10-04 15:00:41 +02:00