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

142 commits

Author SHA1 Message Date
Kevin Ansfield 37ff17b738 Fix and add tests for Ghost Desktop manual update notification
closes #51
- move the check into the `afterModel` hook so that it's always performed on app load (previously it would only be displayed after going through the sign-in process)
- change the alert type to `warn` so that it matches our existing types (success, warn, error)
- don't rely on the `.htmlSafe()` prototype extension
- add basic tests for the upgrade alert display
2016-06-13 13:40:41 +01:00
Kevin Ansfield bf8c05a990 deps: ember-ajax@2.4.1
no issue
- update ember-ajax
- update error handling to match recommended approach
- update error normalization for handling a returned array of strings
2016-06-06 11:54:15 +01: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 Ansfield fd25213b37 Minor version header fixes
refs #38
- use same version regex as `safeVersion` does on the server
- remove errant `console.log` from store service test
2016-06-03 14:47:47 +01:00
Kevin Ansfield c559bbe572 Add version header to API requests
no issue
- modifies the version info included in `env.APP.version` to only include the `major.minor` version numbers
- update base adapter to include `X-Ghost-Version` header
- update `ajax` service to include `X-Ghost-Version` header
2016-06-03 11:53:29 +01:00
Kevin Ansfield b8dc8c698f Add Gruntfile.js, setup linting task and Travis build
refs #23
- add `grunt lint`
- add lint build to Travis matrix
2016-06-02 17:19:30 +01:00
Kevin Ansfield 3ce26bc347
Improve uploader tests + test subscribers CSV import
no issue
- override `x-file-input` in `gh-file-input` to look for a custom property on the change event if we are in testing mode (this is necessary because Ember 2.5+ use native rather than jQuery events so `target.files` is readonly, see https://github.com/emberjs/ember.js/issues/13540)
- migrate unit tests for the uploader components to the integration tests
- add skipped acceptance tests for the subscribers CSV import now that it's possible to simulate file uploads
2016-05-27 13:34:31 +01:00
Kevin Ansfield 2a16e2ec26 Fix drag-n-drop files from Chrome's download bar
closes #6850
- HTML5 drag-n-drop has some weird inconsistencies around the `dragOver` event where it defaults the "drop" behaviour to nothing so you need to cancel the defaults and override
	- http://stackoverflow.com/questions/19526430/drag-and-drop-file-uploads-from-chrome-downloads-bar
2016-05-18 09:53:10 +01:00
Kevin Ansfield a45c0884c3 Fix unwanted clearing of social inputs on blur with no edits
no issue
- updates the logic to expect `null` scratch values as the scratch values won't be set until the input value has changed
- adds tests for initial value display and regression tests for the cleared input bug
2016-05-17 19:14:14 +01:00
Aileen Nowak 7923641cb1 Fixes error in validation
closes #6826

- refactors the validation of facebook and twitter input field in `general.js` and `user.js` controller
	- Example validations for facebook:
		- `facebook.com/username` will be corrected to the full URL
		- `user` will show error `Your Page name is not a valid Facebook Page name' for `general.js` and `Your Username is not a valid Facebook Username` for `user.js` as the username in facebook has to be at least 5 characters long
		- `twitter.com/username` will be autocorrected to the valid facebook URL incl. the `username`
	- Example validations for twitter:
		- `twitter.com/user_` will be corrected to the full URL
                - `user:99` will show error `Your Username is not a valid Twitter Username`
                - `facebook.com/username` will be autocorrected to the valid twitter URL incl. the `username`
- updates both acceptance tests
- adds further validation for facebook pages in general settings and user. Submitting a url which incl. `/page/` or `/pages/` will now accept any username followed incl. further `/`.
- adds a custom transform `facebook-url-user` which will extract the username (if it's a facebook page, incl. `pages/`) to store only this in the backend
- uses the `twitter-url-user` transform now also for user
2016-05-17 17:44:23 +01:00
Kevin Ansfield 9d522e38b2 Merge pull request #6830 from acburdine/no-show-nav-menu
Don't show the nav menu when on a 404 route and not signed in
2016-05-16 11:01:44 +02:00
Austin Burdine 2f58e17b7e update document title on blog title change
no issue
- force document.title to recompute when the blog title is changed in settings/general
2016-05-15 18:41:28 -06:00
Austin Burdine 6ebaffa041 don't show the nav menu when on a 404 route and not signed in
no issue
- fixes problem when the nav menu would be shown on an error404 route when the user is not logged in
- adds failing test that passes with this change
2016-05-13 19:02:55 -06:00
Kevin Ansfield 6a07a0a985 Fix display of server-provided validation error when adding subscriber
no issue
- make the check for "email" in the server provided error case-insensitive
2016-05-11 19:56:58 +02:00
John O'Nolan bf8571c73c Merge pull request #6764 from TryGhost/subscribe
Subscribers
2016-05-11 13:53:53 +02:00
Kevin Ansfield f69c5125e6 Subscribers: Admin UI updates & fixes
Update for synchronous feature service

Add client-side handling of server-side errors when adding subscribers
- display server-provided error message when we get a server error
- fix the ajax util's `getRequestErrorMessage` method so that it works correctly with Ember's `InvalidError` object instead of the previous request object that it was receiving (*TODO:* this really needs looking at properly so we aren't losing details and Ember Data can do it's stuff)

Styling updates
- proper icon for ascending/descending
- change hover colour to green for "Import CSV" button

Delete subscriber button with confirm modal
- display delete button when hovering over a subscriber row (WARN: really ugly button, styles definitely want looking at)
- show confirm modal when clicking the delete button
- delete subscriber, remove from table, and update total on confirm
2016-05-11 11:22:35 +02:00
Kevin Ansfield 67765897b2 Subscribers: Admin User Interface v1
Initial Subscribers screen
- set up mocked api endpoints
- basic subscribers screen with data loading, infinite scroll

"Add Subscriber" screen
- uses modal to display a new subscriber form
- validates subscriber e-mail address
- moves pagination from route into controller to use filtered/sorted CPs on top of a live-query so that new subscribers are added to the list and the total can be properly managed

TODO:
- there is currently a pretty serious performance issue where the whole table is re-rendered when the live-query is updated. `ember-light-table` doesn't allow for live-binding and has no options to easily manipulate it's rows using an external interface - it's possible to move the page loading into the component so we only render new rows but that leaves it difficult to react to new subscribers being added through the UI. I believe the number of components used within the table is also adding to the performance problems.
  - most likely solution is to drop `ember-light-table` in favour of rendering the table directly - glimmer should do a good job of fast updates even though the underlying array will be completely swapped out

"Import subscribers" screen
- uses modal to display an import subscribers CSV file upload form
- displays upload progress
- displays import stats and reloads subscribers table once import has completed
- adds `gh-file-uploader` component (NB. pared down copy of `gh-image-uploader`, ripe for some refactoring)
- fixes subscribers acceptance test failing because fixtures did not have the labs flag enabled

Unfortunately this doesn't have 100% test coverage as we're limited in how we can simulate file uploads 😞

Fix performance issues with subscribers table
- moves the table definition from the component up to the controller
- switches back to manually manipulating table rows instead of using a live-query

This is a quick-fix in that it allows us to continue using the `ember-light-table` component but it does mean that we lose some flexibility that the live-query gave us. For now it's not much of an issue and it allows us to defer deeper performance/flexibility work until we have a concrete need and requirements.

Hook up Export CSV button
- use a hidden iFrame to trigger the browser to hit the CSV export endpoint and download the file

Re-order subscribers table by clicking column headers
- displays currently sorted column and sort direction
- clicking a column header re-fetches the data from the server with the appropriate query params

Fix scroll triggers for infinite pagination + icon change
- adds a debounce as well as the throttle so that we always get a final scroll trigger once scrolling has stopped
- changes the subscribers icon from the temporary team icon to the mail icon
2016-05-11 10:28:11 +02:00
Kevin Ansfield cf7cf3c9be Improve gh-profile-image tests for #6640
refs #6640
- add `NotFoundError` to ajax service and test against that when catching errors in `gh-profile-image`
- don't use `passthrough` in Mirage for gravatar requests to avoid network calls during testing
- add additional tests for `gh-profile-image` and put the debounced gravatar test back in place
2016-05-09 22:14:12 +02:00
David Balderston d238b82b01 Fix Transparent Background in Gravatar Showing Background Image
Closes #5882

* If a gravatar image is available, remove the default image behind it
* If gravatar image is not available, keep or replace the default image
2016-05-09 22:09:27 +02:00
Aileen Nowak 0f9645f97d Structured Data 3.0
closes #6534
- new input fields in general settings incl. validation
- facebook and twitter as new models in settings.js
- adds values for facebook and twitter to default-settings.js
- adds blog helpers for facebook and twittter
- rather than saving the whole URL, the Twitter username incl. '@' will be extracted from URL and saved in the settings. The User will still input the full URL. After saving the blog setting, the stored Twitter username will be parsed again as the full URL and available in the input field. A custom transform is used for this.
- adding meta fields to be rendered in {{ghost_head}}:
	- '<meta property="article:publisher" content="https://www.facebook.com/page" />' and
	- '<meta name="twitter:site" content="@user"/>'
- adds facebook and twitter to unit test for structured data
- adds unit test for general settings
- adds acceptance test for new input fields in general settings
- adds a custom transform for twitter model to save only the username to the server
- adds unit test for transform
2016-05-08 17:43:59 +02:00
Hannah Wolfe 48fa708b85 Merge pull request #6788 from kevinansfield/synchronous-labs-flags
Synchronous feature service
2016-05-08 13:59:31 +02:00
Aileen Nowak e99569b6f4 Slack integration
closes #6584
- Frontend Changes:
	- adds 'Apps' to Navigation Menu
	- adds 'Slack' as nested page to Apps
	- adds `apps.css`
	- adds `slack-integration` model and uses `slack-settings` custom transform to parse JSON file
	- adds validation for `slack` model
	- adds fixtures and `slack/test` API endpoint to Mirage
	- adds acceptance tests for `apps-test` and `slack-test`
	- adds unit tests for `slack-settings` and `slack-integration`
- Backend Changes:
	- adds API endpoint `slack/test` to send Test Notification
	- adds default-values for slack model
	- sends payload to slack:
		- text: the url of the blogpost / test message
		- icon_url: url to ghost logo
		- username: Ghost
	- adds `slack/index.js` to send webhook to slack if
		- a new post is published (if slack webhook url is saved in settings)
		- user clicks on 'Send Test Notification' in UI
	- adds `slack.init()` to `server.index.js` to add event listener
	- adds unit test for `slack/index`
2016-05-08 12:49:15 +02:00
Kevin Ansfield f05d566a78 Synchronous feature service
supersedes #6773
- update `feature` service and `gh-feature-flag` component to work synchronously rather than async
- use the application route's `afterModel` hook so that settings are loaded before first load
- override `session` service's `authenticate` method to load the settings after successful authentication before any other routes are processed
2016-05-07 15:00:06 +02:00
Kevin Ansfield e2f5889600 Use a custom transform to simplify navigation settings
no issue
- moves the `NavItem` object from the navigation controller to an explicit `NavigationItem` model file
- adds a custom transform `navigation-settings` that transforms the navigation settings JSON string to/from an array of `NavigationItem` objects
- simplifies the `settings/navigation` controller as it no longer has to export it's own internal model and handle serialization and deserialization

This pattern should also help simplify the apps/slack integration code if implemented there.
2016-04-26 12:32:29 +01:00
Kevin Ansfield d4ca5ced75 Don't share errors and hasValidated references between validator instances
no issue
- ensure that each validator instance gets it's own `errors` and `hasValidated` objects
- updates some uses of `ValidationEngine` that were relying on side-effects of the unintended reference sharing
- fixes issue with add subscriber modal displaying an error state after opening if it previously had errors when closing
2016-04-25 10:56:11 +01:00
Austin Burdine d0a2dcba14 allow ember to specify jQuery version
- fix slight acceptance test bug
2016-04-19 14:08:36 -05:00
Austin Burdine 678274ae72 replace gh-selectize with power-select in gh-search-input
refs #6458
2016-04-19 10:55:10 -05:00
Austin Burdine 555a996a41 deps: ember@2.5.0 2016-04-15 00:24:57 -05:00
Hannah Wolfe 1ebe96b284 Merge pull request #6651 from kevinansfield/uploader-js-must-die
Replace jQuery-based uploader.js with ember components
2016-04-14 16:57:57 +01:00
Kevin Ansfield 02e89fbdfc Avoid use of this.attrs for closure actions
no issue
- `this.attrs` is a glimmer-component thing (which doesn't exist in Ghost yet), to avoid confusion we should avoid using it
- https://locks.svbtle.com/to-attrs-or-not-to-attrs
- https://github.com/cibernox/ember-power-select/issues/233#issuecomment-170352572
2016-04-09 10:46:19 +01:00
Kevin Ansfield c7458b2160 deps: ember-suave@2.0.1
no issue
- https://github.com/DockYard/ember-suave/releases/tag/v2.0.0
- fix linting errors arising from new rules
2016-04-08 16:27:24 +01:00
Kevin Ansfield 39a175108b Replace jQuery-based uploader.js with ember components
no issue
- adds `gh-image-uploader` that handles image uploads in a fully ember fashion and with no dependency on `uploader.js`
- adds `gh-image-uploader-with-preview` that can fully replace the old `gh-uploader`
- replace uses of `gh-uploader` in PSM & TSM with `gh-image-uploader-with-preview`
- updates the editor preview image handling to use the new `gh-image-uploader-with-preview` component
- updates the image upload modal to use `gh-image-uploader` (utilises the `saveButton=false` flag which means the preview has to be handled externally to avoid auto-replacement when typing a URL)
- removes all old `uploader.js` related code
- adds custom `RequestEntityTooLargeError` and `UnsupportedMediaTypeError` errors to our `ajax` service
2016-04-05 12:03:20 +01:00
Kevin Ansfield 14a80c12d7 Don't swallow error details in ajax service
no issue
- keep the original `ember-ajax` behaviour rather than returning `false` when we hit an ajax error - we should only be using `normalizeErrorResponse` to normalize our error responses 😉
- ensures our application code has access to the returned status code for ajax errors
2016-04-04 14:19:05 +01:00
David Balderston ebbb22a8f5 Remove Nav Item Placeholder and Set as Base Url Value
Closes #6440

* Removed the `.fake-placeholder`class from the input, test, and css
* On adding a nav item, if the url value has not been set by the user,
then set it to the base url as shown in the input
* If url has been set by the user, just do what it has always done
2016-03-22 07:11:20 -07:00
Kevin Ansfield bcd67e85cb deps: ember-cli@2.4.0 2016-03-01 12:49:28 +00:00
Kevin Ansfield 2d01bb59c8 Refactor the feature service
no issue
- removes the unneeded manual caching of the settings object
- fixes multiple API requests to fetch settings when using the feature service
2016-02-23 15:22:32 +00:00
Kevin Ansfield fed33e7fb4 Merge pull request #6518 from acburdine/ember-cli-take-2
Update ember-cli to 2.3.0
2016-02-19 11:56:47 +00:00
Austin Burdine 8061b71e9f add signin acceptance test
refs #6039
2016-02-16 23:08:24 -06:00
Austin Burdine a69ff85111 deps: ember-cli@2.3.0 2016-02-16 12:32:48 -06:00
Kevin Ansfield 3d51161002 Merge pull request #6486 from acburdine/code-injection-test
Add settings/code-injection acceptance test
2016-02-15 11:07:01 +00:00
Kevin Ansfield a3c00f0071 Merge pull request #6488 from acburdine/labs-test
Add settings/labs acceptance test
2016-02-15 11:05:29 +00:00
Kevin Ansfield c3cb2d8741 Merge pull request #6387 from novaugust/post-deletion
Fix post deletion scroll on content and tag screens
2016-02-15 11:02:42 +00:00
Austin Burdine 71c72c386d improve 404 error handling in post route
closes #6503
- change post route 404 handling to match that of the editor and tag routes
- fix 404 tests
2016-02-14 16:49:57 -06:00
Hannah Wolfe 971afd9042 Merge pull request #6468 from kevinansfield/ember-sortable-nav-items
Replace jquery-ui.sortable with ember-sortable for nav items
2016-02-14 13:44:07 +00:00
Austin Burdine 6e4bea2b9d add settings/labs acceptance test
refs #6039
2016-02-11 09:19:04 -06:00
Austin Burdine 65148f08b3 add settings/code-injection acceptance test
refs #6039
2016-02-11 09:05:48 -06:00
Austin Burdine cd1c8dc743 Add settings/general acceptance test
refs #6039
- adds acceptance tests for settings/general flows
- fixes up mirage settings fixtures
2016-02-11 06:06:38 -06:00
Kevin Ansfield 8aaf2e1356 Replace jquery-ui.sortable with ember-sortable for nav items
refs #6458, closes #6457
- replaces jquery-ui.sortable with ember-sortable for drag-n-drop handling
- moves the "new/blank" nav item out of the nav items list
  - allows it to be excluded from the draggable list
  - cleans up handling of the `navigationItems` array as there's no longer a need to ignore/exclude this extra item
- clears validation errors when typing in the respective field
- adds acceptance test for adding/removing nav items
- improves acceptance test for saving nav items to cover more edge cases
2016-02-09 22:08:21 +00:00
Austin Burdine 438c8a52d9 cleanup feature service error handling 2016-02-09 13:39:15 -06:00