6e0be9e175
refs https://github.com/TryGhost/Team/issues/1441 - switched "leave settings" confirmation modal on members email settings screen over to modern modal pattern - removed unused `showEmailDesignSettings` property and `closeEmailDesignSettings()` action on `<Settings::MembersEmailLabs>` component - the used property and action live on the controller, looks like it was a copy/paste hangover when functionality was moved to a component - added newsletter model - includes design-related attributes which are not yet supported by the API but are due to be added - includes `default` attribute but there is no setting for it, due to be removed from the API but it's needed for save not to error for now - set up basic mirage model and endpoints - added validation for main settings to match API validation - added `EditNewsletter` modal - separate tabs for general newsletter settings and design-related settings - used for both creating and editing newsletters - added `/settings/members-email/newsletters/new` and `/settings/members-email/newsletters/:id` routes - both display the `EditNewsletter` modal on top of the members-email settings screen with the appropriate newsletter model - updated `<Settings::MembersEmailLabs::NewsletterManagement>` component to work with real newsletter model instances and the new add/edit routes - removed now-unused `newsletter` service that was providing mocked data for earlier design iteration
122 lines
5.3 KiB
JavaScript
122 lines
5.3 KiB
JavaScript
import ghostPaths from 'ghost-admin/utils/ghost-paths';
|
|
import mockApiKeys from './config/api-keys';
|
|
import mockAuthentication from './config/authentication';
|
|
import mockConfig from './config/config';
|
|
import mockCustomThemeSettings from './config/custom-theme-settings';
|
|
import mockEmails from './config/emails';
|
|
import mockIntegrations from './config/integrations';
|
|
import mockInvites from './config/invites';
|
|
import mockLabels from './config/labels';
|
|
import mockMembers from './config/members';
|
|
import mockNewsletters from './config/newsletters';
|
|
import mockOffers from './config/offers';
|
|
import mockPages from './config/pages';
|
|
import mockPosts from './config/posts';
|
|
import mockProducts from './config/products';
|
|
import mockRoles from './config/roles';
|
|
import mockSettings from './config/settings';
|
|
import mockSite from './config/site';
|
|
import mockSlugs from './config/slugs';
|
|
import mockSnippets from './config/snippets';
|
|
import mockTags from './config/tags';
|
|
import mockThemes from './config/themes';
|
|
import mockUploads from './config/uploads';
|
|
import mockUsers from './config/users';
|
|
import mockWebhooks from './config/webhooks';
|
|
|
|
// import {versionMismatchResponse} from 'utils';
|
|
|
|
export default function () {
|
|
// allow any local requests outside of the namespace (configured below) to hit the real server
|
|
// _must_ be called before the namespace property is set
|
|
this.passthrough('/ghost/assets/**');
|
|
|
|
this.namespace = ghostPaths().apiRoot;
|
|
this.timing = 1000; // delay for each request, automatically set to 0 during testing
|
|
this.logging = true;
|
|
|
|
// Mock endpoints here to override real API requests during development, eg...
|
|
// this.put('/posts/:id/', versionMismatchResponse);
|
|
// mockTags(this);
|
|
// this.loadFixtures('settings');
|
|
mockNewsletters(this);
|
|
|
|
// keep this line, it allows all other API requests to hit the real server
|
|
this.passthrough();
|
|
|
|
// add any external domains to make sure those get passed through too
|
|
this.passthrough('http://www.gravatar.com/**');
|
|
this.passthrough('https://cdn.jsdelivr.net/**');
|
|
this.passthrough('https://api.unsplash.com/**');
|
|
this.passthrough('https://ghost.org/**');
|
|
}
|
|
|
|
// Mock all endpoints here as there is no real API during testing
|
|
export function testConfig() {
|
|
this.namespace = ghostPaths().apiRoot;
|
|
// this.timing = 400; // delay for each request, automatically set to 0 during testing
|
|
this.logging = false;
|
|
|
|
mockApiKeys(this);
|
|
mockAuthentication(this);
|
|
mockConfig(this);
|
|
mockCustomThemeSettings(this);
|
|
mockEmails(this);
|
|
mockIntegrations(this);
|
|
mockInvites(this);
|
|
mockMembers(this);
|
|
mockLabels(this);
|
|
mockPages(this);
|
|
mockPosts(this);
|
|
mockRoles(this);
|
|
mockSettings(this);
|
|
mockSite(this);
|
|
mockSlugs(this);
|
|
mockTags(this);
|
|
mockThemes(this);
|
|
mockUploads(this);
|
|
mockUsers(this);
|
|
mockWebhooks(this);
|
|
mockProducts(this);
|
|
mockOffers(this);
|
|
mockSnippets(this);
|
|
mockNewsletters(this);
|
|
|
|
/* Notifications -------------------------------------------------------- */
|
|
|
|
this.get('/notifications/');
|
|
|
|
/* Integrations - Slack Test Notification ------------------------------- */
|
|
|
|
this.post('/slack/test', function () {
|
|
return {};
|
|
});
|
|
|
|
/* External sites ------------------------------------------------------- */
|
|
|
|
this.head('http://www.gravatar.com/avatar/:md5', function () {
|
|
return '';
|
|
}, 200);
|
|
|
|
this.get('http://www.gravatar.com/avatar/:md5', function () {
|
|
return '';
|
|
}, 200);
|
|
|
|
this.get('https://ghost.org/changelog.json', function () {
|
|
return {
|
|
changelog: [
|
|
{
|
|
title: 'Custom image alt tags',
|
|
custom_excerpt: null,
|
|
html: '<p>We just shipped custom image alt tag support in the Ghost editor. This is one of our most requested features - and great news for accessibility and search engine optimisation for your Ghost publication.</p><p>Previously, you\'d need to use a Markdown card to add an image alt tag. Now you can create alt tags on the go directly from the editor, without the need to add any additional cards or custom tags.</p><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://ghost.org/changelog/content/images/2019/08/image-alt-tag.gif" class="kg-image"></figure><!--kg-card-end: image--><p>To write your alt tag, hit the <code>alt</code> button on the right in the caption line, type your alt text and then hit the button again to return to the caption text. </p><p><em><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><a href="https://ghost.org/pricing/">Ghost(Pro)</a></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong> users already have access to custom image alt tags. Self hosted developers can use <a href="https://ghost.org/docs/ghost-cli/">Ghost-CLI</a> to install the latest release!</em></p>',
|
|
slug: 'image-alt-text-support',
|
|
published_at: '2019-08-05T07:46:16.000+00:00',
|
|
url: 'https://ghost.org/changelog/image-alt-text-support/'
|
|
}
|
|
],
|
|
changelogMajor: [],
|
|
changelogUrl: 'https://ghost.org/changelog/'
|
|
};
|
|
});
|
|
}
|