Commit Graph

2831 Commits

Author SHA1 Message Date
Kevin Ansfield
8826f0e66a 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
Hannah Wolfe
5d3b32a926 Pre-populate setup values from config
no issue
- Check for title, user_name and user_email in the top level of config.
- If they exist, return them as part of the setup check, so that the setup screen can be prepopulated
2016-05-11 19:30:56 +02:00
John O'Nolan
7cd6c786f9 Merge pull request #6764 from TryGhost/subscribe
Subscribers
2016-05-11 13:53:53 +02:00
Hannah Wolfe
1c35fefbb9 Merge pull request #6703 from kevinansfield/6640-tests
Improve `gh-profile-image` tests for #6640
2016-05-11 13:00:19 +02:00
Kevin Ansfield
5b1178c7c5 Fix cmd-s shortcut not saving changes in text fields with focusout
closes #4556
- when <kbd>CMD-S</kbd> is used, if the focused element is an input, trigger it's `focusout` handler then schedule the save action to happen after any actions resulting from the trigger
2016-05-11 11:59:36 +02:00
kirrg001
ec0eeceff0 Subscribers: Move read CSV into separate utility
- split out read CSV function into utility and add tests
- update API response to follow JSONAPI more closely
- update the UI to match the new API response
2016-05-11 11:22:35 +02:00
Kevin Ansfield
755e048f98 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
Hannah Wolfe
2313dab449 Subscribers: router & form helpers
Form:
- add confirm, location & referrer hidden fields
- add script to populate location & referrer
- add helper for creating the email field
- pass through input class and placeholder for email from top level form helper
- rename subscribe_form template & helper as it sounds more natural
- handle success and error cases differently
- improve error message display
- ensure useful data is passed back so that we can show nice messages
- check for honeypot value being filled out
- refactor error handler to set an error and always still render
2016-05-11 10:28:11 +02:00
Kevin Ansfield
83c9270682 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
b505ec18f4 deps: ember-light-table@0.1.9 2016-05-11 10:28:10 +02:00
Kevin Ansfield
e8c337f3f6 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
d8ede94ac6 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
c8d0e25923 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
183e53371f Merge pull request #6788 from kevinansfield/synchronous-labs-flags
Synchronous feature service
2016-05-08 13:59:31 +02:00
Hannah Wolfe
cf99964750 Merge pull request #6802 from kevinansfield/editor-img-perf-makes-me-sad
Fix editor image perf and upload bug
2016-05-08 13:58:54 +02:00
Kevin Ansfield
02b57750cf Fix editor image perf and upload bug
no issue
- ~10x speedup in processing time taken on each keypress when there are many images/image upload components in the editor
  - edit DOM in memory before changing it in the page to avoid double-render
  - keep upload components around and re-assign them on re-render, adding or removing an image will still re-generate everything
- adds a throttle to the preview rendering so that renders don't get queued up
- fixes occasional bug where uploading an image didn't update the markdown correctly due to a timing issue
2016-05-08 12:55:56 +02:00
Aileen Nowak
753f307382 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
2da6673197 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
e32106505a deps: ember-simple-auth@1.1.0-beta.5
no issue
- fixes last remaining 1.1.0 issue, will quite likely be last beta before final release
2016-05-05 12:55:42 +02:00
Austin Burdine
5cc75b1c6c remove unused feature controller 2016-04-28 12:22:54 -05:00
Austin Burdine
ab945b0827 convert more action calls to the ember-invoke-action syntax 2016-04-28 10:34:36 -05:00
Austin Burdine
7332186309 deps: ember-simple-auth@1.1.0-beta.4
- remove related deprecation line in deprecation-workflow.js
2016-04-28 08:34:26 -05:00
Kevin Ansfield
85afbaf38c Merge pull request #6767 from acburdine/ember-2.5.1
deps: ember@2.5.1
2016-04-28 14:18:29 +01:00
Austin Burdine
0017a5ace9 deps: ember@2.5.1
- removes Ember.merge deprecation
2016-04-28 07:15:15 -05:00
Kevin Ansfield
98f92c1444 Don't add trailing slash to end of url with parameters
no issue
- updates the `TrailingHistory` locationType so that trailing slashes aren't added to the end of URLs with parameters but instead matches how the server-side redirects to trailing-slash URLs
- before: `/subscribers?order=created_at/`
- after: `/subscribers/?order=created_at`
2016-04-28 12:42:03 +01:00
Kevin Ansfield
50d1737a25 Merge pull request #6748 from acburdine/closure-actions-readability
Use ember-invoke-action for closure action handling
2016-04-28 10:12:24 +01:00
Austin Burdine
6e29b546f7 deps: ember-invoke-action@1.3.0
no issue
- replace instances of `this.get('action')()` with ember-invoke-action syntax
2016-04-26 16:32:17 -05:00
Kevin Ansfield
0e2f4ea33e 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
983c708ece 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
4a5c7d953e lock jquery-deparam version 2016-04-20 06:18:47 -05:00
Austin Burdine
692d3afc39 deps: password-generator@2.0.2 2016-04-20 06:17:44 -05:00
Austin Burdine
2cbe3546be allow ember to specify jQuery version
- fix slight acceptance test bug
2016-04-19 14:08:36 -05:00
Austin Burdine
eb2e369326 replace gh-selectize with power-select in gh-search-input
refs #6458
2016-04-19 10:55:10 -05:00
Austin Burdine
4b7c00d19e deps: ember-power-select@0.9.2 2016-04-19 10:25:58 -05:00
Austin Burdine
eae02d410a Merge pull request #6735 from kevinansfield/improve-pagination-mixin
Improve `PaginationRoute` mixin
2016-04-19 10:20:08 -05:00
Kevin Ansfield
5f7bd12eec Improve PaginationRoute mixin
no issue
- returns the promise/result from `loadNextPage` so that it's return value can be utilised in closure actions
- sets the `isLoading` property in `loadFirstPage` to match `loadNextPage` behaviour
- reset the `isLoading` property even if the request fails
- adds a `didReceivePaginationMeta` hook so that consumers of the mixin can use the metadata values without having to rely on observers
  - eg. pulling the `total` into a separate property that can be manipulated when items are added/removed but still reset to the sever's total value the next time a page is loaded
- renames the `pagination-route` mixin to simply `pagination` as it's not tied to routes and works equally well in other objects that need to paginate an API resource
2016-04-19 10:53:45 +01:00
Kevin Ansfield
cc04ad2a58 deps: ember-one-way-controls@0.6.2
no issue
- https://github.com/DockYard/ember-one-way-controls/compare/v0.5.4...v0.6.2
- bugfixes
- dynamic attribute binding (attributes no longer need to be explicitly defined in the components in order to be recognised)
- adds `one-way-radio` component
2016-04-19 10:22:29 +01:00
Austin Burdine
cce23ca6e9 deps: ember-cli@2.5.0 2016-04-17 20:05:42 -05:00
Austin Burdine
c118a7d71b deps: ember-data@2.5.2 2016-04-15 00:32:57 -05:00
Austin Burdine
e07a3f4145 deps: ember@2.5.0 2016-04-15 00:24:57 -05:00
Hannah Wolfe
159d729855 Merge pull request #6714 from kevinansfield/allow-mocked-endpoints-in-dev
Enable ability to mock endpoints in development mode
2016-04-14 19:12:43 +01:00
Hannah Wolfe
a2a825bfe9 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
2e66f53a4b Enable ability to mock endpoints in development mode
no issue
- moves existing mirage config into the `testConfig()` function to retain full mocks during testing
- configure mirage to passthrough all requests when in development mode
2016-04-14 15:26:39 +01:00
Kevin Ansfield
490f2bae16 Fix redirect to posts list when saving a new post as an author
no issue
- replace deprecated `normalizeHash` with `normalize` in post serializer
- ensure we check for both `post` and `posts` properties as it will vary depending on the expected response type
2016-04-13 12:28:11 -05:00
Austin Burdine
0f39b4c53c fix leave editor modal
no issue
- following up from 6680, fixes a missing set of parentheses
2016-04-12 14:04:59 -05:00
Jeff Jewiss
600276bd56 Saves post title on focus blur if status is draft
Closes #6656
- adds an action to update the title
- checks if the post title has changed and is a draft and sends a silent + background save action
- includes the action on the focus-out event on the post title
2016-04-10 21:47:28 -04:00
Austin Burdine
89a86249f5 Merge pull request #6694 from jaswilli/bind
Remove Function.bind polyfill
2016-04-10 00:53:19 -05:00
Jason Williams
63ba8a1031 Remove Function.bind polyfill
- Not used anymore, and phantomjs 2 has a native .bind
2016-04-09 13:06:54 -05:00
Kevin Ansfield
0c136a5a23 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
Hannah Wolfe
d542ae86df Merge pull request #6690 from kevinansfield/ember-suave-2-0
deps: ember-suave@2.0.1
2016-04-08 23:05:51 +01:00