Skip to content
Permalink
Browse files

fix code style for all existing js

  • Loading branch information...
nerrad committed Apr 10, 2018
1 parent 609ec33 commit c64537f263ad675eba08350db92380e27d0d0c06
Showing with 261 additions and 255 deletions.
  1. +5 −4 assets/src/eejs/index.js
  2. +56 −59 assets/src/exit-modal-survey/index.js
  3. +11 −3 assets/src/wp-plugins-page/index.js
  4. +5 −5 postcss.config.js
  5. +99 −99 webpack.common.js
  6. +38 −38 webpack.dev.js
  7. +47 −47 webpack.prod.js
@@ -6,12 +6,13 @@
* This will hold arbitrary data assigned by the Assets Registry.
* @type {{}}
*/
export let data = eejsdata.data || {};
export const data = eejsdata.data || {};

/**
* use this for eejs exceptions
* Usage: throw new eejs.exception('some message')
* @param {string} msg
*/
export let exception = function( msg ) {
this.msg = msg;
}
export const exception = function( msg ) {
this.msg = msg;
};
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
import React from 'react';
import ReactDOM from 'react-dom';
import ReactModal from 'react-modal';
import $ from 'jquery';
@@ -10,78 +9,76 @@ import './style.css';
import { data } from '@eventespresso/eejs';
import { stringify } from 'querystringify';

const { exitModali18n: i18n = {}, exitModalInfo: info = {}} = data;
const { exitModali18n: i18n = {}, exitModalInfo: info = {} } = data;

const queryString = stringify({
firstname: info.firstname,
emailaddress: info.emailaddress,
website: info.website
});
const queryString = stringify( {
firstname: info.firstname,
emailaddress: info.emailaddress,
website: info.website,
} );

const modalProps = {
styles: {
content: {
display: 'flex',
top: '80px',
left: '50%',
bottom: 'auto',
right: 'auto',
WebkitTransform: 'translateX(-50%)',
transform: 'translateX(-50%)'
},
typeFormStyle: {
width: '600px',
height: '400px'
}
},
typeFormUrl: 'https://eventespresso.typeform.com/to/O1DDym?' + queryString,
introText: i18n.introText,
doSurveyButtonText: i18n.doSurveyButtonText,
skipButtonText: i18n.skipButtonText,
buttonClass: {
doSurvey: 'button button-primary',
closeModal: 'button button-secondary'
}
styles: {
content: {
display: 'flex',
top: '80px',
left: '50%',
bottom: 'auto',
right: 'auto',
WebkitTransform: 'translateX(-50%)',
transform: 'translateX(-50%)',
},
typeFormStyle: {
width: '600px',
height: '400px',
},
},
typeFormUrl: 'https://eventespresso.typeform.com/to/O1DDym?' + queryString,
introText: i18n.introText,
doSurveyButtonText: i18n.doSurveyButtonText,
skipButtonText: i18n.skipButtonText,
buttonClass: {
doSurvey: 'button button-primary',
closeModal: 'button button-secondary',
},
};

/**
* Handler for deactivation trigger
* @param {Event} e
* @param {element} el
*/
const handleDeactivationClick = (e, el) => {
e.preventDefault();
const link = $(el).attr('href');
const appContainer = document.getElementById('ee-exit-survey-modal');
let modalContainer;
ReactModal.setAppElement(appContainer);
modalContainer = ReactDOM.render(<ExitModal {...modalProps} />, appContainer);
modalContainer.el.addEventListener(
CLOSE_MODAL_EVENT,
function(e){
window.location.href = link;
},
{once: true}
);
const handleDeactivationClick = ( e, el ) => {
e.preventDefault();
const link = $( el ).attr( 'href' );
const appContainer = document.getElementById( 'ee-exit-survey-modal' );
ReactModal.setAppElement( appContainer );
const modalContainer = ReactDOM.render( <ExitModal { ...modalProps } />, //eslint-disable-line react/no-render-return-value
appContainer,
);
modalContainer.el.addEventListener(
CLOSE_MODAL_EVENT,
function() {
window.location.href = link;
},
{ once: true },
);
};

/**
* EE caffeinated click capture but only if feature is active
*/
if (info.isModalActive) {
$('tr[data-slug="event-espresso"]')
.on('click', 'span.deactivate > a', function(e) {
handleDeactivationClick(e, this);
});
if ( info.isModalActive ) {
$( 'tr[data-slug="event-espresso"]' )
.on( 'click', 'span.deactivate > a', function( e ) {
handleDeactivationClick( e, this );
} );

/**
* EE decaf click capture.
*/
$('tr[data-slug="event-espresso-decaf"]')
.on('click', 'span.deactivate > a', function(e) {
handleDeactivationClick(e, this);
});
/**
* EE decaf click capture.
*/
$( 'tr[data-slug="event-espresso-decaf"]' )
.on( 'click', 'span.deactivate > a', function( e ) {
handleDeactivationClick( e, this );
} );
}



@@ -1,7 +1,15 @@
/**
* Internal imports
*/
import '../exit-modal-survey';
import './style.css';

/**
* External imports
*/
import $ from 'jquery';

if ($('tr.ee-upsell-plugin-list-table').length > 0) {
$('tr[data-slug="event-espresso"],tr[data-slug="event-espresso-decaf"]').addClass('update');
}
if ( $( 'tr.ee-upsell-plugin-list-table' ).length > 0 ) {
$( 'tr[data-slug="event-espresso"],tr[data-slug="event-espresso-decaf"]' )
.addClass( 'update' );
}
@@ -1,5 +1,5 @@
module.exports = ({ file, options, env }) => ({
plugins: [
require('autoprefixer')
]
});
module.exports = () => ( {
plugins: [
require( 'autoprefixer' ),
],
} );

0 comments on commit c64537f

Please sign in to comment.
You can’t perform that action at this time.