Skip to content

Commit

Permalink
Merge pull request #507 from Badsender-com/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
medamineziraoui authored Oct 9, 2021
2 parents 74d7ef2 + 90dbd58 commit 1e14da0
Show file tree
Hide file tree
Showing 69 changed files with 3,022 additions and 937 deletions.
6 changes: 4 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ dist/
*.min.*

# Per packages overrides
packages/editor/

packages/editor/*
public/lang/*
packages/documentation/.vuepress/dist/
packages/documentation/api/

!packages/editor/src/js/vue/*
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build

on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14.16.0'
cache: 'yarn'
- run: yarn install
- run: yarn build
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14.16.0'
cache: 'yarn'
- run: yarn install
- run: yarn test-ci
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ dist

# TernJS port file
.tern-port

.vscode/**
# Stores VSCode versions used for testing VSCode extensions
.vscode-test

Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ packages/editor/

packages/documentation/.vuepress/dist/
packages/documentation/api/
packages/ui/helpers/locales
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ module.exports = {
// restoreMocks: false,

// The root directory that Jest should scan for tests and modules within
// rootDir: undefined,
rootDir: './packages',

// A list of paths to directories that Jest should use to search for files in
// roots: [
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
"stream-buffers": "3.0.2",
"validator": "10.11.0",
"vue-i18n": "8.15.3",
"vue-select": "3.13.0",
"vuelidate": "0.7.4",
"xml2json": "0.12.0"
},
Expand Down
5 changes: 4 additions & 1 deletion packages/editor/src/css/badesender-image-gallery.less
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@
padding: @dialog-margin;
display: flex;
justify-content: center;

.ui-tabs-nav {
background: var(--v-secondary-base) !important;
}
.tabs_horizontal {
background: white;
width: 100%;
Expand All @@ -185,6 +187,7 @@
}
.close {
visibility: hidden;
color: #fff;
cursor: pointer;
width: 24px;
display: block;
Expand Down
4 changes: 3 additions & 1 deletion packages/editor/src/css/badsender-editor.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// this the equivalent of app_standalone_material.less

@import '../../../../node_modules/font-awesome/less/font-awesome.less';

@import 'style_mosaico.less';
Expand All @@ -8,6 +7,9 @@

@import (less) '../../../../node_modules/toastr/toastr.less';

@import (less) '../../../../node_modules/vue-select/dist/vue-select.css';
@import (less) 'custom-select-style.less';

// Override variables

@tab-text-color: #555;
Expand Down
13 changes: 13 additions & 0 deletions packages/editor/src/css/custom-select-style.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.vs__dropdown-toggle,
.vs__dropdown-menu {
border: none !important;
}

.vs__selected {
position: absolute;
top: 12px;
}

.vs__actions > button {
padding-right: 10px;
}
51 changes: 2 additions & 49 deletions packages/editor/src/js/ext/badsender-server-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function loader(opts) {
name: 'Save', // l10n happens in the template
enabled: ko.observable(true),
};

saveCmd.execute = function () {
saveCmd.enabled(false);
var data = getData(viewModel);
Expand All @@ -49,7 +50,6 @@ function loader(opts) {
// use callback for easier jQuery updates
// => Deprecation notice for .success(), .error(), and .complete()
function onPostSuccess(data, textStatus, jqXHR) {
console.log('save success');
viewModel.notifier.success(viewModel.t('save-message-success'));
}

Expand Down Expand Up @@ -77,54 +77,7 @@ function loader(opts) {
enabled: ko.observable(true),
};
testCmd.execute = function () {
console.info('TEST');
console.log(viewModel.metadata.url.send);
testCmd.enabled(false);
var email = viewModel.t('Insert here the recipient email address');
email = global.prompt(viewModel.t('Test email address'), email);

// Don't validate `null` values => isEmail will error
if (!email) return testCmd.enabled(true);

const emails = email.split(";");
for (const address of emails){
if (!isEmail(address)) {
global.alert(viewModel.t('Invalid email address'));
return testCmd.enabled(true);
}
}

console.log('TODO testing...', email);
var metadata = ko.toJS(viewModel.metadata);
var datas = {
rcpt: email,
html: viewModel.exportHTML(),
};
$.ajax({
url: viewModel.metadata.url.send,
method: 'POST',
data: datas,
success: onTestSuccess,
error: onTestError,
complete: onTestComplete,
});

function onTestSuccess(data, textStatus, jqXHR) {
console.log('test success');
viewModel.notifier.success(viewModel.t('Test email sent...'));
}

function onTestError(jqXHR, textStatus, errorThrown) {
console.log('test error');
console.log(errorThrown);
viewModel.notifier.error(
viewModel.t('Unexpected error talking to server: contact us!')
);
}

function onTestComplete() {
testCmd.enabled(true);
}
viewModel.openTestModal(true);
};

//////
Expand Down
1 change: 1 addition & 0 deletions packages/editor/src/js/viewmodel.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function initializeEditor(content, blockDefs, thumbPathConverter, galleryUrl) {
debug: ko.observable(false),
contentListeners: ko.observable(0),
loadedTemplate: ko.observable(false),
openTestModal: ko.observable(false),
logoPath: 'rs/img/mosaico32.png',
logoUrl: '.',
logoAlt: 'mosaico',
Expand Down
Loading

0 comments on commit 1e14da0

Please sign in to comment.