Commit Graph

101 Commits

Author SHA1 Message Date
Aileen Nowak
69ea3ae14f Allow signout in forceUpgrade state 2021-10-28 10:50:00 +02:00
Aileen Nowak
b63a396423 Added handling for forceUpgrade state (#2116)
no issue

- Lapsed trials and subscriptions will set the site's hosting config to `forceUpgrade` in which case a Ghost(Pro) site does not have a valid subscription or trial
- In this state we need to redirect all routes for all staff users to `/#/pro` to ensure the subscription can be put back into an active state
- This commit tackles
    - Route update on startup on the application route level
    - Catching and redirecting all transition (utils routes)
    - Fetching the owner user to pass this information to the Ghost(Pro) app for better communication to non-owner staff users
    - Allowing non-owner users in the force upgrade state to transition to the `/#/pro` route
2021-10-22 12:29:55 +02:00
Kevin Ansfield
6155645a45 🐛 Fixed copy-to-clipboard buttons in Chrome + Firefox
no issue

- the method we used for copying text to the clipboard for older browsers has broken on some newer browsers
- the more modern `navigator.clipboard.writeText` API is now universally supported by our target browsers so we're able to switch to that instead which is working across the board
2021-10-05 15:32:23 +01:00
Sanne de Vries
7a56ded8d0 Updated About/What's new? page (#1872)
Merged About and What's new? page.
2021-09-08 14:00:24 +02: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
3c3b3e6710 Fixed infinite loop when lightening/darkening colors
refs https://github.com/TryGhost/Team/issues/928
refs eed299d1f6

- usage of `color` was incorrect resulting in an infinite loop because the color was not being changed on each iteration
  - `Color().lightness()` adjusts via percentage not exact number
  - `Color().l()` does not return lightness
2021-07-28 19:10:26 +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
3dc4126397 Dropped use of @classic decorator in <GhTokenInput>
no issue

- updated component to be a glimmer component and use full "Octane" syntax
2021-07-12 14:03:48 +01:00
Kevin Ansfield
495e435daf Brought checkboxes back to publish menu recipient selection (#1972)
no issue

Free and Paid are by far the two most common options for email recipients so it makes more sense to have them as very clear options which we felt was not the case with the single token/segment select.

- created a new `<GhMembersRecipientSelect>` component that has individual checkboxes for free/paid/segment and when segment is selected an additional token input for specific labels
- updated draft and scheduled publish menu components to use the `<GhMembersRecipientSelect>`

Co-authored-by: Sanne de Vries <sannedv@protonmail.com>
2021-05-21 18:22:01 +01:00
Rishabh
35612db851 Wired membership tiers UI in new members setting
no refs

- Wired Premium membership UI to existing monthly/yearly prices in the default product
- Wired free membership UI to redirect URI setting
- Updated save to validate settings/errors
2021-05-17 20:06:03 +05:30
Kevin Ansfield
7286ae9fcf 🐛 Fixed link contrast in editor with very light/dark accent colors (#1870)
refs https://github.com/TryGhost/Team/issues/551
refs https://github.com/TryGhost/Ghost/issues/12767#issuecomment-800177254

- calculate contrast color of accent color against light/dark mode background color
- lighten (dark mode) or darken (light mode) the accent color used in the editor to ensure it has enough contrast to be legible
2021-03-18 16:46:38 +00:00
Allan Stromfeldt Christensen
b6bc5e66eb Fixed typos in currency names (#1857) 2021-03-01 10:03:52 +00:00
Peter Zimon
7744a78594 Added currency grouping 2021-02-25 12:09:06 +01:00
Fabien 'egg' O'Carroll
34b2162c32 Added support for 113 new currencies (#1853)
refs https://github.com/TryGhost/Team/issues/473

This list of currencies was compiled by taking the union of the UK and US from
https://stripe.com/docs/currencies and removing all non-decimal currencies, e.g.
Japanese Yen.

The members module does not need any additional logic to handle these currencies,
however we do need to clean up hardcoded currency symbols in favour of using the new
`{{price}}` helper and `Intl.NumberFormat`
2021-02-25 09:47:08 +00:00
Fabien 'egg' O'Carroll
c56ba0c71e Added initial event timeline to dashboard (#1840)
refs https://github.com/TryGhost/Team/issues/469

* Updated stats service to fetch event timeline
* Updated dashboard controller to load events
* Added currency utils
* Added GhEventTimeline component
* Updated dashboard to render GhEventTimeline
2021-02-18 14:17:10 +00:00
Kevin Ansfield
27dadcf1c4 Switched from v3 to canary API
refs https://github.com/TryGhost/Team/issues/221

- we're getting ready for the 4.0 API version so we should be using canary to fully test the changes
- changed from `v3` to `canary` in `utils/ghost-paths.js`
- updated mirage and tests to use `ghostPaths` util so we only need to change the version in one place in the future
2021-02-05 09:12:26 +00:00
Kevin Ansfield
7331f8feed Fixed multiple no-shadow linting errors 2020-06-17 09:35:46 +01:00
Kevin Ansfield
1e77a4c915 Removed <GhDownloadCount>
no issue

- the count.ghost.org service is being shut down
- replaced the fetch+poll component with a hardcoded figure
2020-01-27 09:51:45 +00:00
Kevin Ansfield
7c7c4962f9 Upgraded ember-power-* addons (#1459)
no issue

- bump deps
- adjust usage for breaking changes... 
  - https://github.com/cibernox/ember-power-select/blob/master/CHANGELOG.md#300-beta1
  - https://github.com/cibernox/ember-basic-dropdown/blob/master/CHANGELOG.md#200-beta3
  - https://github.com/cibernox/ember-power-datepicker/blob/master/CHANGELOG.md#070
- update overridden component and template files to match latest addon code
  - switch to class syntax w/decorators
  - adjust for angle bracket syntax
2020-01-15 13:53:51 +00:00
Rishabh Garg
30b2d3a4b3 Switched Admin API version from canary to v3 (#1317)
no issue

- Switches over to new v3 endpoint from canary
2019-09-03 12:40:27 +05:30
Kevin Ansfield
d4f2280a68 Switched Admin API version from v2 to canary (#1291)
no issue

- Ghost-Admin is our primary API client, we should keep it in sync with the canary API branch to dog food our API changes
2019-08-12 09:56:21 +01:00
Kevin Ansfield
4ae9151923 Fix linting errors
refs https://github.com/TryGhost/Ghost-Admin/pull/1274

- fixes errors introduced from upgrading to eslint@6
2019-07-22 11:21:24 +01:00
Kevin Ansfield
0b649eaedd Remove unused files
no issue

- `app/helpers/gh-format-html` is duplicated in `lib/koenig-editor/addon/helpers/sanitize-html` and is not used anywhere else
- `app/helpers/gh-path` is not used anywhere - the API should be returning absolute URLs everywhere so path generation is no longer as necessary within templates
- `app/helpers/is-equal` replaced with `{{eq}}` from `ember-truth-helpers`
- `app/helpers/is-not` replaced with `{{not}}` from `ember-truth-helpers`
- `app/utils/isFinite` is not used anywhere
- `app/utils/titleize` is not used anywhere
2019-07-22 11:06:16 +01:00
Kevin Ansfield
fbda677944 Inline password-generator to fix auto-import issues
no issue

- copies `password-generator` npm module functionality into a utility function because the way it was trying to use the `crypto` core library was tripping up webpack which no longer has `node: true` config set by `ember-auto-import`
2019-06-17 11:47:14 +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
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
f083e8bc59 Removed unnecessary TextField override
no issue
- Ember's TextSupport mixin (used by TextField and TextArea) has had `autofocus` as an `attributeBinding` since 1.5.0 so the override to add it is not necessary
2019-02-11 13:51:10 +00:00
Kevin Ansfield
042aecb7f6 Switch from embor-browserify to ember-auto-import
no issue
- minor reduction in build size. Before/after:
  - `vendor.min.js 3.32 MB (710.66 KB gzipped)`
  - `vendor.min.js 3.29 MB (706 KB gzipped)`
2019-01-22 13:09:38 +00:00
Moritz Schramm
8fcd75de32 🎨 Added post title to document title for easier location with multiple editor tabs (#1072)
closes https://github.com/tryghost/ghost/issues/10088
* added `updateDocumentTitle` action to base route and replace usage of `.send('collectTitleTokens, [])`
* added `.titleToken()` method to editor route to add post title to document title
* called `.send('updateDocumentTitle')` after saving post title in editor controller to keep document title in sync
* updated editor controller test for latest ember-mocha and ember-test-helpers
2019-01-21 11:44:30 +00:00
Fabien O'Carroll
3e5a62309f Use Admin API v2 with session auth (#1046)
refs #9865
- removed all `oauth2` and token-based ESA auth
- added new `cookie` authenticator which handles session creation
- updated the session store to extend from the `ephemeral` in-memory store and to restore by fetching the currently logged in user and using the success/failure state to indicate authentication state
  - ESA automatically calls this `.restore()` method on app boot
  - the `session` service caches the current-user query so there's no unnecessary requests being made for the "logged in" state
- removed the now-unnecessary token refresh and logout routines from the `application` route
- removed the now-unnecessary token refresh routines from the `ajax` service
- removed `access_token` query param from iframe file downloaders
- changed Ember Data adapters and `ghost-paths` to use the `/ghost/api/v2/admin/` namespace
2018-10-05 19:46:33 +01:00
Kevin Ansfield
359fcb0756 Koenig - Pass html card content through sanitiser
refs https://github.com/TryGhost/Ghost/issues/9724
- extract html sanitisation into a Koenig helper `{{sanitise-html}}` (all markdown handling will eventually move into Koenig too)
- render sanitised html in the html card
2018-08-09 14:59:03 +01:00
Kevin Ansfield
7d95d42eda Fixed "Route#router intimate API" deprecation notices
closes https://github.com/TryGhost/Ghost/issues/9603
- don't add a `setTitle` method on the router and instead call `window.document.title` directly so that we don't have to access  `Route#router` (throws deprecation) or `Route#_router` (private and may break without notice)
2018-04-30 13:07:37 +01:00
Austin Burdine
ad5528b078 Remove ember-invoke-action (#978)
closes TryGhost/Ghost#9477
- remove ember-invoke-action in favor of straight function calls
2018-03-20 14:57:59 +00:00
Austin Burdine
2a55c5767f Bower => NPM (#972)
no issue

- Convert validator to an npm dependency
  - clean up validator imports
  - fix validator function imports
  - remove unused validator extensions
- Convert devicejs to an npm dependency
- Convert remaining used bower deps to npm deps
- 🔥 Remove bower & unused bower dependencies
- remove globals imports in favor of direct module imports where possible
2018-03-19 17:56:09 +00:00
Rosco Kalis
f8ebab22ef Remove unused wordCount utility (#971)
issue TryGhost/Ghost#9507
- Removed unused wordCount utility
2018-03-19 09:19:09 +00:00
Kevin Ansfield
a85f5fae35 Switch to eslint-plugin-ghost extending plugin:ghost/ember
no issue
- fix lint errors in lib/gh-koenig
- fix ghost:base eslint errors
- update ember plugin refs, remove ember-suave plugin refs
- remove old jshint refs
- add `lint:js` script
- switch to `eslint-plugin-ghost` extending `plugin:ghost/ember`
2018-01-12 12:17:56 +00:00
Kevin Ansfield
95f60f2340 Remove unused {{gh-datetime-input}} and related helper 2017-11-30 17:06:48 +07:00
Kevin Ansfield
719c2c3c6e use windowProxy to avoid mangling URL during team acceptance tests 2017-11-10 14:27:47 +00:00
Aileen Nowak
34e15f0619 🎨 Added confirmation dialogs when leaving screens with unsaved changes (#891)
closes TryGhost/Ghost#9119, refs TryGhost/Ghost#8483

- Apps - AMP
   - Added `leave-settings-modal` component to Settings - Apps - AMP
- Apps - Slack
   - Added `leave-settings-modal` component to Settings - Apps - Slack
   - Added a `triggerDirtyState` action that will uses a new Array with the input data to trigger the dirty state on the parent settings model
- Apps - Unsplash
   - Added `leave-settings-modal` component to Settings - Apps - Unsplash
   - Used manual tracking of changes with using a custom `dirtyAttributes` property and a `rollbackValue` to manually rollback the `isActive` attribute on the model
- Code injection
   - Added `leave-settings-modal` component to Settings - Code injection
- Design
   - Added `leave-settings-modal` component to Settings - Design (only for navigation model)
   - Used manual tracking of changes with using a custom `dirtyAttributes`
   - Added an additional `updateLabel` action to underlying `gh-navitem` component which gets fired on the `focusOut` event, to detect changes on the label
- Team - User
   - Added `leave-settings-modal` component to Team - User
   - Used manual tracking of changes with using a custom `dirtyAttributes` to track changes in slug and role properties
2017-10-31 15:27:25 +00:00
Kevin Ansfield
b1ae1dbcdd Disable fuzzy auto-linking of URLs in markdown preview (#884)
refs https://github.com/TryGhost/Ghost/issues/8987

- set `linkify-it` `fuzzyLink` option to false so that it only auto-links URLs starting with `http(s)://` or other valid schemes
2017-10-03 12:14:40 +02:00
Kevin Ansfield
b68f52fe0c Upgrade eslint dependencies (#855)
no issue

- bump ember-cli-eslint and eslint-plugin-ember
- fix indentation & "unnecessary escape chars" lint errors
2017-09-11 14:56:11 +07:00
Kevin Ansfield
8362f0cdf0 Remove unwanted String.prototype extensions (#856)
closes https://github.com/TryGhost/Ghost/issues/8958

- `markdown-it-named-headers` pulled in `String.js` despite it not being used which added a lot of String.prototype extensions and caused Ember deprecation notices
- moves the short `markdown-it-named-headers` functionality directly into our app code without using `String.js`
2017-09-11 10:39:22 +07:00
Kevin Ansfield
983110d931 Switched from ember-cli-shims to new module imports (#779)
no issue

- add eslint-plugin-ember, configure no-old-shims rule
- run `eslint --fix` on `app`, `lib`, `mirage`, and `tests` to move imports to the new module imports
- further cleanup of Ember globals usage
- remove event-dispatcher initializer now that `canDispatchToEventManager` is deprecated
2017-08-22 14:53:26 +07:00
Kevin Ansfield
ebc8cc8ed2 ctrl/cmd-shift-i triggers image file dialog (#750)
closes https://github.com/TryGhost/Ghost/issues/8523
- use shortcuts mixin to register `cmd-shift-i` shortcut in
`gh-markdown-editor` that triggers the image insertion dialog
- joins multiple uploaded images with new lines instead of a space for
easier editing post-upload
- add `captureSelection` option to `_openImageFileDialog` so that
insertion shortcut triggered when editor doesn't have focus doesn't
insert at the last focused char position
- if image insertion happens with no cursor position add two newlines
before the inserted image markdown for easier editing (previously it
would be inserted immediately after the last char in the post)
- removes unused `editor-shortcuts.js` file
2017-06-22 13:02:38 +01:00
Kevin Ansfield
7919401ba9 🔥 remove markdown attribute from Post model (#720)
refs https://github.com/TryGhost/Ghost/issues/8479

- remove unused `ed-image-manager` util
- remove `markdown` attribute from Post model
2017-05-30 15:36:42 +02:00
Kevin Ansfield
f8f09dab05 🐛 fix missing meta description preview (#719)
refs #718, refs https://github.com/TryGhost/Ghost/pull/8305

- meta description preview in the PSM was relying on the `html` field which is no longer queried - see #718 and https://github.com/TryGhost/Ghost/pull/8305
- restores live preview that was in LTS but removed whilst implementing mobiledoc because we had no quick way of rendering mobiledoc->text
- adds a boolean argument to the `formatMarkdown` util that can disable the replacement of `<script>` and `<iframe>` tags so that the inserted text isn't rendered when converting HTML to text
2017-05-30 15:07:12 +02:00
Kevin Ansfield
cb59388c5b 💄🐷 sort-imports eslint rule (#712)
no issue

- adds `eslint-plugin-sort-imports-es6-autofix` dependency
  - implements ESLint's base `sort-imports` rule but has a distinction in that `import {foo} from 'bar';` is considered `multiple` rather than `single`
  - fixes ESLint's autofix behaviour so `eslint --fix` will actually fix the sort order
- updates all unordered import rules by using `eslint --fix`

With the increased number of `import` statements since Ember+ecosystem started moving towards es6 modules I've found it frustrating at times trying to search through randomly ordered import statements. Recently I've been sorting imports manually when I've added new code or touched old code so I thought I'd add an ESLint rule to codify it.
2017-05-29 20:50:03 +02:00
Kevin Ansfield
4edebe9f1e use markdown-it for markdown previews (#690)
 use markdown-it for markdown previews

no issue

- replaces SimpleMDE's default `marked` rendering with `markdown-it`
- add ember-browserify and markdown-it plugins
2017-05-15 18:51:19 +02:00