Commit 287868f0 authored by Anton Kroosh's avatar Anton Kroosh
Browse files

Initial commit

parents
Pipeline #1222 failed with stages
in 0 seconds
client.egg_info
dist
build
.DS_Store
\ No newline at end of file
[submodule "mailmosaico"]
path = mailmosaico
url = https://code.oak-tree.tech/django-apps/packages/mailmosaico.git
<h3>Mailmosaico package</h3>
[submodule "jslib/mosaico"]
path = jslib/mosaico
url = https://code.oak-tree.tech/guru-frontend/mosaico.git
# Mailings Mosaico
Mailings Mosaco is an application which provides tools for integrating the Mosaico frontend email application into Django projects. It contains JavaScript assets, abstract views, and base templates. It is part of a suite of applications that can be used to provide email services to web applications built on top of the Oak-Tree technical stack.
Components of Mailings Mosaico:
1. Mosaico Frontend Mail Template Editor and wrapper JavaScript models and views which allow it to be integrated into the logic of larger projects
2. Abstract views which allow for Mosaico data structures to be translated into the equivalent Mail Gorilla data structures.
3. JavaScript models and views which allow for Mosaico features to be successfully integrated into a larger project's frontend logic
## Requirements
### Django Application Dependencies
- Guru Base
- Microservices
- Messages
- Mailings Core
## Integration Notes
Mailings Mosaico implements logic to provide a set of optional features. Application components may be subclassed to provide specific functionality, or used as-is. To integrate Mosaico features into a project, some steps are required to ensure that assets and settings are available to the application:
1. Add the application to the project's list of `INSTALLED_APPS`
2. Add a `gulp.js` task to compile and move Mosaico assets from the `jslib` to the `static` folder tree
\ No newline at end of file
MOSAICO_ACTION_DOWNLOAD = 'download'
MOSAICO_ACTION_SEND_TEST_EMAIL = 'email'
import logging
from django import forms
from guru.forms.backbone import BackboneForm
from microservices.forms import MicroserviceRemoteObjectForm, microservice_remoteobject_formset_factory
from mailcore import apisettings as mailcoreapi
from mailcore.mailgorilla.models.templates import MailGorillaEmailTemplate
from . import apisettings as mailmosaicoapi
logger = logging.getLogger(__name__)
class MailGorillaEmailTemplateForm(MicroserviceRemoteObjectForm):
''' Mail Gorilla Email template
'''
description = forms.CharField(label='Description')
subject = forms.CharField(label='Subject', required=False,
widget=forms.TextInput(attrs={'placeholder': 'Email message subject'}))
model = MailGorillaEmailTemplate
def __init__(self, *args, **kwargs):
''' Initialize the form
'''
self.render_create = kwargs.pop('render_create', False)
super(MailGorillaEmailTemplateForm, self).__init__(*args, **kwargs)
class MosaicoEmailTemplateForm(BackboneForm):
''' Validate the structure of an email template created in Mosaico
'''
code = forms.SlugField(label='Email Template Code/ID')
html = forms.CharField(label='EMail HTML Content')
subject = forms.CharField(label='Subject', widget=forms.TextInput(attrs={
'placeholder': 'Email Subject',
}))
class MosaicoImageUploadForm(forms.Form):
''' Validate the structure of Mosaico image uploads
'''
file = forms.FileField()
MOSAICO_REMOTE_ACTIONS = (
(mailmosaicoapi.MOSAICO_ACTION_DOWNLOAD, 'Download inlined copy of template'),
(mailmosaicoapi.MOSAICO_ACTION_SEND_TEST_EMAIL, 'Send a test email'),
)
class MosaicoRemoteActionForm(forms.Form):
''' Validate the structure of Mosaico test email and download requests
'''
action = forms.ChoiceField(label='Mosaico Remote Action', choices=MOSAICO_REMOTE_ACTIONS)
html = forms.CharField(label='Mosaico Template HTML')
# Test Email Fields
rcpt = forms.EmailField(label='Test Email Recipient', required=False)
def clean(self, *args, **kwargs):
cleaned_data = super(MosaicoRemoteActionForm, self).clean(*args, **kwargs)
# Ensure that a recipinet is included if the action is to send a test email
if cleaned_data.get('action') == mailmosaicoapi.MOSAICO_ACTION_SEND_TEST_EMAIL \
and not self.cleaned_data.get('rcpt'):
raise forms.ValidationError({
'rcpt': ['A valid email address is required when sending a test email'],
})
return cleaned_data
\ No newline at end of file
bower_components
node_modules
uploads/**
!uploads/README.md
.tmp/**
!.tmp/README.md
build
dist
{
"js": {
"indent_with_tabs": false,
"indent_size": 2,
}
}
\ No newline at end of file
{
"-W097": false,
"-W069": false,
"globals": {
"require": false,
"module": false
}
}
\ No newline at end of file
# temp folder, temporarily used when uploading
\ No newline at end of file
language: node_js
node_js:
- "6"
- "5"
before_install: npm install -g grunt-cli
install: npm install
### Are you having issues with Mosaico?
Please make sure:
- you understand you have to build it and to run a backend server (either the node.js version bundled with this project or the php backend referenced above or write your own)
- you read this Readme *three* times and followed the instructions
- you understand I'll close any GitHub issue with insufficient information: if you want help then you'll have to take your time to explain your issue.
- you don't ask for a binary/executable to be used as a standalone desktop application
- you understand you can't simply open index.html/editor.html and expect it to work if you don't build the library and don't run a backend server and access that files through the webserver.
- you don't add off topic comments to an existing issue: if you want to add that you are having the same issue please make sure you are having the same issue described. If you are unsure, open a new issue following the rules (we prefer a duplicated issue than a chaotic issue mixing unrelated things).
##### issues building:
- take note of the full log of your npm install, and grunt commands output
- open a GitHub issues saying that you read this doc
- paste the output from npm install and grunt
- write your full environment (your operative system name and version, your node version, your npm version)
##### issues running/editing
if your problem is not with the building then when you open a GitHub issue:
- make sure you specify if you are using the bundled backend or php backend or any other kind of deployment
- tell us the browser you are using (name and version) and test at least a *second* browser to tell us if this happen in both or only one (tell us the details about the second browser too).
- test the same scenario on https://mosaico.io and tell us if you see the same issue
- if you are having issues running with Apache then specify you installed the php backend from access interpreting and WHY you think you are having problem with mosaico.js and not with that specific backend (did you try with bundled node.js backend?)
##### rendering issues with templates generated by Mosaico
- open an issue only if you have a screenshot
- when you open an issue please tell us what template you are using
- tell which email client show the issue (version, name, operative system)
- tell us which backend you are using (the bundled one ran with grunt, the php backend referenced above, or your custom backend).
- if you are sending the email using a different way then most of the times the template gets broken by your way to send it: so try the same thing on mosaico.io and confirm you see the same rendering issues.
### Want to contribute code?
Open an Issue, first, and coordinate with us.
FROM node:6-alpine
RUN apk update
RUN apk add bzip2 tar git imagemagick
RUN npm install grunt-cli -g
# only add package.json so npm install will only be needed if we change it.
COPY package.json /tmp/package.json
# also add bower because package.json post-install needs it.
COPY bower.json /tmp/bower.json
RUN cd /tmp && npm install --unsafe-perm
RUN mkdir -p /opt/mosaico && cp -a /tmp/node_modules /tmp/bower_components /opt/mosaico/ && rm -rf /tmp/node_modules /tmp/bower_components
WORKDIR /opt/mosaico
COPY . /opt/mosaico
EXPOSE 9006
CMD ["grunt", "default"]
FROM centos:centos7
RUN yum clean all
RUN yum -y install epel-release; yum clean all
# TEMPORARY until Centos 7.4 is released. https://bugs.centos.org/view.php?id=13669&nbn=1
RUN rpm -ivh https://kojipkgs.fedoraproject.org//packages/http-parser/2.7.1/3.el7/x86_64/http-parser-2.7.1-3.el7.x86_64.rpm
RUN yum -y install bzip2 tar git nodejs npm ImageMagick; yum clean all
RUN npm install grunt-cli -g
# only add package.json so npm install will only be needed if we change it.
COPY package.json /tmp/package.json
# also add bower because package.json post-install needs it.
COPY bower.json /tmp/bower.json
RUN cd /tmp && npm install --unsafe-perm
RUN mkdir -p /opt/mosaico && cp -a /tmp/node_modules /tmp/bower_components /opt/mosaico/ && rm -rf /tmp/node_modules /tmp/bower_components
WORKDIR /opt/mosaico
COPY . /opt/mosaico
EXPOSE 9006
CMD ["grunt", "default"]
"use strict";
var path = require('path');
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.loadTasks('tasks');
grunt.initConfig({
combineKOTemplates: {
main: {
src: "src/tmpl/*.tmpl.html",
dest: "build/templates.js"
}
},
jshint: {
all: [
'Gruntfile.js',
'src/**/*.js',
],
options: {
reporter: require('jshint-stylish'),
sub: true,
jshintrc: true,
browserify: true
}
},
less: {
options: {
sourceMap: true,
sourceMapRootpath: '../',
/* sourceMapFilename: 'build/mosaico.css.map' */
sourceMapFileInline: true
},
css: {
files: {
"build/mosaico.css": "src/css/app_standalone.less",
"build/mosaico-material.css": "src/css/app_standalone_material.less"
}
}
},
postcss: {
options: {
map: {
inline: false /* , prev: 'build/app.css.map' */
},
diff: false,
processors: [
require('autoprefixer')({
browsers: 'ie 10, last 2 versions'
}),
require('csswring')()
]
},
dist: {
src: 'build/mosaico.css',
dest: 'dist/mosaico.min.css'
},
material: {
src: 'build/mosaico-material.css',
dest: 'dist/mosaico-material.min.css'
}
},
browserify: {
debug: {
options: {
browserifyOptions: {
standalone: 'Mosaico'
},
transform: [['browserify-shim', {global: true}]],
cacheFile: 'build/debug-incremental.bin',
},
files: {
'build/mosaico.js': ['./src/js/app.js', './build/templates.js']
}
},
main: {
options: {
browserifyOptions: {
debug: true,
fullPaths: false,
standalone: 'Mosaico'
},
transform: [['browserify-shim', {global: true}], 'uglifyify'],
cacheFile: 'build/main-incremental.bin',
},
files: {
'build/mosaico.debug.js': ['./src/js/app.js', './build/templates.js']
}
}
},
exorcise: {
main: {
options: {
bundleDest: 'dist/mosaico.min.js'
},
files: {
'dist/mosaico.min.js.map': ['build/mosaico.debug.js'],
}
}
},
watch: {
css: {
files: ['src/css/*.less', 'src/**/*.css'],
tasks: ['less', 'postcss']
},
tmpl: {
files: ['src/tmpl/*.tmpl.html'],
tasks: ['combineKOTemplates']
},
browserify: {
files: ['src/js/**/*.js', 'build/templates.js'],
tasks: ['browserify', 'exorcise']
},
exorcise: {
files: ['build/mosaico.debug.js'],
tasks: ['exorcise']
},
web: {
options: {
livereload: true
},
files: ['*.html', 'dist/**/*.js', 'dist/**/*.css'],
},
jshint: {
files: ['src/js/**/*.js'],
tasks: ['newer:jshint']
}
},
express: {
dev: {
options: {
script: 'backend/main.js',
background: true,
port: 9006,
}
}
},
googlefonts: {
noto: {
options: {
fontPath: './dist/vendor/notoregular/',
httpPath: './',
cssFile: './dist/vendor/notoregular/stylesheet.css',
formats: { eot: true, woff: true, svg: false, ttf: true, woff2: false },
fonts: [
{
family: 'Noto Sans',
styles: [ 400 ],
subsets: [ 'latin' ]
}
]
}
}
},
copy: {
res: {
expand: true,
cwd: 'res',
src: '**',
dest: 'dist/'
},
tinymce: {
expand: true,
cwd: 'node_modules/tinymce/',
src: ['plugins/**', 'skins/**', 'themes/**', 'tinymce.min.js'],
dest: 'dist/vendor/'
},
knockout: {
src: 'node_modules/knockout/build/output/knockout-latest.js',
dest: 'dist/vendor/knockout.js'
},
jquery: {
src: 'node_modules/jquery/dist/jquery.min.js',
dest: 'dist/vendor/jquery.min.js'
},
jqueryui: {
expand: true,
cwd: 'node_modules/jquery-ui-dist',
src: 'jquery-ui.min.*',
dest: 'dist/vendor/'
},
jqueryuitouchpunch: {
src: 'node_modules/jquery-ui-touch-punch/jquery.ui.touch-punch.min.js',
dest: 'dist/vendor/jquery.ui.touch-punch.min.js'
},
knockoutjqueryui: {
src: 'node_modules/knockout-jqueryui/dist/knockout-jqueryui.min.js',
dest: 'dist/vendor/knockout-jqueryui.min.js'
},
fontawesome: {
expand: true,
cwd: 'node_modules/font-awesome/fonts',
src: 'fontawesome-webfont.*',
dest: 'dist/fa/fonts/'
},
blueimpfileupload: {
expand: true,
cwd: 'node_modules/blueimp-file-upload/js/',
src: ['jquery.iframe-transport.js', 'jquery.fileupload.js', 'jquery.fileupload-process.js', 'jquery.fileupload-image.js', 'jquery.fileupload-validate.js'],
dest: 'dist/vendor/'
},
canvastoblob: {
src: 'node_modules/blueimp-canvas-to-blob/js/canvas-to-blob.min.js',
dest: 'dist/vendor/canvas-to-blob.min.js'
},
loadimage: {
src: 'node_modules/blueimp-load-image/js/load-image.all.min.js',
dest: 'dist/vendor/load-image.all.min.js'
},
},
jasmine_node: {
main: {
options: {
coverage: {
reportDir: 'build/coverage',
},
forceExit: true,
captureExceptions: true,
jasmine: {
reporters: {
spec: {},
junitXml: {
report: false,
savePath: './build/jasmine/',
useDotNotation: true,
consolidate: true
}
}
}
},
src: ['src/**/*.js']
}
},
});
grunt.registerTask('js', ['combineKOTemplates', 'browserify', 'exorcise']);
grunt.registerTask('css', ['less', 'postcss']);
grunt.registerTask('server', ['express', 'watch', 'keepalive']);
grunt.registerTask('build', ['googlefonts', 'copy', 'jshint', 'js', 'css']);
grunt.registerTask('default', ['build', 'server']);
grunt.registerTask('test', ['jasmine_node']);
};
\ No newline at end of file
This diff is collapsed.
---------------------
Built-in Dependencies
---------------------
These dependencies are included in the distributed Mosaico library
dist/mosaico.min.js and dist/mosaico.min.css
by an aggregator process named "Browserify"
Browserify (Library "Assembler" targeting the browser):
- MIT License, Copyright Joyent, Inc. and other Node contributors.
> os-browserify:
- MIT License, Copyright (c) 2014 Drew Young
> assert:
- MIT License, Copyright (c) shtylman <shtylman@gmail.com>
> util:
- MIT License, Copyright (c) Joyent (http://www.joyent.com)
> inherit:
- ISC License, Copyright (c) Isaac Z. Schlueter
> process:
- MIT License, Copyright (c) 2013 Roman Shtylman <shtylman@gmail.com>
> console-browserify:
- MIT License, Copyright (c) 2012 Raynos <raynos2@gmail.com>
Knockout-Sortable (Knockout Bindings to jQueryUI Sortable):
- MIT License, Copyright (c) 2015 Ryan Niemeyer
Knockout-UndoManager (Undo Library):
- MIT License, Copyright (c) 2015 Stefano Bagnara
Knockout-Reactor (Knockout value tracking used by Knockout-UndoManager):
- MIT License, Copyright (c) Ziad Jeeroburkhan
TinyColor (Color manipulation library):
- MIT License, Copyright (c) Brian Grinstead <briangrinstead@gmail.com>
(http://briangrinstead.com)",
Toastr (Toast notifications):
- MIT License, Copyright (c) 2012-2015 John Papa, Hans Fjllemark, and Tim Ferrell
Evol-Colorpicker (Color picker):
- MIT License, Copyright (c) 2015 Olivier Giulieri
Juice (CSS Inliner):
- MIT License, Copyright (c) Guillermo Rauch, Arian Stolwijk, Pawel Marzec,
Andrew Kelley, Francois-Guillaume Ribreau
Slick (selector parser used by Juice):
- MIT License, Copyright (c) Shashank Mehta <me@shashankmehta.in>
(http://shashankmehta.in)
JSEP (expression engine):
- MIT License, Copyright (c) Stephen Oney <swloney@gmail.com> (http://from.so/)
Mensch (CSS parser used by Mosaico and Juice):
- MIT License, Copyright (c) Brett Stimmerman <brettstimmerman@gmail.com>
----------------------------
Runtime Bundled Dependencies
----------------------------
res/lang (Language Files):
- CC-BY-4.0 License, Copyright (c) Translation contributors listed at res/lang/README.md
res/vendor/skins (Custom TinyMCE Skin):
- GPL v2.1 License
res/img (Proprietary image resources):
- GPLv3 License
-----------------------------
Runtime External Dependencies
-----------------------------
These dependencies are not included in Mosaico but are used at runtime and are
expected to be found in the running environment (browser)
jQuery, jQueryUI:
- MIT License
Knockout:
- MIT License
Knockout-jQueryUI:
- MIT License
jQuery-File-Upload:
- MIT License
--------------------------------------
Runtime External Optional Dependencies
--------------------------------------
Font NotoSans (in order to enable "Material style" font face):
- Apache License, version 2.0