Commit Graph

196 Commits

Author SHA1 Message Date
Kevin Ansfield 3a7108c975
Use `filter` instead of `status` and `staticPages` params for post queries (#1025)
no issue
- `staticPages` API param is deprecated in favour of using the `filter` param
- switched `status` query to param to the `filter` param as well for consistency
2018-07-20 11:57:53 +01:00
Kevin Ansfield b2a9e4cdd5 Koenig - Show alert for unsupported browsers
refs https://github.com/TryGhost/Ghost/issues/9724
- add `ember-useragent` package so that we can check the user agent screen for known-incompatible browsers/devices
- show alerts for Edge, mobile browsers, and IE11 when accessing the editor with Koenig enabled
2018-07-10 14:14:08 +01:00
Kevin Ansfield 6e8963778c Resolve ember-infinity InfinityRoute deprecation
no issue
- `ember-infinity` has deprecated it's route mixin in favour of it's new `infinity` service
2018-07-02 14:57:41 +01:00
Abdullah Samman a6efb425c4 Fixed broken loading state on transition between posts in editor (#1021)
closes https://github.com/TryGhost/Ghost/issues/9582
- clear the `post` model on the `editor` controller when swapping models to avoid the editor contents and the editor loading state being displayed simultaneously
2018-06-04 09:46:49 +01:00
Kevin Ansfield faf5b74517 Fixed tests
no issue
- after the ember bump the `signin` route's `deactivate` hook started throwing errors - `Property set failed: object in path "signin" could not be found or was destroyed.`
2018-05-08 12:35:42 +01:00
Kevin Ansfield 8c23d5acef Removed used of `ember-data-filter`
closes https://github.com/TryGhost/Ghost/issues/9591
- swapped use of `store.filter` for a combination `store.peekAll` and CPs to filter the result set
2018-04-30 13:54:09 +01:00
Kevin Ansfield 51bc0c9914 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
Kevin Ansfield 317c30981e Fixed duplicate tokens in app titles
no issue
- the `Settings - Apps` part of the title is already set via the `settings` route
2018-04-30 12:49:14 +01:00
Kevin Ansfield 9d02c6f433 🐛 Fixed 404 handling in admin
refs https://github.com/TryGhost/Ghost/issues/9571
- use `replaceWith` rather than `transitionTo` so that the back button still works and doesn't immediately throw you back to the 404 page
- use the new `router` service to avoid deprecation notices
- update the regex replacements to work with `#` urls
2018-04-30 12:09:30 +01:00
Kevin Ansfield 6a9bede003 Fixed multiple 401s caused by token revocation requests
no issue
- disabled Ember Simple Auth's default token revocation
    - we trigger session invalidation on a 401 which means our token isn't valid so the revoke requests will also fail
- renamed application route's `invalidateSession` to `logout` in order to distinguish it from any ESA methods
    - added the token revocation requests to this action, we can be fairly sure at this point that the current tokens will be valid so the requests will succeed
- added check to `ajax.handleResponse` so that we don't invalidate the session for requests to external services
- removed pointless assertion from the ajax integration test
2018-04-16 17:55:21 +01:00
Kevin Ansfield 1229509033
Fixed authors filter for posts with multiple authors (#993)
no issue
- we need `?filter=authors:foo` to match all posts where `foo` is an author, the previous `?filter=author:foo` will only match posts where `foo` is the primary author
2018-03-27 20:57:59 +01:00
Kevin Ansfield 38b138d759 Use token input to allow selection of multiple authors in PSM
requires https://github.com/TryGhost/Ghost/pull/9426
- fixed default token component display in {{gh-token-input}}
    - if no `tokenComponent` is passed to `{{gh-token-input}}` then it should default to the ember-drag-drop `draggable-object` component but instead it didn't output anything
    - put `draggable-object` in quotes because `{{component}}` needs a component name rather than an object
    - rename `option` attribute to `content` to match the default `{{draggable-object}}` interface
- add embedded `authors` attr to the Post model
    - ensure authors is populated when starting new post
    - add validation for empty authors list
- swap author dropdown for a token input in PSM
- show all post authors in posts list
- update tests for `authors`
  - always provide through an authors array
  - fix mirage serialisation for paginated responses (embedded records were not being serialised)
- unify tags and author inputs design
  - remove highlight of primary tags
  - highlight internal tags
  - remove unnecessary/redundant title attributes on tags
  - use SVG icon for "remove option" button in token inputs
2018-03-27 18:50:52 +01:00
Kevin Ansfield e648de4e7e ESLint fixes for latest eslint-plugin-ember
no issue
2018-03-19 13:05:02 +00:00
Kevin Ansfield d6bdc943d3 🐛 Fixed infinite loading on posts screen (#967)
closes https://github.com/TryGhost/Ghost/issues/9493

- bump `ember-infinity` to 1.0.0-alpha for Ember Data 3.0 support
  - update posts and users routes for change in API
- bump `ember-in-viewport` to 3.0.0 (fixes offset on posts screen with new version of ember-infinity)
2018-03-12 17:43:53 +07:00
Austin Burdine ae3b9f97d9 Contributor Role (#948)
refs https://github.com/TryGhost/Ghost/issues/9314

* added save button for contributor
* hide tag filter & redirect to posts.index if post is published
* update editor controller test to need session service
2018-02-07 10:42:46 +01:00
Kevin Ansfield 51e890b991
Refactor new->edit transition to avoid editor re-renders (#949)
closes TryGhost/Ghost#8287
closes TryGhost/Ghost#8750
- moved all editor model functionality into the new `editor` route+controller
- moved editor template from `editor/edit.hbs` to `editor.hbs`
- refactored `editor` controller and the `editor.new`/`editor.edit` routes to work with a persistent editor rather than a teardown/re-render when transitioning from new->edit
- fixed issue in `{{gh-markdown-editor}}` for `autofocus` behaviour when the component isn't re-rendered
- fixed issue in `{{gh-simplemde}}` that was causing multiple updates to the `value` property when a new value is passed in to the component
- added `{{gh-scheduled-post-countdown}}` component to lower the noise in the editor controller
- removed editor route/controller mixins
- removed the `editor.edit` and `editor.new` controllers
2018-01-17 13:27:37 +00:00
Kevin Ansfield 99dcc96e4c Handle errors thrown during app boot
closes https://github.com/TryGhost/Ghost/issues/9394
- add `application-error.hbs` template so that we show an error screen for errors during app boot
- track the application route loading state so that we can fall back to the default error handling for errors that usually only show an alert
2018-01-12 16:11:46 +00:00
Kevin Ansfield ac16e6504c ESLint: Consistent ember property/method ordering
no issue
- https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/order-in-components.md
- https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/order-in-controllers.md
- https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/order-in-routes.md
2018-01-12 12:17:56 +00:00
Kevin Ansfield 0ef503f23d ESLint: Don't use observers if possible
closes https://github.com/TryGhost/Ghost/issues/8690
- https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/no-observers.md
- remove observers where possible
- move night shift toggle behaviour to the feature service
	- refresh feature service after import to fix stuck night shift toggle
2018-01-12 12:17:56 +00:00
Kevin Ansfield 050f4d99b6 ESLint: Alias model in controllers
no issue
- https://github.com/ember-cli/eslint-plugin-ember/blob/HEAD/docs/rules/alias-model-in-controller.md
- replace `model` with a meaningful property name everywhere possible
- refactor `design` and `general` settings controllers to use a directly injected settings service rather than passing it in as a "model" to be more explicit
2018-01-12 12:17:56 +00:00
Kevin Ansfield 7afb88a0c2 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 63fe1b1a88
🎨 Move "Update available" notification to the About screen (#894)
refs https://github.com/TryGhost/Ghost/issues/5071

Upgrade messages are now shown on the About screen rather than as alerts. Notifications that are marked as `top` or `custom` are still shown as alerts to allow for certain upgrade messages to be given more visibility.

- remove old `upgrade-notification` service
- update the `upgrade-status` service:
  - add a `message` property that contains an upgrade notification if any exists
  - add a `handleUpgradeNotification` method that accepts a Notification model instance and extracts the `notification.message` property into a html safe string for use in templates
- when loading server notifications during app boot, pass notifications that aren't marked as `top` or `custom` to the new `handleUpgradeNotification` method
- update the `about.hbs` template to pull the upgrade message from the `upgradeStatus` service
2018-01-09 14:23:36 +00:00
Kevin Ansfield b8fc5606b8 Added Zapier app with pre-built zap templates list (#943)
no issue

- add Zapier app to Apps screen
- use Zapier's zap template embed widget to list our pre-built templates
2018-01-09 11:36:41 +01:00
Kevin Ansfield f8c7d606c7 Avoid leaking state in Ember objects
no issue
- https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/avoid-leaking-state-in-ember-objects.md
2017-11-25 09:49:49 +00:00
Kevin Ansfield 14aa87ed39 Clean up markdown help toggle
no issue

The markdown help link was removed from the sidebar so the only link to toggle the markdown help modal is now the markdown editor yet we we still had a more general implementation with a confusing pass-through of closure actions.

- move the markdown modal toggle and display into the `{{gh-markdown-editor}}` component
2017-11-24 11:15:59 +00:00
Kevin Ansfield 539f9cabb4
🎨 Added "Featured posts" filter and badge to stories list (#907)
closes https://github.com/TryGhost/Ghost/issues/9234
- add `featured` badge to stories/pages that have the featured flag
- add "Featured posts" to the post type filter dropdown
- simplified badge logic in `{{gh-posts-list-item}}`
2017-11-10 17:36:27 +00:00
Kevin Ansfield 6ee8da83cb Ensure user model is present in willTransition hook 2017-11-07 12:34:39 +00:00
Kevin Ansfield f43e7b3328 Fix duplicated willTransition actions from merge 2017-11-07 12:25:17 +00:00
Eric Ellingson fb246507d3 🐛 Fixed password fields not being cleared when leaving team/user page (#900)
closes TryGhost/Ghost#9174
- Added `willTransition` action which clears the password input fields when transitioning to a new route
2017-11-07 12:20:32 +00:00
Kevin Ansfield ddc7b857b5
Bump ember-ajax dependency (#902)
no issue
- upgrade `ember-ajax` to 3.0.0
- `ember-ajax` [now passes the payload through directly](https://github.com/ember-cli/ember-ajax/releases/tag/v3.0.0) rather than trying to normalize it so all our error handling needed to be updated
2017-11-03 22:59:39 +00:00
Aileen Nowak 6ef4c622ad 🎨 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 72ff75b935
New tags input, drop selectize & jquery-ui deps (#892)
closes https://github.com/TryGhost/Ghost/issues/6458
- swap `ember-sortable` for `ember-drag-drop` in navigation UI
- extract PSM tag input into new `{{gh-psm-tags-input}}`
- add new `{{gh-token-input}}` that wraps `ember-power-select` and `ember-drag-drop` to replicate the previous selectize based tags input
- enhance `{{gh-psm-tags-input}}` behaviour to highlight selected primary tag and show "primary/internal" in selected tag titles
- 🔥 remove `selectize`
- 🔥 remove `jquery-ui`
- 🔥 remove unused `{{gh-navigation}}` component
2017-10-31 09:10:49 +00:00
Kevin Ansfield 238983a5df Match service/controller import to ember-modules-codemod style for consistency
no issue

Automated tools, code generators, and editor integrations are increasingly standardising on the import style used in `ember-modules-codemod`. Our import style differed a little with regards to service/controller injection imports which meant we were starting to see inconsistent naming.
2017-10-30 09:38:01 +00:00
Aileen Nowak 4eff42bdac Match client-side password validation to new server-side rules (#899)
refs TryGhost/Ghost#9150

- added a new validator for password validations that will take care of the rules client side
- Passwort rules added:
   - Disallow obviously bad passwords: 1234567890, qwertyuiop, asdfghjkl; and asdfghjklm
   - Disallow passwords that contain the words "password" or "ghost"
   - Disallow passwords that match the user's email address
   - Disallow passwords that match the blog domain or blog title
   - Disallow passwords that include 50% or more of the same characters: 'aaaaaaaaaa', '1111111111' and 'ababababab' for example.
- When changing the own password, the old password is not affected by the new validations
- Validation are running on
   - setup
   - signup
   - password change in Team - User (only new passwords are validated)
   - passwort reset
2017-10-26 11:02:17 +01:00
Aileen Nowak bbbe6038b2 🎨 Added confirmation dialog when leaving settings screen with unsaved changes (#871)
closes TryGhost/Ghost#8483

- Added a new modal component that gets rendered when leaving general/settings after changes have been done but not saved
- Removed independent saving logic for social URL for consistent UX
2017-10-04 11:49:30 +01:00
Kevin Ansfield c994022511 🐛 Fixed error when navigating to tag from admin search box (#881)
closes https://github.com/TryGhost/Ghost/issues/9074

- remove unused pagination route attrs that were interfering with routing service - these were a pre-1.0 hangover from when the tags screen had infinite scroll
- change `Posts` to `Stories` in the search dropdown for consistency
- add general fix for `adapter returned an array for the primary data of a 'queryRecord' response` deprecations by ensuring that `normalizeResponse` in our application serializer transforms the array we get from the server into a "single" JSON-API response
  - this deprecation was being triggered when loading a tag route directly
- fix `defaultValue` complex object deprecations raised from `Setting.unsplash` attr
2017-10-03 11:54:24 +07:00
Kevin Ansfield 2e12987938 🎨 Enabled Unsplash integration by default (#862)
no issue

- Unsplash integration is enabled by default for all users
- it's no longer necessary to create your own Unsplash application and configure your application ID
2017-09-20 12:19:48 +02:00
Kevin Ansfield d4faa15f46 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 6cb04e4c41 Removed defunct Ghost OAuth code (#848)
refs https://github.com/TryGhost/Ghost/issues/8958

- Ghost OAuth isn't coming back, time for the code to disappear and simply all the things
- fixes the `Usage of router is deprecated` notices that flood the console/test logs when testing
2017-09-04 21:17:04 +02:00
Kevin Ansfield 88449ed639 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 1e3191b811 Unsplash integration
closes https://github.com/TryGhost/Ghost/issues/8859, requires https://github.com/TryGhost/Ghost/pull/8895
- adds Unsplash app to app settings
  - enable/disable toggle
  - validation and testing of Unsplash App ID
  - Unsplash App ID field hidden if provided via Ghost config
  - adds `fetchPrivate` method to `config` service to pull config that requires authentication and updates authentication routines to fetch private config
- adds Unsplash buttons to editor toolbar and `{{gh-image-uploader}}`
  - only present when Unsplash app is enabled
  - opens Unsplash image selector when clicked
  - `{{gh-image-uploader}}` has a new `allowUnsplash` attribute to control display of the unsplash button on a per-uploader basis
- adds Unsplash image selector (`{{gh-unsplash}}`)
  - uses new `unsplash` service to handle API requests and maintain state
  - search
  - infinite scroll
  - zoom image
  - insert image
  - download image
- adds `{{gh-scroll-trigger}}` that will fire an event when the component is rendered into or enters the visible screen area via scrolling
- updates `ui` service
  - adds `isFullscreen` property and updates `gh-editor` so that it gets set/unset when toggling editor fullscreen mode
  - adds `hasSideNav` and `isSideNavHidden` properties
- updates `media-queries` service so that it fires an event each time a breakpoint is entered/exited
  - removes the need for observers in certain circumstances
2017-08-15 16:01:12 +01:00
Kevin Ansfield 0eac658b91 Refactor general UI state into a service
no issue
- moves general UI state control such as menu display, autonav, settings menu, etc into a `ui` service for easier use within components
- no longer required to jump through hoops passing state and actions down from application controller into components
- removes indirect "route" actions in favour of calling actions/methods directly on the `ui` service
2017-08-15 16:01:12 +01:00
Kevin Ansfield 91ac2dee40 🐛 fixed active users list not showing more than 20 users (#806)
closes https://github.com/TryGhost/Ghost/issues/8773
- swap old custom `PaginationMixin` for `ember-infinity`
2017-07-31 17:10:52 +04:00
Kevin Ansfield 9d9d040d7c 🐛 fix loss of editor focus on new post autosave (#798)
refs TryGhost/Ghost#8723
- #795 contained a regression where the body focus was lost during the new->edit transition because at that point `model.isNew` is false
- returns `shouldFocusEditor` code that was removed in #768 (it was assumed the body should _always_ have focus in that PR)
- instant-save if body is edited and the post is new - fixes issue where you could keep typing without any save when body had autofocus
- don't show preview link for new posts - fixes issue where it links directly to the admin endpoint so it would force a refresh
2017-07-21 19:11:24 -04:00
Kevin Ansfield ab41d8b84e 🎨 Focus editor content area by default (#768)
closes TryGhost/Ghost#8525

- always give focus to the editor content area by default when loading the editor
- allow content autosave to work for new posts (it was previously turned off for new posts)
- move transition-on-save behaviour from editor/new controller into the controller mixin's save routine
- cancel background autosave when "are you sure you want to leave?" modal is shown as it can cause the "leave" option to fail because it attempts to delete the post record that can be in flight (plus if we're saving anyway it doesn't make much sense to ask the user  🙈) - this is quite an edge-case as it will only happen if the user makes a content change to a draft post then tries to leave the screen within 3 seconds
- change the editor placeholder text
- wait for any save task to finish before exiting the new post route (fixes infinite loop and popup of "are you sure you want to leave?" modal that is then closed automatically straight away
- add a guard to the `gh-post-settings-menu` component so that if the authors query takes a while we don't end up trying to set a value when the component has already been removed
2017-07-10 17:09:50 +02:00
Kevin Ansfield 9c4ae87d8f 🐛 prevent session sync issues with multiple tabs/refreshes (#772)
refs https://github.com/TryGhost/Ghost/issues/8616

- only refresh tokens on boot if we last refreshed more than 24hrs ago - this should prevent rapidly changing access/refresh tokens when opening new admin tabs or refreshing whilst other tabs are open
- fix token refresh test which was testing it's own behaviour instead of the applications 🙈

This may not be the full solution to the session issues but it closes one potential culprit and should at least reduce token churn which can only help track down the real cause.
2017-07-10 12:18:19 +02:00
Kevin Ansfield e7b378ea05 🚀 supercharge tags performance
closes https://github.com/TryGhost/Ghost/issues/8540
- use `{{vertical-collection}}` in the tags dropdown filter list, opening the dropdown is now virtually instant as it's not attempting to immediately render components for every tag in the list
- remove pagination/infinite scroll from tags screen
- load all tags when accessing the tags screen
  - will pause to show spinner if no tags have previously been loaded
  - if tags exist in the ember data store, show the list immediately and load/update list in the background
- use `{{vertical-collection}}` to render enough tags to fill the scrollable area with a small buffer and use occlusion and element re-use to swap tags in whilst scrolling (suuuuper fast no matter number of tags loaded)
- scroll tags into view when they are selected (keyboard nav now makes a lot more sense)
- tested with 875 tags and 2x/5x CPU throttling with no major slowdowns 🎉
2017-07-07 17:53:08 +01:00
Kevin Ansfield 016d3f882d 🔥 remove content screen keyboard shortcuts
closes https://github.com/TryGhost/Ghost/issues/8662
- removes `k`, `j`, `up`, `down` shortcuts for changing the active post (these were already mostly unusable in 1.0) and the associated `enter` and `ctrl/cmd+backspace` commands for opening and triggering the delete modal respectively
- removes the `c` shortcut for opening the new post screen
2017-07-07 10:37:24 +01:00
Katharina Irrgang 5f43349caa Revert "always give editor content focus by default (#748)" (#755)
This reverts commit c297359923.
2017-06-21 18:28:29 +07:00
Kevin Ansfield c297359923 always give editor content focus by default (#748)
closes https://github.com/TryGhost/Ghost/issues/8525
- always give focus to the editor content area by default when loading
the editor
- change the editor placeholder text
2017-06-19 11:16:09 +01:00