1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00
Commit graph

30 commits

Author SHA1 Message Date
Rish 685cf37490 🐛 Fixed staff profile editing incorrectly showing saved state
closes https://github.com/TryGhost/Ghost/issues/11866

- Adds extra check to task button states if the last task ran was same as the current associated task
- In case of task groups, triggering one task in group also triggered states for other tasks in group
- Editing slug called `updateSlug` task which is part of the same task group as `save` task, which triggered the state for save button
2020-06-22 17:09:37 +05:30
Rish 36fa9dc32c Enabled auto reset state for action buttons
no issue

- By default, action buttons had auto-reset off and reset had to be explicitly set
- Auto reset for action buttons is on by default now, and any button that should not reset should explicitly switch it off
2020-06-04 18:44:38 +05:30
Kevin Ansfield 69e5cdb5e9 Reduced unnecessary waiting in tests
no issue

- fixed `<GhTaskButton>` not resetting after an externally triggered task run such as when pressing Cmd+S
- cleaned up manual timeouts/resets where button reset is now fully handled by `<GhTaskButton>` (these were causing 2.5s waits each time a save occurred in acceptance tests)
- where manual timeouts were required, reduce testing time from >2.5s to 50ms
2020-05-11 11:37:35 +01:00
Kevin Ansfield e6496947c1 Sped up tests by reducing reset button timeout whilst testing
no issue

- tests will wait for everything to settle before continuing or ending so the 2.5sec timeout on task button resets was adding a lot of extra time
- use Ember's environment to see if we're testing and reduce the reset timeout from 2500ms to 50ms
2020-04-23 20:20:19 +01:00
Rishabh Garg 825161422f
💄Updated save buttons to reset state (#1522)
* Updated save buttons to reset state

no issue

Currently the save buttons across Admin don't auto-reset to idle state after success/failure on run which can give false impression once user changes any value. This PR auto-resets the button to idle state after a fixed timeout if no subsequent action is performed as a short term UX improvement.

* Fixed success check for auto reset

* Updated timeout value

* Added explicit save button reset for pages

* Updated save buttons to reset via shortcut

Auto-reset for save buttons wasn't working if not done through manual click on task button previously, this handles by splitting the original save task in controller to handle shortcut saves.

* Updated reset check for only successful tasks

* Added save reset to code-injection and design settings

Co-authored-by: Peter Zimon <peter.zimon@gmail.com>
2020-04-06 16:17:28 +05:30
Kevin Ansfield 855757ffe5
Added default and custom post views (filters) to the admin sidebar (#1474)
no issue

- list custom post views in collapsable sidebar navigation
  - default views: Draft, Scheduled, Published (except for contributors)
  - record expanded/collapsed state of the navigation menus in user settings via new `navigation` service
- adds `customViews` service that manages custom views
  - provides list of default views
  - gives access to "active" custom view based on current route and query params
  - manages loading/saving of custom views to user settings
- show "Add view" button in the content filter when the posts list has been filtered
- show "Edit view" button in the content filter when the posts list filter matches a saved view

Co-authored-by: Peter Zimon <peter.zimon@gmail.com>
2020-01-30 15:35:36 +00:00
Kevin Ansfield f529296129
Migrated to <AngleBracketSyntax /> (#1460)
no issue

Ember is migrating to `<AngleBracketSyntax />` for component invocation, see https://github.com/emberjs/rfcs/blob/master/text/0311-angle-bracket-invocation.md

We were in a half-way situation where some templates used angle bracket syntax in some places, this PR updates templates to use the syntax everywhere.

This simplifies the rules for what template code is referring to...

`<Component>` = a component
`{{helper}}` = a helper (or locally assigned handlebars variable)
`{{this.foo}}` = data on the template backing context (a component/controller)
`{{@foo}}` = a named argument passed into the component that the component backing class has not modified (note: this commit does not introduce any named arguments)

- ran codemod https://github.com/ember-codemods/ember-angle-brackets-codemod on the following directories:
  - `app/templates`
  - `lib/koenig-editor/addon/templates`
- removed positional params from components as angle bracket syntax does not support them
  - `gh-feature-flag`
  - `gh-tour-item`
  - `gh-cm-editor`
  - `gh-fullscreen-modal`
  - `gh-task-button`
- updates some code that was missed in aaf9f88ebc to use explicit this
2020-01-16 15:14:03 +00:00
Kevin Ansfield f25f82879b Removed deprecated usage of this.$() in components
no issue

- converted remaining uses of `this.$()` that I could find over to native DOM
- deprecation is still silenced for now because both `liquid-fire` and `liquid-wormhole` trigger it
2020-01-10 15:12:39 +00:00
Kevin Ansfield 56204d0129 Added confirmation modal and use email model in place of action 2019-11-07 15:56:41 +07:00
Kevin Ansfield 7c66d66551
🎨 Added auto-login to private site when viewing site preview in admin (#1286)
closes https://github.com/TryGhost/Ghost/issues/10995

- when first loading the site preview, if private mode is enabled submit the login form in the background to get the cookie before loading the iframe
- refactors post-authentication preloading to ensure it occurs before post-authentication route hooks are called
- adds `showSuccess` attribute to `<GhTaskButton>` so that when set to `false` it can stay in the running state after "success" to avoid state change flashes whilst waiting for a transition
2019-08-12 09:11:10 +01:00
Kevin Ansfield 0e70ac51b2
Update dependency eslint-plugin-ghost to v0.3.0 (#1247)
no issue

- update dependency `eslint-plugin-ghost` to v0.3.0
  - includes new rules from `eslint-plugin-ember` 6.3.0-6.7.0
- fixed linting failures for new rules
2019-06-24 16:33:21 +01:00
Kevin Ansfield 6a8adfec8c Fixed "Send invitation" button needing to be clicked twice
refs https://github.com/TryGhost/Ghost/issues/7131
- adds `disableMouseDown` flag to `{{gh-task-button}}`
- uses flag for the send invite button so that the focus-out validation on the e-mail input is not triggered before the click event is triggered
2019-03-18 17:56:32 +00:00
Kevin Ansfield e9c7fad302 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 b7a6886d22 🐛 Fixed incorrect username being saved by Safari when signing up via invitation
refs https://github.com/TryGhost/Ghost/issues/9868
- ensure signup task is always initiated via form submit
  - adds `defaultClick` option to `<GhTaskButton>` that allows the click event to bubble
- adds `autocomplete` values to signup form fields that match up to the spec
  - "name/display-name": `name`
  - "email": `username email`
  - "password": `new-password` / `current-password` depending on context
- 🔥 no-longer-relevant hacks for Chrome autocomplete
  - this still doesn't fix Chrome remembering the incorrect username unfortunately. Chrome will always select the input previous to the password that has had actual user input as the "username"
- 🔥 unused `authenticate` task in signup controller
2019-01-31 10:27:40 +00:00
Kevin Ansfield 9dd545cbb5 Fixed submit-on-enter and password manager issues on signup
closes https://github.com/TryGhost/Ghost/issues/9868
- moved submit action to the `<form>` which allowed removal of the per-input enter key handlers
- changed submit button to trigger the form submit
- improved markup for password managers
  - linked labels with inputs
  - changed button to a "submit" type and linked it with the form
  - added hidden email input at the bottom of the form in case password managers do not take disabled inputs into account
2018-09-17 16:03:58 +01:00
Austin Burdine 7bd38066f7 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
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 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 7eefbba69f 💄🐷 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 48c45aa5b1 🐛 fix password change button not showing success state (#659)
closes https://github.com/TryGhost/Ghost/issues/8358

- the change password task was not returning a truthy value on success so you always saw the "X Retry" state
- adds option to pass `idleClass` and `runningClass` to `gh-task-button` - this is so that colour classes can be set in the "base" state without overriding the success/failure colors (some colours would have preference based on the order the colours are defined in the CSS file, eg. setting `gh-btn-red` as a base CSS class would override the `gh-btn-green` that is added after a successful save)
2017-04-19 18:21:47 +02:00
Kevin Ansfield 9795557d5b Fix linting error 🙈 2017-04-14 16:33:46 +01:00
Kevin Ansfield 5c76346cd0 🎨 animated retry icon
refs https://github.com/TryGhost/Ghost/issues/7515
- add a `retry` icon that better matches button text dimensions
- add a spin animation for the retry icon
- use the new retry icon in the default `gh-task-button` template
- add a "restart animation" method to `gh-task-button` so that repeated clicks on a button appear to register the action when local validation means that there's no transition from failed->running->failed
2017-04-14 16:16:52 +01:00
Kevin Ansfield 5fbcd6e4ff 🎨 first pass at animated icons for save-state buttons (#637)
refs https://github.com/TryGhost/Ghost/issues/7515
- adds animated spinner and check SVG icons
- improves SVG sizing/alignment in buttons
- disables old technique of fixing button size because it doesn't work now that buttons have more than a single spinner when running/saved/failed
- fixes broken spinner in `gh-spin-button` components
2017-04-11 16:44:37 +01:00
Kevin Ansfield 34cb65df5c new publish menu and date/time picker (#588)
closes https://github.com/TryGhost/Ghost/issues/8249

- replaces the old split-button publish/schedule/update button with a less confusing menu system
- adds a `{{gh-date-time-picker}}` component that contains a datepicker with separate time input
- replaces the date text input in the post settings menu with `{{gh-date-time-picker}}`
  - disabled when post is scheduled, only way to update a scheduled time is via the publish menu
  - validates date is in the past when draft/published so there's no confusion with scheduling
- displays saving status in top-left of editor screen
- refactor editor (auto)saving processes to use ember-concurrency

Other minor changes:
- adds `post.publishedAtBlog{TZ,Date,Time}` properties to Post model to allow working with `publishedAt` datetime in the selected blog timezone rather than UTC
- adds a `beforeSave` hook to `validation-engine` that is called after successful validation and before the Ember Data save call is made
- adds validation of `publishedAtBlog{Date,Time}` to post validator
- prevent gh-task-button showing last task state on first render
- fixes bug where clicking into and out of the published date input in the PSM without making any changes saves a published date for draft posts
2017-04-11 14:39:45 +01:00
Kevin Ansfield d95b2b1d31 🎨 refactor signin screen to use ember-concurrency & gh-task-button (#571)
refs https://github.com/TryGhost/Ghost/issues/7865
- convert all signin related actions to ember-concurrency tasks and consolidate in the signin controller rather than spread across controller+route
- add `successClass` and `failureClass` params to `gh-task-button` that can be used to override the default success/failure button classes
- prevent clicks on `gh-task-button` from triggering form actions (this behaviour should never be necessary, task buttons should either be separate to the form as in the "forgot?" button or the form action performs the same task and can be triggered by a standard form submit)
2017-03-09 14:48:54 -07:00
Kevin Ansfield bd65c1efd4 success/failure state spinner buttons (#566)
refs https://github.com/TryGhost/Ghost/issues/7515
- changes to `gh-task-button`:
  - can take `buttonText` (default: "Save"), `runningText` ("Saving"), `successText` ("Saved"), and `failureText` ("Retry") params
  - positional param for `buttonText`
  - default button display can be overridden by passing in a block, in that scenario the component will yield a hash containing all states to be used in this fashion:
    ```
    {{#gh-task-button task=myTask as |task|}}
    {{if task.isIdle "Save me"}}
    {{if task.isRunning "Saving"}}
    {{if task.isSuccess "Thank you!"}}
    {{if task.isFailure "Nooooooo!"}}
    {{/gh-task-button}}
    ```
- update existing uses of `gh-task-button` to match new component signature
2017-03-07 10:28:52 -07:00
Kevin Ansfield 0aa8b81ebb de-couple gh-task-button from gh-spin-button 2017-01-20 10:03:38 +00:00
Kevin Ansfield b82d192046 🐛 prevent task-buttons dropping clicks when multiple tasks enqueued simultaneously (#222)
refs https://github.com/TryGhost/Ghost/issues/7255
- adds a `.appear-disabled` CSS class that doesn't prevent pointer events like `.disabled`
- updates `gh-task-button`:
  - use `.appear-disabled` class instead of actually disabling button
  - add check to guard against the button's assigned task being run multiple times whilst the spinner is running

This resolves the [user profile slug issue](https://github.com/TryGhost/Ghost/issues/7255) where clicking the Save button whilst the slug input has focus would only trigger the input's focus-out event due to it immediately disabling the button.
2016-08-24 07:14:36 -06:00
Austin Burdine e772430bd6 Introducing Concurrency (#147)
* deps: ember-concurrency@0.7.8

* initial conversion of post & user actions to e-concurrency tasks

- add task button which handles auto-spinning of e-concurrency tasks
- fix tests
2016-08-11 07:58:38 +01:00