mirror of
https://github.com/vale981/Vulcan
synced 2025-03-05 09:31:43 -05:00
ESLint fixes
This commit is contained in:
parent
f41bf7444e
commit
dfa4c77314
29 changed files with 96 additions and 117 deletions
|
@ -4,7 +4,7 @@ import { Components, registerComponent } from 'meteor/vulcan:core';
|
|||
|
||||
export class Buttons extends React.Component {
|
||||
render () {
|
||||
let { buttons = {}, className = "buttons" } = this.props;
|
||||
let { buttons = {}, className = 'buttons' } = this.props;
|
||||
return (
|
||||
<div className={ className }>
|
||||
{Object.keys(buttons).map((id, i) =>
|
||||
|
|
|
@ -49,8 +49,8 @@ export class AccountsField extends PureComponent {
|
|||
type = 'text',
|
||||
onChange,
|
||||
// required = false,
|
||||
className = "field",
|
||||
defaultValue = "",
|
||||
className = 'field',
|
||||
defaultValue = '',
|
||||
message,
|
||||
} = this.props;
|
||||
const { mount = true } = this.state;
|
||||
|
|
|
@ -3,7 +3,7 @@ import { Components, registerComponent } from 'meteor/vulcan:core';
|
|||
|
||||
export class AccountsFields extends React.Component {
|
||||
render () {
|
||||
let { fields = {}, className = "fields" } = this.props;
|
||||
let { fields = {}, className = 'fields' } = this.props;
|
||||
return (
|
||||
<div className={ className }>
|
||||
{Object.keys(fields).map((id, i) =>
|
||||
|
|
|
@ -3,7 +3,7 @@ import { registerComponent } from 'meteor/vulcan:core';
|
|||
|
||||
export class AccountsFormMessage extends React.Component {
|
||||
render () {
|
||||
let { message, type, className = "message", style = {} } = this.props;
|
||||
let { message, type, className = 'message', style = {} } = this.props;
|
||||
message = _.isObject(message) ? message.message : message; // If message is object, then try to get message from it
|
||||
return message ? (
|
||||
<div style={style} className={[ className, type ].join(' ')}>{ message }</div>
|
||||
|
|
|
@ -3,7 +3,7 @@ import { Components, registerComponent } from 'meteor/vulcan:core';
|
|||
|
||||
export class AccountsFormMessages extends Component {
|
||||
render () {
|
||||
const { messages = [], className = "messages", style = {} } = this.props;
|
||||
const { messages = [], className = 'messages', style = {} } = this.props;
|
||||
return messages.length > 0 && (
|
||||
<div className={className} style={style}>
|
||||
{messages
|
||||
|
|
|
@ -185,7 +185,7 @@ export class AccountsLoginFormInner extends TrackerComponent {
|
|||
hint: this.context.intl.formatMessage({id: 'accounts.enter_username_or_email'}),
|
||||
label: this.context.intl.formatMessage({id: 'accounts.username_or_email'}),
|
||||
required: true,
|
||||
defaultValue: this.state.currentUsername || "",
|
||||
defaultValue: this.state.currentUsername || '',
|
||||
onChange: this.handleChange.bind(this, 'usernameOrEmail'),
|
||||
message: this.getMessageForField('usernameOrEmail'),
|
||||
};
|
||||
|
@ -197,7 +197,7 @@ export class AccountsLoginFormInner extends TrackerComponent {
|
|||
hint: this.context.intl.formatMessage({id: 'accounts.enter_username'}),
|
||||
label: this.context.intl.formatMessage({id: 'accounts.username'}),
|
||||
required: true,
|
||||
defaultValue: this.state.currentUsername || "",
|
||||
defaultValue: this.state.currentUsername || '',
|
||||
onChange: this.handleChange.bind(this, 'username'),
|
||||
message: this.getMessageForField('username'),
|
||||
};
|
||||
|
@ -210,7 +210,7 @@ export class AccountsLoginFormInner extends TrackerComponent {
|
|||
label: this.context.intl.formatMessage({id: 'accounts.email'}),
|
||||
type: 'email',
|
||||
required: true,
|
||||
defaultValue: this.state.email || "",
|
||||
defaultValue: this.state.email || '',
|
||||
onChange: this.handleChange.bind(this, 'email'),
|
||||
message: this.getMessageForField('email'),
|
||||
};
|
||||
|
@ -223,7 +223,7 @@ export class AccountsLoginFormInner extends TrackerComponent {
|
|||
label: this.context.intl.formatMessage({id: 'accounts.password'}),
|
||||
type: 'password',
|
||||
required: true,
|
||||
defaultValue: this.state.password || "",
|
||||
defaultValue: this.state.password || '',
|
||||
onChange: this.handleChange.bind(this, 'password'),
|
||||
message: this.getMessageForField('password'),
|
||||
};
|
||||
|
@ -277,18 +277,18 @@ export class AccountsLoginFormInner extends TrackerComponent {
|
|||
|
||||
if (hasPasswordService() && formState == STATES.SIGN_IN) {
|
||||
if (_.contains([
|
||||
"USERNAME_AND_EMAIL",
|
||||
"USERNAME_AND_OPTIONAL_EMAIL",
|
||||
'USERNAME_AND_EMAIL',
|
||||
'USERNAME_AND_OPTIONAL_EMAIL',
|
||||
], passwordSignupFields())) {
|
||||
loginFields.push(this.getUsernameOrEmailField());
|
||||
}
|
||||
|
||||
if (passwordSignupFields() === "USERNAME_ONLY") {
|
||||
if (passwordSignupFields() === 'USERNAME_ONLY') {
|
||||
loginFields.push(this.getUsernameField());
|
||||
}
|
||||
|
||||
if (_.contains([
|
||||
"EMAIL_ONLY",
|
||||
'EMAIL_ONLY',
|
||||
], passwordSignupFields())) {
|
||||
loginFields.push(this.getEmailField());
|
||||
}
|
||||
|
@ -298,21 +298,21 @@ export class AccountsLoginFormInner extends TrackerComponent {
|
|||
|
||||
if (hasPasswordService() && formState == STATES.SIGN_UP) {
|
||||
if (_.contains([
|
||||
"USERNAME_AND_EMAIL",
|
||||
"USERNAME_AND_OPTIONAL_EMAIL",
|
||||
"USERNAME_ONLY",
|
||||
'USERNAME_AND_EMAIL',
|
||||
'USERNAME_AND_OPTIONAL_EMAIL',
|
||||
'USERNAME_ONLY',
|
||||
], passwordSignupFields())) {
|
||||
loginFields.push(this.getUsernameField());
|
||||
}
|
||||
|
||||
if (_.contains([
|
||||
"USERNAME_AND_EMAIL",
|
||||
"EMAIL_ONLY",
|
||||
'USERNAME_AND_EMAIL',
|
||||
'EMAIL_ONLY',
|
||||
], passwordSignupFields())) {
|
||||
loginFields.push(this.getEmailField());
|
||||
}
|
||||
|
||||
if (_.contains(["USERNAME_AND_OPTIONAL_EMAIL"], passwordSignupFields())) {
|
||||
if (_.contains(['USERNAME_AND_OPTIONAL_EMAIL'], passwordSignupFields())) {
|
||||
loginFields.push(Object.assign(this.getEmailField(), {required: false}));
|
||||
}
|
||||
|
||||
|
@ -495,7 +495,7 @@ export class AccountsLoginFormInner extends TrackerComponent {
|
|||
|
||||
showForgotPasswordLink() {
|
||||
return this.state.formState == STATES.SIGN_IN && hasPasswordService() && _.contains(
|
||||
["USERNAME_AND_EMAIL", "USERNAME_AND_OPTIONAL_EMAIL", "EMAIL_ONLY"],
|
||||
['USERNAME_AND_EMAIL', 'USERNAME_AND_OPTIONAL_EMAIL', 'EMAIL_ONLY'],
|
||||
passwordSignupFields()
|
||||
);
|
||||
}
|
||||
|
@ -628,7 +628,7 @@ export class AccountsLoginFormInner extends TrackerComponent {
|
|||
if (usernameOrEmail !== null) {
|
||||
if (!this.validateField('username', usernameOrEmail)) {
|
||||
if (this.state.formState == STATES.SIGN_UP) {
|
||||
this.state.onSubmitHook("error.accounts.usernameRequired", this.state.formState);
|
||||
this.state.onSubmitHook('error.accounts.usernameRequired', this.state.formState);
|
||||
}
|
||||
error = true;
|
||||
}
|
||||
|
@ -638,7 +638,7 @@ export class AccountsLoginFormInner extends TrackerComponent {
|
|||
} else if (username !== null) {
|
||||
if (!this.validateField('username', username)) {
|
||||
if (this.state.formState == STATES.SIGN_UP) {
|
||||
this.state.onSubmitHook("error.accounts.usernameRequired", this.state.formState);
|
||||
this.state.onSubmitHook('error.accounts.usernameRequired', this.state.formState);
|
||||
}
|
||||
error = true;
|
||||
}
|
||||
|
@ -718,7 +718,7 @@ export class AccountsLoginFormInner extends TrackerComponent {
|
|||
serviceName = 'meteorDeveloperAccount';
|
||||
}
|
||||
|
||||
const loginWithService = Meteor["loginWith" + capitalService()];
|
||||
const loginWithService = Meteor['loginWith' + capitalService()];
|
||||
|
||||
let options = {}; // use default scope unless specified
|
||||
if (Accounts.ui._options.requestPermissions[serviceName])
|
||||
|
@ -774,7 +774,7 @@ export class AccountsLoginFormInner extends TrackerComponent {
|
|||
if (username !== null) {
|
||||
if ( !this.validateField('username', username) ) {
|
||||
if (this.state.formState == STATES.SIGN_UP) {
|
||||
this.state.onSubmitHook("error.accounts.usernameRequired", this.state.formState);
|
||||
this.state.onSubmitHook('error.accounts.usernameRequired', this.state.formState);
|
||||
}
|
||||
error = true;
|
||||
} else {
|
||||
|
@ -782,10 +782,10 @@ export class AccountsLoginFormInner extends TrackerComponent {
|
|||
}
|
||||
} else {
|
||||
if (_.contains([
|
||||
"USERNAME_AND_EMAIL",
|
||||
'USERNAME_AND_EMAIL',
|
||||
], passwordSignupFields()) && !this.validateField('username', username) ) {
|
||||
if (this.state.formState == STATES.SIGN_UP) {
|
||||
this.state.onSubmitHook("error.accounts.usernameRequired", this.state.formState);
|
||||
this.state.onSubmitHook('error.accounts.usernameRequired', this.state.formState);
|
||||
}
|
||||
error = true;
|
||||
}
|
||||
|
@ -798,7 +798,7 @@ export class AccountsLoginFormInner extends TrackerComponent {
|
|||
}
|
||||
|
||||
if (!this.validateField('password', password)) {
|
||||
onSubmitHook("Invalid password", formState);
|
||||
onSubmitHook('Invalid password', formState);
|
||||
error = true;
|
||||
} else {
|
||||
options.password = password;
|
||||
|
|
|
@ -6,7 +6,7 @@ import { intlShape } from 'meteor/vulcan:i18n';
|
|||
|
||||
export class AccountsPasswordOrService extends PureComponent {
|
||||
render () {
|
||||
let { className = "password-or-service", style = {} } = this.props;
|
||||
let { className = 'password-or-service', style = {} } = this.props;
|
||||
const services = Object.keys(this.props.oauthServices).map(service => {
|
||||
return this.props.oauthServices[service].label;
|
||||
});
|
||||
|
|
|
@ -5,7 +5,7 @@ import { Components, registerComponent } from 'meteor/vulcan:core';
|
|||
|
||||
export class AccountsSocialButtons extends React.Component {
|
||||
render() {
|
||||
let { oauthServices = {}, className = "social-buttons" } = this.props;
|
||||
let { oauthServices = {}, className = 'social-buttons' } = this.props;
|
||||
return(
|
||||
<div className={ className }>
|
||||
{Object.keys(oauthServices).map((id, i) => {
|
||||
|
|
|
@ -172,7 +172,7 @@ const Card = ({title, className, collection, document, currentUser, fields, show
|
|||
);
|
||||
};
|
||||
|
||||
Card.displayName = "Card";
|
||||
Card.displayName = 'Card';
|
||||
|
||||
Card.propTypes = {
|
||||
className: PropTypes.string,
|
||||
|
|
|
@ -10,7 +10,7 @@ const Error404 = () => {
|
|||
)
|
||||
}
|
||||
|
||||
Error404.displayName = "Error404";
|
||||
Error404.displayName = 'Error404';
|
||||
|
||||
registerComponent('Error404', Error404);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ const header = {
|
|||
}
|
||||
|
||||
const code = {
|
||||
border: "1px solid #ccc",
|
||||
border: '1px solid #ccc',
|
||||
borderRadius: 3,
|
||||
padding: '10px 20px',
|
||||
background: 'white',
|
||||
|
@ -28,11 +28,11 @@ const code = {
|
|||
|
||||
function escapeHtml(unsafe) {
|
||||
return unsafe
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'");
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
}
|
||||
|
||||
const HelloWorld = props =>
|
||||
|
|
|
@ -9,7 +9,7 @@ const Icon = ({ name, iconClass, onClick }) => {
|
|||
return <i onClick={onClick} className={c} aria-hidden="true"></i>;
|
||||
}
|
||||
|
||||
Icon.displayName = "Icon";
|
||||
Icon.displayName = 'Icon';
|
||||
|
||||
registerComponent('Icon', Icon);
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import React from 'react';
|
|||
const Layout = ({children}) =>
|
||||
<div className="wrapper" id="wrapper">{children}</div>
|
||||
|
||||
Layout.displayName = "Layout";
|
||||
Layout.displayName = 'Layout';
|
||||
|
||||
registerComponent('Layout', Layout);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ const Loading = props => {
|
|||
)
|
||||
}
|
||||
|
||||
Loading.displayName = "Loading";
|
||||
Loading.displayName = 'Loading';
|
||||
|
||||
registerComponent('Loading', Loading);
|
||||
|
||||
|
|
|
@ -15,6 +15,6 @@ ShowIf.propTypes = {
|
|||
failureComponent: PropTypes.object,
|
||||
};
|
||||
|
||||
ShowIf.displayName = "ShowIf";
|
||||
ShowIf.displayName = 'ShowIf';
|
||||
|
||||
registerComponent('ShowIf', ShowIf, withCurrentUser);
|
|
@ -19,7 +19,7 @@ const header = {
|
|||
}
|
||||
|
||||
const code = {
|
||||
border: "1px solid #ccc",
|
||||
border: '1px solid #ccc',
|
||||
borderRadius: 3,
|
||||
padding: '10px 20px',
|
||||
background: 'white',
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import React from "react";
|
||||
import React from 'react';
|
||||
import {
|
||||
registerComponent,
|
||||
Components,
|
||||
ComponentsTable
|
||||
} from "meteor/vulcan:lib";
|
||||
} from 'meteor/vulcan:lib';
|
||||
|
||||
const ComponentHOCs = ({ document }) => (
|
||||
<div>
|
||||
<ul>
|
||||
{document.hocs.map((hoc, i) => (
|
||||
<li key={i}>{typeof hoc.name === "string" ? hoc.name : hoc[0].name}</li>
|
||||
<li key={i}>{typeof hoc.name === 'string' ? hoc.name : hoc[0].name}</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -23,9 +23,9 @@ const ComponentsDashboard = props => (
|
|||
showEdit={false}
|
||||
data={Object.values(ComponentsTable)}
|
||||
columns={[
|
||||
"name",
|
||||
'name',
|
||||
{
|
||||
name: "hocs",
|
||||
name: 'hocs',
|
||||
component: ComponentHOCs
|
||||
}
|
||||
]}
|
||||
|
@ -33,4 +33,4 @@ const ComponentsDashboard = props => (
|
|||
</div>
|
||||
);
|
||||
|
||||
registerComponent("Components", ComponentsDashboard);
|
||||
registerComponent('Components', ComponentsDashboard);
|
||||
|
|
|
@ -34,11 +34,11 @@ class Email extends PureComponent {
|
|||
return (
|
||||
<tr>
|
||||
<td>{name}</td>
|
||||
<td><a href={"/email/template/"+email.template} target="_blank">{email.template}</a></td>
|
||||
<td><a href={'/email/template/'+email.template} target="_blank">{email.template}</a></td>
|
||||
<td>{typeof email.subject === 'function' ? email.subject({}) : email.subject}</td>
|
||||
<td><a href={email.path.replace(':_id?', '').replace(':documentId?', '')} target="_blank">{email.path}</a></td>
|
||||
<td>
|
||||
<div className={this.state.loading ? "test-email loading" : "test-email"}>
|
||||
<div className={this.state.loading ? 'test-email loading' : 'test-email'}>
|
||||
<Components.Button disabled={this.state.loading} onClick={this.sendTest} variant="primary">Send Test</Components.Button>
|
||||
{this.state.loading ? <Components.Loading color="white"/> : null}
|
||||
</div>
|
||||
|
|
|
@ -23,10 +23,8 @@ VulcanEmail.addTemplates = templates => {
|
|||
_.extend(VulcanEmail.templates, templates);
|
||||
};
|
||||
|
||||
VulcanEmail.getTemplate = templateName => Handlebars.compile(
|
||||
VulcanEmail.templates[templateName],
|
||||
{ noEscape: true, strict: true}
|
||||
);
|
||||
VulcanEmail.getTemplate = templateName =>
|
||||
Handlebars.compile(VulcanEmail.templates[templateName], { noEscape: true, strict: true });
|
||||
|
||||
VulcanEmail.buildTemplate = (htmlContent, data = {}, locale) => {
|
||||
const emailProperties = {
|
||||
|
@ -37,7 +35,7 @@ VulcanEmail.buildTemplate = (htmlContent, data = {}, locale) => {
|
|||
siteUrl: Utils.getSiteUrl(),
|
||||
body: htmlContent,
|
||||
unsubscribe: '',
|
||||
accountLink: Utils.getSiteUrl()+'account',
|
||||
accountLink: Utils.getSiteUrl() + 'account',
|
||||
footer: getSetting('emailFooter'),
|
||||
logoUrl: getSetting('logoUrl'),
|
||||
logoHeight: getSetting('logoHeight'),
|
||||
|
@ -47,40 +45,33 @@ VulcanEmail.buildTemplate = (htmlContent, data = {}, locale) => {
|
|||
};
|
||||
|
||||
const emailHTML = VulcanEmail.getTemplate('wrapper')(emailProperties);
|
||||
const inlinedHTML = Juice(emailHTML, {preserveMediaQueries: true});
|
||||
const doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'
|
||||
const inlinedHTML = Juice(emailHTML, { preserveMediaQueries: true });
|
||||
const doctype =
|
||||
'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
|
||||
|
||||
return doctype+inlinedHTML;
|
||||
return doctype + inlinedHTML;
|
||||
};
|
||||
|
||||
VulcanEmail.generateTextVersion = html => {
|
||||
return htmlToText.fromString(html, {
|
||||
wordwrap: 130
|
||||
wordwrap: 130,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
VulcanEmail.send = (to, subject, html, text, throwErrors, cc, bcc, replyTo) => {
|
||||
// TODO: limit who can send emails
|
||||
// TODO: fix this error: Error: getaddrinfo ENOTFOUND
|
||||
|
||||
if(typeof to === 'object'){
|
||||
var {
|
||||
to,
|
||||
cc,
|
||||
bcc,
|
||||
replyTo,
|
||||
subject,
|
||||
html,
|
||||
text,
|
||||
throwErrors,
|
||||
} = to;
|
||||
|
||||
if (typeof to === 'object') {
|
||||
// eslint-disable-next-line no-redeclare
|
||||
var { to, cc, bcc, replyTo, subject, html, text, throwErrors } = to;
|
||||
}
|
||||
|
||||
const from = getSetting('defaultEmail', 'noreply@example.com');
|
||||
const siteName = getSetting('title', 'Vulcan');
|
||||
subject = '['+siteName+'] '+subject;
|
||||
subject = '[' + siteName + '] ' + subject;
|
||||
|
||||
if (typeof text === 'undefined'){
|
||||
if (typeof text === 'undefined') {
|
||||
// Auto-generate text version if it doesn't exist. Has bugs, but should be good enough.
|
||||
text = VulcanEmail.generateTextVersion(html);
|
||||
}
|
||||
|
@ -93,49 +84,44 @@ VulcanEmail.send = (to, subject, html, text, throwErrors, cc, bcc, replyTo) => {
|
|||
replyTo: replyTo,
|
||||
subject: subject,
|
||||
text: text,
|
||||
html: html
|
||||
html: html,
|
||||
};
|
||||
|
||||
if (process.env.NODE_ENV === 'production' || getSetting('enableDevelopmentEmails', false)) {
|
||||
|
||||
if (process.env.NODE_ENV === 'production' || getSetting('enableDevelopmentEmails', false)) {
|
||||
console.log('//////// sending email…'); // eslint-disable-line
|
||||
console.log('from: '+from); // eslint-disable-line
|
||||
console.log("cc: " + cc); // eslint-disable-line
|
||||
console.log("bcc: " + bcc); // eslint-disable-line
|
||||
console.log("replyTo: " + replyTo); // eslint-disable-line
|
||||
console.log('from: ' + from); // eslint-disable-line
|
||||
console.log('cc: ' + cc); // eslint-disable-line
|
||||
console.log('bcc: ' + bcc); // eslint-disable-line
|
||||
console.log('replyTo: ' + replyTo); // eslint-disable-line
|
||||
// console.log('html: '+html);
|
||||
// console.log('text: '+text);
|
||||
|
||||
try {
|
||||
Email.send(email);
|
||||
} catch (error) {
|
||||
console.log("// error while sending email:"); // eslint-disable-line
|
||||
console.log('// error while sending email:'); // eslint-disable-line
|
||||
console.log(error); // eslint-disable-line
|
||||
if (throwErrors) throw error;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
console.log('//////// sending email (simulation)…'); // eslint-disable-line
|
||||
console.log('from: '+from); // eslint-disable-line
|
||||
console.log('to: '+to); // eslint-disable-line
|
||||
console.log("cc: " + cc); // eslint-disable-line
|
||||
console.log("bcc: " + bcc); // eslint-disable-line
|
||||
console.log("replyTo: " + replyTo); // eslint-disable-line
|
||||
|
||||
console.log('from: ' + from); // eslint-disable-line
|
||||
console.log('to: ' + to); // eslint-disable-line
|
||||
console.log('cc: ' + cc); // eslint-disable-line
|
||||
console.log('bcc: ' + bcc); // eslint-disable-line
|
||||
console.log('replyTo: ' + replyTo); // eslint-disable-line
|
||||
}
|
||||
|
||||
return email;
|
||||
|
||||
};
|
||||
|
||||
VulcanEmail.build = async ({ emailName, variables, locale }) => {
|
||||
// execute email's GraphQL query
|
||||
const email = VulcanEmail.emails[emailName];
|
||||
const result = email.query ? await runQuery(email.query, variables, { locale }) : {data: {}};
|
||||
const result = email.query ? await runQuery(email.query, variables, { locale }) : { data: {} };
|
||||
|
||||
// if email has a data() function, merge its return value with results from the query
|
||||
const data = email.data ? {...result.data, ...email.data(variables)} : result.data;
|
||||
const data = email.data ? { ...result.data, ...email.data(variables) } : result.data;
|
||||
|
||||
const subject = typeof email.subject === 'function' ? email.subject(data) : email.subject;
|
||||
|
||||
|
@ -144,12 +130,11 @@ VulcanEmail.build = async ({ emailName, variables, locale }) => {
|
|||
const html = VulcanEmail.buildTemplate(VulcanEmail.getTemplate(email.template)(data), data, locale);
|
||||
|
||||
return { data, subject, html };
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
VulcanEmail.buildAndSend = async ({ to, cc, bcc, replyTo, emailName, variables, locale = getSetting("locale") }) => {
|
||||
VulcanEmail.buildAndSend = async ({ to, cc, bcc, replyTo, emailName, variables, locale = getSetting('locale') }) => {
|
||||
const email = await VulcanEmail.build({ to, emailName, variables, locale });
|
||||
return VulcanEmail.send({to, cc, bcc, replyTo, subject: email.subject, html: email.html});
|
||||
return VulcanEmail.send({ to, cc, bcc, replyTo, subject: email.subject, html: email.html });
|
||||
};
|
||||
|
||||
VulcanEmail.buildAndSendHTML = (to, subject, html) => VulcanEmail.send(to, subject, VulcanEmail.buildTemplate(html));
|
||||
|
|
|
@ -128,7 +128,7 @@ class EmbedURL extends Component {
|
|||
return (
|
||||
<div className="embedly-thumbnail">
|
||||
<div
|
||||
style={{ width: `${Math.round(60 * this.getDimensions().ratio)}px`, height: `60px` }}
|
||||
style={{ width: `${Math.round(60 * this.getDimensions().ratio)}px`, height: '60px' }}
|
||||
onClick={this.editThumbnail}
|
||||
className="embedly-thumbnail-placeholder"
|
||||
>
|
||||
|
|
|
@ -23,7 +23,7 @@ class Tags extends PureComponent {
|
|||
|
||||
this.state = {
|
||||
tags: tags,
|
||||
suggestions: _.pluck(props.options, "label"),
|
||||
suggestions: _.pluck(props.options, 'label'),
|
||||
value: props.value || []
|
||||
};
|
||||
}
|
||||
|
|
|
@ -58,12 +58,6 @@ import { convertSchema, formProperties } from '../modules/schema_utils';
|
|||
import { isEmptyValue } from '../modules/utils';
|
||||
import { getParentPath } from '../modules/path_utils';
|
||||
|
||||
// unsetCompact
|
||||
const unsetCompact = (object, path) => {
|
||||
unset(object, path);
|
||||
compactParent(object, path);
|
||||
};
|
||||
|
||||
const compactParent = (object, path) => {
|
||||
const parentPath = getParentPath(path);
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ class FormWrapper extends PureComponent {
|
|||
|
||||
// if a document is being passed, this is an edit form
|
||||
getFormType() {
|
||||
return this.props.documentId || this.props.slug ? "edit" : "new";
|
||||
return this.props.documentId || this.props.slug ? 'edit' : 'new';
|
||||
}
|
||||
|
||||
// filter out fields with "." or "$"
|
||||
|
@ -108,7 +108,7 @@ class FormWrapper extends PureComponent {
|
|||
let mutationFields = this.getFormType() === 'new' ? _.unique(createableFields.concat(readableFields)) : _.unique(createableFields.concat(updatetableFields));
|
||||
|
||||
// if "fields" prop is specified, restrict list of fields to it
|
||||
if (typeof fields !== "undefined" && fields.length > 0) {
|
||||
if (typeof fields !== 'undefined' && fields.length > 0) {
|
||||
queryFields = _.intersection(queryFields, fields);
|
||||
mutationFields = _.intersection(mutationFields, fields);
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ class FormWrapper extends PureComponent {
|
|||
{...props}
|
||||
/>;
|
||||
};
|
||||
Loader.displayName = `withLoader(Form)`;
|
||||
Loader.displayName = 'withLoader(Form)';
|
||||
|
||||
// if this is an edit from, load the necessary data using the withSingle HoC
|
||||
if (this.getFormType() === 'edit') {
|
||||
|
|
|
@ -132,7 +132,7 @@ export const populateComponentsApp = () => {
|
|||
}
|
||||
|
||||
return registerComponent(name, newComponent, ...newHocs, ...previousHocs);
|
||||
};
|
||||
}
|
||||
|
||||
export const copyHoCs = (sourceComponent, targetComponent) => {
|
||||
return compose(...sourceComponent.hocs)(targetComponent);
|
||||
|
|
|
@ -17,7 +17,7 @@ import { RouterClient } from './router.jsx';
|
|||
|
||||
Meteor.startup(() => {
|
||||
// note: route defined here because it "shouldn't be removable"
|
||||
addRoute({name:"app.notfound", path:"*", componentName: 'Error404'});
|
||||
addRoute({name:'app.notfound', path:'*', componentName: 'Error404'});
|
||||
|
||||
// init the application components and routes, including components & routes from 3rd-party packages
|
||||
initializeFragments();
|
||||
|
|
|
@ -25,7 +25,7 @@ function isAppUrl(req) {
|
|||
// we only need to support HTML pages only for browsers
|
||||
// Facebook's scraper uses a request header Accepts: */*
|
||||
// so allow either
|
||||
const facebookAcceptsHeader = new RegExp("/*\/*/");
|
||||
const facebookAcceptsHeader = new RegExp('/*\/*/');
|
||||
return /html/.test(req.headers.accept) || facebookAcceptsHeader.test(req.headers.accept);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import { RouterServer } from './router.jsx';
|
|||
|
||||
Meteor.startup(() => {
|
||||
// note: route defined here because it "shouldn't be removable"
|
||||
addRoute({name:"app.notfound", path:"*", componentName: 'Error404'});
|
||||
addRoute({name:'app.notfound', path:'*', componentName: 'Error404'});
|
||||
|
||||
// init the application components and routes, including components & routes from 3rd-party packages
|
||||
initializeFragments();
|
||||
|
|
|
@ -39,11 +39,11 @@ class SubscribeToActionHandler extends PureComponent {
|
|||
{id: `${documentType}.${action}d`},
|
||||
// handle usual name properties
|
||||
{name: document.name || document.title || document.displayName}
|
||||
), "success");
|
||||
), 'success');
|
||||
|
||||
|
||||
} catch(error) {
|
||||
this.props.flash(error.message, "error");
|
||||
this.props.flash(error.message, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ class SubscribeToActionHandler extends PureComponent {
|
|||
return null;
|
||||
}
|
||||
|
||||
const className = this.props.className ? this.props.className : "";
|
||||
const className = this.props.className ? this.props.className : '';
|
||||
|
||||
return Users.canDo(currentUser, action) ? <a className={className} onClick={this.onSubscribe}><FormattedMessage id={action} /></a> : null;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ class DateTime extends PureComponent {
|
|||
value={date}
|
||||
// newDate argument is a Moment object given by react-datetime
|
||||
onChange={newDate => this.updateDate(newDate._d)}
|
||||
format={"x"}
|
||||
format={'x'}
|
||||
inputProps={{name: this.props.name}}
|
||||
/>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue