Commit Graph

36 Commits

Author SHA1 Message Date
Katharina Irrgang 68ffa29e31 🐛 fix date with seconds (#753)
closes #8603

- see https://github.com/TryGhost/Ghost/issues/8603#issuecomment-309538395
- see comment in code base
2017-06-20 15:12:57 +07:00
Katharina Irrgang 9069318dba 🎨 rename language to locale and use `en` as default locale (#721)
refs https://github.com/TryGhost/Ghost/pull/8490
2017-05-31 16:01:46 +01:00
Kevin Ansfield 6d9997cccd 🔥 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
Katharina Irrgang 221ca16c67 🎨 use `formats` query param (#718)
refs https://github.com/TryGhost/Ghost/issues/8275
- ask Ghost for `mobiledoc` and `plaintext`
- Ghost returns `html` by default
- use plaintext for `{{subText}}` for posts overview
2017-05-30 10:15:46 +01: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 4b48328e6d SimpleMDE editor (#682)
no issue

* move "save on first change" behaviour into editor controller
* allow TAB events to be specified in keyEvents hash of gh-input
* replace mobiledoc-kit/gh-koenig with a SimpleMDE based editor
    - remove `gh-koenig` in-repo-addon from `package.json` so that test files etc aren't loaded
    - remove `mobiledoc-kit` dependencies
    - extends `gh-editor` to handle file drag/drop
    - adds `gh-uploader` and `gh-progress-bar` components to handle file uploads in a more composable manner
    - adds `gh-simplemde` component that wraps SimpleMDE
2017-05-08 11:35:42 +01:00
Katharina Irrgang 7169a14568 🔥 Adapt image property changes (#661)
refs https://github.com/TryGhost/Ghost/issues/8348, requires https://github.com/TryGhost/Ghost/pull/8364
- rename all image properties
- e.g. author.image --> author.profile_image
- test all image functionality
2017-04-24 18:22:39 +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 5e9e3cd027 switch to ember-cli-moment-shim (#622)
no issue

- preparation for using `ember-pikaday` that utilizes `ember-cli-moment-shim`
- removes usage of `moment` global
- removes custom imports of `moment` and `moment-timezone` libraries
2017-04-05 19:45:35 +02:00
Kevin Ansfield 2f56152dbf 🎨 synchronous settings service
no issue
- adds `settings` service that acts as a proxy to the singular settings model with methods to fetch and reload, also prevents accidentally loading only some settings types which has caused problems in the past
- updates app boot, signin, and signup processes to fetch settings ensuring that any part of the app can grab settings synchronously if needed
- removes `timeZone` service, it's no longer needed as we can grab `settings.activeTimezone` directly
- replaces all store queries for the settings model with appropriate `settings` methods
- refactors `apps/*` routes/controllers, they had become a little convoluted with the way they were dealing with settings and the new service helped to clean that up
2017-03-20 07:43:49 -05:00
Austin Burdine 525e6c85d0 🎨 convert post-settings-menu into a component (#137)
no issue
- cleans up some of the render code
- aligns things with the "ember way"
- move metaTitleScratch and metaDescriptionScratch bindings to post model
2017-03-10 14:30:01 +00:00
Ryan McCarvill bcdf9cea73 renamed to koenig 2017-03-02 09:56:52 +00:00
Austin Burdine b01b8a6324 fix test warnings (#492)
- fix ember-data complex default value returning in post model
- fix mirage returning a user of id 'me' from /user/me
2017-01-13 21:14:54 +00:00
Kevin Ansfield c59f9351f9 Fix inability to write posts as an author (#405)
closes TryGhost/Ghost#7730
- treat `Post.authorID` as a string not a number as it's now an objectid
- update `isAuthoredByUser` method so that author's posts aren't hidden from them
- update the post compare method so that it doesn't try to parse objectids as integers (may need revisiting now that we don't have auto-increment IDs to fall back on)
2016-11-17 20:08:11 +00:00
Kevin Ansfield 4a604ce64f Update code to match eslint rules
no issue
- switch `jscs` and `jshint` inline config to `eslint` config
- fix eslint errors, predominantly in tests where the config now the main app config more closely
2016-11-14 13:26:00 +00:00
Ryan McCarvill c34e0161ff Mobile-Doc based editor (#291)
refs TryGhost/Ghost#7429, requires TryGhost/Ghost#7437

Added Ghost-Editor (based on mobiled doc).
-------------------
- Added mobiledoc editor
- Fixed problems with workflow and auto saves
- Integrated basic toolbar
- Removed all editor related tests, everything bar the most basic acceptance tests will be in the ghost-editor repository.
- Commented out tests which relied on Ember Helpers that are not compatable with mobile-doc, workarounds are inbound shortly.

This is the first integration of ghost-editor. It's styled enough to work, however it is not anywhere approaching something that looks remotely like what the finished thing will be.

Early ALPHA, development build. Tread cautiously.
2016-09-26 15:04:20 +02: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
Austin Burdine a9ce94de9f convert ember imports to ember-cli-shim imports where possible (#95) 2016-06-30 11:21:47 +01:00
Kevin Ansfield ec6c614461 Use Ember.Comparable mixin to sort posts
closes https://github.com/TryGhost/Ghost/issues/7002
- move sorting logic out of the controller and into the Post model

This is a quick attempt at implementing the refactoring referenced in https://github.com/TryGhost/Ghost/issues/7002. The client-side sorting is working but we still have the problem of scheduled posts not appearing in the list until you scroll to the very first published post because the server is returning posts in the wrong order.
2016-06-17 11:33:11 +01:00
Aileen Nowak dd8d3507f0 Renaming date properties to contain `UTC`
closes TryGhost/Ghost#6985

- renames all date properties to end with `UTC`:
	- `publishedAt` in `post` model
	- `createdAt` in `post`, `role`, `subscriber`, `tag` and `user` model
	- `updatedAt` in `post`, `role`, `subscriber`, `tag` and `user` model
	- `unsubscribedAt` in `subscriber` model
	- `lastLogin` in `user` model
- adds `attrs` transforms in matching serializers `post`, `tag` and `user`
- new serializers files for `subscribers` and `role` to add `attr` transforms
- adds unit tests for all serializers
- use two variables in `post-settings-menu` controller to handle blog-timezone adjusted date as well as UTC date
2016-06-17 11:09:21 +02:00
Aileen Nowak 6ce7e14fd7 Scheduler UI
refs TryGhost/Ghost#6413 and TryGhost/Ghost#6870

needs TryGhost/Ghost#6861

- **Post Settings Menu (PSM)**:'Publish Date' input accepts a date from now, min. 2 minutes to allow scheduler processing on the server. Also, there will always be some delay between typing the date and clicking on the 'Schedule Post' button. If the user types a future date for an already published post, the date will be reseted and he sees the message, that the post needs to be unpublished first. Once, the date is accepted, the label will change to 'Scheduled Date'.

- adds a CP 'timeScheduled' to post model, which will return `true` if the publish time is currently in the future.

- **Changes to the button flow in editor**:
- if the the CP `timeScheduled` returns true, a different drop-down-menu will be shown: 'Schedule Post' replaces 'Publish Now' and 'Unschedule' replaces 'Unpublish'.

- Covering the _edge cases_, especially when a scheduled post is about to be published, while the user is in the editor.
	- First, a new CP `scheduleCountdown` will return the remaining time, when the estimated publish time is 15 minutes from now. A notification with this live-ticker is shown next to the save button. Once, we reach a 2 minutes limit, another CP `statusFreeze` will return true and causes the save button to only show `Unschedule` in a red state, until we reach the publish time
	- Once the publish time is reached, a CP `scheduledWillPublish` causes the buttons and the existing code to pretend we're already dealing with a publish post. At the moment, there's no way to make a background-fetch of the now serverside-scheduled post model from the server, so Ember doesn't know about the changed state at that time.
	- Changes in the editor, which are done during this 'status freeze'-process will be saved back correctly, once the user hits 'Update Post' after the buttons changed back. A click on 'Unpublish' will change the status back to a draft.
	- The user will get a regular 'toaster' notification that the post has been published.

- adds CP `isScheduled` for scheduled posts
- adds CP `offset` to component `gh-posts-list-item` and helper `gh-format-time-scheduled` to show schedule date in content overview.
- sets timeout in `gh-spin-button` to 10ms for `Ember.testing`
- changes error message in `gh-editor-base-controller` to be in one line, seperated with a `:`

TODOs:
- [x] new sort order for posts (1. scheduled, 2. draft, 3. published) (refs TryGhost/Ghost#6932)
- [ ] Move posts sorting from posts controller to model and refactor to use `Ember.comparable` mixin
- [x] Flows for draft -> scheduled -> published like described in TryGhost/Ghost#6870 incl. edge cases and button behaviour
- [x] Tests
- [x] new PSM behaviour for time/date in future
- [x] display publishedAt date with timezone offset on posts overview
2016-06-13 17:01:42 +02:00
Austin Burdine 7d693c1f96 internal tags feature
refs TryGhost/Ghost#6165
- change behavior to use 'visibility' property
- add tests
2016-06-13 08:21:41 -06:00
Kevin Ansfield 604fda4348 Update package.json details, rename module to `ghost-admin`
no issue
- updates `package.json` details to better reflect the separation from the `Ghost` package
- update ember config and all import statements to reflect the new `ghost-admin` module name in `package.json`
2016-06-03 16:12:54 +01:00
Aileen Nowak be8b31ec85 Timezones: Always use the timezone of blog setting
closes TryGhost/Ghost#6406

follow-up PR of #2

- adds a `timeZone` Service to provide the offset (=timezone reg. moment-timezone) of the users blog settings
- `gh-datetime-input` will read the offset of the timezone now and adjust the `publishedAt` date with it. This is the date which will be shown in the PSM 'Publish Date' field. When the user writes a new date/time, the offset is considered and will be deducted again before saving it to the model. This way, we always work with a UTC publish date except for this input field.
- gets `availableTimezones` from `configuration/timezones` API endpoint
- adds a `moment-utc` transform on all date attr (`createdAt`, `updatedAt`, `publishedAt`, `unsubscribedAt` and `lastLogin`) to only work with UTC times on serverside
- when switching the timezone in the select box, the user will be shown the local time of the selected timezone
- `createdAt`-property in `gh-user-invited` returns now `moment(createdAt).fromNow()` as `createdAt` is a moment date already
- added clock service to show actual time ticking below select box
- default timezone is '(GMT) Greenwich Mean Time : Dublin, Edinburgh, London'
- if no timezone is saved in the settings yet, the default value will be used
- shows the local time in 'Publish Date'  in PSM by default, until user overwrites it
- adds dependency `moment-timezone 0.5.4` to `bower.json`

---------

**Tests:**

- sets except for clock service in test env
- adds fixtures to mirage
- adds `service.ajax` and `service:ghostPaths` to navigation-test.js
- adds unit test for `gh-format-timeago` helper
- updates acceptance test `general-setting`
- adds acceptance test for `editor`
- adds integration tests for `services/config` and `services/time-zone`

---------

**Todos:**

- [ ] Integration tests: ~~`services/config`~~, ~~`services/time-zone`~~, `components/gh-datetime-input`
- [x] Acceptance test: `editor`
- [ ] Unit tests: `utils/date-formatting`
- [ ] write issue for renaming date properties (e. g. `createdAt` to `createdAtUTC`) and translate those for server side with serializers
2016-06-03 16:23:39 +02:00
Kevin P. Kucharczyk 24cc72cafd Standardise client property names to camelCase
closes #6018
- added keyForAttribute method in application serializer
- override keyForAttribute in settings serializer to not apply camelCase/underscore conversion
- rename under_scored properties to camelCased
2016-01-23 19:12:22 +01:00
Kevin Ansfield e30e178c4f deps: ember-data@2.3.2
no issue
- updates ember-data dependency and switches to direct es6 module import instead of destructuring assignment
- fixes issue with `authenticationFailed` action being called before transitions have finished
2016-01-19 14:36:39 +00:00
Austin Burdine b2c91dd3be cleanup usage of Ember.inject 2016-01-19 07:03:27 -06:00
Kevin Ansfield 7ce3726589 Use es6 across client and add ember-suave to enforce rules
no issue
- add ember-suave dependency
- upgrade grunt-jscs dependency
- add a new .jscsrc for the client's tests directory that extends from client's base .jscsrc
- separate client tests in Gruntfile jscs task so they pick up the test's .jscsrc
- standardize es6 usage across client
2015-11-30 10:41:01 +00:00
Kevin Ansfield fbb92476f0 Ember-cli, Ember, & Ember Data 1.13.x upgrades
closes #5630
- upgrade ember-cli to latest version
- upgrade ember to latest 1.13.x release
- upgrade ember data to latest 1.13.x release
    - update custom adapters and serialisers for new internal JSON-API compatible formats [(docs)][1]
    - update all store queries to use new standardised query methods [(docs)][2]
    - add ember-data-filter addon ready for store.filter removal in ember-data 2.0 [(docs)][3]
- remove use of prototype extensions for computed properties and observers
- consolidate pagination into a single route mixin and simplify configuration

[1]: http://emberjs.com/blog/2015/06/18/ember-data-1-13-released.html#toc_transition-to-the-new-jsonserializer-and-restserializer-apis
[2]: http://emberjs.com/blog/2015/06/18/ember-data-1-13-released.html#toc_simplified-find-methods
[3]: http://emberjs.com/blog/2015/06/18/ember-data-1-13-released.html#toc_ds-store-filter-moved-to-an-addon
2015-10-06 16:09:05 +01:00
Kevin Ansfield 5e303ce07d Fix new tags disappearing in PSM when saving post
closes #5708
- when adding a tag give it a throwaway UUID so that every selected/available tag object has a unique identifier for use with selectize
2015-08-25 23:53:19 +01:00
Jason Williams 3ef1167815 Use Ember.inject instead of needs and initializers
No Issue
- Switches to the newer style of dependency injection.
- Instead of injection Controllers via "needs," use
  Ember.inject.controller().
- Get rid of initializers that were only injecting objects
  into various factories. Converts these objects into Ember.Service
  objects and declaratively inject them where needed via
  Ember.inject.service().  The added benefit to this is that it's no
  longer a mystery where these properties/methods come from and it's
  straightforward to inject them where needed.
2015-05-27 07:41:42 -05:00
cobbspur a64b4d43fc Nuke nprogress
closes #5328

- removes all references to nprogress and loading indicator
2015-05-26 19:24:32 +01:00
Matt Enlow c892a812c2 Add post preview via uuid (/p/:uuid)
Refs #5097

- All drafts will show a preview link (this needs real css)
- Published posts will redirect
- prev/next post helpers only activate on published posts
- Powered by ~10 pints between the two of us (@ErisDS, @novaugust)
2015-04-30 11:57:37 +01:00
Matt Enlow 4e389c9429 Use absolute url for post preview link
Closes #5116
- adds new CP `absoluteUrl` to PostModel
- use `absoluteUrl` in the two places we link previews
- swap out some code for es6 loveliness
2015-04-08 18:58:52 -06:00
Matt Enlow 55472b143f Ember init, bower deps, es6 modules 2015-03-11 12:37:41 -06:00
Matt Enlow 6bbc62d3c2 The great migration (EAK -> ember-cli) 2015-03-11 12:37:41 -06:00
Renamed from models/post.js (Browse further)