resolved merge conflicts
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@ -13,3 +13,6 @@ npm-debug.log
|
||||
temp
|
||||
.idea
|
||||
wysija-newsletters.zip
|
||||
tests/javascript/testBundles
|
||||
assets/css/*.css
|
||||
assets/js/*.js
|
43
RoboFile.php
43
RoboFile.php
@ -1,6 +1,17 @@
|
||||
<?php
|
||||
|
||||
class RoboFile extends \Robo\Tasks {
|
||||
|
||||
private $css_files = array(
|
||||
'assets/css/src/admin.styl',
|
||||
'assets/css/src/rtl.styl'
|
||||
);
|
||||
|
||||
private $js_files = array(
|
||||
'assets/js/src/*.js',
|
||||
'assets/js/src/**/*.js'
|
||||
);
|
||||
|
||||
function install() {
|
||||
$this->_exec('./composer.phar install');
|
||||
$this->_exec('npm install');
|
||||
@ -13,35 +24,35 @@ class RoboFile extends \Robo\Tasks {
|
||||
}
|
||||
|
||||
function watch() {
|
||||
$css_files = array(
|
||||
'assets/css/src/admin.styl',
|
||||
'assets/css/src/rtl.styl'
|
||||
);
|
||||
|
||||
$js_files = glob('assets/js/src/*.js');
|
||||
$js_files = array();
|
||||
array_map(function($path) use(&$js_files) {
|
||||
$js_files = array_merge($js_files, glob($path));
|
||||
}, $this->js_files);
|
||||
|
||||
$this->taskWatch()
|
||||
->monitor($js_files, function() {
|
||||
$this->compileJavascript();
|
||||
$this->compileJs();
|
||||
})
|
||||
->monitor($css_files, function() use($css_files) {
|
||||
$this->compileStyles($css_files);
|
||||
->monitor($this->css_files, function() {
|
||||
$this->compileCss();
|
||||
})
|
||||
->run();
|
||||
}
|
||||
|
||||
function compileJavascript() {
|
||||
function compileAll() {
|
||||
$this->compileJs();
|
||||
$this->compileCss();
|
||||
}
|
||||
|
||||
function compileJs() {
|
||||
$this->_exec('./node_modules/webpack/bin/webpack.js');
|
||||
}
|
||||
|
||||
protected function compileStyles($files = array()) {
|
||||
if(empty($files)) { return; }
|
||||
|
||||
function compileCss() {
|
||||
$this->_exec(join(' ', array(
|
||||
'./node_modules/stylus/bin/stylus',
|
||||
'-u nib',
|
||||
'-w',
|
||||
join(' ', $files),
|
||||
join(' ', $this->css_files),
|
||||
'-o assets/css/'
|
||||
)));
|
||||
}
|
||||
@ -78,7 +89,7 @@ class RoboFile extends \Robo\Tasks {
|
||||
}
|
||||
|
||||
function testJavascript() {
|
||||
$this->compileJavascript();
|
||||
$this->compileJs();
|
||||
|
||||
$this->_exec(join(' ', array(
|
||||
'./node_modules/mocha/bin/mocha',
|
||||
|
1026
assets/css/admin.css
1026
assets/css/admin.css
File diff suppressed because it is too large
Load Diff
@ -1,629 +0,0 @@
|
||||
a:focus {
|
||||
outline: 0 none !important;
|
||||
}
|
||||
#mailpoet_form_history {
|
||||
display:none;
|
||||
}
|
||||
#mailpoet_form_editor {
|
||||
padding:20px;
|
||||
width:300px;
|
||||
border:1px solid #ccc;
|
||||
position: relative;
|
||||
background-color: #fff;
|
||||
-webkit-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.1);
|
||||
-moz-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.1);
|
||||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
#mailpoet_form_editor:before, #mailpoet_form_editor:after {
|
||||
position: absolute;
|
||||
width: 40%;
|
||||
height: 10px;
|
||||
content: ' ';
|
||||
left: 12px;
|
||||
bottom: 12px;
|
||||
background: transparent;
|
||||
-webkit-transform: skew(-5deg) rotate(-5deg);
|
||||
-moz-transform: skew(-5deg) rotate(-5deg);
|
||||
-ms-transform: skew(-5deg) rotate(-5deg);
|
||||
-o-transform: skew(-5deg) rotate(-5deg);
|
||||
transform: skew(-5deg) rotate(-5deg);
|
||||
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
|
||||
-moz-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
|
||||
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
|
||||
z-index: -1;
|
||||
}
|
||||
#mailpoet_form_editor:after
|
||||
{
|
||||
left: auto;
|
||||
right: 12px;
|
||||
-webkit-transform: skew(5deg) rotate(5deg);
|
||||
-moz-transform: skew(5deg) rotate(5deg);
|
||||
-ms-transform: skew(5deg) rotate(5deg);
|
||||
-o-transform: skew(5deg) rotate(5deg);
|
||||
transform: skew(5deg) rotate(5deg);
|
||||
}
|
||||
|
||||
|
||||
/* Warnings in blocks*/
|
||||
.mailpoet_warning {
|
||||
font-weight:bold;
|
||||
color:#900;
|
||||
}
|
||||
|
||||
.block_placeholder {
|
||||
font-weight: bold;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
line-height: 30px;
|
||||
text-align: center;
|
||||
border: 0 none;
|
||||
width:298px;
|
||||
z-index: 9500;
|
||||
margin:0 auto;
|
||||
text-indent: -9999px;
|
||||
|
||||
}
|
||||
.block_placeholder.active {
|
||||
text-indent: 0;
|
||||
/*border:1px dashed #dfdfdf;*/
|
||||
/*background-color:#f5f5f5;*/
|
||||
background-color: #4cb7e1;
|
||||
display:block;
|
||||
overflow: auto;
|
||||
height: 30px;
|
||||
}
|
||||
.block_placeholder.hover {
|
||||
background-color: #0074a2;
|
||||
border-color:#0074a2;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.mailpoet_form_block {
|
||||
background-color:#fff;
|
||||
height:20px;
|
||||
border:0 none;
|
||||
}
|
||||
.mailpoet_form_block.highlighted {
|
||||
border:1px solid #5897FB;
|
||||
padding:9px 17px;
|
||||
}
|
||||
|
||||
.mailpoet_form_block img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* Widget styles */
|
||||
.mailpoet_form_block p {
|
||||
margin:5px 0;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
/* Widget: checkbox, radio */
|
||||
.mailpoet_radio,
|
||||
.mailpoet_checkbox {
|
||||
margin:-2px 5px 0 0;
|
||||
}
|
||||
|
||||
/* MailPoet Form wrapper */
|
||||
#mailpoet_form_wrapper {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* MailPoet Form container */
|
||||
#mailpoet_form_container {
|
||||
width:340px;
|
||||
margin:0;
|
||||
}
|
||||
#mailpoet_form_editor.loading,
|
||||
#mailpoet_form_toolbar.loading {
|
||||
background: url(loading.gif) no-repeat center center #fcfcfc;
|
||||
}
|
||||
#mailpoet_form_toolbar.loading {
|
||||
border:1px solid #dfdfdf;
|
||||
}
|
||||
#mailpoet_form_toolbar.loading #mailpoet_toolbar_fields {
|
||||
visibility: hidden;
|
||||
z-index:1;
|
||||
}
|
||||
|
||||
/* Tabs : content/images/styles/themes */
|
||||
#wysija-add-field {
|
||||
float: none;
|
||||
}
|
||||
|
||||
#mailpoet_form_toolbar {
|
||||
position: absolute;
|
||||
width: 400px;
|
||||
}
|
||||
#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs {
|
||||
border-bottom:1px solid #dfdfdf;
|
||||
line-height:0;
|
||||
}
|
||||
#mailpoet_form_toolbar .add_custom_field {
|
||||
text-align:center;
|
||||
padding:15px 0 5px 0;
|
||||
}
|
||||
|
||||
#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs li,
|
||||
#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a {
|
||||
margin:0;
|
||||
height:30px;
|
||||
line-height:30px;
|
||||
padding:0;
|
||||
display:-moz-inline-box;
|
||||
display:inline-block;
|
||||
*display:inline;
|
||||
*float:left;
|
||||
outline:0 none;
|
||||
}
|
||||
#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a {
|
||||
outline:0 none; text-decoration:none; color:#a6a6a6;
|
||||
}
|
||||
#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs li {
|
||||
margin:0 0 1px 0;
|
||||
}
|
||||
#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a {
|
||||
font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;
|
||||
background-color: #F5F5F5;
|
||||
background-image: -moz-linear-gradient(center top , #F9F9F9, #F5F5F5);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#F5F5F5', endColorstr='#F9F9F9');
|
||||
background: -webkit-gradient(linear, left top,left bottom, from(#F9F9F9), to(#F5F5F5));
|
||||
border:1px solid #DFDFDF;
|
||||
-moz-border-radius: 3px 3px 0 0;
|
||||
-webkit-border-radius: 3px 3px 0 0;
|
||||
-khtml-border-radius: 3px 3px 0 0;
|
||||
border-radius: 3px 3px 0 0;
|
||||
box-shadow: 0 1px 0 #FFFFFF inset;
|
||||
padding:0 7px;
|
||||
}
|
||||
#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a:hover {
|
||||
background-color:#eee;
|
||||
}
|
||||
#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a.selected {
|
||||
color:#000;
|
||||
border-bottom:0 none;
|
||||
background:#fcfcfc;
|
||||
filter:none;
|
||||
padding-bottom:1px;
|
||||
}
|
||||
#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs .last a { }
|
||||
|
||||
.wysija_params {
|
||||
display:none !important;
|
||||
}
|
||||
|
||||
#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs,
|
||||
#mailpoet_form_toolbar #mailpoet_toolbar_fields {
|
||||
position:relative;
|
||||
z-index:9998;
|
||||
margin:0;
|
||||
}
|
||||
|
||||
/* edit form name */
|
||||
h2.title {
|
||||
margin:0 0 15px 0;
|
||||
}
|
||||
|
||||
#mailpoet_form_name_input {
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
/* wysija widgets */
|
||||
.mailpoet_form_widget {
|
||||
width:298px;
|
||||
height:25px;
|
||||
line-height:25px;
|
||||
z-index:9999 !important;
|
||||
}
|
||||
|
||||
.mailpoet_toolbar_section {
|
||||
margin-bottom: 0;
|
||||
|
||||
background: none repeat scroll 0 0 #fff;
|
||||
border: 1px solid #e5e5e5;
|
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
|
||||
min-width: 255px;
|
||||
position: relative;
|
||||
|
||||
cursor: pointer;
|
||||
max-height: auto;
|
||||
}
|
||||
|
||||
.mailpoet_toolbar_section > div {
|
||||
padding:10px 20px 20px 20px;
|
||||
}
|
||||
|
||||
.mailpoet_toolbar_section h3 {
|
||||
margin: 10px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.mailpoet_toolbar_section.closed {
|
||||
max-height:38px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.mailpoet_toolbar_section .mailpoet_toggle {
|
||||
position: absolute;
|
||||
top:0;
|
||||
right: 0;
|
||||
height: 38px;
|
||||
width: 27px;
|
||||
}
|
||||
.mailpoet_toolbar_section .mailpoet_toggle:focus {
|
||||
outline: 0 none !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.mailpoet_toolbar_section .mailpoet_toggle:before {
|
||||
right: 12px;
|
||||
font: 400 20px/1 dashicons;
|
||||
speak: none;
|
||||
display: inline-block;
|
||||
padding: 8px 10px;
|
||||
top: 0;
|
||||
position: relative;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-decoration: none!important;
|
||||
content: '\f142';
|
||||
}
|
||||
.mailpoet_toolbar_section.closed .mailpoet_toggle:before {
|
||||
content: '\f140';
|
||||
}
|
||||
|
||||
#mailpoet_form_styles {
|
||||
margin:10px;
|
||||
max-width: 318px;
|
||||
width: 318px;
|
||||
min-height: 300px;
|
||||
resize:vertical;
|
||||
}
|
||||
|
||||
#mailpoet_form_toolbar a.mailpoet_form_field,
|
||||
.mailpoet_form_widget {
|
||||
height:25px;
|
||||
line-height:25px;
|
||||
background-color: #F5F5F5;
|
||||
background-image: -moz-linear-gradient(center top , #f9f9f9, #ececec);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#ececec');
|
||||
background: -webkit-gradient(linear, left top,left bottom, from(#f9f9f9), to(#ececec));
|
||||
border:1px solid #DFDFDF;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
-khtml-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 1px 0 #FFFFFF inset;
|
||||
display:block;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
padding:0 7px;
|
||||
cursor:move;
|
||||
color:#222;
|
||||
text-shadow: 0 1px 0 #FFFFFF;
|
||||
}
|
||||
#mailpoet_form_toolbar a.mailpoet_form_field.disabled {
|
||||
cursor:pointer;
|
||||
color:#cccccc;
|
||||
pointer-events:none;
|
||||
}
|
||||
.mailpoet_form_field_edit {
|
||||
position:absolute;
|
||||
right:27px;
|
||||
bottom:13px;
|
||||
}
|
||||
.mailpoet_form_field_delete {
|
||||
position: absolute;
|
||||
right:7px;
|
||||
bottom:13px;
|
||||
}
|
||||
|
||||
/* toolbar: fields */
|
||||
#mailpoet_toolbar_fields li {
|
||||
padding:0 0 10px 0;
|
||||
position:relative;
|
||||
}
|
||||
|
||||
#mailpoet_toolbar_fields li.notice {
|
||||
font-style:italic;
|
||||
font-size:11px;
|
||||
margin: 0 !important;
|
||||
border: 0 none !important;
|
||||
background: none !important;
|
||||
}
|
||||
|
||||
/* blocks */
|
||||
.mailpoet_form_block {
|
||||
position:relative;
|
||||
margin:0;
|
||||
padding:10px 18px 10px 18px;
|
||||
display: inline-table;
|
||||
display: block;
|
||||
height: 1%;
|
||||
margin:0;
|
||||
z-index:98;
|
||||
}
|
||||
|
||||
.mailpoet_form_block.dragging {
|
||||
z-index:99000;
|
||||
pointer-events:none;
|
||||
}
|
||||
|
||||
.mailpoet_form_block:after {
|
||||
content: ".";
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
}
|
||||
.mailpoet_form_block.hover {
|
||||
border:1px dashed #bbb;
|
||||
margin:0 0 0 0;
|
||||
padding:9px 17px 9px 17px;
|
||||
}
|
||||
.mailpoet_form_block.static {
|
||||
/*padding:0;
|
||||
margin:0;*/
|
||||
background-color:#999;
|
||||
}
|
||||
|
||||
/* controls*/
|
||||
.mailpoet_form_block .wysija_controls {
|
||||
background-color:#dfdfdf;
|
||||
background-image: -moz-linear-gradient(center bottom , #bbb, #eee);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#bbbbbb');
|
||||
background: -webkit-gradient(linear, left bottom,left top, from(#bbb), to(#eee));
|
||||
-moz-border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
-khtml-border-radius: 2px;
|
||||
border-radius: 2px;
|
||||
border:1px solid #ccc;
|
||||
position:absolute;
|
||||
margin:0;
|
||||
padding:0;
|
||||
width:298px;
|
||||
height:20px;
|
||||
left:-1px;
|
||||
right:0;
|
||||
top:-22px;
|
||||
}
|
||||
.mailpoet_form_block .wysija_controls li {
|
||||
float:left;
|
||||
width:20px;
|
||||
height:20px;
|
||||
}
|
||||
.mailpoet_form_block .wysija_controls a {
|
||||
cursor: pointer;
|
||||
float: left;
|
||||
font-size: 120%;
|
||||
font-weight: bold;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
text-align: center;
|
||||
width: 20px;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
.mailpoet_form_block .wysija_controls a.remove {
|
||||
margin:0 0 0 1px;
|
||||
}
|
||||
.mailpoet_form_block .handle_container,
|
||||
.mailpoet_form_block .handle_container a {
|
||||
float:none;
|
||||
width:40px !important;
|
||||
}
|
||||
|
||||
.mailpoet_form_block .handle_container {
|
||||
left: 140px;
|
||||
top: 0;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
/* controls & icons */
|
||||
.wysija_controls a span,
|
||||
.wysija_gallery .wysija_tools a span,
|
||||
.wysija_image .wysija_tools a span,
|
||||
.wysija_text .wysija_tools a span,
|
||||
#mailpoet_toolbar_fields a span {
|
||||
display: block;
|
||||
height:20px;
|
||||
width:20px;
|
||||
}
|
||||
|
||||
/* toolbar: full width button */
|
||||
|
||||
/* color picker in control bars */
|
||||
.wysija_controls span input {
|
||||
margin:2px 0 0 0;
|
||||
padding: 0;
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
/* left alignment button */
|
||||
.alignment-left span {
|
||||
background:url(form_editor_icons.png) no-repeat 0 0;
|
||||
}
|
||||
.alignment-left.active span, .alignment-left:hover span {
|
||||
background:url(form_editor_icons.png) no-repeat 0 -20px;
|
||||
}
|
||||
|
||||
/* center alignment button */
|
||||
.alignment-center span {
|
||||
background:url(form_editor_icons.png) no-repeat -20px 0;
|
||||
}
|
||||
.alignment-center.active span, .alignment-center:hover span {
|
||||
background:url(form_editor_icons.png) no-repeat -20px -20px;
|
||||
}
|
||||
|
||||
/* right alignment button */
|
||||
.alignment-right span {
|
||||
background:url(form_editor_icons.png) no-repeat -40px 0;
|
||||
}
|
||||
.alignment-right.active span, .alignment-right:hover span {
|
||||
background:url(form_editor_icons.png) no-repeat -40px -20px;
|
||||
}
|
||||
|
||||
/* linking */
|
||||
.add-link span {
|
||||
background:url(form_editor_icons.png) no-repeat -60px 0;
|
||||
}
|
||||
.add-link.active span, .add-link:hover span {
|
||||
background:url(form_editor_icons.png) no-repeat -60px -20px;
|
||||
}
|
||||
|
||||
.remove-link span {
|
||||
background:url(form_editor_icons.png) no-repeat -80px 0;
|
||||
}
|
||||
|
||||
.remove-link.active span, .remove-link:hover span {
|
||||
background:url(form_editor_icons.png) no-repeat -80px -20px;
|
||||
}
|
||||
|
||||
/* block controls */
|
||||
.remove span, .delete span {
|
||||
background:url(form_editor_icons.png) no-repeat -100px 0;
|
||||
}
|
||||
.remove.active span, .remove:hover span,
|
||||
.delete.active span, .delete:hover span {
|
||||
background:url(form_editor_icons.png) no-repeat -100px -20px;
|
||||
}
|
||||
|
||||
.handle span {
|
||||
background: url(handle.png) no-repeat;
|
||||
cursor:move;
|
||||
width: 40px !important;
|
||||
}
|
||||
|
||||
.duplicate span {
|
||||
background:url(form_editor_icons.png) no-repeat -140px 0;
|
||||
}
|
||||
|
||||
.duplicate.active span, .duplicate:hover span {
|
||||
background:url(form_editor_icons.png) no-repeat -140px -20px;
|
||||
}
|
||||
|
||||
.settings span {
|
||||
background:url(form_editor_icons.png) no-repeat -160px 0;
|
||||
}
|
||||
.settings.active span, .settings:hover span {
|
||||
background:url(form_editor_icons.png) no-repeat -160px -20px;
|
||||
}
|
||||
|
||||
.icon-plus span {
|
||||
background:url(form_editor_icons.png) no-repeat -200px 0;
|
||||
}
|
||||
|
||||
.icon-plus.active span, .icon-plus:hover span {
|
||||
background:url(form_editor_icons.png) no-repeat -200px -20px;
|
||||
}
|
||||
|
||||
.icon-minus span {
|
||||
background:url(form_editor_icons.png) no-repeat -220px 0;
|
||||
}
|
||||
|
||||
.icon-minus.active span, .icon-minus:hover span {
|
||||
background:url(form_editor_icons.png) no-repeat -220px -20px;
|
||||
}
|
||||
|
||||
/* wysija options */
|
||||
.wysija_options {
|
||||
display:none;
|
||||
}
|
||||
|
||||
/* wysija block settings */
|
||||
.wysija_settings {
|
||||
position: absolute;
|
||||
z-index:1000;
|
||||
}
|
||||
.wysija_settings a {
|
||||
background-color: #F5F5F5;
|
||||
background-image: -moz-linear-gradient(center top , #f9f9f9, #ececec);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#ececec');
|
||||
background: -webkit-gradient(linear, left top,left bottom, from(#f9f9f9), to(#ececec));
|
||||
border:1px solid #DFDFDF;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
-khtml-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 1px 0 #FFFFFF inset;
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
cursor:pointer;
|
||||
color:#222;
|
||||
text-shadow: 0 1px 0 #FFFFFF;
|
||||
text-decoration: none;
|
||||
display:block;
|
||||
padding:5px 5px 3px 27px;
|
||||
}
|
||||
|
||||
.wysija_settings a span {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
left: 5px;
|
||||
}
|
||||
|
||||
/* labels */
|
||||
.mailpoet_form_block label {
|
||||
margin:0 5px 0 0;
|
||||
display:block;
|
||||
}
|
||||
|
||||
/* form settings: success message */
|
||||
#mailpoet_on_success textarea,
|
||||
#mailpoet_on_success select {
|
||||
width:100%;
|
||||
}
|
||||
|
||||
#mailpoet_on_success textarea {
|
||||
height:50px;
|
||||
min-height: 50px;
|
||||
resize:vertical;
|
||||
}
|
||||
|
||||
/* make sure textareas within the form editor are not resizeable */
|
||||
.mailpoet_form_block textarea {
|
||||
resize:none;
|
||||
}
|
||||
/* remove click events from inputs within form editor */
|
||||
.mailpoet_form_block input,
|
||||
.mailpoet_form_block textarea {
|
||||
pointer-events:none;
|
||||
}
|
||||
|
||||
/* form export */
|
||||
#mailpoet_form_export textarea {
|
||||
width:340px;
|
||||
height:150px;
|
||||
min-height: 150px;
|
||||
resize:vertical;
|
||||
font-size:85%;
|
||||
display:none;
|
||||
}
|
||||
|
||||
/** Styling for WP 3.8 and higher */
|
||||
.mailpoet_form_field_edit,
|
||||
.mailpoet_form_field_delete {
|
||||
text-decoration: none;
|
||||
}
|
||||
.mailpoet_form_field_edit:hover .dashicons-admin-generic:before,
|
||||
.mailpoet_form_field_delete:hover .dashicons-dismiss:before,
|
||||
.settings:hover .dashicons-admin-generic:before {
|
||||
color: #2ea2cc;
|
||||
}
|
||||
.mailpoet_form_field_edit span,
|
||||
.mailpoet_form_field_delete span {
|
||||
background: none !important;
|
||||
color: #999;
|
||||
}
|
||||
.mailpoet_form_field_delete span:before {
|
||||
font-size: 21px;
|
||||
}
|
||||
|
||||
|
||||
/* Code Mirror */
|
||||
.CodeMirror {
|
||||
border: 1px solid #eee;
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
define('admin', [
|
||||
'mailpoet',
|
||||
'jquery',
|
||||
'handlebars',
|
||||
], function(MailPoet, jQuery, Handlebars) {
|
||||
console.log('OVER HERE', MailPoet, jQuery, Handlebars);
|
||||
jQuery(function($) {
|
||||
// dom ready
|
||||
$(function() {
|
||||
|
||||
});
|
||||
});
|
||||
});
|
@ -1,9 +0,0 @@
|
||||
define('mailpoet', [], function() {
|
||||
// A placeholder for MailPoet object
|
||||
var MailPoet = {};
|
||||
|
||||
// Expose MailPoet globally
|
||||
window.MailPoet = MailPoet;
|
||||
|
||||
return MailPoet;
|
||||
});
|
@ -1,21 +1,12 @@
|
||||
webpackJsonp([0],[
|
||||
/* 0 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
|
||||
__webpack_require__(1),
|
||||
__webpack_require__(2),
|
||||
__webpack_require__(3),
|
||||
], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery, Handlebars) {
|
||||
console.log('OVER HERE', MailPoet, jQuery, Handlebars);
|
||||
define('admin', [
|
||||
'mailpoet',
|
||||
'jquery',
|
||||
'handlebars',
|
||||
], function(MailPoet, jQuery, Handlebars) {
|
||||
jQuery(function($) {
|
||||
// dom ready
|
||||
$(function() {
|
||||
|
||||
});
|
||||
});
|
||||
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
||||
|
||||
|
||||
/***/ }
|
||||
]);
|
||||
});
|
||||
|
@ -1,921 +1,9 @@
|
||||
webpackJsonp([1],[
|
||||
/* 0 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
define('mailpoet', [], function() {
|
||||
// A placeholder for MailPoet object
|
||||
var MailPoet = {};
|
||||
|
||||
__webpack_require__(1);
|
||||
__webpack_require__(11);
|
||||
__webpack_require__(12);
|
||||
module.exports = __webpack_require__(13);
|
||||
// Expose MailPoet globally
|
||||
window.MailPoet = MailPoet;
|
||||
|
||||
|
||||
/***/ },
|
||||
/* 1 */,
|
||||
/* 2 */,
|
||||
/* 3 */,
|
||||
/* 4 */,
|
||||
/* 5 */,
|
||||
/* 6 */,
|
||||
/* 7 */,
|
||||
/* 8 */,
|
||||
/* 9 */,
|
||||
/* 10 */,
|
||||
/* 11 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery) {
|
||||
"use strict";
|
||||
/**
|
||||
* MailPoet Ajax
|
||||
**/
|
||||
|
||||
MailPoet.Ajax = {
|
||||
version: 0.1,
|
||||
options: {},
|
||||
defaults: {
|
||||
url: null,
|
||||
controller: 'dummy',
|
||||
action: 'test',
|
||||
data: {},
|
||||
onSuccess: function(data, textStatus, xhr) {},
|
||||
onError: function(xhr, textStatus, errorThrown) {}
|
||||
},
|
||||
get: function(options) {
|
||||
this.request('get', options);
|
||||
},
|
||||
post: function(options) {
|
||||
this.request('post', options);
|
||||
},
|
||||
delete: function(options) {
|
||||
this.request('delete', options);
|
||||
},
|
||||
init: function(options) {
|
||||
// merge options
|
||||
this.options = jQuery.extend({}, this.defaults, options);
|
||||
|
||||
if(this.options.url === null) {
|
||||
this.options.url = ajaxurl+'?action=mailpoet_ajax';
|
||||
}
|
||||
|
||||
// routing
|
||||
this.options.url += '&mailpoet_controller='+this.options.controller;
|
||||
this.options.url += '&mailpoet_action='+this.options.action;
|
||||
},
|
||||
request: function(method, options) {
|
||||
// set options
|
||||
this.init(options);
|
||||
|
||||
// make ajax request depending on method
|
||||
if(method === 'get') {
|
||||
jQuery.get(
|
||||
this.options.url,
|
||||
this.options.data,
|
||||
this.options.onSuccess,
|
||||
'json'
|
||||
);
|
||||
} else {
|
||||
jQuery.ajax(
|
||||
this.options.url,
|
||||
{
|
||||
data: JSON.stringify(this.options.data),
|
||||
processData: false,
|
||||
contentType: "application/json; charset=utf-8",
|
||||
type : method,
|
||||
dataType: 'json',
|
||||
success : this.options.onSuccess,
|
||||
error : this.options.onError
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
||||
|
||||
|
||||
/***/ },
|
||||
/* 12 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery) {
|
||||
"use strict";
|
||||
/*==================================================================================================
|
||||
|
||||
MailPoet Modal:
|
||||
|
||||
version: 0.8
|
||||
author: Jonathan Labreuille
|
||||
company: Wysija
|
||||
dependencies: jQuery
|
||||
|
||||
|
||||
Options:
|
||||
|
||||
Mandatory:
|
||||
// Modal window's title
|
||||
(string) title: 'Modal title'
|
||||
|
||||
// template
|
||||
(string) template: jQuery('#handlebars_template').html() or
|
||||
literal html
|
||||
|
||||
Optional:
|
||||
// jQuery cached element object node to be displayed,
|
||||
// instead of creating a new one
|
||||
(object) element: jQuery(selector)
|
||||
|
||||
// - data object that will be passed to the template when rendering
|
||||
(object) data: {},
|
||||
|
||||
// - data will be loaded via this url and passed to the template
|
||||
// when rendering
|
||||
// - if a "data" option was specified, it will be merged with the
|
||||
// ajax's response data
|
||||
(string) url: '/url.json'
|
||||
|
||||
// ajax method
|
||||
(string) method: 'post' (default: 'get')
|
||||
|
||||
// ajax post params
|
||||
(object) params: {}
|
||||
|
||||
// - integers are expressed in pixels
|
||||
(mixed) width: '50%' | 100 | '100px'
|
||||
|
||||
// - integers are expressed in pixels
|
||||
// - will be ignored when in "panel" mode
|
||||
(mixed) height: '50%' | 100 | '100px'
|
||||
|
||||
// - only used for "panel" mode
|
||||
// - will be ignored in "popup" mode
|
||||
(string) position: 'left' | 'right'
|
||||
|
||||
// display overlay or not
|
||||
(boolean) overlay: true | false
|
||||
|
||||
// element(s) to be highlighted when the overlay is "on"
|
||||
(object) highlight: jQuery element
|
||||
|
||||
// callbacks
|
||||
(function) onInit: called when the modal is displayed
|
||||
(function) onSuccess: called by calling MailPoet_Guide.success()
|
||||
(function) onCancel: called when closing the popup
|
||||
or by calling MailPoet_Guide.cancel()
|
||||
|
||||
Usage:
|
||||
|
||||
// popup mode
|
||||
MailPoet.Modal.popup(options);
|
||||
|
||||
// panel mode
|
||||
MailPoet.Modal.panel(options);
|
||||
|
||||
// loading states
|
||||
MailPoet.Modal.loading(true); // displays loading indicator
|
||||
MailPoet.Modal.loading(false); // hides loading indicator
|
||||
|
||||
==================================================================================================*/
|
||||
|
||||
MailPoet.Modal = {
|
||||
version: 0.8,
|
||||
|
||||
// flags
|
||||
initialized: false,
|
||||
opened: false,
|
||||
locked: false,
|
||||
|
||||
// sub panels
|
||||
subpanels: [],
|
||||
|
||||
// default values
|
||||
defaults: {
|
||||
// title
|
||||
title: null,
|
||||
|
||||
// type
|
||||
type: null,
|
||||
|
||||
// positionning
|
||||
position: 'right',
|
||||
|
||||
// data sources
|
||||
data: {},
|
||||
url: null,
|
||||
method: 'get',
|
||||
params: {},
|
||||
|
||||
// template
|
||||
template: null,
|
||||
body_template: null,
|
||||
|
||||
// dimensions
|
||||
width: 'auto',
|
||||
height: 'auto',
|
||||
|
||||
// display overlay
|
||||
overlay: false,
|
||||
|
||||
// highlighted elements
|
||||
highlight: null,
|
||||
|
||||
// callbacks
|
||||
onInit: null,
|
||||
onSuccess: null,
|
||||
onCancel: null
|
||||
},
|
||||
renderer: 'html',
|
||||
options: {},
|
||||
templates: {
|
||||
overlay: '<div id="mailpoet_modal_overlay" style="display:none;"></div>',
|
||||
popup: '<div id="mailpoet_popup">'+
|
||||
'<div class="mailpoet_popup_wrapper">'+
|
||||
'<a href="javascript:;" id="mailpoet_modal_close"></a>'+
|
||||
'<div id="mailpoet_popup_title"><h2></h2></div>'+
|
||||
'<div class="mailpoet_popup_body clearfix"></div>'+
|
||||
'</div>'+
|
||||
'</div>',
|
||||
loading: '<div id="mailpoet_loading" style="display:none;">'+
|
||||
'<div id="mailpoet_modal_loading_1" class="mailpoet_modal_loading"></div>'+
|
||||
'<div id="mailpoet_modal_loading_2" class="mailpoet_modal_loading"></div>'+
|
||||
'<div id="mailpoet_modal_loading_3" class="mailpoet_modal_loading"></div>'+
|
||||
'</div>',
|
||||
panel: '<div id="mailpoet_panel">'+
|
||||
'<a href="javascript:;" id="mailpoet_modal_close"></a>'+
|
||||
'<div class="mailpoet_panel_wrapper">'+
|
||||
'<div class="mailpoet_panel_body clearfix"></div>'+
|
||||
'</div>'+
|
||||
'</div>',
|
||||
subpanel: '<div class="mailpoet_panel_wrapper">'+
|
||||
'<div class="mailpoet_panel_body clearfix"></div>'+
|
||||
'</div>'
|
||||
},
|
||||
setRenderer: function() {
|
||||
this.renderer = (typeof(Handlebars) === "undefined") ? 'html' : 'handlebars';
|
||||
},
|
||||
compileTemplate: function(template) {
|
||||
if(this.renderer === 'html') {
|
||||
return function() { return template; };
|
||||
} else {
|
||||
return Handlebars.compile(template);
|
||||
}
|
||||
},
|
||||
init: function(options) {
|
||||
if(this.initialized === true) {
|
||||
this.close();
|
||||
}
|
||||
|
||||
// merge options
|
||||
this.options = jQuery.extend({}, this.defaults, options);
|
||||
|
||||
// set renderer
|
||||
this.setRenderer();
|
||||
|
||||
// init overlay
|
||||
this.initOverlay();
|
||||
|
||||
// toggle overlay
|
||||
this.toggleOverlay(this.options.overlay);
|
||||
|
||||
if(this.options.type !== null) {
|
||||
// insert modal depending on its type
|
||||
if(this.options.type === 'popup') {
|
||||
var modal = this.compileTemplate(this.templates[this.options.type]);
|
||||
// create modal
|
||||
jQuery('#mailpoet_modal_overlay').append(modal(this.options));
|
||||
// set title
|
||||
jQuery('#mailpoet_popup_title h2').html(this.options.title);
|
||||
} else if(this.options.type === 'panel') {
|
||||
// create panel
|
||||
jQuery('#mailpoet_modal_overlay').after(this.templates[this.options.type]);
|
||||
}
|
||||
|
||||
// add proper overlay class
|
||||
jQuery('#mailpoet_modal_overlay')
|
||||
.removeClass('mailpoet_popup_overlay mailpoet_panel_overlay')
|
||||
.addClass('mailpoet_'+this.options.type+'_overlay');
|
||||
}
|
||||
|
||||
// render template if specified
|
||||
if(this.options.template !== null) {
|
||||
// set "success" callback if specified
|
||||
if(options.onSuccess !== undefined) {
|
||||
this.options.onSuccess = options.onSuccess;
|
||||
}
|
||||
|
||||
// set "cancel" callback if specified
|
||||
if(options.onCancel !== undefined) {
|
||||
this.options.onCancel = options.onCancel;
|
||||
}
|
||||
|
||||
// compile template
|
||||
this.options.body_template = this.compileTemplate(this.options.template);
|
||||
|
||||
// setup events
|
||||
this.setupEvents();
|
||||
}
|
||||
|
||||
// set popup as initialized
|
||||
this.initialized = true;
|
||||
|
||||
return this;
|
||||
},
|
||||
initOverlay: function(toggle) {
|
||||
if(jQuery('#mailpoet_modal_overlay').length === 0) {
|
||||
// insert overlay into the DOM
|
||||
jQuery('body').append(this.templates.overlay);
|
||||
// insert loading indicator into overlay
|
||||
jQuery('#mailpoet_modal_overlay').append(this.templates.loading);
|
||||
}
|
||||
return this;
|
||||
},
|
||||
toggleOverlay: function(toggle) {
|
||||
if(toggle === true) {
|
||||
jQuery('#mailpoet_modal_overlay').removeClass('mailpoet_overlay_hidden');
|
||||
} else {
|
||||
jQuery('#mailpoet_modal_overlay').addClass('mailpoet_overlay_hidden');
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
setupEvents: function() {
|
||||
// close popup when user clicks on close button
|
||||
jQuery('#mailpoet_modal_close').on('click', this.cancel.bind(this));
|
||||
|
||||
// close popup when user clicks on overlay
|
||||
jQuery('#mailpoet_modal_overlay').on('click', function(e) {
|
||||
// we need to make sure that we are actually clicking on the overlay
|
||||
// because when clicking on the popup content, it will trigger the click
|
||||
// event on the overlay
|
||||
if(e.target.id === 'mailpoet_modal_overlay') { this.cancel(); }
|
||||
}.bind(this));
|
||||
|
||||
// close popup when user presses ESC key
|
||||
jQuery(document).on('keyup.mailpoet_modal', function(e) {
|
||||
if(this.opened === false) { return false; }
|
||||
if(e.keyCode === 27) { this.cancel(); }
|
||||
}.bind(this));
|
||||
|
||||
// make sure the popup is repositioned when the window is resized
|
||||
jQuery(window).on('resize.mailpoet_modal', function() {
|
||||
this.setPosition();
|
||||
}.bind(this));
|
||||
|
||||
return this;
|
||||
},
|
||||
removeEvents: function() {
|
||||
jQuery(document).unbind('keyup.mailpoet_modal');
|
||||
jQuery(window).unbind('resize.mailpoet_modal');
|
||||
jQuery('#mailpoet_modal_close').off('click');
|
||||
if(this.options.overlay === true) {
|
||||
jQuery('#mailpoet_modal_overlay').off('click');
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
lock: function() {
|
||||
this.locked = true;
|
||||
|
||||
return this;
|
||||
},
|
||||
unlock: function() {
|
||||
this.locked = false;
|
||||
|
||||
return this;
|
||||
},
|
||||
isLocked: function() {
|
||||
return this.locked;
|
||||
},
|
||||
loadTemplate: function() {
|
||||
if(this.subpanels.length > 0) {
|
||||
// hide panel
|
||||
jQuery('.mailpoet_'+this.options.type+'_wrapper').hide();
|
||||
|
||||
// add sub panel wrapper
|
||||
jQuery('#mailpoet_'+this.options.type).append(this.templates['subpanel']);
|
||||
|
||||
// add sub panel content
|
||||
jQuery('.mailpoet_'+this.options.type+'_body').last().html(this.subpanels[(this.subpanels.length - 1)].element);
|
||||
} else if (this.options.element) {
|
||||
jQuery('.mailpoet_'+this.options.type+'_body').empty();
|
||||
jQuery('.mailpoet_'+this.options.type+'_body').append(this.options.element);
|
||||
} else {
|
||||
jQuery('.mailpoet_'+this.options.type+'_body').html(
|
||||
this.options.body_template(
|
||||
this.options.data
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
loadUrl: function() {
|
||||
if(this.options.method === 'get') {
|
||||
// make ajax request
|
||||
jQuery.getJSON(this.options.url, function(data) {
|
||||
// merge returned data with existing data passed when calling the "open" method
|
||||
this.options.data = jQuery.extend({}, this.options.data, data);
|
||||
// load template using fetched data
|
||||
this.loadTemplate();
|
||||
// show modal window
|
||||
this.showModal();
|
||||
}.bind(this));
|
||||
} else if(this.options.method === 'post') {
|
||||
// make ajax request
|
||||
jQuery.post(this.options.url, JSON.stringify(this.options.params), function(data) {
|
||||
// merge returned data with existing data passed when calling the "open" method
|
||||
this.options.data = jQuery.extend({}, this.options.data, data);
|
||||
// load template using fetched data
|
||||
this.loadTemplate();
|
||||
// show modal window
|
||||
this.showModal();
|
||||
}.bind(this), 'json');
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
setDimensions: function() {
|
||||
switch(this.options.type) {
|
||||
case 'popup':
|
||||
// set popup dimensions
|
||||
jQuery('#mailpoet_popup').css({
|
||||
width: this.options.width,
|
||||
minHeight: this.options.height
|
||||
});
|
||||
// set popup wrapper height
|
||||
jQuery('#mailpoet_popup_wrapper').css({ height: this.options.height});
|
||||
break;
|
||||
case 'panel':
|
||||
// set dimensions
|
||||
if(this.options.position === 'right') {
|
||||
jQuery('#mailpoet_panel').css({
|
||||
width: this.options.width,
|
||||
right: 0,
|
||||
marginRight: '-' + this.options.width,
|
||||
left: 'auto'
|
||||
});
|
||||
} else if(this.options.position === 'left') {
|
||||
jQuery('#mailpoet_panel').css({
|
||||
width: this.options.width,
|
||||
left: 0,
|
||||
marginLeft: '-' + this.options.width,
|
||||
right: 'auto'
|
||||
});
|
||||
}
|
||||
jQuery('#mailpoet_panel').css({ minHeight: 'auto' });
|
||||
break;
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
setPosition: function() {
|
||||
switch(this.options.type) {
|
||||
case 'popup':
|
||||
var screenWidth = jQuery(window).width(),
|
||||
screenHeight = jQuery(window).height(),
|
||||
modalWidth = jQuery('.mailpoet_'+ this.options.type +'_wrapper').width(),
|
||||
modalHeight = jQuery('.mailpoet_'+ this.options.type +'_wrapper').height();
|
||||
|
||||
var top = Math.max(48, parseInt((screenHeight / 2) - (modalHeight / 2))),
|
||||
left = Math.max(0, parseInt((screenWidth / 2) - (modalWidth / 2)));
|
||||
|
||||
// set position of popup depending on screen dimensions.
|
||||
jQuery('#mailpoet_popup').css({
|
||||
top: top,
|
||||
left: left
|
||||
});
|
||||
break;
|
||||
case 'panel':
|
||||
setTimeout(function() {
|
||||
// set position of popup depending on screen dimensions.
|
||||
if(this.options.position === 'right') {
|
||||
jQuery('#mailpoet_panel').css(
|
||||
{ marginRight: 0 }
|
||||
);
|
||||
} else if(this.options.position === 'left') {
|
||||
jQuery('#mailpoet_panel').css(
|
||||
{ marginLeft: 0 }
|
||||
);
|
||||
}
|
||||
}.bind(this), 0);
|
||||
break;
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
showModal: function() {
|
||||
// set modal dimensions
|
||||
this.setDimensions();
|
||||
|
||||
// add a flag on the body so that we can prevent scrolling (setting overflow hidden)
|
||||
jQuery('body').addClass('mailpoet_modal_opened');
|
||||
|
||||
// show popup
|
||||
jQuery('#mailpoet_'+this.options.type).show();
|
||||
|
||||
// display overlay
|
||||
this.showOverlay();
|
||||
|
||||
// set modal position
|
||||
this.setPosition();
|
||||
|
||||
// add class on highlighted elements
|
||||
if(this.options.highlight !== null) {
|
||||
if(this.options.highlight.length > 0) {
|
||||
this.highlightOn(this.options.highlight);
|
||||
}
|
||||
}
|
||||
|
||||
// set popup as opened
|
||||
this.opened = true;
|
||||
|
||||
// trigger init event if specified
|
||||
if(this.options.onInit !== null) {
|
||||
this.options.onInit();
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
highlightOn: function(element) {
|
||||
jQuery(element).addClass('mailpoet_modal_highlight');
|
||||
return this;
|
||||
},
|
||||
highlightOff: function() {
|
||||
jQuery('.mailpoet_modal_highlight').removeClass('mailpoet_modal_highlight');
|
||||
return this;
|
||||
},
|
||||
hideModal: function(callback) {
|
||||
// set modal as closed
|
||||
this.opened = false;
|
||||
|
||||
// hide modal
|
||||
jQuery('#mailpoet_'+this.options.type).hide();
|
||||
|
||||
// remove class on highlighted elements
|
||||
this.highlightOff();
|
||||
|
||||
// remove class from body to let it be scrollable
|
||||
jQuery('body').removeClass('mailpoet_modal_opened');
|
||||
|
||||
return this;
|
||||
},
|
||||
showOverlay: function(force) {
|
||||
jQuery('#mailpoet_modal_overlay').show();
|
||||
return this;
|
||||
},
|
||||
hideOverlay: function() {
|
||||
jQuery('#mailpoet_modal_overlay').hide();
|
||||
return this;
|
||||
},
|
||||
popup: function(options) {
|
||||
// get options
|
||||
options = options || {};
|
||||
// set modal type
|
||||
options.type = 'popup';
|
||||
// set overlay state
|
||||
options.overlay = options.overlay || true;
|
||||
// initialize modal
|
||||
this.init(options);
|
||||
// open modal
|
||||
this.open();
|
||||
|
||||
return this;
|
||||
},
|
||||
panel: function(options) {
|
||||
// get options
|
||||
options = options || {};
|
||||
// reset subpanels
|
||||
this.subpanels = [];
|
||||
// set modal type
|
||||
options.type = 'panel';
|
||||
// set overlay state
|
||||
options.overlay = options.overlay || false;
|
||||
// set highlighted element
|
||||
options.highlight = options.highlight || null;
|
||||
// set modal dimensions
|
||||
options.width = options.width || '40%';
|
||||
options.height = options.height || 'auto';
|
||||
// initialize modal
|
||||
this.init(options);
|
||||
// open modal
|
||||
this.open();
|
||||
|
||||
return this;
|
||||
},
|
||||
subpanel: function(options) {
|
||||
if(this.opened === false) {
|
||||
// if no panel is already opened, let's create one instead
|
||||
this.panel(options);
|
||||
} else {
|
||||
// if a panel is already opened, add a sub panel to it
|
||||
this.subpanels.push(options);
|
||||
this.loadTemplate();
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
loading: function(toggle) {
|
||||
// make sure the overlay is initialized and that it's visible
|
||||
this.initOverlay(true);
|
||||
|
||||
if(toggle === true) {
|
||||
this.showLoading();
|
||||
} else {
|
||||
this.hideLoading();
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
showLoading: function() {
|
||||
jQuery('#mailpoet_loading').show();
|
||||
|
||||
// add loading class to overlay
|
||||
jQuery('#mailpoet_modal_overlay').addClass('mailpoet_overlay_loading');
|
||||
|
||||
return this;
|
||||
},
|
||||
hideLoading: function() {
|
||||
jQuery('#mailpoet_loading').hide();
|
||||
|
||||
// remove loading class from overlay
|
||||
jQuery('#mailpoet_modal_overlay').removeClass('mailpoet_overlay_loading');
|
||||
|
||||
return this;
|
||||
},
|
||||
open: function() {
|
||||
// load template if specified
|
||||
if(this.options.template !== null) {
|
||||
// check if a url was specified to get extra data
|
||||
if(this.options.url !== null) {
|
||||
this.loadUrl();
|
||||
} else {
|
||||
// load template
|
||||
this.loadTemplate();
|
||||
|
||||
// show modal window
|
||||
this.showModal();
|
||||
}
|
||||
} else {
|
||||
this.cancel();
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
success: function() {
|
||||
if(this.subpanels.length > 0) {
|
||||
if(this.subpanels[(this.subpanels.length - 1)].onSuccess !== undefined) {
|
||||
this.subpanels[(this.subpanels.length - 1)].onSuccess(this.subpanels[(this.subpanels.length - 1)].data);
|
||||
}
|
||||
} else {
|
||||
if(this.options.onSuccess !== null) {
|
||||
this.options.onSuccess(this.options.data);
|
||||
}
|
||||
}
|
||||
this.close();
|
||||
|
||||
return this;
|
||||
},
|
||||
cancel: function() {
|
||||
if(this.subpanels.length > 0) {
|
||||
if(this.subpanels[(this.subpanels.length - 1)].onCancel !== undefined) {
|
||||
this.subpanels[(this.subpanels.length - 1)].onCancel(this.subpanels[(this.subpanels.length - 1)].data);
|
||||
}
|
||||
} else {
|
||||
if(this.options.onCancel !== null) {
|
||||
this.options.onCancel(this.options.data);
|
||||
}
|
||||
}
|
||||
this.close();
|
||||
|
||||
return this;
|
||||
},
|
||||
destroy: function() {
|
||||
this.hideOverlay();
|
||||
|
||||
// remove extra modal
|
||||
if(jQuery('#mailpoet_'+this.options.type).length > 0) {
|
||||
jQuery('#mailpoet_'+this.options.type).remove();
|
||||
}
|
||||
|
||||
this.initialized = false;
|
||||
|
||||
return this;
|
||||
},
|
||||
close: function() {
|
||||
if(this.isLocked() === true) return this;
|
||||
|
||||
if(this.subpanels.length > 0) {
|
||||
|
||||
// close subpanel
|
||||
jQuery('.mailpoet_'+this.options.type+'_wrapper').last().remove();
|
||||
|
||||
// show previous panel
|
||||
jQuery('.mailpoet_'+this.options.type+'_wrapper').last().show();
|
||||
|
||||
// remove last subpanels
|
||||
this.subpanels.pop();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
// remove event handlers
|
||||
this.removeEvents();
|
||||
|
||||
// hide modal window
|
||||
this.hideModal();
|
||||
|
||||
// destroy modal element
|
||||
this.destroy();
|
||||
|
||||
// reset options
|
||||
this.options = {
|
||||
onSuccess: null,
|
||||
onCancel: null
|
||||
};
|
||||
|
||||
return this;
|
||||
}
|
||||
};
|
||||
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
||||
|
||||
|
||||
/***/ },
|
||||
/* 13 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery) {
|
||||
"use strict";
|
||||
/*==================================================================================================
|
||||
|
||||
MailPoet Notice:
|
||||
|
||||
description: Handles notices
|
||||
version: 0.2
|
||||
author: Jonathan Labreuille
|
||||
company: Wysija
|
||||
dependencies: jQuery
|
||||
|
||||
Usage:
|
||||
|
||||
// success message (static: false)
|
||||
MailPoet.Notice.success('Yatta!');
|
||||
|
||||
// error message (static: false)
|
||||
MailPoet.Notice.error('Boo!');
|
||||
|
||||
// system message (static: true)
|
||||
MailPoet.Notice.system('You need to updated ASAP!');
|
||||
|
||||
Examples:
|
||||
|
||||
MailPoet.Notice.success('- success #1 -');
|
||||
setTimeout(function() {
|
||||
MailPoet.Notice.success('- success #2 -');
|
||||
setTimeout(function() {
|
||||
MailPoet.Notice.error('- error -');
|
||||
setTimeout(function() {
|
||||
MailPoet.Notice.system('- system -');
|
||||
|
||||
setTimeout(function() {
|
||||
MailPoet.Notice.hide();
|
||||
}, 2500);
|
||||
}, 300);
|
||||
}, 400);
|
||||
}, 500);
|
||||
|
||||
==================================================================================================*/
|
||||
|
||||
MailPoet.Notice = {
|
||||
version: 0.2,
|
||||
// default options
|
||||
defaults: {
|
||||
type: 'success',
|
||||
message: '',
|
||||
static: false,
|
||||
scroll: false,
|
||||
timeout: 2000,
|
||||
onOpen: null,
|
||||
onClose: null
|
||||
},
|
||||
options: {},
|
||||
init: function(options) {
|
||||
// set options
|
||||
this.options = jQuery.extend({}, this.defaults, options);
|
||||
|
||||
// clone element
|
||||
this.element = jQuery('#mailpoet_notice_'+this.options.type).clone();
|
||||
|
||||
// remove id from clone
|
||||
this.element.removeAttr('id');
|
||||
|
||||
// insert notice after its parent
|
||||
jQuery('#mailpoet_notice_'+this.options.type).after(this.element);
|
||||
|
||||
// setup onClose callback
|
||||
var onClose = null;
|
||||
if(this.options.onClose !== null) {
|
||||
onClose = this.options.onClose;
|
||||
}
|
||||
|
||||
// listen to remove event
|
||||
var element = this.element;
|
||||
jQuery(this.element).on('close', function() {
|
||||
jQuery(this).fadeOut(200, function() {
|
||||
// on close callback
|
||||
if(onClose !== null) {
|
||||
onClose();
|
||||
}
|
||||
// remove notice
|
||||
jQuery(this).remove();
|
||||
});
|
||||
}.bind(this.element));
|
||||
|
||||
// listen to message event
|
||||
jQuery(this.element).on('message', function(e, message) {
|
||||
MailPoet.Notice.setMessage(message);
|
||||
}.bind(this.element));
|
||||
|
||||
return this;
|
||||
},
|
||||
isHTML: function(str) {
|
||||
var a = document.createElement('div');
|
||||
a.innerHTML = str;
|
||||
for(var c = a.childNodes, i = c.length; i--;) {
|
||||
if(c[i].nodeType == 1) return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
setMessage: function(message) {
|
||||
// if it's not an html message, let's sugar coat the message with a fancy <p>
|
||||
if(this.isHTML(message) === false) {
|
||||
message = '<p>'+message+'</p>';
|
||||
}
|
||||
// set message
|
||||
return this.element.html(message);
|
||||
},
|
||||
show: function(options) {
|
||||
// initialize
|
||||
this.init(options);
|
||||
|
||||
// show notice
|
||||
this.showNotice();
|
||||
|
||||
// return this;
|
||||
},
|
||||
showNotice: function() {
|
||||
// set message
|
||||
this.setMessage(this.options.message);
|
||||
|
||||
// make the notice appear
|
||||
this.element.fadeIn(200);
|
||||
|
||||
// if scroll option is enabled, scroll to the notice
|
||||
if(this.options.scroll === true) {
|
||||
this.element.get(0).scrollIntoView(false);
|
||||
}
|
||||
|
||||
// if the notice is not static, it has to disappear after a timeout
|
||||
if(this.options.static === false) {
|
||||
this.element.delay(this.options.timeout).trigger('close');
|
||||
} else {
|
||||
this.element.append('<a href="javascript:;" class="mailpoet_notice_close"><span class="dashicons dashicons-dismiss"></span></a>');
|
||||
this.element.find('.mailpoet_notice_close').on('click', function() {
|
||||
jQuery(this).trigger('close');
|
||||
});
|
||||
}
|
||||
|
||||
// call onOpen callback
|
||||
if(this.options.onOpen !== null) {
|
||||
this.options.onOpen(this.element);
|
||||
}
|
||||
},
|
||||
hide: function(all) {
|
||||
if(all !== undefined && all === true) {
|
||||
jQuery('.mailpoet_notice:not([id])').trigger('close');
|
||||
} else {
|
||||
jQuery('.mailpoet_notice.updated:not([id]), .mailpoet_notice.error:not([id])')
|
||||
.trigger('close');
|
||||
}
|
||||
},
|
||||
error: function(message, options) {
|
||||
this.show(jQuery.extend({}, {
|
||||
type: 'error',
|
||||
message: '<p>'+message+'</p>'
|
||||
}, options));
|
||||
},
|
||||
success: function(message, options) {
|
||||
this.show(jQuery.extend({}, {
|
||||
type: 'success',
|
||||
message: '<p>'+message+'</p>'
|
||||
}, options));
|
||||
},
|
||||
system: function(message, options) {
|
||||
this.show(jQuery.extend({}, {
|
||||
type: 'system',
|
||||
static: true,
|
||||
message: message
|
||||
}, options));
|
||||
}
|
||||
};
|
||||
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
||||
|
||||
|
||||
/***/ }
|
||||
]);
|
||||
return MailPoet;
|
||||
});
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -25,7 +25,7 @@ class Router {
|
||||
$method = $_POST['method'];
|
||||
$args = $_POST['args'];
|
||||
$endpoint = new $endpoint();
|
||||
$endpoint->$method(json_encode($args));
|
||||
$endpoint->$method($args);
|
||||
}
|
||||
|
||||
function setToken() {
|
||||
|
@ -23,9 +23,9 @@
|
||||
|
||||
<!-- javascripts -->
|
||||
<%= javascript(
|
||||
'src/vendor.js',
|
||||
'src/mailpoet.js',
|
||||
'src/admin.js'
|
||||
'vendor.js',
|
||||
'mailpoet.js',
|
||||
'admin.js'
|
||||
)%>
|
||||
|
||||
<!-- handlebars templates -->
|
||||
|
@ -13,7 +13,7 @@ baseConfig = {
|
||||
admin: 'admin.js',
|
||||
},
|
||||
output: {
|
||||
path: './assets/js/src',
|
||||
path: './assets/js',
|
||||
filename: '[name].js',
|
||||
},
|
||||
plugins: [
|
||||
@ -36,12 +36,12 @@ baseConfig = {
|
||||
resolve: {
|
||||
modulesDirectories: [
|
||||
'node_modules',
|
||||
'assets/js',
|
||||
'assets/js/src',
|
||||
'assets/css/lib'
|
||||
],
|
||||
fallback: path.join(__dirname, 'node_modules'),
|
||||
alias: {
|
||||
'handlebars': 'handlebars/runtime.js'
|
||||
'handlebars': 'handlebars/dist/handlebars.js'
|
||||
}
|
||||
},
|
||||
resolveLoader: {
|
||||
@ -71,13 +71,14 @@ module.exports = [
|
||||
resolve: {
|
||||
modulesDirectories: [
|
||||
'node_modules',
|
||||
'assets/js',
|
||||
'assets/js/src',
|
||||
'tests/javascript/newsletter_editor'
|
||||
],
|
||||
fallback: path.join(__dirname, 'node_modules'),
|
||||
alias: {
|
||||
'handlebars': 'handlebars/runtime.js'
|
||||
'handlebars': 'handlebars/dist/handlebars.js'
|
||||
}
|
||||
},
|
||||
plugins: [],
|
||||
})
|
||||
];
|
||||
|
Reference in New Issue
Block a user