Compare commits
187 Commits
3.0.0-rc.2
...
3.0.4
Author | SHA1 | Date | |
---|---|---|---|
ff2a3cd19e | |||
8419d95ea1 | |||
4ad317ac7b | |||
7cccebbf2c | |||
e4f76ee9eb | |||
7f52f72c25 | |||
44afcbbeaf | |||
e816c59539 | |||
c74421a42a | |||
23eb4633c4 | |||
92dbf966a1 | |||
db226b54a8 | |||
3af059f5c4 | |||
8706abcdf0 | |||
2129d041ac | |||
2a4a44ebb5 | |||
a4f2d5402c | |||
9f5fc151b4 | |||
8a91eb46e6 | |||
e4ab928e82 | |||
a1b02cb862 | |||
84b942b9d2 | |||
1ca99a6209 | |||
6b61abe8c0 | |||
27028ca1ef | |||
eed88926a2 | |||
b25877c514 | |||
119e574495 | |||
7308d253b2 | |||
1c19b71697 | |||
7551fff93f | |||
b2aa919574 | |||
1102bbe483 | |||
b78dd22ba9 | |||
73110ada46 | |||
74dedd06bc | |||
20c936d13b | |||
f135b89de9 | |||
6a83930ae0 | |||
a1d0acfac2 | |||
04be06c0cb | |||
78d52d6298 | |||
5ff7c28c43 | |||
5526f315d2 | |||
d5e25fdeb1 | |||
90a7bf5179 | |||
bf1f696870 | |||
95551ad049 | |||
1ad90680f4 | |||
d69d3cb421 | |||
9adca07393 | |||
a9d129fddc | |||
b4ac09bea3 | |||
b1a403d9b5 | |||
28504fb5e3 | |||
8ebb8e3c02 | |||
c95c2cd1ae | |||
946bee2194 | |||
1f9bd04308 | |||
33572b2dc7 | |||
680446b77e | |||
bf1d76a3a7 | |||
c915fcfdff | |||
02966c3b93 | |||
84dc48daec | |||
12225004f4 | |||
320dfa2ec5 | |||
b5f3016085 | |||
cd53e369d0 | |||
6fc11af774 | |||
42e3a97616 | |||
6b16aa1692 | |||
03d0de74e4 | |||
c3b643df84 | |||
697f9ba5bc | |||
28c75c5b96 | |||
6f255854f2 | |||
91c5f9c43e | |||
62acd6404a | |||
adc1461771 | |||
66cc0964ce | |||
10d77720ad | |||
475114c6f9 | |||
a0fec7d103 | |||
4d9d92a026 | |||
e51aa8c271 | |||
d44adedade | |||
9fb3c50aa7 | |||
907053a349 | |||
f0f85cfb59 | |||
44d0341fb2 | |||
0cdae52c66 | |||
0cd9c8e416 | |||
9e3010ab52 | |||
d831b2df55 | |||
16ff630e88 | |||
d35763662e | |||
10be411b12 | |||
6ecce192f7 | |||
ee07e60fe9 | |||
a35d7a1154 | |||
ebba8dbfd6 | |||
44c637c06b | |||
d54ba734bf | |||
b45fc22306 | |||
994935d4ae | |||
ceb5ce850c | |||
97b5ed945d | |||
873b322245 | |||
12ad9e41e7 | |||
96b418e455 | |||
8ea7861f77 | |||
821976c881 | |||
6f1443e43d | |||
09fcaecdfc | |||
efd72ca9f6 | |||
550b5e9aed | |||
4b7ae5fcff | |||
fa85e12127 | |||
1cce50902b | |||
2048fa5cf9 | |||
f438c8fd31 | |||
0bfa832dad | |||
483dfbe1ec | |||
561fee491d | |||
97d157192a | |||
6b14a8a057 | |||
d27b187f5e | |||
02d49ba2ca | |||
f3571a5855 | |||
3d5f0df213 | |||
595a201fe7 | |||
c3db7d8148 | |||
4a2187ff32 | |||
279c36a30d | |||
fd65117a5d | |||
9305beace3 | |||
ba86cbfb18 | |||
2ac7d1d4ab | |||
e9c55260c8 | |||
99b6a287f8 | |||
d645f0cad4 | |||
b0343254c0 | |||
cc368f015b | |||
4e508855fc | |||
72c0a6f165 | |||
f266508654 | |||
1893d82b2d | |||
bb1dd6a2ec | |||
7097ea5d9b | |||
b4092e0641 | |||
2c068c7bb6 | |||
a1a4fcb978 | |||
f77620d649 | |||
9e932c9078 | |||
de47dbe41b | |||
6d36d67a60 | |||
607bf51b37 | |||
f38ed0272c | |||
eef969439b | |||
272f552f3c | |||
dff9c1012b | |||
52470360a1 | |||
6c62459ed4 | |||
98482cebf9 | |||
509880119e | |||
195ccb5eed | |||
122af1c943 | |||
169940058b | |||
478e60d60e | |||
9fc0ac8c4f | |||
e86b780479 | |||
42f08bdc65 | |||
c2789cdac3 | |||
8a362f49f8 | |||
784a80d1a5 | |||
922d2b4b5f | |||
91e8461cac | |||
8757598a2d | |||
524aabea1d | |||
513181ff47 | |||
6bc288ed54 | |||
77f3a875dd | |||
6584250d1a | |||
e42db162aa | |||
2762096167 | |||
b2ec3e5f7b |
@ -9,10 +9,7 @@
|
||||
},
|
||||
"rules": {
|
||||
"import/no-amd": 0,
|
||||
"space-before-function-paren": 0,
|
||||
"prefer-arrow-callback": 0,
|
||||
"no-undef": 0,
|
||||
"key-spacing": 0,
|
||||
"radix": 0,
|
||||
"no-alert": 0,
|
||||
"block-scoped-var": 0,
|
||||
@ -20,7 +17,6 @@
|
||||
"no-prototype-builtins": 0,
|
||||
"no-restricted-syntax": 0,
|
||||
"no-useless-concat": 0,
|
||||
"no-multi-spaces": 0,
|
||||
"no-nested-ternary": 0,
|
||||
"no-sequences": 0,
|
||||
"no-useless-return": 0,
|
||||
@ -28,27 +24,17 @@
|
||||
"new-cap": 0,
|
||||
"no-continue": 0,
|
||||
"no-new": 0,
|
||||
"space-unary-ops": 0,
|
||||
"no-redeclare": 0,
|
||||
"no-console": 0,
|
||||
"no-empty": 0,
|
||||
"no-useless-escape": 0,
|
||||
"wrap-iife": 0,
|
||||
"no-unused-expressions": 0,
|
||||
"block-spacing": 0,
|
||||
"computed-property-spacing": 0,
|
||||
"no-plusplus": 0,
|
||||
"array-bracket-spacing": 0,
|
||||
"no-unreachable": 0,
|
||||
"default-case": 0,
|
||||
"no-lonely-if": 0,
|
||||
"space-before-blocks": 0,
|
||||
"no-unneeded-ternary": 0,
|
||||
"no-mixed-operators": 0,
|
||||
"eqeqeq": 0,
|
||||
"space-in-parens": 0,
|
||||
"max-len": 0,
|
||||
"no-trailing-spaces": 0,
|
||||
"global-require": 0,
|
||||
"no-throw-literal": 0,
|
||||
"no-extra-bind": 0,
|
||||
@ -61,20 +47,15 @@
|
||||
"no-use-before-define": 0,
|
||||
"one-var": 0,
|
||||
"camelcase": 0,
|
||||
"spaced-comment": 0,
|
||||
"padded-blocks": 0,
|
||||
"object-curly-spacing": 0,
|
||||
"strict": 0,
|
||||
"vars-on-top": 0,
|
||||
"no-var": 0,
|
||||
"space-infix-ops": 0,
|
||||
"no-unused-vars": 0,
|
||||
"object-shorthand": 0,
|
||||
"new-parens": 0,
|
||||
"keyword-spacing": 0,
|
||||
"eol-last": 0,
|
||||
"dot-notation": 0,
|
||||
"indent": 0,
|
||||
"prefer-template": 0,
|
||||
"func-names": 0
|
||||
}
|
||||
|
@ -10,6 +10,9 @@
|
||||
"jsx": true
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"import/resolver": "webpack"
|
||||
},
|
||||
"rules": {
|
||||
"comma-dangle": ["error", "always-multiline"],
|
||||
"import/no-amd": 0,
|
||||
@ -18,19 +21,15 @@
|
||||
"react/jsx-max-props-per-line": 0,
|
||||
"react/prop-types": 0,
|
||||
"react/jsx-first-prop-new-line": 0,
|
||||
"react/jsx-indent-props": 0,
|
||||
"react/no-is-mounted": 0,
|
||||
"react/jsx-no-target-blank": 0,
|
||||
"react/no-render-return-value": 0,
|
||||
"react/jsx-boolean-value": 0,
|
||||
"react/jsx-indent": 0,
|
||||
"react/jsx-no-bind": 0,
|
||||
"react/no-array-index-key": 0,
|
||||
"react/self-closing-comp": 0,
|
||||
"react/jsx-tag-spacing": 0,
|
||||
"react/jsx-closing-bracket-location": 0,
|
||||
"react/no-string-refs": 0,
|
||||
"react/jsx-curly-spacing": 0,
|
||||
"react/no-did-mount-set-state": 0,
|
||||
"react/prefer-stateless-function": 0,
|
||||
"jsx-a11y/label-has-for": 0,
|
||||
@ -41,31 +40,21 @@
|
||||
"no-bitwise": 0,
|
||||
"arrow-body-style": 0,
|
||||
"prefer-template": 0,
|
||||
"keyword-spacing": 0,
|
||||
"default-case": 0,
|
||||
"array-callback-return": 0,
|
||||
"consistent-return": 0,
|
||||
"no-unreachable": 0,
|
||||
"import/no-unresolved": 0,
|
||||
"import/extensions": 0,
|
||||
"import/no-extraneous-dependencies": 0,
|
||||
"camelcase": 0,
|
||||
"template-curly-spacing": 0,
|
||||
"eqeqeq": 0,
|
||||
"no-lonely-if": 0,
|
||||
"space-unary-ops": 0,
|
||||
"block-scoped-var": 0,
|
||||
"no-extra-bind": 0,
|
||||
"no-multi-spaces": 0,
|
||||
"class-methods-use-this": 0,
|
||||
"key-spacing": 0,
|
||||
"space-in-parens": 0,
|
||||
"no-case-declarations": 0,
|
||||
"array-bracket-spacing": 0,
|
||||
"no-else-return": 0,
|
||||
"max-len": 0,
|
||||
"no-useless-concat": 0,
|
||||
"no-unused-expressions": 0,
|
||||
"no-sequences": 0,
|
||||
"no-extra-boolean-cast": 0,
|
||||
"dot-notation": 0,
|
||||
@ -76,10 +65,7 @@
|
||||
"no-script-url": 0,
|
||||
"wrap-iife": 0,
|
||||
"vars-on-top": 0,
|
||||
"space-infix-ops": 0,
|
||||
"no-irregular-whitespace": 0,
|
||||
"padded-blocks": 0,
|
||||
"no-underscore-dangle": 0,
|
||||
"no-undef": 0
|
||||
"no-underscore-dangle": 0
|
||||
}
|
||||
}
|
||||
|
@ -9,9 +9,7 @@
|
||||
},
|
||||
"rules": {
|
||||
"import/no-amd": 0,
|
||||
"no-undef": 0,
|
||||
"one-var": 0,
|
||||
"indent": 0,
|
||||
"no-whitespace-before-property": 0,
|
||||
"global-require": 0,
|
||||
"keyword-spacing": 0,
|
||||
@ -21,7 +19,6 @@
|
||||
"max-len": 0,
|
||||
"space-unary-ops": 0,
|
||||
"no-unused-vars": 0,
|
||||
"no-unused-expressions": 0,
|
||||
"no-underscore-dangle": 0,
|
||||
"no-shadow": 0,
|
||||
"padded-blocks": 0,
|
||||
|
@ -90,6 +90,7 @@ class RoboFile extends \Robo\Tasks {
|
||||
|
||||
$css_files = array(
|
||||
'assets/css/src/admin.styl',
|
||||
'assets/css/src/admin-global.styl',
|
||||
'assets/css/src/newsletter_editor/newsletter_editor.styl',
|
||||
'assets/css/src/public.styl',
|
||||
'assets/css/src/rtl.styl',
|
||||
|
15
assets/css/src/admin-global.styl
Normal file
15
assets/css/src/admin-global.styl
Normal file
@ -0,0 +1,15 @@
|
||||
@import 'nib'
|
||||
|
||||
@require 'icons'
|
||||
|
||||
/*
|
||||
Style for Members plugin
|
||||
*/
|
||||
|
||||
.members-tab-title
|
||||
.mailpoet-icon-logo
|
||||
vertical-align: middle;
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
font-size: 20px;
|
||||
margin-right: 3px;
|
24
assets/css/src/icons.styl
Normal file
24
assets/css/src/icons.styl
Normal file
@ -0,0 +1,24 @@
|
||||
icon-font-path ?= "../fonts"
|
||||
|
||||
@font-face
|
||||
font-family 'mailpoet'
|
||||
src url(icon-font-path + '/mailpoet.ttf?mx0b6n') format('truetype'), url(icon-font-path + '/mailpoet.woff?mx0b6n') format('woff'), url(icon-font-path + '/mailpoet.svg?mx0b6n#mailpoet') format('svg')
|
||||
font-weight normal
|
||||
font-style normal
|
||||
|
||||
[class^="mailpoet-icon-"], [class*=" mailpoet-icon-"]
|
||||
font-family 'mailpoet' !important
|
||||
speak none
|
||||
font-style normal
|
||||
font-weight normal
|
||||
font-variant normal
|
||||
text-transform none
|
||||
line-height 1
|
||||
|
||||
/* Better Font Rendering =========== */
|
||||
-webkit-font-smoothing antialiased
|
||||
-moz-osx-font-smoothing grayscale
|
||||
|
||||
.mailpoet-icon-logo
|
||||
&:before
|
||||
content "\e900"
|
@ -48,3 +48,41 @@ $resize-handle-z-index = 2
|
||||
|
||||
.mailpoet_resize_handle
|
||||
display: inline-block
|
||||
|
||||
|
||||
.mailpoet_image_resize_handle_container
|
||||
position: absolute
|
||||
bottom: 0
|
||||
right: 0
|
||||
width: 20px
|
||||
height: 20px
|
||||
|
||||
.mailpoet_image_resize_handle
|
||||
position: relative
|
||||
background: $resize-handle-background-color
|
||||
border-radius(3px)
|
||||
display: inline-block
|
||||
width: 20px
|
||||
height: 20px
|
||||
cursor: nwse-resize
|
||||
z-index: $resize-handle-z-index
|
||||
|
||||
.mailpoet_image_resize_handle_text,
|
||||
.mailpoet_image_resize_handle_icon
|
||||
pointer-events: none
|
||||
|
||||
.mailpoet_image_resize_handle_icon
|
||||
position: absolute
|
||||
top: 0
|
||||
right: 0
|
||||
|
||||
& > svg
|
||||
width: 100%
|
||||
height: 100%
|
||||
fill: $resize-handle-font-color
|
||||
|
||||
.mailpoet_block.mailpoet_image_resize_active > .mailpoet_block_highlight
|
||||
border: 1px dashed $resize-active-color
|
||||
|
||||
.mailpoet_image_resize_handle
|
||||
display: inline-block
|
||||
|
@ -23,9 +23,11 @@ $block-text-line-height = $text-line-height
|
||||
border: 1px solid $transparent-color
|
||||
|
||||
&:hover > .mailpoet_block_highlight
|
||||
&.mailpoet_highlight > .mailpoet_block_highlight
|
||||
border: 1px dashed $block-hover-highlight-color
|
||||
|
||||
&.mailpoet_highlight > .mailpoet_block_highlight
|
||||
border: 1px dashed $block-hover-highlight-color !important
|
||||
|
||||
.mailpoet_content
|
||||
position: relative
|
||||
line-height: $block-text-line-height
|
||||
|
@ -3,14 +3,19 @@
|
||||
img
|
||||
vertical-align: bottom
|
||||
max-width: 100%
|
||||
width: auto
|
||||
height: auto
|
||||
|
||||
&.mailpoet_full_image
|
||||
padding-left: 0
|
||||
padding-right: 0
|
||||
margin: auto
|
||||
margin-bottom: 0
|
||||
|
||||
.mailpoet_content a:hover
|
||||
.mailpoet_content
|
||||
margin: auto
|
||||
max-width: 100%
|
||||
min-width: 36px
|
||||
|
||||
a:hover
|
||||
cursor: all-scroll
|
||||
|
||||
|
@ -2,7 +2,7 @@ animation-slide-open-downwards($max-height = 2000px)
|
||||
transition: all 250ms cubic-bezier(0.420, 0.000, 0.580, 1.000) /* ease-in-out */
|
||||
max-height: $max-height
|
||||
opacity: 1
|
||||
overflow-y: hidden
|
||||
overflow-y: inherit
|
||||
|
||||
&.mailpoet_closed
|
||||
max-height: 0px
|
||||
|
@ -33,3 +33,6 @@ Custom styles for MailPoet pages.
|
||||
|
||||
p.top-space-triple
|
||||
margin-top: 3em
|
||||
|
||||
p.mailpoet-top-text
|
||||
margin-right: 0
|
||||
|
@ -62,6 +62,15 @@
|
||||
margin-bottom: 2em
|
||||
margin-top: 2em
|
||||
|
||||
.sending-free-plan-button
|
||||
background: #FF5301
|
||||
border-color: #e64c03
|
||||
text-shadow: 0 -1px 1px #e64c03
|
||||
box-shadow: 0 1px 0 #e64c03
|
||||
margin: 10px 0
|
||||
strong
|
||||
text-transform: uppercase
|
||||
|
||||
.mailpoet_success_item::before
|
||||
content '✔ '
|
||||
|
||||
|
11
assets/fonts/mailpoet.svg
Normal file
11
assets/fonts/mailpoet.svg
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<metadata>Generated by IcoMoon</metadata>
|
||||
<defs>
|
||||
<font id="mailpoet" horiz-adv-x="1024">
|
||||
<font-face units-per-em="1024" ascent="960" descent="-64" />
|
||||
<missing-glyph horiz-adv-x="1024" />
|
||||
<glyph unicode=" " horiz-adv-x="0" d="" />
|
||||
<glyph unicode="" glyph-name="optimised" horiz-adv-x="972" d="M230.188 949.695c-21.982-3.361-41.376-14.741-48.618-28.188l-5.948-11.637 0.517-265.588c0.776-263.779 0.776-265.847 6.206-273.088 11.12-15.258 40.601-22.24 68.79-16.551 16.551 3.621 25.861 9.827 32.584 21.723 3.879 7.499 4.397 23.791 5.689 185.161l1.293 176.628 60.514-161.111c33.102-88.702 63.875-168.612 68.013-177.404 13.707-29.481 35.687-41.376 72.151-39.049 21.206 1.293 39.308 9.827 47.584 22.499 3.361 5.172 35.947 91.806 72.41 192.662s67.237 185.42 68.53 187.49c1.551 2.587 2.587-69.307 2.587-185.937v-190.335l5.948-11.379c8.533-16.809 20.172-21.982 49.652-21.982 27.929 0.259 39.825 4.914 49.911 20.172l6.982 10.603v530.401l-5.689 9.31c-12.671 20.43-50.17 31.033-91.806 25.601-34.394-4.138-53.79-16.292-66.72-41.118-2.587-5.172-35.947-101.89-73.961-214.902s-69.824-206.367-70.6-207.403c-1.034-1.034-32.326 86.115-69.824 193.954-37.757 107.581-71.892 205.075-76.030 216.453-10.086 26.118-25.601 42.929-45.514 48.877-17.326 5.172-46.807 6.982-64.652 4.138zM54.854 243.443c-20.172-3.879-43.963-19.136-51.204-33.619-6.206-11.379-4.914-32.843 2.587-47.841 23.533-46.807 71.634-86.892 126.717-104.736 17.068-5.689 23.274-5.948 120.252-7.499 97.235-1.551 102.926-1.81 116.373-7.241 29.739-11.896 51.204-35.687 61.807-68.013 3.621-11.12 13.964-21.206 25.861-25.344 4.914-1.551 18.361-2.844 29.739-2.844 16.809 0 23.533 1.293 32.584 5.689 11.896 6.206 13.964 9.31 26.895 38.791 11.896 27.671 39.567 49.652 70.858 56.117 8.533 1.81 47.067 2.844 100.856 2.844 99.563 0 113.786 2.068 151.801 20.689 49.652 24.567 96.978 77.84 101.373 113.529 3.104 26.118-17.326 49.394-51.204 58.187-25.601 6.465-41.635-0.517-54.825-24.050-11.12-19.655-29.998-38.015-47.841-46.29l-14.741-6.982-99.563-1.551c-90.77-1.293-101.373-2.068-120.252-6.982-27.154-7.499-58.444-23.016-80.427-40.084l-17.844-13.964-16.809 13.964c-20.689 16.809-51.462 32.584-78.875 39.825-19.136 5.172-28.705 5.948-120.252 7.241l-99.563 1.551-15.775 7.241c-18.102 8.533-32.584 21.982-48.36 45.773-16.034 24.567-26.895 29.998-50.17 25.601z" />
|
||||
</font></defs></svg>
|
After Width: | Height: | Size: 2.4 KiB |
BIN
assets/fonts/mailpoet.ttf
Normal file
BIN
assets/fonts/mailpoet.ttf
Normal file
Binary file not shown.
BIN
assets/fonts/mailpoet.woff
Normal file
BIN
assets/fonts/mailpoet.woff
Normal file
Binary file not shown.
@ -35,7 +35,7 @@ define('ajax', ['mailpoet', 'jquery', 'underscore'], function(mp, jQuery, _) {
|
||||
|
||||
// set default url
|
||||
if (this.options.url === null) {
|
||||
this.options.url = ajaxurl;
|
||||
this.options.url = window.ajaxurl;
|
||||
}
|
||||
|
||||
// set default token
|
||||
|
@ -43,15 +43,6 @@ function trackCachedEvents() {
|
||||
});
|
||||
}
|
||||
|
||||
function initializeMixpanelWhenLoaded() {
|
||||
if (typeof window.mixpanel === 'object') {
|
||||
exportMixpanel(MailPoet);
|
||||
trackCachedEvents();
|
||||
} else {
|
||||
setTimeout(initializeMixpanelWhenLoaded, 100);
|
||||
}
|
||||
}
|
||||
|
||||
function cacheEvent(forced, name, data) {
|
||||
eventsCache.push({
|
||||
name: name,
|
||||
@ -65,6 +56,15 @@ define(
|
||||
function (mp, _) {
|
||||
var MailPoet = mp;
|
||||
|
||||
function initializeMixpanelWhenLoaded() {
|
||||
if (typeof window.mixpanel === 'object') {
|
||||
exportMixpanel(MailPoet);
|
||||
trackCachedEvents();
|
||||
} else {
|
||||
setTimeout(initializeMixpanelWhenLoaded, 100);
|
||||
}
|
||||
}
|
||||
|
||||
MailPoet.trackEvent = _.partial(cacheEvent, false);
|
||||
MailPoet.forceTrackEvent = _.partial(cacheEvent, true);
|
||||
|
||||
|
@ -212,7 +212,6 @@ define([
|
||||
year={this.state.year}
|
||||
placeholder={this.props.field.year_placeholder}
|
||||
/>);
|
||||
break;
|
||||
|
||||
case 'MM':
|
||||
return (<FormFieldDateMonth
|
||||
@ -224,7 +223,6 @@ define([
|
||||
monthNames={monthNames}
|
||||
placeholder={this.props.field.month_placeholder}
|
||||
/>);
|
||||
break;
|
||||
|
||||
case 'DD':
|
||||
return (<FormFieldDateDay
|
||||
@ -235,7 +233,6 @@ define([
|
||||
day={this.state.day}
|
||||
placeholder={this.props.field.day_placeholder}
|
||||
/>);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -7,6 +7,7 @@ define([
|
||||
'form/fields/checkbox.jsx',
|
||||
'form/fields/selection.jsx',
|
||||
'form/fields/date.jsx',
|
||||
'jquery',
|
||||
],
|
||||
(
|
||||
React,
|
||||
@ -16,7 +17,8 @@ define([
|
||||
FormFieldRadio,
|
||||
FormFieldCheckbox,
|
||||
FormFieldSelection,
|
||||
FormFieldDate
|
||||
FormFieldDate,
|
||||
jQuery
|
||||
) => {
|
||||
const FormField = React.createClass({
|
||||
renderField: function (data, inline = false) {
|
||||
|
@ -116,6 +116,7 @@ define([
|
||||
}
|
||||
},
|
||||
handleChange: function (e) {
|
||||
let value;
|
||||
if (this.props.onValueChange !== undefined) {
|
||||
if (this.props.field.multiple) {
|
||||
value = jQuery('#' + this.refs.select.id).val();
|
||||
|
@ -5,13 +5,15 @@ define(
|
||||
'classnames',
|
||||
'react-router',
|
||||
'form/fields/field.jsx',
|
||||
'jquery',
|
||||
],
|
||||
(
|
||||
React,
|
||||
MailPoet,
|
||||
classNames,
|
||||
Router,
|
||||
FormField
|
||||
FormField,
|
||||
jQuery
|
||||
) => {
|
||||
|
||||
const Form = React.createClass({
|
||||
|
@ -91,7 +91,7 @@ var Observable = (function() {
|
||||
function getHandlers(klass) {
|
||||
var proto = klass.prototype,
|
||||
namespace = proto.namespace;
|
||||
return Object.keys(proto).grep(/^on/).inject($H(), function(handlers, name) {
|
||||
return Object.keys(proto).grep(/^on/).inject(window.$H(), function (handlers, name) {
|
||||
if (name === 'onDomLoaded') return handlers;
|
||||
handlers.set(getEventName(name, namespace), getWrapper(proto[name], klass));
|
||||
return handlers;
|
||||
@ -105,7 +105,7 @@ var Observable = (function() {
|
||||
}
|
||||
|
||||
function onDomLoad(selector, klass) {
|
||||
$$(selector).each(function(element) {
|
||||
window.$$(selector).each(function (element) {
|
||||
new klass(element).onDomLoaded();
|
||||
});
|
||||
}
|
||||
@ -114,7 +114,13 @@ var Observable = (function() {
|
||||
if (!this.handlers) this.handlers = {};
|
||||
if (this.handlers[selector]) return;
|
||||
var klass = this;
|
||||
if(this.prototype.onDomLoaded) document.loaded ? onDomLoad(selector, klass) : document.observe('dom:loaded', onDomLoad.curry(selector, klass));
|
||||
if (this.prototype.onDomLoaded) {
|
||||
if (document.loaded) {
|
||||
onDomLoad(selector, klass);
|
||||
} else {
|
||||
document.observe('dom:loaded', onDomLoad.curry(selector, klass));
|
||||
}
|
||||
}
|
||||
this.handlers[selector] = getHandlers(klass).each(function (handler) {
|
||||
document.delegate(selector, handler.key, handler.value);
|
||||
});
|
||||
@ -130,12 +136,12 @@ var Observable = (function() {
|
||||
})();
|
||||
|
||||
// override droppables
|
||||
Object.extend(Droppables, {
|
||||
deactivate: Droppables.deactivate.wrap(function(proceed, drop, draggable) {
|
||||
Object.extend(window.Droppables, {
|
||||
deactivate: window.Droppables.deactivate.wrap(function (proceed, drop, draggable) {
|
||||
if (drop.onLeave) drop.onLeave(draggable, drop.element);
|
||||
return proceed(drop);
|
||||
}),
|
||||
activate: Droppables.activate.wrap(function(proceed, drop, draggable) {
|
||||
activate: window.Droppables.activate.wrap(function (proceed, drop, draggable) {
|
||||
if (drop.onEnter) drop.onEnter(draggable, drop.element);
|
||||
return proceed(drop);
|
||||
}),
|
||||
@ -143,14 +149,14 @@ Object.extend(Droppables, {
|
||||
if (!this.drops.length) return;
|
||||
var drop, affected = [];
|
||||
this.drops.each(function (drop) {
|
||||
if(Droppables.isAffected(point, element, drop)) affected.push(drop);
|
||||
if (window.Droppables.isAffected(point, element, drop)) affected.push(drop);
|
||||
});
|
||||
if(affected.length > 0) drop = Droppables.findDeepestChild(affected);
|
||||
if (affected.length > 0) drop = window.Droppables.findDeepestChild(affected);
|
||||
if (this.last_active && this.last_active !== drop) this.deactivate(this.last_active, element);
|
||||
if (drop) {
|
||||
Position.within(drop.element, point[0], point[1]);
|
||||
if(drop.onHover) drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
|
||||
if(drop !== this.last_active) Droppables.activate(drop, element);
|
||||
window.Position.within(drop.element, point[0], point[1]);
|
||||
if (drop.onHover) drop.onHover(element, drop.element, window.Position.overlap(drop.overlap, drop.element));
|
||||
if (drop !== this.last_active) window.Droppables.activate(drop, element);
|
||||
}
|
||||
},
|
||||
displayArea: function (draggable) {
|
||||
@ -199,36 +205,36 @@ var WysijaHistory = {
|
||||
// check if the field is unique
|
||||
if (parseInt(clone.readAttribute('wysija_unique'), 10) === 1) {
|
||||
// check if the field is already in the queue
|
||||
$(WysijaHistory.container).select('[wysija_name="' + clone.readAttribute('wysija_name') + '"]').invoke('remove');
|
||||
window.$(WysijaHistory.container).select('[wysija_name="' + clone.readAttribute('wysija_name') + '"]').invoke('remove');
|
||||
}
|
||||
|
||||
// check history size
|
||||
if($(WysijaHistory.container).select('> div').length >= WysijaHistory.size) {
|
||||
if (window.$(WysijaHistory.container).select('> div').length >= WysijaHistory.size) {
|
||||
// remove oldest element (last in the list)
|
||||
$(WysijaHistory.container).select('> div').last().remove();
|
||||
window.$(WysijaHistory.container).select('> div').last().remove();
|
||||
}
|
||||
|
||||
// store block in history
|
||||
$(WysijaHistory.container).insert({
|
||||
window.$(WysijaHistory.container).insert({
|
||||
top: clone
|
||||
});
|
||||
},
|
||||
dequeue: function () {
|
||||
// pop last block off the history
|
||||
var block = $(WysijaHistory.container).select('div').first();
|
||||
var block = window.$(WysijaHistory.container).select('div').first();
|
||||
|
||||
if (block !== undefined) {
|
||||
// insert block back into the editor
|
||||
$(WysijaForm.options.body).insert({
|
||||
window.$(WysijaForm.options.body).insert({
|
||||
top: block
|
||||
});
|
||||
}
|
||||
},
|
||||
clear: function () {
|
||||
$(WysijaHistory.container).innerHTML = '';
|
||||
window.$(WysijaHistory.container).innerHTML = '';
|
||||
},
|
||||
remove: function (field) {
|
||||
$(WysijaHistory.container).select('[wysija_name="' + field + '"]').invoke('remove');
|
||||
window.$(WysijaHistory.container).select('[wysija_name="' + field + '"]').invoke('remove');
|
||||
}
|
||||
};
|
||||
|
||||
@ -272,17 +278,17 @@ var WysijaForm = {
|
||||
},
|
||||
loading: function (is_loading) {
|
||||
if (is_loading) {
|
||||
$(WysijaForm.options.editor).addClassName('loading');
|
||||
$(WysijaForm.options.toolbar).addClassName('loading');
|
||||
window.$(WysijaForm.options.editor).addClassName('loading');
|
||||
window.$(WysijaForm.options.toolbar).addClassName('loading');
|
||||
} else {
|
||||
$(WysijaForm.options.editor).removeClassName('loading');
|
||||
$(WysijaForm.options.toolbar).removeClassName('loading');
|
||||
window.$(WysijaForm.options.editor).removeClassName('loading');
|
||||
window.$(WysijaForm.options.toolbar).removeClassName('loading');
|
||||
}
|
||||
},
|
||||
loadStatic: function (blocks) {
|
||||
$A(blocks).each(function(block) {
|
||||
window.$A(blocks).each(function (block) {
|
||||
// create block
|
||||
WysijaForm.Block.create(block, $('block_placeholder'));
|
||||
WysijaForm.Block.create(block, window.$('block_placeholder'));
|
||||
});
|
||||
},
|
||||
load: function (data) {
|
||||
@ -290,13 +296,13 @@ var WysijaForm = {
|
||||
|
||||
// load body
|
||||
if (data.body !== undefined) {
|
||||
$A(data.body).each(function(block) {
|
||||
window.$A(data.body).each(function (block) {
|
||||
// create block
|
||||
WysijaForm.Block.create(block, $('block_placeholder'));
|
||||
WysijaForm.Block.create(block, window.$('block_placeholder'));
|
||||
});
|
||||
|
||||
// load settings
|
||||
var settings_elements = $('mailpoet_form_settings').getElements();
|
||||
var settings_elements = window.$('mailpoet_form_settings').getElements();
|
||||
settings_elements.each(function (setting) {
|
||||
// skip lists
|
||||
if (setting.name === 'segments') {
|
||||
@ -305,7 +311,7 @@ var WysijaForm = {
|
||||
// if the input value is equal to the one stored in the settings
|
||||
if (setting.value === data.settings[setting.name]) {
|
||||
// check selected value
|
||||
$(setting).checked = true;
|
||||
window.$(setting).checked = true;
|
||||
}
|
||||
} else if (data.settings[setting.name] !== undefined) {
|
||||
if (typeof data.settings[setting.name] === 'string') {
|
||||
@ -320,10 +326,10 @@ var WysijaForm = {
|
||||
save: function () {
|
||||
var position = 1,
|
||||
data = {
|
||||
name: $F('mailpoet_form_name'),
|
||||
settings: $('mailpoet_form_settings').serialize(true),
|
||||
name: window.$F('mailpoet_form_name'),
|
||||
settings: window.$('mailpoet_form_settings').serialize(true),
|
||||
body: [],
|
||||
styles: (MailPoet.CodeEditor !== undefined) ? MailPoet.CodeEditor.getValue() : null
|
||||
styles: (window.MailPoet.CodeEditor !== undefined) ? window.MailPoet.CodeEditor.getValue() : null
|
||||
};
|
||||
// body
|
||||
WysijaForm.getBlocks().each(function (b) {
|
||||
@ -395,11 +401,11 @@ var WysijaForm = {
|
||||
return data;
|
||||
},
|
||||
toggleWidgets: function () {
|
||||
$$('a[wysija_unique="1"]').invoke('removeClassName', 'disabled');
|
||||
window.$$('a[wysija_unique="1"]').invoke('removeClassName', 'disabled');
|
||||
|
||||
// loop through each unique field already inserted in the editor and disable its toolbar equivalent
|
||||
$$('#' + WysijaForm.options.editor + ' [wysija_unique="1"]').map(function(element) {
|
||||
var field = $$('#' + WysijaForm.options.toolbar + ' [wysija_id="' + element.readAttribute('wysija_id') + '"]');
|
||||
window.$$('#' + WysijaForm.options.editor + ' [wysija_unique="1"]').map(function (element) {
|
||||
var field = window.$$('#' + WysijaForm.options.toolbar + ' [wysija_id="' + element.readAttribute('wysija_id') + '"]');
|
||||
if (field.length > 0) {
|
||||
field.first().addClassName('disabled');
|
||||
}
|
||||
@ -408,18 +414,18 @@ var WysijaForm = {
|
||||
var hasSegmentSelection = WysijaForm.hasSegmentSelection();
|
||||
|
||||
if (hasSegmentSelection) {
|
||||
$('mailpoet_form_segments').writeAttribute('required', false).disable();
|
||||
$('mailpoet_settings_segment_selection').hide();
|
||||
window.$('mailpoet_form_segments').writeAttribute('required', false).disable();
|
||||
window.$('mailpoet_settings_segment_selection').hide();
|
||||
} else {
|
||||
$('mailpoet_form_segments').writeAttribute('required', true).enable();
|
||||
$('mailpoet_settings_segment_selection').show();
|
||||
window.$('mailpoet_form_segments').writeAttribute('required', true).enable();
|
||||
window.$('mailpoet_settings_segment_selection').show();
|
||||
}
|
||||
},
|
||||
hasSegmentSelection: function () {
|
||||
return ($$('#' + WysijaForm.options.editor + ' [wysija_id="segments"]').length > 0);
|
||||
return (window.$$('#' + WysijaForm.options.editor + ' [wysija_id="segments"]').length > 0);
|
||||
},
|
||||
isSegmentSelectionValid: function () {
|
||||
var segment_selection = $$('#' + WysijaForm.options.editor + ' [wysija_id="segments"]')[0];
|
||||
var segment_selection = window.$$('#' + WysijaForm.options.editor + ' [wysija_id="segments"]')[0];
|
||||
if (segment_selection !== undefined) {
|
||||
var block = WysijaForm.get(segment_selection).block.getData();
|
||||
return (
|
||||
@ -447,7 +453,7 @@ var WysijaForm = {
|
||||
|
||||
if (target !== undefined) {
|
||||
// get placeholders (previous placeholder matches the placeholder linked to the next block)
|
||||
var block_placeholder = $(target.element.readAttribute('wysija_placeholder')),
|
||||
var block_placeholder = window.$(target.element.readAttribute('wysija_placeholder')),
|
||||
previous_placeholder = target.element.previous('.block_placeholder');
|
||||
|
||||
if (block_placeholder !== null) {
|
||||
@ -469,18 +475,18 @@ var WysijaForm = {
|
||||
WysijaForm.scroll = document.viewport.getScrollOffsets();
|
||||
},
|
||||
hideSettings: function () {
|
||||
$(WysijaForm.options.container).select('.wysija_settings').invoke('hide');
|
||||
window.$(WysijaForm.options.container).select('.wysija_settings').invoke('hide');
|
||||
},
|
||||
setSettingsPosition: function () {
|
||||
// get viewport offsets and dimensions
|
||||
var viewportHeight = document.viewport.getHeight(),
|
||||
blockPadding = 5;
|
||||
|
||||
$(WysijaForm.options.container).select('.wysija_settings').each(function(element) {
|
||||
window.$(WysijaForm.options.container).select('.wysija_settings').each(function (element) {
|
||||
// get parent dimensions and position
|
||||
var parentDim = element.up('.mailpoet_form_block').getDimensions(),
|
||||
parentPos = element.up('.mailpoet_form_block').cumulativeOffset(),
|
||||
is_visible = (parentPos.top <= (WysijaForm.scroll.top + viewportHeight)) ? true : false,
|
||||
is_visible = (parentPos.top <= (WysijaForm.scroll.top + viewportHeight)),
|
||||
buttonMargin = 5,
|
||||
relativeTop = buttonMargin;
|
||||
|
||||
@ -494,22 +500,22 @@ var WysijaForm = {
|
||||
relativeTop = parseInt((parentDim.height / 2) - (element.getHeight() / 2), 10);
|
||||
}
|
||||
// set position for button
|
||||
$(element).setStyle({
|
||||
window.$(element).setStyle({
|
||||
left: parseInt((parentDim.width / 2) - (element.getWidth() / 2)) + 'px',
|
||||
top: relativeTop + 'px'
|
||||
});
|
||||
});
|
||||
},
|
||||
initToolbarPosition: function () {
|
||||
if(WysijaForm.toolbar.top === null) WysijaForm.toolbar.top = parseInt($(WysijaForm.options.container).positionedOffset().top);
|
||||
if (WysijaForm.toolbar.top === null) WysijaForm.toolbar.top = parseInt(window.$(WysijaForm.options.container).positionedOffset().top);
|
||||
if (WysijaForm.toolbar.y === null) WysijaForm.toolbar.y = parseInt(WysijaForm.toolbar.top);
|
||||
|
||||
if(isRtl) {
|
||||
if (window.isRtl) {
|
||||
if (WysijaForm.toolbar.left === null) WysijaForm.toolbar.left = 0;
|
||||
} else {
|
||||
if(WysijaForm.toolbar.left === null) WysijaForm.toolbar.left = parseInt($(WysijaForm.options.container).positionedOffset().left);
|
||||
if (WysijaForm.toolbar.left === null) WysijaForm.toolbar.left = parseInt(window.$(WysijaForm.options.container).positionedOffset().left);
|
||||
}
|
||||
if(WysijaForm.toolbar.x === null) WysijaForm.toolbar.x = parseInt(WysijaForm.toolbar.left + $(WysijaForm.options.container).getDimensions().width + 15);
|
||||
if (WysijaForm.toolbar.x === null) WysijaForm.toolbar.x = parseInt(WysijaForm.toolbar.left + window.$(WysijaForm.options.container).getDimensions().width + 15);
|
||||
|
||||
},
|
||||
setToolbarPosition: function () {
|
||||
@ -520,13 +526,13 @@ var WysijaForm = {
|
||||
visibility: 'visible'
|
||||
};
|
||||
|
||||
if(isRtl) {
|
||||
if (window.isRtl) {
|
||||
position.right = WysijaForm.toolbar.x + 'px';
|
||||
} else {
|
||||
position.left = WysijaForm.toolbar.x + 'px';
|
||||
}
|
||||
|
||||
$(WysijaForm.options.toolbar).setStyle(position);
|
||||
window.$(WysijaForm.options.toolbar).setStyle(position);
|
||||
},
|
||||
updateToolbarPosition: function () {
|
||||
// init toolbar position (updates scroll and toolbar y)
|
||||
@ -538,31 +544,31 @@ var WysijaForm = {
|
||||
if (WysijaForm.scroll.top >= (WysijaForm.toolbar.top - 20)) {
|
||||
WysijaForm.toolbar.y = parseInt(20 + WysijaForm.scroll.top);
|
||||
// start effect
|
||||
WysijaForm.toolbar.effect = new Effect.Move(WysijaForm.options.toolbar, {
|
||||
WysijaForm.toolbar.effect = new window.Effect.Move(WysijaForm.options.toolbar, {
|
||||
x: WysijaForm.toolbar.x,
|
||||
y: WysijaForm.toolbar.y,
|
||||
mode: 'absolute',
|
||||
duration: 0.2
|
||||
});
|
||||
} else {
|
||||
$(WysijaForm.options.toolbar).setStyle({
|
||||
window.$(WysijaForm.options.toolbar).setStyle({
|
||||
left: WysijaForm.toolbar.x + 'px',
|
||||
top: WysijaForm.toolbar.top + 'px'
|
||||
});
|
||||
}
|
||||
},
|
||||
blockDropOptions: {
|
||||
accept: $w('mailpoet_form_field'), // acceptable items (classes array)
|
||||
accept: window.$w('mailpoet_form_field'), // acceptable items (classes array)
|
||||
onEnter: function (draggable, droppable) {
|
||||
$(droppable).addClassName('hover');
|
||||
window.$(droppable).addClassName('hover');
|
||||
},
|
||||
onLeave: function (draggable, droppable) {
|
||||
$(droppable).removeClassName('hover');
|
||||
window.$(droppable).removeClassName('hover');
|
||||
},
|
||||
onDrop: function (draggable, droppable) {
|
||||
// custom data for images
|
||||
droppable.fire('wjfe:item:drop', WysijaForm.getFieldData(draggable));
|
||||
$(droppable).removeClassName('hover');
|
||||
window.$(droppable).removeClassName('hover');
|
||||
}
|
||||
},
|
||||
hideControls: function () {
|
||||
@ -573,7 +579,7 @@ var WysijaForm = {
|
||||
}
|
||||
},
|
||||
hideTools: function () {
|
||||
$$('.wysija_tools').invoke('hide');
|
||||
window.$$('.wysija_tools').invoke('hide');
|
||||
WysijaForm.locks.showingTools = false;
|
||||
},
|
||||
instances: {},
|
||||
@ -588,11 +594,11 @@ var WysijaForm = {
|
||||
return instance;
|
||||
},
|
||||
makeDroppable: function () {
|
||||
Droppables.add('block_placeholder', WysijaForm.blockDropOptions);
|
||||
window.Droppables.add('block_placeholder', WysijaForm.blockDropOptions);
|
||||
},
|
||||
makeSortable: function () {
|
||||
var body = $(WysijaForm.options.body);
|
||||
Sortable.create(body, {
|
||||
var body = window.$(WysijaForm.options.body);
|
||||
window.Sortable.create(body, {
|
||||
tag: 'div',
|
||||
only: 'mailpoet_form_block',
|
||||
scroll: window,
|
||||
@ -600,15 +606,15 @@ var WysijaForm = {
|
||||
constraint: 'vertical'
|
||||
|
||||
});
|
||||
Draggables.removeObserver(body);
|
||||
Draggables.addObserver({
|
||||
window.Draggables.removeObserver(body);
|
||||
window.Draggables.addObserver({
|
||||
element: body,
|
||||
onStart: WysijaForm.startBlockPositions,
|
||||
onEnd: WysijaForm.setBlockPositions
|
||||
});
|
||||
},
|
||||
hideBlockControls: function () {
|
||||
$$('.wysija_controls').invoke('hide');
|
||||
window.$$('.wysija_controls').invoke('hide');
|
||||
this.getBlockElements().invoke('removeClassName', 'hover');
|
||||
},
|
||||
getBlocks: function () {
|
||||
@ -617,7 +623,7 @@ var WysijaForm = {
|
||||
});
|
||||
},
|
||||
getBlockElements: function () {
|
||||
return $(WysijaForm.options.container).select('.mailpoet_form_block');
|
||||
return window.$(WysijaForm.options.container).select('.mailpoet_form_block');
|
||||
},
|
||||
startBlockPositions: function (event, target) {
|
||||
if (target.element.hasClassName('mailpoet_form_block')) {
|
||||
@ -665,14 +671,14 @@ var WysijaForm = {
|
||||
}
|
||||
};
|
||||
|
||||
WysijaForm.DraggableItem = Class.create({
|
||||
WysijaForm.DraggableItem = window.Class.create({
|
||||
initialize: function (element) {
|
||||
this.elementType = $(element).readAttribute('wysija_type');
|
||||
this.element = $(element).down() || $(element);
|
||||
this.elementType = window.$(element).readAttribute('wysija_type');
|
||||
this.element = window.$(element).down() || window.$(element);
|
||||
this.clone = this.cloneElement();
|
||||
this.insert();
|
||||
},
|
||||
STYLES: new Template('position: absolute; top: #{top}px; left: #{left}px;'),
|
||||
STYLES: new window.Template('position: absolute; top: #{top}px; left: #{left}px;'),
|
||||
cloneElement: function () {
|
||||
var clone = this.element.clone(),
|
||||
offset = this.element.cumulativeOffset(),
|
||||
@ -695,27 +701,27 @@ WysijaForm.DraggableItem = Class.create({
|
||||
return this.element.up('ul');
|
||||
},
|
||||
insert: function () {
|
||||
$$('body')[0].insert(this.clone);
|
||||
window.$$('body')[0].insert(this.clone);
|
||||
},
|
||||
onMousedown: function (event) {
|
||||
var draggable = new Draggable(this.clone, {
|
||||
var draggable = new window.Draggable(this.clone, {
|
||||
scroll: window,
|
||||
onStart: function () {
|
||||
Droppables.displayArea(draggable);
|
||||
window.Droppables.displayArea(draggable);
|
||||
},
|
||||
onEnd: function (drag) {
|
||||
drag.destroy();
|
||||
drag.element.remove();
|
||||
Droppables.hideArea();
|
||||
window.Droppables.hideArea();
|
||||
},
|
||||
starteffect: function (element) {
|
||||
new Effect.Opacity(element, {
|
||||
new window.Effect.Opacity(element, {
|
||||
duration: 0.2,
|
||||
from: element.getOpacity(),
|
||||
to: 0.7
|
||||
});
|
||||
},
|
||||
endeffect: Prototype.emptyFunction
|
||||
endeffect: window.Prototype.emptyFunction
|
||||
});
|
||||
draggable.initDrag(event);
|
||||
draggable.startDrag(event);
|
||||
@ -725,12 +731,12 @@ WysijaForm.DraggableItem = Class.create({
|
||||
Object.extend(WysijaForm.DraggableItem, Observable).observe('a[class="mailpoet_form_field"]');
|
||||
|
||||
|
||||
WysijaForm.Block = Class.create({
|
||||
WysijaForm.Block = window.Class.create({
|
||||
/* Invoked on load */
|
||||
initialize: function (element) {
|
||||
info('block -> init');
|
||||
|
||||
this.element = $(element);
|
||||
this.element = window.$(element);
|
||||
this.block = new WysijaForm.Widget(this.element);
|
||||
|
||||
// enable block placeholder
|
||||
@ -763,14 +769,14 @@ WysijaForm.Block = Class.create({
|
||||
makeBlockDroppable: function () {
|
||||
if (this.isBlockDroppableEnabled() === false) {
|
||||
var block_placeholder = this.getBlockDroppable();
|
||||
Droppables.add(block_placeholder.identify(), WysijaForm.blockDropOptions);
|
||||
window.Droppables.add(block_placeholder.identify(), WysijaForm.blockDropOptions);
|
||||
block_placeholder.addClassName('enabled');
|
||||
}
|
||||
},
|
||||
removeBlockDroppable: function () {
|
||||
if (this.isBlockDroppableEnabled()) {
|
||||
var block_placeholder = this.getBlockDroppable();
|
||||
Droppables.remove(block_placeholder.identify());
|
||||
window.Droppables.remove(block_placeholder.identify());
|
||||
block_placeholder.removeClassName('enabled');
|
||||
}
|
||||
},
|
||||
@ -786,7 +792,7 @@ WysijaForm.Block = Class.create({
|
||||
createBlockDroppable: function () {
|
||||
info('block -> createBlockDroppable');
|
||||
this.element.insert({
|
||||
before: '<div class=\"block_placeholder\">' + $('block_placeholder').innerHTML + '</div>'
|
||||
before: '<div class=\"block_placeholder\">' + window.$('block_placeholder').innerHTML + '</div>'
|
||||
});
|
||||
return this.element.previous('.block_placeholder');
|
||||
},
|
||||
@ -851,7 +857,7 @@ WysijaForm.Block = Class.create({
|
||||
if (this.settingsButton !== null) {
|
||||
this.settingsButton.observe('click', function (event) {
|
||||
// TODO: refactor
|
||||
var block = $(event.target).up('.mailpoet_form_block') || null;
|
||||
var block = window.$(event.target).up('.mailpoet_form_block') || null;
|
||||
if (block !== null) {
|
||||
var field = WysijaForm.getFieldData(block);
|
||||
this.editSettings();
|
||||
@ -867,7 +873,7 @@ WysijaForm.Block = Class.create({
|
||||
// save block in history
|
||||
WysijaHistory.enqueue(this.element);
|
||||
|
||||
Effect.Fade(this.element.identify(), {
|
||||
window.Effect.Fade(this.element.identify(), {
|
||||
duration: 0.2,
|
||||
afterFinish: function (effect) {
|
||||
// remove placeholder
|
||||
@ -899,20 +905,20 @@ WysijaForm.Block = Class.create({
|
||||
/* Invoked on item dropped */
|
||||
WysijaForm.Block.create = function (createBlock, target) {
|
||||
var block = createBlock;
|
||||
if($('form_template_' + block.type) === null) {
|
||||
if (window.$('form_template_' + block.type) === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var body = $(WysijaForm.options.body),
|
||||
block_template = Handlebars.compile($('form_template_block').innerHTML),
|
||||
template = Handlebars.compile($('form_template_' + block.type).innerHTML),
|
||||
var body = window.$(WysijaForm.options.body),
|
||||
block_template = window.Handlebars.compile(window.$('form_template_block').innerHTML),
|
||||
template = window.Handlebars.compile(window.$('form_template_' + block.type).innerHTML),
|
||||
output = '';
|
||||
|
||||
if (block.type === 'segment') {
|
||||
if (block.params.values === undefined) {
|
||||
var settings_segments = jQuery('#mailpoet_form_segments').val();
|
||||
var settings_segments = window.jQuery('#mailpoet_form_segments').val();
|
||||
if (settings_segments !== null && settings_segments.length > 0) {
|
||||
block.params.values = mailpoet_segments.filter(function(segment) {
|
||||
block.params.values = window.mailpoet_segments.filter(function (segment) {
|
||||
return (settings_segments.indexOf(segment.id) !== -1);
|
||||
});
|
||||
}
|
||||
@ -967,10 +973,10 @@ document.observe('wjfe:item:drop', function(event) {
|
||||
});
|
||||
|
||||
/* Form Widget */
|
||||
WysijaForm.Widget = Class.create(WysijaForm.Block, {
|
||||
WysijaForm.Widget = window.Class.create(WysijaForm.Block, {
|
||||
initialize: function (element) {
|
||||
info('widget -> init');
|
||||
this.element = $(element);
|
||||
this.element = window.$(element);
|
||||
return this;
|
||||
},
|
||||
setup: function () {
|
||||
@ -989,7 +995,7 @@ WysijaForm.Widget = Class.create(WysijaForm.Block, {
|
||||
},
|
||||
setData: function (data) {
|
||||
var current_data = this.getData(),
|
||||
params = $H(current_data.params).merge(data.params).toObject();
|
||||
params = window.$H(current_data.params).merge(data.params).toObject();
|
||||
|
||||
// update type if it changed
|
||||
if (data.type !== undefined && data.type !== current_data.type) {
|
||||
@ -1018,9 +1024,9 @@ WysijaForm.Widget = Class.create(WysijaForm.Block, {
|
||||
this.setData(data);
|
||||
var options = this.getData();
|
||||
// redraw block
|
||||
var block_template = Handlebars.compile($('form_template_block').innerHTML),
|
||||
template = Handlebars.compile($('form_template_' + options.type).innerHTML),
|
||||
data = $H(options).merge({
|
||||
var block_template = window.Handlebars.compile(window.$('form_template_block').innerHTML),
|
||||
template = window.Handlebars.compile(window.$('form_template_' + options.type).innerHTML),
|
||||
data = window.$H(options).merge({
|
||||
template: template(options)
|
||||
}).toObject();
|
||||
this.element.replace(block_template(data));
|
||||
@ -1028,12 +1034,12 @@ WysijaForm.Widget = Class.create(WysijaForm.Block, {
|
||||
WysijaForm.init();
|
||||
},
|
||||
editSettings: function () {
|
||||
MailPoet.Modal.popup({
|
||||
title: MailPoet.I18n.t('editFieldSettings'),
|
||||
template: jQuery('#form_template_field_settings').html(),
|
||||
window.MailPoet.Modal.popup({
|
||||
title: window.MailPoet.I18n.t('editFieldSettings'),
|
||||
template: window.jQuery('#form_template_field_settings').html(),
|
||||
data: this.getData(),
|
||||
onSuccess: function () {
|
||||
var data = jQuery('#form_field_settings').serializeObject();
|
||||
var data = window.jQuery('#form_field_settings').serializeObject();
|
||||
this.redraw(data);
|
||||
}.bind(this)
|
||||
});
|
||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { Router, Route, IndexRoute, useRouterHistory } from 'react-router';
|
||||
import { createHashHistory } from 'history';
|
||||
import FormList from 'forms/list.jsx';
|
||||
import FormList from './list.jsx';
|
||||
|
||||
const history = useRouterHistory(createHashHistory)({ queryKey: false });
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
import React from 'react';
|
||||
import Listing from 'listing/listing.jsx';
|
||||
import classNames from 'classnames';
|
||||
import MailPoet from 'mailpoet';
|
||||
import jQuery from 'jquery';
|
||||
import Listing from '../listing/listing.jsx';
|
||||
|
||||
const columns = [
|
||||
{
|
||||
@ -128,7 +129,7 @@ const FormList = React.createClass({
|
||||
endpoint: 'forms',
|
||||
action: 'create',
|
||||
}).done((response) => {
|
||||
window.location = mailpoet_form_edit_url + response.data.id;
|
||||
window.location = window.mailpoet_form_edit_url + response.data.id;
|
||||
}).fail((response) => {
|
||||
if (response.errors.length > 0) {
|
||||
MailPoet.Notice.error(
|
||||
@ -145,7 +146,7 @@ const FormList = React.createClass({
|
||||
'has-row-actions'
|
||||
);
|
||||
|
||||
let segments = mailpoet_segments.filter((segment) => {
|
||||
let segments = window.mailpoet_segments.filter((segment) => {
|
||||
return (jQuery.inArray(segment.id, form.segments) !== -1);
|
||||
}).map((segment) => {
|
||||
return segment.name;
|
||||
@ -190,7 +191,7 @@ const FormList = React.createClass({
|
||||
</h1>
|
||||
|
||||
<Listing
|
||||
limit={ mailpoet_listing_per_page }
|
||||
limit={window.mailpoet_listing_per_page}
|
||||
location={this.props.location}
|
||||
params={this.props.params}
|
||||
messages={messages}
|
||||
|
@ -22,9 +22,9 @@ define('handlebars_helpers', ['handlebars'], function(Handlebars) {
|
||||
var f = block.hash.format || 'MMM Do, YYYY';
|
||||
// check if we passed a timestamp
|
||||
if (parseInt(timestamp, 10) == timestamp) {
|
||||
return moment.unix(timestamp).format(f);
|
||||
return window.moment.unix(timestamp).format(f);
|
||||
} else {
|
||||
return moment.utc(timestamp).format(f);
|
||||
return window.moment.utc(timestamp).format(f);
|
||||
}
|
||||
} else {
|
||||
return timestamp;
|
||||
|
@ -276,7 +276,7 @@ const ListingItems = React.createClass({
|
||||
selection={this.props.selection}
|
||||
is_selectable={this.props.is_selectable}
|
||||
item_actions={this.props.item_actions}
|
||||
group={ this.props.group }
|
||||
group={this.props.group}
|
||||
key={`item-${renderItem.id}-${index}`}
|
||||
item={renderItem} />
|
||||
);
|
||||
|
@ -112,9 +112,8 @@ define('modal', ['mailpoet', 'jquery'],
|
||||
if (this.renderer === 'html') {
|
||||
return function () { return template; };
|
||||
} else {
|
||||
return Handlebars.compile(template);
|
||||
return window.Handlebars.compile(template);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
init: function (options) {
|
||||
if (this.initialized === true) {
|
||||
|
@ -26,7 +26,7 @@ define('mp2migrator', ['mailpoet', 'jquery'], function(mp, jQuery) {
|
||||
|
||||
displayLogs: function () {
|
||||
jQuery.ajax({
|
||||
url: mailpoet_mp2_migrator.log_file_url,
|
||||
url: window.mailpoet_mp2_migrator.log_file_url,
|
||||
cache: false
|
||||
}).done(function (result) {
|
||||
jQuery('#logger').html('');
|
||||
@ -53,7 +53,7 @@ define('mp2migrator', ['mailpoet', 'jquery'], function(mp, jQuery) {
|
||||
|
||||
updateProgressbar: function () {
|
||||
jQuery.ajax({
|
||||
url: mailpoet_mp2_migrator.progress_url,
|
||||
url: window.mailpoet_mp2_migrator.progress_url,
|
||||
cache: false,
|
||||
dataType: 'json'
|
||||
}).always(function (result) {
|
||||
|
@ -13,14 +13,34 @@ define([
|
||||
|
||||
BL.ColorPickerBehavior = Marionette.Behavior.extend({
|
||||
onRender: function () {
|
||||
this.view.$('.mailpoet_color').spectrum({
|
||||
var that = this,
|
||||
preferredFormat = 'hex6';
|
||||
this.view.$('.mailpoet_color').each(function () {
|
||||
var $input = that.view.$(this);
|
||||
var updateColorInput = function (color) {
|
||||
if (color && color.getAlpha() > 0) {
|
||||
$input.val(color.toString(preferredFormat));
|
||||
} else {
|
||||
$input.val('');
|
||||
}
|
||||
$input.trigger('change');
|
||||
};
|
||||
$input.spectrum({
|
||||
clickoutFiresChange: true,
|
||||
showInput: true,
|
||||
showInitial: true,
|
||||
preferredFormat: 'hex6',
|
||||
showPalette: true,
|
||||
showSelectionPalette: true,
|
||||
palette: [],
|
||||
localStorageKey: 'newsletter_editor.spectrum.palette',
|
||||
preferredFormat: preferredFormat,
|
||||
allowEmpty: true,
|
||||
chooseText: MailPoet.I18n.t('selectColor'),
|
||||
cancelText: MailPoet.I18n.t('cancelColorSelection')
|
||||
cancelText: MailPoet.I18n.t('cancelColorSelection'),
|
||||
change: updateColorInput,
|
||||
move: updateColorInput,
|
||||
hide: updateColorInput
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
/**
|
||||
* ContainerDropZoneBehavior
|
||||
*
|
||||
@ -195,7 +196,8 @@ define([
|
||||
|
||||
if (view.model.get('orientation') === 'horizontal' && droppableModel.get('type') !== 'container') {
|
||||
// Regular blocks always need to be inserted into columns - vertical containers
|
||||
tempCollection = new (EditorApplication.getBlockTypeModel('container'))({
|
||||
|
||||
tempCollection = new (window.EditorApplication.getBlockTypeModel('container'))({
|
||||
orientation: 'vertical'
|
||||
});
|
||||
tempCollection.get('blocks').add(droppableModel);
|
||||
@ -210,7 +212,7 @@ define([
|
||||
// and inserting dropModel into that
|
||||
var tempModel = viewCollection.at(dropPosition.index);
|
||||
|
||||
tempCollection = new (EditorApplication.getBlockTypeModel('container'))({
|
||||
tempCollection = new (window.EditorApplication.getBlockTypeModel('container'))({
|
||||
orientation: (view.model.get('orientation') === 'vertical') ? 'horizontal' : 'vertical'
|
||||
});
|
||||
|
||||
@ -218,19 +220,19 @@ define([
|
||||
|
||||
if (tempCollection.get('orientation') === 'horizontal') {
|
||||
if (dropPosition.position === 'before') {
|
||||
tempCollection2 = new (EditorApplication.getBlockTypeModel('container'))({
|
||||
tempCollection2 = new (window.EditorApplication.getBlockTypeModel('container'))({
|
||||
orientation: 'vertical'
|
||||
});
|
||||
tempCollection2.get('blocks').add(droppableModel);
|
||||
tempCollection.get('blocks').add(tempCollection2);
|
||||
}
|
||||
tempCollection2 = new (EditorApplication.getBlockTypeModel('container'))({
|
||||
tempCollection2 = new (window.EditorApplication.getBlockTypeModel('container'))({
|
||||
orientation: 'vertical'
|
||||
});
|
||||
tempCollection2.get('blocks').add(tempModel);
|
||||
tempCollection.get('blocks').add(tempCollection2);
|
||||
if (dropPosition.position === 'after') {
|
||||
tempCollection2 = new (EditorApplication.getBlockTypeModel('container'))({
|
||||
tempCollection2 = new (window.EditorApplication.getBlockTypeModel('container'))({
|
||||
orientation: 'vertical'
|
||||
});
|
||||
tempCollection2.get('blocks').add(droppableModel);
|
||||
@ -291,7 +293,7 @@ define([
|
||||
|
||||
insertionType, index, position, indexAndPosition;
|
||||
|
||||
unsafe = !!is_unsafe;
|
||||
var unsafe = !!is_unsafe;
|
||||
|
||||
if (this.getCollection().length === 0) {
|
||||
return {
|
||||
|
@ -54,7 +54,7 @@ define([
|
||||
// Use substitution instead of a clone
|
||||
var tempClone = (_.isFunction(that.options.onDragSubstituteBy)) ? that.options.onDragSubstituteBy(that) : undefined,
|
||||
// Or use a clone
|
||||
clone = tempClone ? tempClone : event.target.cloneNode(true),
|
||||
clone = tempClone || event.target.cloneNode(true),
|
||||
|
||||
$original = jQuery(event.target),
|
||||
$clone = jQuery(clone),
|
||||
|
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Highlight Container Behavior
|
||||
*
|
||||
* Highlights a container block when hovering over its tools
|
||||
*/
|
||||
define([
|
||||
'backbone.marionette',
|
||||
'newsletter_editor/behaviors/BehaviorsLookup'
|
||||
], function (Marionette, BehaviorsLookup) {
|
||||
var BL = BehaviorsLookup;
|
||||
|
||||
BL.HighlightContainerBehavior = Marionette.Behavior.extend({
|
||||
events: {
|
||||
'mouseenter @ui.tools': 'enableHighlight',
|
||||
'mouseleave @ui.tools': 'disableHighlight'
|
||||
},
|
||||
enableHighlight: function () {
|
||||
this.$el.addClass('mailpoet_highlight');
|
||||
},
|
||||
disableHighlight: function () {
|
||||
if (!this.view._isBeingEdited) {
|
||||
this.$el.removeClass('mailpoet_highlight');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
@ -15,9 +15,11 @@ define([
|
||||
stopEditing: 'disableHighlight'
|
||||
},
|
||||
enableHighlight: function () {
|
||||
this.view._isBeingEdited = true;
|
||||
this.$el.addClass('mailpoet_highlight');
|
||||
},
|
||||
disableHighlight: function () {
|
||||
this.view._isBeingEdited = false;
|
||||
this.$el.removeClass('mailpoet_highlight');
|
||||
}
|
||||
});
|
||||
|
@ -14,9 +14,16 @@ define([
|
||||
defaults: {
|
||||
elementSelector: null,
|
||||
resizeHandleSelector: true, // true will use edges of the element itself
|
||||
transformationFunction: function(y) { return y; },
|
||||
transformationFunction: function (y) { return y; }, // for blocks that use the default onResize function
|
||||
minLength: 0,
|
||||
modelField: 'styles.block.height'
|
||||
maxLength: Infinity,
|
||||
modelField: 'styles.block.height',
|
||||
onResize: function (event) {
|
||||
var currentLength = parseFloat(this.view.model.get(this.options.modelField)),
|
||||
newLength = currentLength + this.options.transformationFunction(event.dy);
|
||||
newLength = Math.min(this.options.maxLength, Math.max(this.options.minLength, newLength));
|
||||
this.view.model.set(this.options.modelField, newLength + 'px');
|
||||
}
|
||||
},
|
||||
events: {
|
||||
mouseenter: 'showResizeHandle',
|
||||
@ -40,16 +47,14 @@ define([
|
||||
right: false,
|
||||
bottom: (typeof this.options.resizeHandleSelector === 'string') ? this.view.$(this.options.resizeHandleSelector).get(0) : this.options.resizeHandleSelector
|
||||
}
|
||||
}).on('resizestart', function(event) {
|
||||
})
|
||||
.on('resizestart', function (event) {
|
||||
that.isBeingResized = true;
|
||||
that.$el.addClass('mailpoet_resize_active');
|
||||
}).on('resizemove', function(event) {
|
||||
var currentLength = parseFloat(that.view.model.get(that.options.modelField)),
|
||||
newLength = currentLength + that.options.transformationFunction(event.dy);
|
||||
|
||||
if (newLength < that.options.minLength) newLength = that.options.minLength;
|
||||
|
||||
that.view.model.set(that.options.modelField, newLength + 'px');
|
||||
})
|
||||
.on('resizemove', function (event) {
|
||||
var onResize = that.options.onResize.bind(that);
|
||||
return onResize(event);
|
||||
})
|
||||
.on('resizeend', function (event) {
|
||||
that.isBeingResized = null;
|
||||
|
@ -65,7 +65,7 @@ define([
|
||||
editor.focus();
|
||||
if (that._isActivationClick) {
|
||||
editor.selection.setRng(
|
||||
tinymce.dom.RangeUtils.getCaretRangeFromPoint(e.clientX, e.clientY, editor.getDoc())
|
||||
window.tinymce.dom.RangeUtils.getCaretRangeFromPoint(e.clientX, e.clientY, editor.getDoc())
|
||||
);
|
||||
that._isActivationClick = false;
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ define([
|
||||
}
|
||||
App.getChannel().on('replaceAllButtonStyles', replaceButtonStylesHandler.bind(this));
|
||||
},
|
||||
getTemplate: function() { return templates.automatedLatestContentBlock; },
|
||||
getTemplate: function () { return window.templates.automatedLatestContentBlock; },
|
||||
regions: {
|
||||
toolsRegion: '.mailpoet_tools',
|
||||
postsRegion: '.mailpoet_automated_latest_content_block_posts'
|
||||
@ -168,7 +168,7 @@ define([
|
||||
|
||||
// Sidebar view container
|
||||
Module.AutomatedLatestContentBlockSettingsView = base.BlockSettingsView.extend({
|
||||
getTemplate: function() { return templates.automatedLatestContentBlockSettings; },
|
||||
getTemplate: function () { return window.templates.automatedLatestContentBlockSettings; },
|
||||
events: function () {
|
||||
return {
|
||||
'click .mailpoet_automated_latest_content_hide_display_options': 'toggleDisplayOptions',
|
||||
@ -364,7 +364,7 @@ define([
|
||||
});
|
||||
|
||||
Module.AutomatedLatestContentWidgetView = base.WidgetView.extend({
|
||||
getTemplate: function() { return templates.automatedLatestContentInsertion; },
|
||||
getTemplate: function () { return window.templates.automatedLatestContentInsertion; },
|
||||
behaviors: {
|
||||
DraggableBehavior: {
|
||||
cloneOriginal: true,
|
||||
|
@ -178,7 +178,7 @@ define([
|
||||
});
|
||||
|
||||
Module.BlockToolsView = AugmentedView.extend({
|
||||
getTemplate: function() { return templates.genericBlockTools; },
|
||||
getTemplate: function () { return window.templates.genericBlockTools; },
|
||||
events: {
|
||||
'click .mailpoet_edit_block': 'changeSettings',
|
||||
'click .mailpoet_delete_block_activate': 'showDeletionConfirmation',
|
||||
@ -275,7 +275,7 @@ define([
|
||||
this.model.set(field, jQuery(event.target).val() + suffix);
|
||||
},
|
||||
changeBoolField: function (field, event) {
|
||||
this.model.set(field, (jQuery(event.target).val() === 'true') ? true : false);
|
||||
this.model.set(field, (jQuery(event.target).val() === 'true'));
|
||||
},
|
||||
changeBoolCheckboxField: function (field, event) {
|
||||
this.model.set(field, (!!jQuery(event.target).prop('checked')));
|
||||
|
@ -42,7 +42,7 @@ define([
|
||||
|
||||
Module.ButtonBlockView = base.BlockView.extend({
|
||||
className: 'mailpoet_block mailpoet_button_block mailpoet_droppable_block',
|
||||
getTemplate: function() { return templates.buttonBlock; },
|
||||
getTemplate: function () { return window.templates.buttonBlock; },
|
||||
onDragSubstituteBy: function () { return Module.ButtonWidgetView; },
|
||||
behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
|
||||
ShowSettingsBehavior: {}
|
||||
@ -65,7 +65,7 @@ define([
|
||||
});
|
||||
|
||||
Module.ButtonBlockSettingsView = base.BlockSettingsView.extend({
|
||||
getTemplate: function() { return templates.buttonBlockSettings; },
|
||||
getTemplate: function () { return window.templates.buttonBlockSettings; },
|
||||
events: function () {
|
||||
return {
|
||||
'input .mailpoet_field_button_text': _.partial(this.changeField, 'text'),
|
||||
@ -121,7 +121,7 @@ define([
|
||||
});
|
||||
|
||||
Module.ButtonWidgetView = base.WidgetView.extend({
|
||||
getTemplate: function() { return templates.buttonInsertion; },
|
||||
getTemplate: function () { return window.templates.buttonInsertion; },
|
||||
behaviors: {
|
||||
DraggableBehavior: {
|
||||
cloneOriginal: true,
|
||||
|
@ -103,7 +103,7 @@ define([
|
||||
}
|
||||
}),
|
||||
className: 'mailpoet_block mailpoet_container_block mailpoet_droppable_block mailpoet_droppable_layout_block',
|
||||
getTemplate: function() { return templates.containerBlock; },
|
||||
getTemplate: function () { return window.templates.containerBlock; },
|
||||
events: _.extend({}, base.BlockView.prototype.events, {
|
||||
'click .mailpoet_newsletter_layer_selector': 'toggleEditingLayer'
|
||||
}),
|
||||
@ -138,7 +138,8 @@ define([
|
||||
// for root and column containers.
|
||||
return view.renderOptions.depth === 1;
|
||||
}
|
||||
}
|
||||
},
|
||||
HighlightContainerBehavior: {}
|
||||
}),
|
||||
onDragSubstituteBy: function () {
|
||||
// For two and three column layouts display their respective widgets,
|
||||
@ -217,7 +218,7 @@ define([
|
||||
});
|
||||
|
||||
Module.ContainerBlockEmptyView = Marionette.View.extend({
|
||||
getTemplate: function() { return templates.containerEmpty; },
|
||||
getTemplate: function () { return window.templates.containerEmpty; },
|
||||
initialize: function (options) {
|
||||
this.renderOptions = _.defaults(options.renderOptions || {}, {});
|
||||
},
|
||||
@ -234,7 +235,7 @@ define([
|
||||
});
|
||||
|
||||
Module.ContainerBlockSettingsView = base.BlockSettingsView.extend({
|
||||
getTemplate: function() { return templates.containerBlockSettings; },
|
||||
getTemplate: function () { return window.templates.containerBlockSettings; },
|
||||
events: function () {
|
||||
return {
|
||||
'change .mailpoet_field_container_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'),
|
||||
@ -266,7 +267,7 @@ define([
|
||||
});
|
||||
|
||||
Module.ContainerBlockColumnSettingsView = Marionette.View.extend({
|
||||
getTemplate: function() { return templates.containerBlockColumnSettings; },
|
||||
getTemplate: function () { return window.templates.containerBlockColumnSettings; },
|
||||
initialize: function (options) {
|
||||
this.columnNumber = (options.columnIndex || 0) + 1;
|
||||
},
|
||||
@ -280,7 +281,7 @@ define([
|
||||
|
||||
Module.OneColumnContainerWidgetView = base.WidgetView.extend({
|
||||
className: base.WidgetView.prototype.className + ' mailpoet_droppable_layout_block',
|
||||
getTemplate: function() { return templates.oneColumnLayoutInsertion; },
|
||||
getTemplate: function () { return window.templates.oneColumnLayoutInsertion; },
|
||||
behaviors: {
|
||||
DraggableBehavior: {
|
||||
cloneOriginal: true,
|
||||
@ -298,7 +299,7 @@ define([
|
||||
|
||||
Module.TwoColumnContainerWidgetView = base.WidgetView.extend({
|
||||
className: base.WidgetView.prototype.className + ' mailpoet_droppable_layout_block',
|
||||
getTemplate: function() { return templates.twoColumnLayoutInsertion; },
|
||||
getTemplate: function () { return window.templates.twoColumnLayoutInsertion; },
|
||||
behaviors: {
|
||||
DraggableBehavior: {
|
||||
cloneOriginal: true,
|
||||
@ -317,7 +318,7 @@ define([
|
||||
|
||||
Module.ThreeColumnContainerWidgetView = base.WidgetView.extend({
|
||||
className: base.WidgetView.prototype.className + ' mailpoet_droppable_layout_block',
|
||||
getTemplate: function() { return templates.threeColumnLayoutInsertion; },
|
||||
getTemplate: function () { return window.templates.threeColumnLayoutInsertion; },
|
||||
behaviors: {
|
||||
DraggableBehavior: {
|
||||
cloneOriginal: true,
|
||||
|
@ -33,7 +33,7 @@ define([
|
||||
|
||||
Module.DividerBlockView = base.BlockView.extend({
|
||||
className: 'mailpoet_block mailpoet_divider_block mailpoet_droppable_block',
|
||||
getTemplate: function() { return templates.dividerBlock; },
|
||||
getTemplate: function () { return window.templates.dividerBlock; },
|
||||
modelEvents: _.omit(base.BlockView.prototype.modelEvents, 'change'),
|
||||
behaviors: _.defaults({
|
||||
ResizableBehavior: {
|
||||
@ -84,7 +84,7 @@ define([
|
||||
});
|
||||
|
||||
Module.DividerBlockSettingsView = base.BlockSettingsView.extend({
|
||||
getTemplate: function() { return templates.dividerBlockSettings; },
|
||||
getTemplate: function () { return window.templates.dividerBlockSettings; },
|
||||
events: function () {
|
||||
return {
|
||||
'click .mailpoet_field_divider_style': 'changeStyle',
|
||||
@ -129,7 +129,7 @@ define([
|
||||
});
|
||||
|
||||
Module.DividerWidgetView = base.WidgetView.extend({
|
||||
getTemplate: function() { return templates.dividerInsertion; },
|
||||
getTemplate: function () { return window.templates.dividerInsertion; },
|
||||
behaviors: {
|
||||
DraggableBehavior: {
|
||||
cloneOriginal: true,
|
||||
|
@ -4,8 +4,9 @@
|
||||
define([
|
||||
'newsletter_editor/App',
|
||||
'newsletter_editor/blocks/base',
|
||||
'underscore'
|
||||
], function(App, BaseBlock, _) {
|
||||
'underscore',
|
||||
'mailpoet'
|
||||
], function (App, BaseBlock, _, MailPoet) {
|
||||
|
||||
'use strict';
|
||||
|
||||
@ -38,7 +39,7 @@ define([
|
||||
|
||||
Module.FooterBlockView = base.BlockView.extend({
|
||||
className: 'mailpoet_block mailpoet_footer_block mailpoet_droppable_block',
|
||||
getTemplate: function() { return templates.footerBlock; },
|
||||
getTemplate: function () { return window.templates.footerBlock; },
|
||||
modelEvents: _.extend({
|
||||
'change:styles.block.backgroundColor change:styles.text.fontColor change:styles.text.fontFamily change:styles.text.fontSize change:styles.text.textAlign change:styles.link.fontColor change:styles.link.textDecoration': 'render'
|
||||
}, _.omit(base.BlockView.prototype.modelEvents, 'change')),
|
||||
@ -75,7 +76,7 @@ define([
|
||||
});
|
||||
|
||||
Module.FooterBlockSettingsView = base.BlockSettingsView.extend({
|
||||
getTemplate: function() { return templates.footerBlockSettings; },
|
||||
getTemplate: function () { return window.templates.footerBlockSettings; },
|
||||
events: function () {
|
||||
return {
|
||||
'change .mailpoet_field_footer_text_color': _.partial(this.changeColorField, 'styles.text.fontColor'),
|
||||
@ -98,7 +99,7 @@ define([
|
||||
});
|
||||
|
||||
Module.FooterWidgetView = base.WidgetView.extend({
|
||||
getTemplate: function() { return templates.footerInsertion; },
|
||||
getTemplate: function () { return window.templates.footerInsertion; },
|
||||
behaviors: {
|
||||
DraggableBehavior: {
|
||||
cloneOriginal: true,
|
||||
|
@ -4,8 +4,9 @@
|
||||
define([
|
||||
'newsletter_editor/App',
|
||||
'newsletter_editor/blocks/base',
|
||||
'underscore'
|
||||
], function(App, BaseBlock, _) {
|
||||
'underscore',
|
||||
'mailpoet'
|
||||
], function (App, BaseBlock, _, MailPoet) {
|
||||
|
||||
'use strict';
|
||||
|
||||
@ -38,7 +39,7 @@ define([
|
||||
|
||||
Module.HeaderBlockView = base.BlockView.extend({
|
||||
className: 'mailpoet_block mailpoet_header_block mailpoet_droppable_block',
|
||||
getTemplate: function() { return templates.headerBlock; },
|
||||
getTemplate: function () { return window.templates.headerBlock; },
|
||||
modelEvents: _.extend({
|
||||
'change:styles.block.backgroundColor change:styles.text.fontColor change:styles.text.fontFamily change:styles.text.fontSize change:styles.text.textAlign change:styles.link.fontColor change:styles.link.textDecoration': 'render'
|
||||
}, _.omit(base.BlockView.prototype.modelEvents, 'change')),
|
||||
@ -75,7 +76,7 @@ define([
|
||||
});
|
||||
|
||||
Module.HeaderBlockSettingsView = base.BlockSettingsView.extend({
|
||||
getTemplate: function() { return templates.headerBlockSettings; },
|
||||
getTemplate: function () { return window.templates.headerBlockSettings; },
|
||||
events: function () {
|
||||
return {
|
||||
'change .mailpoet_field_header_text_color': _.partial(this.changeColorField, 'styles.text.fontColor'),
|
||||
@ -98,7 +99,7 @@ define([
|
||||
});
|
||||
|
||||
Module.HeaderWidgetView = base.WidgetView.extend({
|
||||
getTemplate: function() { return templates.headerInsertion; },
|
||||
getTemplate: function () { return window.templates.headerInsertion; },
|
||||
behaviors: {
|
||||
DraggableBehavior: {
|
||||
cloneOriginal: true,
|
||||
|
@ -5,8 +5,9 @@ define([
|
||||
'newsletter_editor/App',
|
||||
'newsletter_editor/blocks/base',
|
||||
'underscore',
|
||||
'mailpoet'
|
||||
], function(App, BaseBlock, _, MailPoet) {
|
||||
'mailpoet',
|
||||
'jquery'
|
||||
], function (App, BaseBlock, _, MailPoet, jQuery) {
|
||||
|
||||
'use strict';
|
||||
|
||||
@ -35,7 +36,7 @@ define([
|
||||
|
||||
Module.ImageBlockView = base.BlockView.extend({
|
||||
className: 'mailpoet_block mailpoet_image_block mailpoet_droppable_block',
|
||||
getTemplate: function() { return templates.imageBlock; },
|
||||
getTemplate: function () { return window.templates.imageBlock; },
|
||||
onDragSubstituteBy: function () { return Module.ImageWidgetView; },
|
||||
templateContext: function () {
|
||||
return _.extend({
|
||||
@ -43,17 +44,28 @@ define([
|
||||
}, base.BlockView.prototype.templateContext.apply(this));
|
||||
},
|
||||
behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
|
||||
ShowSettingsBehavior: {}
|
||||
ResizableBehavior: {
|
||||
elementSelector: '.mailpoet_image',
|
||||
resizeHandleSelector: '.mailpoet_image_resize_handle',
|
||||
onResize: function (event) {
|
||||
var corner = this.$('.mailpoet_image').offset(),
|
||||
width = event.pageX - corner.left;
|
||||
this.view.model.set('width', width + 'px');
|
||||
}
|
||||
},
|
||||
ShowSettingsBehavior: {
|
||||
ignoreFrom: '.mailpoet_image_resize_handle'
|
||||
}
|
||||
}),
|
||||
onRender: function () {
|
||||
this.toolsView = new Module.ImageBlockToolsView({ model: this.model });
|
||||
this.showChildView('toolsRegion', this.toolsView);
|
||||
|
||||
if (this.model.get('fullWidth')) {
|
||||
this.$el.addClass('mailpoet_full_image');
|
||||
} else {
|
||||
this.$el.removeClass('mailpoet_full_image');
|
||||
}
|
||||
this.$('.mailpoet_content').css('width', this.model.get('width'));
|
||||
}
|
||||
});
|
||||
|
||||
@ -72,7 +84,7 @@ define([
|
||||
tooltip: MailPoet.I18n.t('helpTooltipDesignerIdealWidth')
|
||||
});
|
||||
},
|
||||
getTemplate: function() { return templates.imageBlockSettings; },
|
||||
getTemplate: function () { return window.templates.imageBlockSettings; },
|
||||
events: function () {
|
||||
return {
|
||||
'input .mailpoet_field_image_link': _.partial(this.changeField, 'link'),
|
||||
@ -81,9 +93,32 @@ define([
|
||||
'change .mailpoet_field_image_full_width': _.partial(this.changeBoolCheckboxField, 'fullWidth'),
|
||||
'change .mailpoet_field_image_alignment': _.partial(this.changeField, 'styles.block.textAlign'),
|
||||
'click .mailpoet_field_image_select_another_image': 'showMediaManager',
|
||||
'click .mailpoet_done_editing': 'close'
|
||||
'click .mailpoet_done_editing': 'close',
|
||||
'input .mailpoet_field_image_width': _.partial(this.updateValueAndCall, '.mailpoet_field_image_width_input', _.partial(this.changePixelField, 'width').bind(this)),
|
||||
'change .mailpoet_field_image_width': _.partial(this.updateValueAndCall, '.mailpoet_field_image_width_input', _.partial(this.changePixelField, 'width').bind(this)),
|
||||
'input .mailpoet_field_image_width_input': _.partial(this.updateValueAndCall, '.mailpoet_field_image_width', _.partial(this.changePixelField, 'width').bind(this))
|
||||
};
|
||||
},
|
||||
modelEvents: function () {
|
||||
return {
|
||||
'change:maxWidth': 'updateMaxWidth',
|
||||
'change:width': 'updateWidth'
|
||||
};
|
||||
},
|
||||
updateValueAndCall: function (fieldToUpdate, callable, event) {
|
||||
this.$(fieldToUpdate).val(jQuery(event.target).val());
|
||||
callable(event);
|
||||
},
|
||||
updateMaxWidth: function () {
|
||||
var maxWidth = parseInt(this.model.get('maxWidth'));
|
||||
this.$('.mailpoet_field_image_width').attr('max', maxWidth);
|
||||
this.$('.mailpoet_field_image_width_input').attr('max', maxWidth);
|
||||
},
|
||||
updateWidth: function () {
|
||||
var width = parseInt(this.model.get('width'));
|
||||
this.$('.mailpoet_field_image_width').val(width);
|
||||
this.$('.mailpoet_field_image_width_input').val(width);
|
||||
},
|
||||
initialize: function (options) {
|
||||
base.BlockSettingsView.prototype.initialize.apply(this, arguments);
|
||||
|
||||
@ -98,10 +133,10 @@ define([
|
||||
return;
|
||||
}
|
||||
|
||||
var MediaManager = wp.media.view.MediaFrame.Select.extend({
|
||||
var MediaManager = window.wp.media.view.MediaFrame.Select.extend({
|
||||
|
||||
initialize: function () {
|
||||
wp.media.view.MediaFrame.prototype.initialize.apply(this, arguments);
|
||||
window.wp.media.view.MediaFrame.prototype.initialize.apply(this, arguments);
|
||||
|
||||
_.defaults(this.options, {
|
||||
multiple: true,
|
||||
@ -123,7 +158,7 @@ define([
|
||||
},
|
||||
|
||||
createQuery: function (options) {
|
||||
var query = wp.media.query(options);
|
||||
var query = window.wp.media.query(options);
|
||||
return query;
|
||||
},
|
||||
|
||||
@ -133,7 +168,7 @@ define([
|
||||
// Add the default states.
|
||||
this.states.add([
|
||||
// Main states.
|
||||
new wp.media.controller.Library({
|
||||
new window.wp.media.controller.Library({
|
||||
id: 'insert',
|
||||
title: 'Add images',
|
||||
priority: 20,
|
||||
@ -155,8 +190,8 @@ define([
|
||||
})
|
||||
]);
|
||||
|
||||
if(wp.media.view.settings.post.featuredImageId) {
|
||||
this.states.add(new wp.media.controller.FeaturedImage());
|
||||
if (window.wp.media.view.settings.post.featuredImageId) {
|
||||
this.states.add(new window.wp.media.controller.FeaturedImage());
|
||||
}
|
||||
},
|
||||
|
||||
@ -193,13 +228,13 @@ define([
|
||||
},
|
||||
|
||||
uploadContent: function () {
|
||||
wp.media.view.MediaFrame.Select.prototype.uploadContent.apply(this, arguments);
|
||||
window.wp.media.view.MediaFrame.Select.prototype.uploadContent.apply(this, arguments);
|
||||
this.$el.addClass('hide-toolbar');
|
||||
},
|
||||
|
||||
// Content
|
||||
embedContent: function () {
|
||||
var view = new wp.media.view.Embed({
|
||||
var view = new window.wp.media.view.Embed({
|
||||
controller: this,
|
||||
model: this.state()
|
||||
}).render();
|
||||
@ -213,7 +248,7 @@ define([
|
||||
selection = state.get('selection'),
|
||||
view;
|
||||
|
||||
view = new wp.media.view.AttachmentsBrowser({
|
||||
view = new window.wp.media.view.AttachmentsBrowser({
|
||||
controller: this,
|
||||
collection: selection,
|
||||
selection: selection,
|
||||
@ -222,7 +257,7 @@ define([
|
||||
search: false,
|
||||
dragInfo: true,
|
||||
|
||||
AttachmentView: wp.media.view.Attachment.EditSelection
|
||||
AttachmentView: window.wp.media.view.Attachment.EditSelection
|
||||
}).render();
|
||||
|
||||
view.toolbar.set('backToLibrary', {
|
||||
@ -242,7 +277,7 @@ define([
|
||||
selectionStatusToolbar: function (view) {
|
||||
var editable = this.state().get('editable');
|
||||
|
||||
view.set('selection', new wp.media.view.Selection({
|
||||
view.set('selection', new window.wp.media.view.Selection({
|
||||
controller: this,
|
||||
collection: this.state().get('selection'),
|
||||
priority: -40,
|
||||
@ -278,7 +313,7 @@ define([
|
||||
|
||||
mainEmbedToolbar: function (toolbar) {
|
||||
var tbar = toolbar;
|
||||
tbar.view = new wp.media.view.Toolbar.Embed({
|
||||
tbar.view = new window.wp.media.view.Toolbar.Embed({
|
||||
controller: this,
|
||||
text: 'Add images'
|
||||
});
|
||||
@ -363,7 +398,7 @@ define([
|
||||
});
|
||||
|
||||
ImageWidgetView = base.WidgetView.extend({
|
||||
getTemplate: function() { return templates.imageInsertion; },
|
||||
getTemplate: function () { return window.templates.imageInsertion; },
|
||||
behaviors: {
|
||||
DraggableBehavior: {
|
||||
cloneOriginal: true,
|
||||
|
@ -177,7 +177,7 @@ define([
|
||||
|
||||
Module.PostsBlockView = base.BlockView.extend({
|
||||
className: 'mailpoet_block mailpoet_posts_block mailpoet_droppable_block',
|
||||
getTemplate: function() { return templates.postsBlock; },
|
||||
getTemplate: function () { return window.templates.postsBlock; },
|
||||
modelEvents: {}, // Forcefully disable all events
|
||||
regions: _.extend({
|
||||
postsRegion: '.mailpoet_posts_block_posts'
|
||||
@ -216,7 +216,7 @@ define([
|
||||
});
|
||||
|
||||
Module.PostsBlockSettingsView = base.BlockSettingsView.extend({
|
||||
getTemplate: function() { return templates.postsBlockSettings; },
|
||||
getTemplate: function () { return window.templates.postsBlockSettings; },
|
||||
regions: {
|
||||
selectionRegion: '.mailpoet_settings_posts_selection',
|
||||
displayOptionsRegion: '.mailpoet_settings_posts_display_options'
|
||||
@ -308,7 +308,7 @@ define([
|
||||
});
|
||||
|
||||
var PostSelectionSettingsView = Marionette.View.extend({
|
||||
getTemplate: function() { return templates.postSelectionPostsBlockSettings; },
|
||||
getTemplate: function () { return window.templates.postSelectionPostsBlockSettings; },
|
||||
regions: {
|
||||
posts: '.mailpoet_post_selection_container'
|
||||
},
|
||||
@ -428,11 +428,11 @@ define([
|
||||
});
|
||||
|
||||
var EmptyPostSelectionSettingsView = Marionette.View.extend({
|
||||
getTemplate: function() { return templates.emptyPostPostsBlockSettings; }
|
||||
getTemplate: function () { return window.templates.emptyPostPostsBlockSettings; }
|
||||
});
|
||||
|
||||
var SinglePostSelectionSettingsView = Marionette.View.extend({
|
||||
getTemplate: function() { return templates.singlePostPostsBlockSettings; },
|
||||
getTemplate: function () { return window.templates.singlePostPostsBlockSettings; },
|
||||
events: function () {
|
||||
return {
|
||||
'change .mailpoet_select_post_checkbox': 'postSelectionChange'
|
||||
@ -459,7 +459,7 @@ define([
|
||||
});
|
||||
|
||||
var PostsDisplayOptionsSettingsView = base.BlockSettingsView.extend({
|
||||
getTemplate: function() { return templates.displayOptionsPostsBlockSettings; },
|
||||
getTemplate: function () { return window.templates.displayOptionsPostsBlockSettings; },
|
||||
events: function () {
|
||||
return {
|
||||
'click .mailpoet_posts_select_button': 'showButtonSettings',
|
||||
@ -564,7 +564,7 @@ define([
|
||||
});
|
||||
|
||||
Module.PostsWidgetView = base.WidgetView.extend({
|
||||
getTemplate: function() { return templates.postsInsertion; },
|
||||
getTemplate: function () { return window.templates.postsInsertion; },
|
||||
behaviors: {
|
||||
DraggableBehavior: {
|
||||
cloneOriginal: true,
|
||||
|
@ -85,7 +85,7 @@ define([
|
||||
|
||||
var SocialIconView = Marionette.View.extend({
|
||||
tagName: 'span',
|
||||
getTemplate: function() { return templates.socialIconBlock; },
|
||||
getTemplate: function () { return window.templates.socialIconBlock; },
|
||||
modelEvents: {
|
||||
change: 'render'
|
||||
},
|
||||
@ -105,7 +105,7 @@ define([
|
||||
|
||||
Module.SocialBlockView = base.BlockView.extend({
|
||||
className: 'mailpoet_block mailpoet_social_block mailpoet_droppable_block',
|
||||
getTemplate: function() { return templates.socialBlock; },
|
||||
getTemplate: function () { return window.templates.socialBlock; },
|
||||
regions: _.extend({}, base.BlockView.prototype.regions, {
|
||||
icons: '.mailpoet_social'
|
||||
}),
|
||||
@ -131,7 +131,7 @@ define([
|
||||
|
||||
// Sidebar view container
|
||||
Module.SocialBlockSettingsView = base.BlockSettingsView.extend({
|
||||
getTemplate: function() { return templates.socialBlockSettings; },
|
||||
getTemplate: function () { return window.templates.socialBlockSettings; },
|
||||
regions: {
|
||||
iconRegion: '#mailpoet_social_icons_selection',
|
||||
stylesRegion: '#mailpoet_social_icons_styles'
|
||||
@ -155,7 +155,7 @@ define([
|
||||
|
||||
// Single icon settings view, used by the selector view
|
||||
SocialBlockSettingsIconView = Marionette.View.extend({
|
||||
getTemplate: function() { return templates.socialSettingsIcon; },
|
||||
getTemplate: function () { return window.templates.socialSettingsIcon; },
|
||||
events: function () {
|
||||
return {
|
||||
'click .mailpoet_delete_block': 'deleteIcon',
|
||||
@ -212,7 +212,7 @@ define([
|
||||
|
||||
// Select icons section container view
|
||||
SocialBlockSettingsIconSelectorView = Marionette.View.extend({
|
||||
getTemplate: function() { return templates.socialSettingsIconSelector; },
|
||||
getTemplate: function () { return window.templates.socialSettingsIconSelector; },
|
||||
regions: {
|
||||
icons: '#mailpoet_social_icon_selector_contents'
|
||||
},
|
||||
@ -235,7 +235,7 @@ define([
|
||||
});
|
||||
|
||||
SocialBlockSettingsStylesView = Marionette.View.extend({
|
||||
getTemplate: function() { return templates.socialSettingsStyles; },
|
||||
getTemplate: function () { return window.templates.socialSettingsStyles; },
|
||||
modelEvents: {
|
||||
change: 'render'
|
||||
},
|
||||
@ -263,7 +263,7 @@ define([
|
||||
});
|
||||
|
||||
Module.SocialWidgetView = base.WidgetView.extend({
|
||||
getTemplate: function() { return templates.socialInsertion; },
|
||||
getTemplate: function () { return window.templates.socialInsertion; },
|
||||
behaviors: {
|
||||
DraggableBehavior: {
|
||||
cloneOriginal: true,
|
||||
|
@ -28,7 +28,7 @@ define([
|
||||
|
||||
Module.SpacerBlockView = base.BlockView.extend({
|
||||
className: 'mailpoet_block mailpoet_spacer_block mailpoet_droppable_block',
|
||||
getTemplate: function() { return templates.spacerBlock; },
|
||||
getTemplate: function () { return window.templates.spacerBlock; },
|
||||
behaviors: _.defaults({
|
||||
ResizableBehavior: {
|
||||
elementSelector: '.mailpoet_spacer',
|
||||
@ -66,7 +66,7 @@ define([
|
||||
});
|
||||
|
||||
Module.SpacerBlockSettingsView = base.BlockSettingsView.extend({
|
||||
getTemplate: function() { return templates.spacerBlockSettings; },
|
||||
getTemplate: function () { return window.templates.spacerBlockSettings; },
|
||||
events: function () {
|
||||
return {
|
||||
'change .mailpoet_field_spacer_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'),
|
||||
@ -76,7 +76,7 @@ define([
|
||||
});
|
||||
|
||||
Module.SpacerWidgetView = base.WidgetView.extend({
|
||||
getTemplate: function() { return templates.spacerInsertion; },
|
||||
getTemplate: function () { return window.templates.spacerInsertion; },
|
||||
behaviors: {
|
||||
DraggableBehavior: {
|
||||
cloneOriginal: true,
|
||||
|
@ -4,8 +4,9 @@
|
||||
define([
|
||||
'newsletter_editor/App',
|
||||
'newsletter_editor/blocks/base',
|
||||
'underscore'
|
||||
], function(App, BaseBlock, _) {
|
||||
'underscore',
|
||||
'mailpoet'
|
||||
], function (App, BaseBlock, _, MailPoet) {
|
||||
|
||||
'use strict';
|
||||
|
||||
@ -23,7 +24,7 @@ define([
|
||||
|
||||
Module.TextBlockView = base.BlockView.extend({
|
||||
className: 'mailpoet_block mailpoet_text_block mailpoet_droppable_block',
|
||||
getTemplate: function() { return templates.textBlock; },
|
||||
getTemplate: function () { return window.templates.textBlock; },
|
||||
modelEvents: _.omit(base.BlockView.prototype.modelEvents, 'change'), // Prevent rerendering on model change due to text editor redrawing
|
||||
behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
|
||||
TextEditorBehavior: {
|
||||
@ -78,11 +79,11 @@ define([
|
||||
});
|
||||
|
||||
Module.TextBlockSettingsView = base.BlockSettingsView.extend({
|
||||
getTemplate: function() { return templates.textBlockSettings; }
|
||||
getTemplate: function () { return window.templates.textBlockSettings; }
|
||||
});
|
||||
|
||||
Module.TextWidgetView = base.WidgetView.extend({
|
||||
getTemplate: function() { return templates.textInsertion; },
|
||||
getTemplate: function () { return window.templates.textInsertion; },
|
||||
behaviors: {
|
||||
DraggableBehavior: {
|
||||
cloneOriginal: true,
|
||||
|
@ -3,15 +3,16 @@ define([
|
||||
'backbone',
|
||||
'backbone.marionette',
|
||||
'underscore',
|
||||
'jquery'
|
||||
], function(App, Backbone, Marionette, _, jQuery) {
|
||||
'jquery',
|
||||
'mailpoet'
|
||||
], function (App, Backbone, Marionette, _, jQuery, MailPoet) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var Module = {};
|
||||
|
||||
Module.HeadingView = Marionette.View.extend({
|
||||
getTemplate: function() { return templates.heading; },
|
||||
getTemplate: function () { return window.templates.heading; },
|
||||
templateContext: function () {
|
||||
return {
|
||||
model: this.model.toJSON()
|
||||
|
@ -8,7 +8,9 @@ define([
|
||||
'jquery',
|
||||
'blob',
|
||||
'file-saver',
|
||||
'html2canvas'
|
||||
'html2canvas',
|
||||
'underscore',
|
||||
'jquery'
|
||||
], function (
|
||||
App,
|
||||
CommunicationComponent,
|
||||
@ -19,7 +21,9 @@ define([
|
||||
jQuery,
|
||||
Blob,
|
||||
FileSaver,
|
||||
html2canvas
|
||||
html2canvas,
|
||||
_,
|
||||
$
|
||||
) {
|
||||
|
||||
'use strict';
|
||||
@ -139,7 +143,7 @@ define([
|
||||
};
|
||||
|
||||
Module.SaveView = Marionette.View.extend({
|
||||
getTemplate: function() { return templates.save; },
|
||||
getTemplate: function () { return window.templates.save; },
|
||||
events: {
|
||||
'click .mailpoet_save_button': 'save',
|
||||
'click .mailpoet_save_show_options': 'toggleSaveOptions',
|
||||
|
@ -53,7 +53,7 @@ define([
|
||||
Module.getLayoutWidgets = function () { return Module._layoutWidgets; };
|
||||
|
||||
var SidebarView = Marionette.View.extend({
|
||||
getTemplate: function() { return templates.sidebar; },
|
||||
getTemplate: function () { return window.templates.sidebar; },
|
||||
regions: {
|
||||
contentRegion: '.mailpoet_content_region',
|
||||
layoutRegion: '.mailpoet_layout_region',
|
||||
@ -147,7 +147,7 @@ define([
|
||||
* Responsible for rendering draggable content widgets
|
||||
*/
|
||||
Module.SidebarWidgetsView = Marionette.View.extend({
|
||||
getTemplate: function() { return templates.sidebarContent; },
|
||||
getTemplate: function () { return window.templates.sidebarContent; },
|
||||
regions: {
|
||||
widgets: '.mailpoet_region_content'
|
||||
},
|
||||
@ -167,14 +167,14 @@ define([
|
||||
* Responsible for rendering draggable layout widgets
|
||||
*/
|
||||
Module.SidebarLayoutWidgetsView = Module.SidebarWidgetsView.extend({
|
||||
getTemplate: function() { return templates.sidebarLayout; }
|
||||
getTemplate: function () { return window.templates.sidebarLayout; }
|
||||
});
|
||||
|
||||
/**
|
||||
* Responsible for managing global styles
|
||||
*/
|
||||
Module.SidebarStylesView = Marionette.View.extend({
|
||||
getTemplate: function() { return templates.sidebarStyles; },
|
||||
getTemplate: function () { return window.templates.sidebarStyles; },
|
||||
behaviors: {
|
||||
ColorPickerBehavior: {}
|
||||
},
|
||||
@ -238,7 +238,7 @@ define([
|
||||
});
|
||||
|
||||
Module.SidebarPreviewView = Marionette.View.extend({
|
||||
getTemplate: function() { return templates.sidebarPreview; },
|
||||
getTemplate: function () { return window.templates.sidebarPreview; },
|
||||
events: {
|
||||
'click .mailpoet_show_preview': 'showPreview',
|
||||
'click #mailpoet_send_preview': 'sendPreview'
|
||||
@ -346,7 +346,7 @@ define([
|
||||
});
|
||||
|
||||
Module.NewsletterPreviewView = Marionette.View.extend({
|
||||
getTemplate: function() { return templates.newsletterPreview; },
|
||||
getTemplate: function () { return window.templates.newsletterPreview; },
|
||||
initialize: function (options) {
|
||||
this.previewUrl = options.previewUrl;
|
||||
this.width = '100%';
|
||||
|
@ -1,8 +1,9 @@
|
||||
define([
|
||||
'newsletter_editor/App',
|
||||
'backbone.marionette',
|
||||
'backbone.supermodel'
|
||||
], function(App, Marionette, SuperModel) {
|
||||
'backbone.supermodel',
|
||||
'underscore'
|
||||
], function (App, Marionette, SuperModel, _) {
|
||||
|
||||
'use strict';
|
||||
|
||||
@ -47,7 +48,7 @@ define([
|
||||
});
|
||||
|
||||
Module.StylesView = Marionette.View.extend({
|
||||
getTemplate: function() { return templates.styles; },
|
||||
getTemplate: function () { return window.templates.styles; },
|
||||
modelEvents: {
|
||||
change: 'render'
|
||||
},
|
||||
|
@ -1,27 +0,0 @@
|
||||
/**
|
||||
* A sample implementation of template widgets.
|
||||
* A draggable widget, on drop creates a container with (image|text) block.
|
||||
*/
|
||||
ImageAndTextTemplateWidgetView = EditorApplication.module('blocks.base').WidgetView.extend({
|
||||
getTemplate: function() { return templates.imageAndTextInsertion; },
|
||||
className: 'mailpoet_droppable_block mailpoet_droppable_widget',
|
||||
behaviors: {
|
||||
DraggableBehavior: {
|
||||
drop: function() {
|
||||
return new (EditorApplication.getBlockTypeModel('container'))({
|
||||
type: 'container',
|
||||
orientation: 'horizontal',
|
||||
blocks: [
|
||||
{
|
||||
type: 'image'
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
text: 'Some random text'
|
||||
}
|
||||
]
|
||||
}, {parse: true});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
@ -185,7 +185,7 @@ const NewsletterListNotification = React.createClass({
|
||||
return (
|
||||
<select
|
||||
data-id={newsletter.id}
|
||||
defaultValue={ newsletter.status }
|
||||
defaultValue={newsletter.status}
|
||||
onChange={this.updateStatus}
|
||||
>
|
||||
<option value="active">{ MailPoet.I18n.t('active') }</option>
|
||||
@ -317,7 +317,7 @@ const NewsletterListNotification = React.createClass({
|
||||
<ListingTabs tab="notification" />
|
||||
|
||||
<Listing
|
||||
limit={ mailpoet_listing_per_page }
|
||||
limit={window.mailpoet_listing_per_page}
|
||||
location={this.props.location}
|
||||
params={this.props.params}
|
||||
endpoint="newsletters"
|
||||
|
@ -110,7 +110,7 @@ const NewsletterListNotificationHistory = React.createClass({
|
||||
>{MailPoet.I18n.t('backToPostNotifications')}</Link>
|
||||
|
||||
<Listing
|
||||
limit={ mailpoet_listing_per_page }
|
||||
limit={window.mailpoet_listing_per_page}
|
||||
location={this.props.location}
|
||||
params={this.props.params}
|
||||
endpoint="newsletters"
|
||||
|
@ -218,7 +218,7 @@ const NewsletterListStandard = React.createClass({
|
||||
<ListingTabs tab="standard" />
|
||||
|
||||
<Listing
|
||||
limit={ mailpoet_listing_per_page }
|
||||
limit={window.mailpoet_listing_per_page}
|
||||
location={this.props.location}
|
||||
params={this.props.params}
|
||||
endpoint="newsletters"
|
||||
|
@ -165,7 +165,7 @@ const NewsletterListWelcome = React.createClass({
|
||||
<p>
|
||||
<select
|
||||
data-id={newsletter.id}
|
||||
defaultValue={ newsletter.status }
|
||||
defaultValue={newsletter.status}
|
||||
onChange={this.updateStatus}
|
||||
>
|
||||
<option value="active">{ MailPoet.I18n.t('active') }</option>
|
||||
@ -295,7 +295,7 @@ const NewsletterListWelcome = React.createClass({
|
||||
<ListingTabs tab="welcome" />
|
||||
|
||||
<Listing
|
||||
limit={ mailpoet_listing_per_page }
|
||||
limit={window.mailpoet_listing_per_page}
|
||||
location={this.props.location}
|
||||
params={this.props.params}
|
||||
endpoint="newsletters"
|
||||
|
@ -10,6 +10,7 @@ define(
|
||||
'newsletters/send/welcome.jsx',
|
||||
'newsletters/breadcrumb.jsx',
|
||||
'help-tooltip.jsx',
|
||||
'jquery',
|
||||
],
|
||||
(
|
||||
React,
|
||||
@ -21,7 +22,8 @@ define(
|
||||
NotificationNewsletterFields,
|
||||
WelcomeNewsletterFields,
|
||||
Breadcrumb,
|
||||
HelpTooltip
|
||||
HelpTooltip,
|
||||
jQuery
|
||||
) => {
|
||||
|
||||
const NewsletterSend = React.createClass({
|
||||
@ -283,6 +285,7 @@ define(
|
||||
}
|
||||
return newField;
|
||||
});
|
||||
const sendButtonOptions = this.getSendButtonOptions();
|
||||
return (
|
||||
<div>
|
||||
<h1>{MailPoet.I18n.t('finalNewsletterStep')}</h1>
|
||||
@ -311,7 +314,7 @@ define(
|
||||
type="button"
|
||||
onClick={this.handleSend}
|
||||
value={MailPoet.I18n.t('send')}
|
||||
{...this.getSendButtonOptions()}
|
||||
{...sendButtonOptions}
|
||||
/>
|
||||
}
|
||||
|
||||
@ -328,10 +331,12 @@ define(
|
||||
{MailPoet.I18n.t('goBackToDesign')}
|
||||
</a>.
|
||||
</p>
|
||||
{ !isPaused && sendButtonOptions['disabled'] && sendButtonOptions['disabled'] === 'disabled' && (
|
||||
<HelpTooltip
|
||||
tooltip={MailPoet.I18n.t('helpTooltipSendEmail')}
|
||||
tooltipId="helpTooltipSendEmail"
|
||||
/>
|
||||
) }
|
||||
</Form>
|
||||
</div>
|
||||
);
|
||||
|
@ -33,13 +33,13 @@ function(
|
||||
form.parsley().on('form:submit', function (parsley) {
|
||||
var form_data = form.serializeObject() || {};
|
||||
// check if we're on the same domain
|
||||
if(isSameDomain(MailPoetForm.ajax_url) === false) {
|
||||
if (isSameDomain(window.MailPoetForm.ajax_url) === false) {
|
||||
// non ajax post request
|
||||
return true;
|
||||
} else {
|
||||
// ajax request
|
||||
MailPoet.Ajax.post({
|
||||
url: MailPoetForm.ajax_url,
|
||||
url: window.MailPoetForm.ajax_url,
|
||||
token: form_data.token,
|
||||
api_version: form_data.api_version,
|
||||
endpoint: 'subscribers',
|
||||
|
@ -210,7 +210,7 @@ const SegmentList = React.createClass({
|
||||
if (segment.type === 'wp_users') {
|
||||
// the WP users segment is not editable so just display its name
|
||||
segment_name = (
|
||||
<span className="row-title">{ segment.name }</span>
|
||||
<span className="row-title">{ segment.name }</span>
|
||||
);
|
||||
} else {
|
||||
segment_name = (
|
||||
@ -258,7 +258,7 @@ const SegmentList = React.createClass({
|
||||
</h1>
|
||||
|
||||
<Listing
|
||||
limit={ mailpoet_listing_per_page }
|
||||
limit={window.mailpoet_listing_per_page}
|
||||
location={this.props.location}
|
||||
params={this.props.params}
|
||||
messages={messages}
|
||||
|
@ -107,7 +107,7 @@ define(
|
||||
},
|
||||
];
|
||||
|
||||
const custom_fields = window.mailpoet_custom_fields || [];
|
||||
const custom_fields = window.mailpoet_custom_fields || [];
|
||||
custom_fields.map((custom_field) => {
|
||||
const field = {
|
||||
name: 'cf_' + custom_field.id,
|
||||
|
@ -17,14 +17,14 @@ define(
|
||||
return;
|
||||
}
|
||||
jQuery(document).ready(function () {
|
||||
if (!exportData.segments) {
|
||||
if (!window.exportData.segments) {
|
||||
return;
|
||||
}
|
||||
var subscribers_export_template =
|
||||
Handlebars.compile(jQuery('#mailpoet_subscribers_export_template').html());
|
||||
|
||||
// render template
|
||||
jQuery('#mailpoet_subscribers_export > div.inside').html(subscribers_export_template(exportData));
|
||||
jQuery('#mailpoet_subscribers_export > div.inside').html(subscribers_export_template(window.exportData));
|
||||
|
||||
// define reusable variables
|
||||
var segmentsContainerElement = jQuery('#export_lists'),
|
||||
@ -77,9 +77,9 @@ define(
|
||||
}
|
||||
})
|
||||
.on('change', function () {
|
||||
if ((exportData.segments && segmentsContainerElement.select2('data').length && subscriberFieldsContainerElement.select2('data').length)
|
||||
if ((window.exportData.segments && segmentsContainerElement.select2('data').length && subscriberFieldsContainerElement.select2('data').length)
|
||||
||
|
||||
(!exportData.segments && subscriberFieldsContainerElement.select2('data').length)
|
||||
(!window.exportData.segments && subscriberFieldsContainerElement.select2('data').length)
|
||||
) {
|
||||
toggleNextStepButton('on');
|
||||
}
|
||||
@ -87,20 +87,20 @@ define(
|
||||
toggleNextStepButton('off');
|
||||
}
|
||||
|
||||
if (segmentsContainerElement.select2('data').length > 1 && exportData.groupBySegmentOption) {
|
||||
if (segmentsContainerElement.select2('data').length > 1 && window.exportData.groupBySegmentOption) {
|
||||
jQuery('.mailpoet_group_by_list').show();
|
||||
}
|
||||
else if (exportData.groupBySegmentOption) {
|
||||
else if (window.exportData.groupBySegmentOption) {
|
||||
jQuery('.mailpoet_group_by_list').hide();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// set confirmed subscribers export option to false
|
||||
exportData.exportConfirmedOption = false;
|
||||
window.exportData.exportConfirmedOption = false;
|
||||
|
||||
renderSegmentsAndFields(subscriberFieldsContainerElement, subscriberFieldsSelect2);
|
||||
renderSegmentsAndFields(segmentsContainerElement, segments);
|
||||
renderSegmentsAndFields(subscriberFieldsContainerElement, window.subscriberFieldsSelect2);
|
||||
renderSegmentsAndFields(segmentsContainerElement, window.segments);
|
||||
|
||||
subscriberFieldsContainerElement.val([
|
||||
'email',
|
||||
@ -112,12 +112,12 @@ define(
|
||||
exportConfirmedOptionElement.change(function () {
|
||||
var selectedSegments = segmentsContainerElement.val();
|
||||
if (this.value == 1) {
|
||||
exportData.exportConfirmedOption = true;
|
||||
renderSegmentsAndFields(segmentsContainerElement, segmentsWithConfirmedSubscribers);
|
||||
window.exportData.exportConfirmedOption = true;
|
||||
renderSegmentsAndFields(segmentsContainerElement, window.segmentsWithConfirmedSubscribers);
|
||||
}
|
||||
else {
|
||||
exportData.exportConfirmedOption = false;
|
||||
renderSegmentsAndFields(segmentsContainerElement, segments);
|
||||
window.exportData.exportConfirmedOption = false;
|
||||
renderSegmentsAndFields(segmentsContainerElement, window.segments);
|
||||
}
|
||||
segmentsContainerElement.val(selectedSegments).trigger('change');
|
||||
});
|
||||
@ -143,16 +143,16 @@ define(
|
||||
endpoint: 'ImportExport',
|
||||
action: 'processExport',
|
||||
data: JSON.stringify({
|
||||
export_confirmed_option: exportData.exportConfirmedOption,
|
||||
export_confirmed_option: window.exportData.exportConfirmedOption,
|
||||
export_format_option: exportFormat,
|
||||
group_by_segment_option: (groupBySegmentOptionElement.is(':visible')) ? groupBySegmentOptionElement.prop('checked') : false,
|
||||
segments: (exportData.segments) ? segmentsContainerElement.val() : false,
|
||||
segments: (window.exportData.segments) ? segmentsContainerElement.val() : false,
|
||||
subscriber_fields: subscriberFieldsContainerElement.val()
|
||||
})
|
||||
}).always(function (response) {
|
||||
MailPoet.Modal.loading(false);
|
||||
}).done(function (response) {
|
||||
resultMessage = MailPoet.I18n.t('exportMessage')
|
||||
var resultMessage = MailPoet.I18n.t('exportMessage')
|
||||
.replace('%1$s', '<strong>' + parseInt(response.data.totalExported).toLocaleString() + '</strong>')
|
||||
.replace('[link]', '<a href="' + response.data.exportFileURL + '" target="_blank" >')
|
||||
.replace('[/link]', '</a>');
|
||||
@ -160,7 +160,7 @@ define(
|
||||
window.location.href = response.data.exportFileURL;
|
||||
MailPoet.trackEvent('Subscribers export completed', {
|
||||
'Total exported': response.data.totalExported,
|
||||
'Only confirmed?': exportData.exportConfirmedOption,
|
||||
'Only confirmed?': window.exportData.exportConfirmedOption,
|
||||
'File Format': exportFormat,
|
||||
'MailPoet Free version': window.mailpoet_version
|
||||
});
|
||||
|
@ -27,7 +27,7 @@ define(
|
||||
jQuery(document).ready(function () {
|
||||
jQuery('input[name="select_method"]').attr('checked', false);
|
||||
// configure router
|
||||
router = new (Backbone.Router.extend({
|
||||
var router = new (Backbone.Router.extend({
|
||||
routes: {
|
||||
'': 'home',
|
||||
step1: 'step1',
|
||||
@ -51,13 +51,13 @@ define(
|
||||
*/
|
||||
router.on('route:step1', function () {
|
||||
// set or reset temporary validation rule on all columns
|
||||
mailpoetColumns = jQuery.map(mailpoetColumns, function (column, columnIndex) {
|
||||
window.mailpoetColumns = jQuery.map(window.mailpoetColumns, function (column, columnIndex) {
|
||||
var col = column;
|
||||
col.validation_rule = false;
|
||||
return col;
|
||||
});
|
||||
|
||||
if (typeof (importData.step1) !== 'undefined') {
|
||||
if (typeof (window.importData.step1) !== 'undefined') {
|
||||
showCurrentStep();
|
||||
return;
|
||||
}
|
||||
@ -134,7 +134,7 @@ define(
|
||||
MailPoet.Notice.hide();
|
||||
// get an approximate size of textarea paste in bytes
|
||||
var pasteSize = encodeURI(pasteInputElement.val()).split(/%..|./).length - 1;
|
||||
if (pasteSize > maxPostSizeBytes) {
|
||||
if (pasteSize > window.maxPostSizeBytes) {
|
||||
MailPoet.Notice.error(MailPoet.I18n.t('maxPostSizeNotice'));
|
||||
return;
|
||||
}
|
||||
@ -237,7 +237,7 @@ define(
|
||||
}).always(function (response) {
|
||||
MailPoet.Modal.loading(false);
|
||||
}).done(function (response) {
|
||||
importData.step1 = response.data;
|
||||
window.importData.step1 = response.data;
|
||||
MailPoet.trackEvent('Subscribers import started', {
|
||||
source: 'MailChimp',
|
||||
'MailPoet Free version': window.mailpoet_version
|
||||
@ -368,7 +368,7 @@ define(
|
||||
for (var column in rowData) {
|
||||
var email = detectAndCleanupEmail(rowData[column]);
|
||||
if (emailColumnPosition === null
|
||||
&& emailRegex.test(email)) {
|
||||
&& window.emailRegex.test(email)) {
|
||||
emailColumnPosition = column;
|
||||
parsedEmails[email] = true; // add current e-mail to an object index
|
||||
rowData[column] = email;
|
||||
@ -387,7 +387,7 @@ define(
|
||||
if (_.has(parsedEmails, email)) {
|
||||
duplicateEmails.push(email);
|
||||
}
|
||||
else if (!emailRegex.test(email)) {
|
||||
else if (!window.emailRegex.test(email)) {
|
||||
invalidEmails.push(rowData[emailColumnPosition]);
|
||||
}
|
||||
// if we haven't yet processed this e-mail and it passed
|
||||
@ -410,8 +410,8 @@ define(
|
||||
) {
|
||||
// since we assume that the header line is always present, we need
|
||||
// to detect the header by checking if it contains a valid e-mail address
|
||||
importData.step1 = {
|
||||
header: (!emailRegex.test(
|
||||
window.importData.step1 = {
|
||||
header: (!window.emailRegex.test(
|
||||
processedSubscribers[0][emailColumnPosition])
|
||||
) ? processedSubscribers.shift() : null,
|
||||
subscribers: processedSubscribers,
|
||||
@ -438,7 +438,7 @@ define(
|
||||
});
|
||||
|
||||
router.on('route:step2', function () {
|
||||
if (typeof (importData.step1) === 'undefined') {
|
||||
if (typeof (window.importData.step1) === 'undefined') {
|
||||
router.navigate('step1', { trigger: true });
|
||||
return;
|
||||
}
|
||||
@ -446,7 +446,7 @@ define(
|
||||
var nextStepButton = jQuery('#step2_process'),
|
||||
previousStepButton = jQuery('#return_to_step1'),
|
||||
// create a copy of subscribers object for further manipulation
|
||||
subscribers = jQuery.extend(true, {}, importData.step1),
|
||||
subscribers = jQuery.extend(true, {}, window.importData.step1),
|
||||
subscribersDataTemplate =
|
||||
Handlebars
|
||||
.compile(jQuery('#subscribers_data_template')
|
||||
@ -526,7 +526,7 @@ define(
|
||||
});
|
||||
|
||||
// show available segments
|
||||
if (mailpoetSegments.length) {
|
||||
if (window.mailpoetSegments.length) {
|
||||
jQuery('.mailpoet_segments').show();
|
||||
}
|
||||
else {
|
||||
@ -599,7 +599,7 @@ define(
|
||||
description: segmentDescription
|
||||
}
|
||||
}).done(function (response) {
|
||||
mailpoetSegments.push({
|
||||
window.mailpoetSegments.push({
|
||||
id: response.data.id,
|
||||
name: response.data.name,
|
||||
subscriberCount: 0
|
||||
@ -612,7 +612,7 @@ define(
|
||||
selected_values.push(response.data.id);
|
||||
}
|
||||
|
||||
enableSegmentSelection(mailpoetSegments);
|
||||
enableSegmentSelection(window.mailpoetSegments);
|
||||
segmentSelectElement.val(selected_values).trigger('change');
|
||||
jQuery('.mailpoet_segments:hidden').show();
|
||||
jQuery('.mailpoet_no_segments:visible').hide();
|
||||
@ -649,16 +649,16 @@ define(
|
||||
var columnData = subscribers.subscribers[0][i],
|
||||
columnId = 'ignore'; // set default column type
|
||||
// if the column is not undefined and has a valid e-mail, set type as email
|
||||
if (columnData % 1 !== 0 && emailRegex.test(columnData)) {
|
||||
if (columnData % 1 !== 0 && window.emailRegex.test(columnData)) {
|
||||
columnId = 'email';
|
||||
} else if (subscribers.header) {
|
||||
var headerName = subscribers.header[i],
|
||||
headerNameMatch = mailpoetColumns.map(function (el) {
|
||||
headerNameMatch = window.mailpoetColumns.map(function (el) {
|
||||
return el.name;
|
||||
}).indexOf(headerName);
|
||||
// set column type using header
|
||||
if (headerNameMatch !== -1) {
|
||||
columnId = mailpoetColumns[headerNameMatch].id;
|
||||
columnId = window.mailpoetColumns[headerNameMatch].id;
|
||||
}// set column type using header name
|
||||
else if (headerName) {
|
||||
if (/first|first name|given name/i.test(headerName)) {
|
||||
@ -723,7 +723,7 @@ define(
|
||||
// filter displayed data
|
||||
jQuery('select.mailpoet_subscribers_column_data_match')
|
||||
.select2({
|
||||
data: mailpoetColumnsSelect2,
|
||||
data: window.mailpoetColumnsSelect2,
|
||||
width: '15em',
|
||||
templateResult: function (item) {
|
||||
return item.name;
|
||||
@ -762,21 +762,21 @@ define(
|
||||
custom: true
|
||||
};
|
||||
// if this is the first custom column, create an "optgroup"
|
||||
if (mailpoetColumnsSelect2.length === 2) {
|
||||
mailpoetColumnsSelect2.push({
|
||||
if (window.mailpoetColumnsSelect2.length === 2) {
|
||||
window.mailpoetColumnsSelect2.push({
|
||||
name: MailPoet.I18n.t('userColumns'),
|
||||
children: []
|
||||
});
|
||||
}
|
||||
mailpoetColumnsSelect2[2].children.push(new_column_data);
|
||||
mailpoetColumns.push(new_column_data);
|
||||
window.mailpoetColumnsSelect2[2].children.push(new_column_data);
|
||||
window.mailpoetColumns.push(new_column_data);
|
||||
jQuery('select.mailpoet_subscribers_column_data_match')
|
||||
.each(function () {
|
||||
jQuery(this)
|
||||
.html('')
|
||||
.select2('destroy')
|
||||
.select2({
|
||||
data: mailpoetColumnsSelect2,
|
||||
data: window.mailpoetColumnsSelect2,
|
||||
width: '15em',
|
||||
templateResult: function (item) {
|
||||
return item.name;
|
||||
@ -845,14 +845,14 @@ define(
|
||||
return { id: columnId, index: elementIndex, validationRule: validationRule, element: element };
|
||||
});
|
||||
// iterate through the object of mailpoet columns
|
||||
jQuery.map(mailpoetColumns, function (column, columnIndex) {
|
||||
jQuery.map(window.mailpoetColumns, function (column, columnIndex) {
|
||||
// check if the column id matches the selected id of one of the
|
||||
// subscriber's data columns
|
||||
var matchedColumn = _.find(displayedColumns, function (data) { return data.id === column.id; });
|
||||
// EMAIL filter: if the first value in the column doesn't have a valid
|
||||
// email, hide the next button
|
||||
if (column.id === 'email') {
|
||||
if (!emailRegex.test(subscribersClone.subscribers[0][matchedColumn.index])) {
|
||||
if (!window.emailRegex.test(subscribersClone.subscribers[0][matchedColumn.index])) {
|
||||
preventNextStep = true;
|
||||
if (!jQuery('[data-id="notice_invalidEmail"]').length) {
|
||||
MailPoet.Notice.error(MailPoet.I18n.t('columnContainsInvalidElement'), {
|
||||
@ -996,7 +996,7 @@ define(
|
||||
return res;
|
||||
}, []);
|
||||
},
|
||||
subscribers = splitSubscribers(importData.step1.subscribers, batchSize);
|
||||
subscribers = splitSubscribers(window.importData.step1.subscribers, batchSize);
|
||||
|
||||
_.each(jQuery('select.mailpoet_subscribers_column_data_match'),
|
||||
function (column, columnIndex) {
|
||||
@ -1020,7 +1020,7 @@ define(
|
||||
subscribers: subscribers[batchNumber],
|
||||
timestamp: timestamp,
|
||||
segments: segmentSelectElement.val(),
|
||||
updateSubscribers: (jQuery(':radio[name="subscriber_update_option"]:checked').val() === 'yes') ? true : false
|
||||
updateSubscribers: (jQuery(':radio[name="subscriber_update_option"]:checked').val() === 'yes')
|
||||
})
|
||||
}).done(function (response) {
|
||||
importResults.created += response.data.created;
|
||||
@ -1050,37 +1050,37 @@ define(
|
||||
);
|
||||
}
|
||||
else {
|
||||
mailpoetSegments = importResults.segments;
|
||||
window.mailpoetSegments = importResults.segments;
|
||||
importResults.segments = _.map(segmentSelectElement.select2('data'),
|
||||
function (data) {
|
||||
return data.name;
|
||||
});
|
||||
importData.step2 = importResults;
|
||||
enableSegmentSelection(mailpoetSegments);
|
||||
window.importData.step2 = importResults;
|
||||
enableSegmentSelection(window.mailpoetSegments);
|
||||
router.navigate('step3', { trigger: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
filterSubscribers();
|
||||
enableSegmentSelection(mailpoetSegments);
|
||||
enableSegmentSelection(window.mailpoetSegments);
|
||||
});
|
||||
|
||||
router.on('route:step3', function () {
|
||||
if (typeof (importData.step2) === 'undefined') {
|
||||
if (typeof (window.importData.step2) === 'undefined') {
|
||||
router.navigate('step2', { trigger: true });
|
||||
return;
|
||||
}
|
||||
|
||||
showCurrentStep();
|
||||
|
||||
if (importData.step2.errors.length > 0) {
|
||||
MailPoet.Notice.error(_.flatten(importData.step2.errors));
|
||||
if (window.importData.step2.errors.length > 0) {
|
||||
MailPoet.Notice.error(_.flatten(window.importData.step2.errors));
|
||||
}
|
||||
|
||||
MailPoet.trackEvent('Subscribers import finished', {
|
||||
'Subscribers created': importData.step2.created,
|
||||
'Subscribers updated': importData.step2.updated,
|
||||
'Subscribers created': window.importData.step2.created,
|
||||
'Subscribers updated': window.importData.step2.updated,
|
||||
'MailPoet Free version': window.mailpoet_version
|
||||
});
|
||||
|
||||
@ -1091,18 +1091,18 @@ define(
|
||||
.html()),
|
||||
exportMenuElement = jQuery('span.mailpoet_export'),
|
||||
importResults = {
|
||||
created: (importData.step2.created)
|
||||
created: (window.importData.step2.created)
|
||||
? MailPoet.I18n.t('subscribersCreated')
|
||||
.replace('%1$s', '<strong>' + importData.step2.created.toLocaleString() + '</strong>')
|
||||
.replace('%2$s', '"' + importData.step2.segments.join('", "') + '"')
|
||||
.replace('%1$s', '<strong>' + window.importData.step2.created.toLocaleString() + '</strong>')
|
||||
.replace('%2$s', '"' + window.importData.step2.segments.join('", "') + '"')
|
||||
: false,
|
||||
updated: (importData.step2.updated)
|
||||
updated: (window.importData.step2.updated)
|
||||
? MailPoet.I18n.t('subscribersUpdated')
|
||||
.replace('%1$s', '<strong>' + importData.step2.updated.toLocaleString() + '</strong>')
|
||||
.replace('%2$s', '"' + importData.step2.segments.join('", "') + '"')
|
||||
.replace('%1$s', '<strong>' + window.importData.step2.updated.toLocaleString() + '</strong>')
|
||||
.replace('%2$s', '"' + window.importData.step2.segments.join('", "') + '"')
|
||||
: false,
|
||||
no_action: (!importData.step2.created && !importData.step2.updated),
|
||||
added_to_segment_with_welcome_notification: importData.step2.added_to_segment_with_welcome_notification
|
||||
no_action: (!window.importData.step2.created && !window.importData.step2.updated),
|
||||
added_to_segment_with_welcome_notification: window.importData.step2.added_to_segment_with_welcome_notification
|
||||
};
|
||||
|
||||
jQuery('#subscribers_data_import_results')
|
||||
@ -1125,7 +1125,7 @@ define(
|
||||
}
|
||||
|
||||
// reset previous step's data so that coming back to this step is prevented
|
||||
importData.step2 = undefined;
|
||||
window.importData.step2 = undefined;
|
||||
});
|
||||
|
||||
if (!Backbone.History.started) {
|
||||
|
@ -83,7 +83,7 @@ const messages = {
|
||||
MailPoet.Notice.success(message);
|
||||
},
|
||||
onNoItemsFound: (group) => {
|
||||
if (group === 'bounced' && !mailpoet_premium_active) {
|
||||
if (group === 'bounced' && !window.mailpoet_premium_active) {
|
||||
return (
|
||||
<div>
|
||||
<p>{MailPoet.I18n.t('bouncedSubscribersHelp')}</p>
|
||||
@ -245,7 +245,7 @@ const item_actions = [
|
||||
const SubscriberList = React.createClass({
|
||||
getSegmentFromId: function (segment_id) {
|
||||
let result = false;
|
||||
mailpoet_segments.map((segment) => {
|
||||
window.mailpoet_segments.map((segment) => {
|
||||
if (segment.id === segment_id) {
|
||||
result = segment;
|
||||
}
|
||||
@ -350,7 +350,7 @@ const SubscriberList = React.createClass({
|
||||
</h1>
|
||||
|
||||
<Listing
|
||||
limit={ mailpoet_listing_per_page }
|
||||
limit={window.mailpoet_listing_per_page}
|
||||
location={this.props.location}
|
||||
params={this.props.params}
|
||||
endpoint="subscribers"
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace MailPoet\API\JSON;
|
||||
|
||||
if(!defined('ABSPATH')) exit;
|
||||
@ -12,23 +13,19 @@ class ErrorResponse extends Response {
|
||||
}
|
||||
|
||||
function getData() {
|
||||
if(empty($this->errors)) {
|
||||
return null;
|
||||
} else {
|
||||
return array(
|
||||
'errors' => $this->errors
|
||||
);
|
||||
}
|
||||
return (empty($this->errors)) ? null : array('errors' => $this->errors);
|
||||
}
|
||||
|
||||
function formatErrors($errors = array()) {
|
||||
$formatted_errors = array();
|
||||
foreach($errors as $error => $message) {
|
||||
$formatted_errors[] = array(
|
||||
return array_map(function($error, $message) {
|
||||
// sanitize SQL error
|
||||
if(preg_match('/^SQLSTATE/i', $message)) {
|
||||
$message = __('An unknown error occurred.', 'mailpoet');
|
||||
}
|
||||
return array(
|
||||
'error' => $error,
|
||||
'message' => $message
|
||||
);
|
||||
}
|
||||
return $formatted_errors;
|
||||
}, array_keys($errors), array_values($errors));
|
||||
}
|
||||
}
|
@ -20,13 +20,14 @@ class AutomatedLatestContent extends APIEndpoint {
|
||||
|
||||
function getPostTypes() {
|
||||
$post_types = array_map(function($post_type) {
|
||||
if(!empty($post_type->exclude_from_search)) return;
|
||||
return array(
|
||||
'name' => $post_type->name,
|
||||
'label' => $post_type->label
|
||||
);
|
||||
}, get_post_types(array(), 'objects'));
|
||||
return $this->successResponse(
|
||||
$post_types
|
||||
array_filter($post_types)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ class NewsletterTemplates extends APIEndpoint {
|
||||
}
|
||||
|
||||
function getAll() {
|
||||
$collection = NewsletterTemplate::findMany();
|
||||
$collection = NewsletterTemplate::orderByDesc('created_at')->orderByAsc('name')->findMany();
|
||||
$templates = array_map(function($item) {
|
||||
return $item->asArray();
|
||||
}, $collection);
|
||||
|
@ -65,13 +65,11 @@ class Newsletters extends APIEndpoint {
|
||||
$newsletter = Newsletter::createOrUpdate($data);
|
||||
$errors = $newsletter->getErrors();
|
||||
|
||||
if(!empty($errors)) {
|
||||
return $this->badRequest($errors);
|
||||
} else {
|
||||
if(!empty($errors)) return $this->badRequest($errors);
|
||||
|
||||
if(!empty($segments)) {
|
||||
NewsletterSegment::where('newsletter_id', $newsletter->id)
|
||||
->deleteMany();
|
||||
|
||||
foreach($segments as $segment) {
|
||||
if(!is_array($segment)) continue;
|
||||
$relation = NewsletterSegment::create();
|
||||
@ -86,7 +84,6 @@ class Newsletters extends APIEndpoint {
|
||||
'newsletter_type',
|
||||
$newsletter->type
|
||||
)->findMany();
|
||||
|
||||
// update newsletter options
|
||||
foreach($option_fields as $option_field) {
|
||||
if(isset($options[$option_field->name])) {
|
||||
@ -99,11 +96,9 @@ class Newsletters extends APIEndpoint {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// reload newsletter with updated options
|
||||
$newsletter = Newsletter::filter('filterWithOptions')
|
||||
->findOne($newsletter->id);
|
||||
|
||||
// if this is a post notification, process newsletter options and update its schedule
|
||||
if($newsletter->type === Newsletter::TYPE_NOTIFICATION) {
|
||||
// generate the new schedule from options and get the new "next run" date
|
||||
@ -120,16 +115,22 @@ class Newsletters extends APIEndpoint {
|
||||
|
||||
$queue = $newsletter->getQueue();
|
||||
if($queue) {
|
||||
// if newsletter was previously scheduled and is now unscheduled, set its status to DRAFT and delete associated queue record
|
||||
if($newsletter->status === Newsletter::STATUS_SCHEDULED && isset($options['isScheduled']) && empty($options['isScheduled'])) {
|
||||
$queue->delete();
|
||||
$newsletter->status = Newsletter::STATUS_DRAFT;
|
||||
$newsletter->save();
|
||||
} else {
|
||||
$queue->newsletter_rendered_body = null;
|
||||
$queue->newsletter_rendered_subject = null;
|
||||
$queue->save();
|
||||
}
|
||||
}
|
||||
|
||||
Hooks::doAction('mailpoet_api_newsletters_save_after', $newsletter);
|
||||
|
||||
return $this->successResponse($newsletter->asArray());
|
||||
}
|
||||
}
|
||||
|
||||
function setStatus($data = array()) {
|
||||
$status = (isset($data['status']) ? $data['status'] : null);
|
||||
|
@ -10,10 +10,13 @@ use MailPoet\Form\Util\FieldNameObfuscator;
|
||||
use MailPoet\Models\Form;
|
||||
use MailPoet\Models\StatisticsForms;
|
||||
use MailPoet\Models\Subscriber;
|
||||
use MailPoet\Util\Helpers;
|
||||
|
||||
if(!defined('ABSPATH')) exit;
|
||||
|
||||
class Subscribers extends APIEndpoint {
|
||||
const SUBSCRIPTION_LIMIT_COOLDOWN = 60;
|
||||
|
||||
public $permissions = array(
|
||||
'global' => AccessControl::PERMISSION_MANAGE_SUBSCRIBERS,
|
||||
'methods' => array('subscribe' => AccessControl::NO_ACCESS_RESTRICTION)
|
||||
@ -94,6 +97,19 @@ class Subscribers extends APIEndpoint {
|
||||
$form_fields = $form->getFieldList();
|
||||
$data = array_intersect_key($data, array_flip($form_fields));
|
||||
|
||||
// make sure we don't allow too many subscriptions with the same ip address
|
||||
$subscription_count = Subscriber::where(
|
||||
'subscribed_ip',
|
||||
Helpers::getIP()
|
||||
)->whereRaw(
|
||||
'(TIME_TO_SEC(TIMEDIFF(NOW(), created_at)) < ? OR TIME_TO_SEC(TIMEDIFF(NOW(), updated_at)) < ?)',
|
||||
array(self::SUBSCRIPTION_LIMIT_COOLDOWN, self::SUBSCRIPTION_LIMIT_COOLDOWN)
|
||||
)->count();
|
||||
|
||||
if($subscription_count > 0) {
|
||||
throw new \Exception(__('You need to wait before subscribing again.', 'mailpoet'));
|
||||
}
|
||||
|
||||
$subscriber = Subscriber::subscribe($data, $segment_ids);
|
||||
$errors = $subscriber->getErrors();
|
||||
|
||||
|
@ -8,26 +8,25 @@ if(!defined('ABSPATH')) exit;
|
||||
require_once(ABSPATH . 'wp-includes/pluggable.php');
|
||||
|
||||
class AccessControl {
|
||||
const PERMISSION_ACCESS_PLUGIN_ADMIN = 'access_plugin_admin';
|
||||
const PERMISSION_MANAGE_SETTINGS = 'manage_settings';
|
||||
const PERMISSION_MANAGE_EMAILS = 'manage_emails';
|
||||
const PERMISSION_MANAGE_SUBSCRIBERS = 'manage_subscribers';
|
||||
const PERMISSION_MANAGE_FORMS = 'manage_forms';
|
||||
const PERMISSION_MANAGE_SEGMENTS = 'manage_segments';
|
||||
const PERMISSION_UPDATE_PLUGIN = 'update_plugin';
|
||||
const NO_ACCESS_RESTRICTION = 'no_access_restriction';
|
||||
const PERMISSION_ACCESS_PLUGIN_ADMIN = 'mailpoet_access_plugin_admin';
|
||||
const PERMISSION_MANAGE_SETTINGS = 'mailpoet_manage_settings';
|
||||
const PERMISSION_MANAGE_EMAILS = 'mailpoet_manage_emails';
|
||||
const PERMISSION_MANAGE_SUBSCRIBERS = 'mailpoet_manage_subscribers';
|
||||
const PERMISSION_MANAGE_FORMS = 'mailpoet_manage_forms';
|
||||
const PERMISSION_MANAGE_SEGMENTS = 'mailpoet_manage_segments';
|
||||
const NO_ACCESS_RESTRICTION = 'mailpoet_no_access_restriction';
|
||||
|
||||
public $permissions;
|
||||
public $current_user_roles;
|
||||
public $user_roles;
|
||||
public $user_capabilities;
|
||||
|
||||
function __construct() {
|
||||
$this->permissions = $this->getDefaultPermissions();
|
||||
$this->permissions = self::getDefaultPermissions();
|
||||
$this->user_roles = $this->getUserRoles();
|
||||
$this->user_capabilities = $this->getUserCapabilities();
|
||||
}
|
||||
|
||||
private function getDefaultPermissions() {
|
||||
static function getDefaultPermissions() {
|
||||
return array(
|
||||
self::PERMISSION_ACCESS_PLUGIN_ADMIN => WPHooks::applyFilters(
|
||||
'mailpoet_permission_access_plugin_admin',
|
||||
@ -67,12 +66,17 @@ class AccessControl {
|
||||
'administrator'
|
||||
)
|
||||
),
|
||||
self::PERMISSION_UPDATE_PLUGIN => WPHooks::applyFilters(
|
||||
'mailpoet_permission_update_plugin',
|
||||
array(
|
||||
'administrator'
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static function getPermissionLabels() {
|
||||
return array(
|
||||
self::PERMISSION_ACCESS_PLUGIN_ADMIN => __('Admin menu item', 'mailpoet'),
|
||||
self::PERMISSION_MANAGE_SETTINGS => __('Manage settings', 'mailpoet'),
|
||||
self::PERMISSION_MANAGE_EMAILS => __('Manage emails', 'mailpoet'),
|
||||
self::PERMISSION_MANAGE_SUBSCRIBERS => __('Manage subscribers', 'mailpoet'),
|
||||
self::PERMISSION_MANAGE_FORMS => __('Manage forms', 'mailpoet'),
|
||||
self::PERMISSION_MANAGE_SEGMENTS => __('Manage segments', 'mailpoet'),
|
||||
);
|
||||
}
|
||||
|
||||
@ -94,11 +98,12 @@ class AccessControl {
|
||||
|
||||
function validatePermission($permission) {
|
||||
if($permission === self::NO_ACCESS_RESTRICTION) return true;
|
||||
if(empty($this->permissions[$permission])) return false;
|
||||
$permitted_roles = array_intersect(
|
||||
$this->user_roles,
|
||||
$this->permissions[$permission]
|
||||
);
|
||||
return (!empty($permitted_roles));
|
||||
foreach($this->user_roles as $role) {
|
||||
$role_object = get_role($role);
|
||||
if($role_object && $role_object->has_cap($permission)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace MailPoet\Config;
|
||||
|
||||
use MailPoet\Models\Setting;
|
||||
|
||||
if(!defined('ABSPATH')) exit;
|
||||
|
||||
class Activator {
|
||||
@ -11,12 +13,17 @@ class Activator {
|
||||
|
||||
$populator = new Populator();
|
||||
$populator->up();
|
||||
Setting::setValue('db_version', Env::$version);
|
||||
|
||||
update_option('mailpoet_db_version', Env::$version);
|
||||
$caps = new Capabilities();
|
||||
$caps->setupWPCapabilities();
|
||||
}
|
||||
|
||||
function deactivate() {
|
||||
$migrator = new Migrator();
|
||||
$migrator->down();
|
||||
|
||||
$caps = new Capabilities();
|
||||
$caps->removeWPCapabilities();
|
||||
}
|
||||
}
|
85
lib/Config/Capabilities.php
Normal file
85
lib/Config/Capabilities.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace MailPoet\Config;
|
||||
|
||||
use MailPoet\WP\Hooks;
|
||||
|
||||
class Capabilities {
|
||||
const MEMBERS_CAP_GROUP_NAME = 'mailpoet';
|
||||
|
||||
private $renderer = null;
|
||||
|
||||
function __construct($renderer = null) {
|
||||
if($renderer !== null) {
|
||||
$this->renderer = $renderer;
|
||||
}
|
||||
}
|
||||
|
||||
function init() {
|
||||
$this->setupMembersCapabilities();
|
||||
}
|
||||
|
||||
function setupWPCapabilities() {
|
||||
$permissions = AccessControl::getDefaultPermissions();
|
||||
$role_objects = array();
|
||||
foreach($permissions as $name => $roles) {
|
||||
foreach($roles as $role) {
|
||||
if(!isset($role_objects[$role])) {
|
||||
$role_objects[$role] = get_role($role);
|
||||
}
|
||||
$role_objects[$role]->add_cap($name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function removeWPCapabilities() {
|
||||
$permissions = AccessControl::getDefaultPermissions();
|
||||
$role_objects = array();
|
||||
foreach($permissions as $name => $roles) {
|
||||
foreach($roles as $role) {
|
||||
if(!isset($role_objects[$role])) {
|
||||
$role_objects[$role] = get_role($role);
|
||||
}
|
||||
$role_objects[$role]->remove_cap($name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setupMembersCapabilities() {
|
||||
Hooks::addAction('admin_enqueue_scripts', array($this, 'enqueueMembersStyles'));
|
||||
Hooks::addAction('members_register_cap_groups', array($this, 'registerMembersCapGroup'));
|
||||
Hooks::addAction('members_register_caps', array($this, 'registerMembersCapabilities'));
|
||||
}
|
||||
|
||||
function enqueueMembersStyles() {
|
||||
wp_enqueue_style(
|
||||
'mailpoet-admin-global',
|
||||
Env::$assets_url . '/css/' . $this->renderer->getCssAsset('admin-global.css')
|
||||
);
|
||||
}
|
||||
|
||||
function registerMembersCapGroup() {
|
||||
members_register_cap_group(
|
||||
self::MEMBERS_CAP_GROUP_NAME,
|
||||
array(
|
||||
'label' => __('MailPoet', 'mailpoet'),
|
||||
'caps' => array(),
|
||||
'icon' => 'mailpoet-icon-logo',
|
||||
'priority' => 30
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function registerMembersCapabilities() {
|
||||
$permissions = AccessControl::getPermissionLabels();
|
||||
foreach($permissions as $name => $label) {
|
||||
members_register_cap(
|
||||
$name,
|
||||
array(
|
||||
'label' => $label,
|
||||
'group' => self::MEMBERS_CAP_GROUP_NAME
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ namespace MailPoet\Config;
|
||||
|
||||
use MailPoet\API;
|
||||
use MailPoet\Cron\CronTrigger;
|
||||
use MailPoet\Models\Setting;
|
||||
use MailPoet\Router;
|
||||
use MailPoet\Util\ConflictResolver;
|
||||
use MailPoet\Util\Helpers;
|
||||
@ -61,12 +62,17 @@ class Initializer {
|
||||
|
||||
add_action('init', array(
|
||||
$this,
|
||||
'onInit'
|
||||
'preInitialize'
|
||||
), 0);
|
||||
|
||||
add_action('init', array(
|
||||
$this,
|
||||
'initialize'
|
||||
));
|
||||
|
||||
add_action('wp_loaded', array(
|
||||
$this,
|
||||
'setupHooks'
|
||||
'postInitialize'
|
||||
));
|
||||
|
||||
add_action('admin_init', array(
|
||||
@ -90,7 +96,27 @@ class Initializer {
|
||||
$database->init();
|
||||
}
|
||||
|
||||
function onInit() {
|
||||
function preInitialize() {
|
||||
try {
|
||||
$this->setupRenderer();
|
||||
$this->setupWidget();
|
||||
} catch(\Exception $e) {
|
||||
$this->handleFailedInitialization($e);
|
||||
}
|
||||
}
|
||||
|
||||
function setupRenderer() {
|
||||
$caching = !WP_DEBUG;
|
||||
$debugging = WP_DEBUG;
|
||||
$this->renderer = new Renderer($caching, $debugging);
|
||||
}
|
||||
|
||||
function setupWidget() {
|
||||
$widget = new Widget($this->renderer);
|
||||
$widget->init();
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
try {
|
||||
$this->setupAccessControl();
|
||||
|
||||
@ -98,9 +124,8 @@ class Initializer {
|
||||
$this->setupInstaller();
|
||||
$this->setupUpdater();
|
||||
|
||||
$this->setupRenderer();
|
||||
$this->setupWidget();
|
||||
$this->setupLocalizer();
|
||||
$this->setupCapabilities();
|
||||
$this->setupMenu();
|
||||
$this->setupShortcodes();
|
||||
$this->setupImages();
|
||||
@ -109,8 +134,6 @@ class Initializer {
|
||||
$this->setupCronTrigger();
|
||||
$this->setupConflictResolver();
|
||||
|
||||
$this->setupJSONAPI();
|
||||
$this->setupRouter();
|
||||
$this->setupPages();
|
||||
|
||||
do_action('mailpoet_initialized', MAILPOET_VERSION);
|
||||
@ -122,13 +145,14 @@ class Initializer {
|
||||
}
|
||||
|
||||
function maybeDbUpdate() {
|
||||
$current_db_version = get_option('mailpoet_db_version', false);
|
||||
try {
|
||||
$current_db_version = Setting::getValue('db_version');
|
||||
} catch(\Exception $e) {
|
||||
$current_db_version = null;
|
||||
}
|
||||
|
||||
// if current db version and plugin version differ
|
||||
if(version_compare($current_db_version, Env::$version) !== 0) {
|
||||
if(!$this->access_control->validatePermission(AccessControl::PERMISSION_UPDATE_PLUGIN)) {
|
||||
throw new \Exception(__('You do not have permission to activate/deactivate MailPoet plugin.', 'mailpoet'));
|
||||
}
|
||||
$this->runActivator();
|
||||
}
|
||||
}
|
||||
@ -158,22 +182,16 @@ class Initializer {
|
||||
$updater->init();
|
||||
}
|
||||
|
||||
function setupRenderer() {
|
||||
$caching = !WP_DEBUG;
|
||||
$debugging = WP_DEBUG;
|
||||
$this->renderer = new Renderer($caching, $debugging);
|
||||
}
|
||||
|
||||
function setupWidget() {
|
||||
$widget = new Widget($this->renderer);
|
||||
$widget->init();
|
||||
}
|
||||
|
||||
function setupLocalizer() {
|
||||
$localizer = new Localizer($this->renderer);
|
||||
$localizer = new Localizer();
|
||||
$localizer->init();
|
||||
}
|
||||
|
||||
function setupCapabilities() {
|
||||
$caps = new Capabilities($this->renderer);
|
||||
$caps->init();
|
||||
}
|
||||
|
||||
function setupMenu() {
|
||||
$menu = new Menu($this->renderer, Env::$assets_url, $this->access_control);
|
||||
$menu->init();
|
||||
@ -206,6 +224,17 @@ class Initializer {
|
||||
$conflict_resolver->init();
|
||||
}
|
||||
|
||||
function postInitialize() {
|
||||
if(!defined(self::INITIALIZED)) return;
|
||||
try {
|
||||
$this->setupHooks();
|
||||
$this->setupJSONAPI();
|
||||
$this->setupRouter();
|
||||
} catch(\Exception $e) {
|
||||
$this->handleFailedInitialization($e);
|
||||
}
|
||||
}
|
||||
|
||||
function setupJSONAPI() {
|
||||
$json_api = API\API::JSON($this->access_control);
|
||||
$json_api->init();
|
||||
@ -222,13 +251,8 @@ class Initializer {
|
||||
}
|
||||
|
||||
function setupHooks() {
|
||||
if(!defined(self::INITIALIZED)) return;
|
||||
try {
|
||||
$hooks = new Hooks();
|
||||
$hooks->init();
|
||||
} catch(\Exception $e) {
|
||||
$this->handleFailedInitialization($e);
|
||||
}
|
||||
}
|
||||
|
||||
function handleFailedInitialization($exception) {
|
||||
|
@ -1,32 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace MailPoet\Config;
|
||||
|
||||
if(!defined('ABSPATH')) exit;
|
||||
|
||||
class Localizer {
|
||||
function __construct($renderer) {
|
||||
$this->renderer = $renderer;
|
||||
}
|
||||
|
||||
function init() {
|
||||
add_action(
|
||||
'init',
|
||||
array($this, 'setup')
|
||||
);
|
||||
}
|
||||
|
||||
function setup() {
|
||||
$this->loadGlobalText();
|
||||
$this->loadPluginText();
|
||||
$this->setGlobalRtl();
|
||||
}
|
||||
|
||||
function loadGlobalText() {
|
||||
$language_path =
|
||||
Env::$languages_path
|
||||
. '/'
|
||||
. $this->locale()
|
||||
. '.mo';
|
||||
$language_path = sprintf(
|
||||
'%s/%s.mo',
|
||||
Env::$languages_path,
|
||||
$this->locale()
|
||||
);
|
||||
load_textdomain(Env::$plugin_name, $language_path);
|
||||
}
|
||||
|
||||
@ -38,10 +27,6 @@ class Localizer {
|
||||
);
|
||||
}
|
||||
|
||||
function setGlobalRtl() {
|
||||
$this->renderer->addGlobal('is_rtl', is_rtl());
|
||||
}
|
||||
|
||||
function locale() {
|
||||
$locale = apply_filters(
|
||||
'plugin_locale',
|
||||
|
@ -148,7 +148,7 @@ class MP2Migrator {
|
||||
}
|
||||
ob_start();
|
||||
$datetime = new \MailPoet\WP\DateTime();
|
||||
$this->log(sprintf('=== ' . __('START IMPORT', 'mailpoet') . ' %s ===', $datetime->formatTime(time(), \MailPoet\WP\DateTime::DEFAULT_DATE_TIME_FORMAT)));
|
||||
$this->log(sprintf('=== ' . mb_strtoupper(__('Start import', 'mailpoet'), 'UTF-8') . ' %s ===', $datetime->formatTime(time(), \MailPoet\WP\DateTime::DEFAULT_DATE_TIME_FORMAT)));
|
||||
Setting::setValue('import_stopped', false); // Reset the stop import action
|
||||
|
||||
if(!Setting::getValue('mailpoet_migration_started', false)) {
|
||||
@ -165,10 +165,10 @@ class MP2Migrator {
|
||||
|
||||
if(!$this->importStopped()) {
|
||||
Setting::setValue('mailpoet_migration_complete', true);
|
||||
$this->log(__('IMPORT COMPLETE', 'mailpoet'));
|
||||
$this->log(mb_strtoupper(__('Import complete', 'mailpoet'), 'UTF-8'));
|
||||
}
|
||||
|
||||
$this->log(sprintf('=== ' . __('END IMPORT', 'mailpoet') . ' %s ===', $datetime->formatTime(time(), \MailPoet\WP\DateTime::DEFAULT_DATE_TIME_FORMAT)));
|
||||
$this->log(sprintf('=== ' . mb_strtoupper(__('End import', 'mailpoet'), 'UTF-8') . ' %s ===', $datetime->formatTime(time(), \MailPoet\WP\DateTime::DEFAULT_DATE_TIME_FORMAT)));
|
||||
$result = ob_get_contents();
|
||||
ob_clean();
|
||||
return $result;
|
||||
@ -223,7 +223,7 @@ class MP2Migrator {
|
||||
*/
|
||||
public function stopImport() {
|
||||
Setting::setValue('import_stopped', true);
|
||||
$this->log(__('IMPORT STOPPED BY USER', 'mailpoet'));
|
||||
$this->log(mb_strtoupper(__('Import stopped by user', 'mailpoet'), 'UTF-8'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -486,7 +486,7 @@ class MP2Migrator {
|
||||
break;
|
||||
|
||||
default:
|
||||
$params['date_format'] = strtoupper($params['date_order']);
|
||||
$params['date_format'] = mb_strtoupper($params['date_order'], 'UTF-8');
|
||||
}
|
||||
unset($params['date_order']);
|
||||
}
|
||||
|
@ -37,7 +37,6 @@ class Menu {
|
||||
$this->renderer = $renderer;
|
||||
$this->assets_url = $assets_url;
|
||||
$this->access_control = $access_control;
|
||||
$this->user_capability = $this->access_control->getUserFirstCapability();
|
||||
$subscribers_feature = new SubscribersFeature();
|
||||
$this->subscribers_over_limit = $subscribers_feature->check();
|
||||
$this->checkMailPoetAPIKey();
|
||||
@ -70,7 +69,7 @@ class Menu {
|
||||
add_menu_page(
|
||||
'MailPoet',
|
||||
'MailPoet',
|
||||
$this->user_capability,
|
||||
AccessControl::PERMISSION_ACCESS_PLUGIN_ADMIN,
|
||||
self::MAIN_PAGE_SLUG,
|
||||
null,
|
||||
$this->assets_url . '/img/menu_icon.png',
|
||||
@ -78,12 +77,11 @@ class Menu {
|
||||
);
|
||||
|
||||
// Emails page
|
||||
if($this->access_control->validatePermission(AccessControl::PERMISSION_MANAGE_EMAILS)) {
|
||||
$newsletters_page = add_submenu_page(
|
||||
self::MAIN_PAGE_SLUG,
|
||||
$this->setPageTitle(__('Emails', 'mailpoet')),
|
||||
__('Emails', 'mailpoet'),
|
||||
$this->user_capability,
|
||||
AccessControl::PERMISSION_MANAGE_EMAILS,
|
||||
self::MAIN_PAGE_SLUG,
|
||||
array(
|
||||
$this,
|
||||
@ -108,22 +106,20 @@ class Menu {
|
||||
true,
|
||||
$this->setPageTitle(__('Newsletter', 'mailpoet')),
|
||||
__('Newsletter Editor', 'mailpoet'),
|
||||
$this->user_capability,
|
||||
AccessControl::PERMISSION_MANAGE_EMAILS,
|
||||
'mailpoet-newsletter-editor',
|
||||
array(
|
||||
$this,
|
||||
'newletterEditor'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Forms page
|
||||
if($this->access_control->validatePermission(AccessControl::PERMISSION_MANAGE_FORMS)) {
|
||||
$forms_page = add_submenu_page(
|
||||
self::MAIN_PAGE_SLUG,
|
||||
$this->setPageTitle(__('Forms', 'mailpoet')),
|
||||
__('Forms', 'mailpoet'),
|
||||
$this->user_capability,
|
||||
AccessControl::PERMISSION_MANAGE_FORMS,
|
||||
'mailpoet-forms',
|
||||
array(
|
||||
$this,
|
||||
@ -148,22 +144,20 @@ class Menu {
|
||||
true,
|
||||
$this->setPageTitle(__('Form Editor', 'mailpoet')),
|
||||
__('Form Editor', 'mailpoet'),
|
||||
$this->user_capability,
|
||||
AccessControl::PERMISSION_MANAGE_FORMS,
|
||||
'mailpoet-form-editor',
|
||||
array(
|
||||
$this,
|
||||
'formEditor'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Subscribers page
|
||||
if($this->access_control->validatePermission(AccessControl::PERMISSION_MANAGE_SUBSCRIBERS)) {
|
||||
$subscribers_page = add_submenu_page(
|
||||
self::MAIN_PAGE_SLUG,
|
||||
$this->setPageTitle(__('Subscribers', 'mailpoet')),
|
||||
__('Subscribers', 'mailpoet'),
|
||||
$this->user_capability,
|
||||
AccessControl::PERMISSION_MANAGE_SUBSCRIBERS,
|
||||
'mailpoet-subscribers',
|
||||
array(
|
||||
$this,
|
||||
@ -188,7 +182,7 @@ class Menu {
|
||||
'admin.php?page=mailpoet-subscribers',
|
||||
$this->setPageTitle(__('Import', 'mailpoet')),
|
||||
__('Import', 'mailpoet'),
|
||||
$this->user_capability,
|
||||
AccessControl::PERMISSION_MANAGE_SUBSCRIBERS,
|
||||
'mailpoet-import',
|
||||
array(
|
||||
$this,
|
||||
@ -201,22 +195,20 @@ class Menu {
|
||||
true,
|
||||
$this->setPageTitle(__('Export', 'mailpoet')),
|
||||
__('Export', 'mailpoet'),
|
||||
$this->user_capability,
|
||||
AccessControl::PERMISSION_MANAGE_SUBSCRIBERS,
|
||||
'mailpoet-export',
|
||||
array(
|
||||
$this,
|
||||
'export'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Segments page
|
||||
if($this->access_control->validatePermission(AccessControl::PERMISSION_MANAGE_SEGMENTS)) {
|
||||
$segments_page = add_submenu_page(
|
||||
self::MAIN_PAGE_SLUG,
|
||||
$this->setPageTitle(__('Lists', 'mailpoet')),
|
||||
__('Lists', 'mailpoet'),
|
||||
$this->user_capability,
|
||||
AccessControl::PERMISSION_MANAGE_SEGMENTS,
|
||||
'mailpoet-segments',
|
||||
array(
|
||||
$this,
|
||||
@ -235,29 +227,26 @@ class Menu {
|
||||
'option' => 'mailpoet_segments_per_page'
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
// Settings page
|
||||
if($this->access_control->validatePermission(AccessControl::PERMISSION_MANAGE_SETTINGS)) {
|
||||
add_submenu_page(
|
||||
self::MAIN_PAGE_SLUG,
|
||||
$this->setPageTitle(__('Settings', 'mailpoet')),
|
||||
__('Settings', 'mailpoet'),
|
||||
$this->user_capability,
|
||||
AccessControl::PERMISSION_MANAGE_SETTINGS,
|
||||
'mailpoet-settings',
|
||||
array(
|
||||
$this,
|
||||
'settings'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Help page
|
||||
add_submenu_page(
|
||||
self::MAIN_PAGE_SLUG,
|
||||
$this->setPageTitle(__('Help', 'mailpoet')),
|
||||
__('Help', 'mailpoet'),
|
||||
$this->user_capability,
|
||||
AccessControl::PERMISSION_ACCESS_PLUGIN_ADMIN,
|
||||
'mailpoet-help',
|
||||
array(
|
||||
$this,
|
||||
@ -271,7 +260,7 @@ class Menu {
|
||||
License::getLicense() ? true : self::MAIN_PAGE_SLUG,
|
||||
$this->setPageTitle(__('Premium', 'mailpoet')),
|
||||
__('Premium', 'mailpoet'),
|
||||
$this->user_capability,
|
||||
AccessControl::PERMISSION_ACCESS_PLUGIN_ADMIN,
|
||||
'mailpoet-premium',
|
||||
array(
|
||||
$this,
|
||||
@ -284,7 +273,7 @@ class Menu {
|
||||
true,
|
||||
$this->setPageTitle(__('Welcome', 'mailpoet')),
|
||||
__('Welcome', 'mailpoet'),
|
||||
$this->user_capability,
|
||||
AccessControl::PERMISSION_ACCESS_PLUGIN_ADMIN,
|
||||
'mailpoet-welcome',
|
||||
array(
|
||||
$this,
|
||||
@ -297,7 +286,7 @@ class Menu {
|
||||
true,
|
||||
$this->setPageTitle(__('Update', 'mailpoet')),
|
||||
__('Update', 'mailpoet'),
|
||||
$this->user_capability,
|
||||
AccessControl::PERMISSION_ACCESS_PLUGIN_ADMIN,
|
||||
'mailpoet-update',
|
||||
array(
|
||||
$this,
|
||||
@ -310,7 +299,7 @@ class Menu {
|
||||
true,
|
||||
$this->setPageTitle(__('Migration', 'mailpoet')),
|
||||
'',
|
||||
$this->user_capability,
|
||||
AccessControl::PERMISSION_ACCESS_PLUGIN_ADMIN,
|
||||
'mailpoet-migration',
|
||||
array(
|
||||
$this,
|
||||
@ -422,6 +411,7 @@ class Menu {
|
||||
'premium_key_valid' => !empty($this->premium_key_valid),
|
||||
'mss_active' => Bridge::isMPSendingServiceEnabled(),
|
||||
'mss_key_valid' => !empty($mp_api_key_valid),
|
||||
'members_plugin_active' => is_plugin_active('members/members.php'),
|
||||
'pages' => Pages::getAll(),
|
||||
'flags' => $flags,
|
||||
'current_user' => wp_get_current_user(),
|
||||
@ -658,7 +648,7 @@ class Menu {
|
||||
true,
|
||||
'MailPoet',
|
||||
'MailPoet',
|
||||
$access_control->getUserFirstCapability(),
|
||||
AccessControl::PERMISSION_ACCESS_PLUGIN_ADMIN,
|
||||
$_REQUEST['page'],
|
||||
array(
|
||||
__CLASS__,
|
||||
|
@ -172,7 +172,8 @@ class Migrator {
|
||||
'deleted_at TIMESTAMP NULL,',
|
||||
'unconfirmed_data longtext,',
|
||||
'PRIMARY KEY (id),',
|
||||
'UNIQUE KEY email (email)'
|
||||
'UNIQUE KEY email (email),',
|
||||
'KEY wp_user_id (wp_user_id)',
|
||||
);
|
||||
return $this->sqlify(__FUNCTION__, $attributes);
|
||||
}
|
||||
@ -186,7 +187,8 @@ class Migrator {
|
||||
'created_at TIMESTAMP NULL,',
|
||||
'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,',
|
||||
'PRIMARY KEY (id),',
|
||||
'UNIQUE KEY subscriber_segment (subscriber_id,segment_id)'
|
||||
'UNIQUE KEY subscriber_segment (subscriber_id,segment_id),',
|
||||
'KEY segment_id (segment_id)',
|
||||
);
|
||||
return $this->sqlify(__FUNCTION__, $attributes);
|
||||
}
|
||||
|
@ -3,8 +3,6 @@
|
||||
namespace MailPoet\Config;
|
||||
|
||||
class PluginActivatedHook {
|
||||
|
||||
/** @var DeferredAdminNotices */
|
||||
private $deferred_admin_notices;
|
||||
|
||||
public function __construct(DeferredAdminNotices $deferred_admin_notices) {
|
||||
@ -13,8 +11,7 @@ class PluginActivatedHook {
|
||||
|
||||
public function action($plugin, $network_wide) {
|
||||
if($plugin === plugin_basename(Env::$file) && $network_wide) {
|
||||
$this->deferred_admin_notices->addNetworkAdminNotice(__('We noticed that you\'re using an unsupported environment. While MailPoet might work within a MultiSite environment, we don’t support it.', 'mailpoet'));
|
||||
$this->deferred_admin_notices->addNetworkAdminNotice(__("We noticed that you're using an unsupported environment. While MailPoet might work within a MultiSite environment, we don’t support it.", 'mailpoet'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -337,7 +337,7 @@ class Populator {
|
||||
function convertExistingDataToUTF8() {
|
||||
global $wpdb;
|
||||
|
||||
if(!version_compare(get_option('mailpoet_db_version', '3.0.0-beta.33'), '3.0.0-beta.32', '<=')) {
|
||||
if(!version_compare(Setting::getValue('db_version', '3.0.0-beta.33'), '3.0.0-beta.32', '<=')) {
|
||||
// Data conversion should only be performed only once, when migrating from
|
||||
// older version
|
||||
return false;
|
||||
@ -402,7 +402,7 @@ class Populator {
|
||||
global $wpdb;
|
||||
|
||||
// perform once for versions below 3.0.0-beta.36.2.1
|
||||
if(version_compare(get_option('mailpoet_db_version', '3.0.0-beta.36.2.3'), '3.0.0-beta.36.2.1', '>=')) {
|
||||
if(version_compare(Setting::getValue('db_version', '3.0.0-beta.36.2.3'), '3.0.0-beta.36.2.1', '>=')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -455,7 +455,7 @@ class Populator {
|
||||
global $wpdb;
|
||||
|
||||
// perform once for versions below 3.0.0-beta.36.2.1
|
||||
if(version_compare(get_option('mailpoet_db_version', '3.0.0-beta.36.2.3'), '3.0.0-beta.36.2.1', '>=')) {
|
||||
if(version_compare(Setting::getValue('db_version', '3.0.0-beta.36.2.3'), '3.0.0-beta.36.2.1', '>=')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ class AppWelcome {
|
||||
private $social_icon_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/app_welcome';
|
||||
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/app_welcome';
|
||||
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ class BurgerJoint {
|
||||
private $social_icon_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->template_image_url = 'http://ps.w.org/mailpoet/assets/newsletter-templates/burger_joint';
|
||||
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/burger_joint';
|
||||
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ class ChocolateStore {
|
||||
private $social_icon_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/chocolate_store';
|
||||
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/chocolate_store';
|
||||
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ class CoffeeShop {
|
||||
private $template_image_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/franks-roast-house';
|
||||
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/franks-roast-house';
|
||||
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ class Discount {
|
||||
private $social_icon_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/discount';
|
||||
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/discount';
|
||||
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ class Faith {
|
||||
private $social_icon_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/faith';
|
||||
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/faith';
|
||||
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ class FestivalEvent {
|
||||
private $social_icon_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/festival_event';
|
||||
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/festival_event';
|
||||
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ class FoodBox {
|
||||
private $social_icon_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/food_box';
|
||||
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/food_box';
|
||||
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ class KickOff {
|
||||
private $social_icon_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/kick_off';
|
||||
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/kick_off';
|
||||
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ class NewsDay {
|
||||
private $social_icon_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/news_day';
|
||||
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/news_day';
|
||||
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ class NewsletterBlank121Column {
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->assets_url = $assets_url;
|
||||
$this->external_template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/newsletter-blank-1-2-1-column';
|
||||
$this->external_template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/newsletter-blank-1-2-1-column';
|
||||
$this->template_image_url = $this->assets_url . '/img/blank_templates';
|
||||
$this->social_icon_url = $this->assets_url . '/img/newsletter_editor/social-icons';
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ class NewsletterBlank12Column {
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->assets_url = $assets_url;
|
||||
$this->external_template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/newsletter-blank-1-2-column';
|
||||
$this->external_template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/newsletter-blank-1-2-column';
|
||||
$this->template_image_url = $this->assets_url . '/img/blank_templates';
|
||||
$this->social_icon_url = $this->assets_url . '/img/newsletter_editor/social-icons';
|
||||
}
|
||||
@ -117,7 +117,7 @@ class NewsletterBlank12Column {
|
||||
),
|
||||
array(
|
||||
"type" => "text",
|
||||
"text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started!</strong></h1>\n<p></p>\n<p>It's time to design your newsletter! In the right sidebar, you'll find 4 menu items that will help you customize your newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Columns</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>", 'mailpoet')
|
||||
"text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started!</strong></h1>\n<p> </p>\n<p>It's time to design your newsletter! In the right sidebar, you'll find 4 menu items that will help you customize your newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Columns</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>", 'mailpoet')
|
||||
),
|
||||
array(
|
||||
"type" => "divider",
|
||||
|
@ -7,7 +7,7 @@ class NewsletterBlank13Column {
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->assets_url = $assets_url;
|
||||
$this->external_template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/newsletter-blank-1-3-column';
|
||||
$this->external_template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/newsletter-blank-1-3-column';
|
||||
$this->template_image_url = $this->assets_url . '/img/blank_templates';
|
||||
$this->social_icon_url = $this->assets_url . '/img/newsletter_editor/social-icons';
|
||||
}
|
||||
@ -117,7 +117,7 @@ class NewsletterBlank13Column {
|
||||
),
|
||||
array(
|
||||
"type" => "text",
|
||||
"text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started! </strong></h1>\n<p></p>\n<p>It's time to design your newsletter! In the right sidebar, you'll find four menu items that will help you customize your newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Columns</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>", 'mailpoet')
|
||||
"text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started! </strong></h1>\n<p> </p>\n<p>It's time to design your newsletter! In the right sidebar, you'll find four menu items that will help you customize your newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Columns</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>", 'mailpoet')
|
||||
),
|
||||
array(
|
||||
"type" => "divider",
|
||||
|
@ -7,7 +7,7 @@ class NewsletterBlank1Column {
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->assets_url = $assets_url;
|
||||
$this->external_template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/newsletter-blank-1-column';
|
||||
$this->external_template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/newsletter-blank-1-column';
|
||||
$this->template_image_url = $this->assets_url . '/img/blank_templates';
|
||||
$this->social_icon_url = $this->assets_url . '/img/newsletter_editor/social-icons';
|
||||
}
|
||||
@ -117,7 +117,7 @@ class NewsletterBlank1Column {
|
||||
),
|
||||
array(
|
||||
"type" => "text",
|
||||
"text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started! </strong></h1>\n<p></p>\n<p>It's time to design your newsletter! In the right sidebar, you'll find 4 menu items that will help you customize your newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Columns</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>", 'mailpoet')
|
||||
"text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started! </strong></h1>\n<p> </p>\n<p>It's time to design your newsletter! In the right sidebar, you'll find 4 menu items that will help you customize your newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Columns</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>", 'mailpoet')
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -8,7 +8,7 @@ class PieceOfCake {
|
||||
private $social_icon_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/piece_of_cake';
|
||||
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/piece_of_cake';
|
||||
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ class PostNotificationsBlank1Column {
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->assets_url = $assets_url;
|
||||
$this->external_template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/post-notifications-blank-1-column';
|
||||
$this->external_template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/post-notifications-blank-1-column';
|
||||
$this->template_image_url = $this->assets_url . '/img/blank_templates';
|
||||
$this->social_icon_url = $this->assets_url . '/img/newsletter_editor/social-icons';
|
||||
}
|
||||
@ -117,7 +117,7 @@ class PostNotificationsBlank1Column {
|
||||
),
|
||||
array(
|
||||
"type" => "text",
|
||||
"text" => __("<h1 style=\"text-align: center;\"><strong>Check Out Our New Blog Posts! </strong></h1>\n<p></p>\n<p>MailPoet can <span style=\"line-height: 1.6em; background-color: inherit;\"><em>automatically</em> </span><span style=\"line-height: 1.6em; background-color: inherit;\">send your new blog posts to your subscribers.</span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\"></span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\">Below, you'll find three recent posts, which are displayed automatically, thanks to the <em>Automatic Latest Content</em> widget, which can be found in the right sidebar, under <em>Content</em>.</span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\"></span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\">To edit the settings and styles of your post, simply click on a post below.</span></p>", 'mailpoet')
|
||||
"text" => __("<h1 style=\"text-align: center;\"><strong>Check Out Our New Blog Posts! </strong></h1>\n<p> </p>\n<p>MailPoet can <span style=\"line-height: 1.6em; background-color: inherit;\"><em>automatically</em> </span><span style=\"line-height: 1.6em; background-color: inherit;\">send your new blog posts to your subscribers.</span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\"></span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\">Below, you'll find three recent posts, which are displayed automatically, thanks to the <em>Automatic Latest Content</em> widget, which can be found in the right sidebar, under <em>Content</em>.</span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\"></span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\">To edit the settings and styles of your post, simply click on a post below.</span></p>", 'mailpoet')
|
||||
),
|
||||
array(
|
||||
"type" => "divider",
|
||||
|
@ -8,7 +8,7 @@ class ScienceWeekly {
|
||||
private $social_icon_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/science_weekly';
|
||||
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/science_weekly';
|
||||
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ class Shoes {
|
||||
private $social_icon_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/shoes';
|
||||
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/shoes';
|
||||
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ class SimpleText {
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->assets_url = $assets_url;
|
||||
$this->external_template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/simple-text';
|
||||
$this->external_template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/simple-text';
|
||||
$this->template_image_url = $this->assets_url . '/img/blank_templates';
|
||||
$this->social_icon_url = $this->assets_url . '/img/newsletter_editor/social-icons';
|
||||
}
|
||||
@ -132,7 +132,7 @@ class SimpleText {
|
||||
),
|
||||
array(
|
||||
"type" => "text",
|
||||
"text" => __("<p>Thanks for reading. See you soon!</p>\n<p></p>\n<p><strong><em>The MailPoet Team</em></strong></p>", 'mailpoet')
|
||||
"text" => __("<p>Thanks for reading. See you soon!</p>\n<p> </p>\n<p><strong><em>The MailPoet Team</em></strong></p>", 'mailpoet')
|
||||
),
|
||||
array(
|
||||
"type" => "footer",
|
||||
|
@ -8,7 +8,7 @@ class TakeAHike {
|
||||
private $social_icon_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/take_a_hike';
|
||||
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/take_a_hike';
|
||||
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ class TravelNomads {
|
||||
private $social_icon_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/travel_nomads';
|
||||
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/travel_nomads';
|
||||
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ class WelcomeBlank12Column {
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->assets_url = $assets_url;
|
||||
$this->external_template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/welcome-email-blank-1-2-column';
|
||||
$this->external_template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/welcome-email-blank-1-2-column';
|
||||
$this->template_image_url = $this->assets_url . '/img/blank_templates';
|
||||
$this->social_icon_url = $this->assets_url . '/img/newsletter_editor/social-icons';
|
||||
}
|
||||
@ -117,7 +117,7 @@ class WelcomeBlank12Column {
|
||||
),
|
||||
array(
|
||||
"type" => "text",
|
||||
"text" => __("<h1 style=\"text-align: center;\"><strong>Hi, new subscriber!</strong></h1>\n<p></p>\n<p>[subscriber:firstname | default:Subscriber],</p>\n<p></p>\n<p>You recently joined our list and we'd like to give you a warm welcome!</p>", 'mailpoet')
|
||||
"text" => __("<h1 style=\"text-align: center;\"><strong>Hi, new subscriber!</strong></h1>\n<p> </p>\n<p>[subscriber:firstname | default:Subscriber],</p>\n<p> </p>\n<p>You recently joined our list and we'd like to give you a warm welcome!</p>", 'mailpoet')
|
||||
),
|
||||
array(
|
||||
"type" => "divider",
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user