diff --git a/RoboFile.php b/RoboFile.php
index f57d4b660b..a798240eef 100644
--- a/RoboFile.php
+++ b/RoboFile.php
@@ -3,11 +3,21 @@ class RoboFile extends \Robo\Tasks {
function install() {
$this->_exec('./composer.phar install');
$this->_exec('npm install');
+ $this->symlinkDependencies();
}
function update() {
$this->_exec('./composer.phar update');
$this->_exec('npm update');
+ $this->symlinkDependencies();
+ }
+
+ function symlinkDependencies() {
+ // handlebars
+ $this->_symlink(
+ __DIR__.'/node_modules/handlebars/dist/handlebars.min.js',
+ __DIR__.'/assets/js/handlebars/handlebars.min.js'
+ );
}
function testUnit() {
diff --git a/assets/js/handlebars/handlebars.min.js b/assets/js/handlebars/handlebars.min.js
new file mode 120000
index 0000000000..6eaa519328
--- /dev/null
+++ b/assets/js/handlebars/handlebars.min.js
@@ -0,0 +1 @@
+/Users/jonathan/work/namp2/node_modules/handlebars/dist/handlebars.min.js
\ No newline at end of file
diff --git a/assets/js/mailpoet_modal.js b/assets/js/modal.js
similarity index 100%
rename from assets/js/mailpoet_modal.js
rename to assets/js/modal.js
diff --git a/assets/js/mailpoet_notice.js b/assets/js/notice.js
similarity index 100%
rename from assets/js/mailpoet_notice.js
rename to assets/js/notice.js
diff --git a/lib/config/initializer.php b/lib/config/initializer.php
index 0b1982e46d..d7628673f2 100644
--- a/lib/config/initializer.php
+++ b/lib/config/initializer.php
@@ -43,8 +43,10 @@ class Initializer {
);
// renderer: global variables
- // $this->renderer->addGlobal('assets_url', $this->assets_url);
- $this->renderer->addExtension(new Renderer\Assets($this->assets_url));
+ $this->renderer->addExtension(new Renderer\Assets(array(
+ 'assets_url' => $this->assets_url,
+ 'assets_path' => $this->assets_path
+ )));
register_activation_hook(
$this->file,
diff --git a/lib/renderer/assets.php b/lib/renderer/assets.php
index 68a924569a..4d6b63bb2f 100644
--- a/lib/renderer/assets.php
+++ b/lib/renderer/assets.php
@@ -3,10 +3,10 @@ namespace MailPoet\Renderer;
class Assets extends \Twig_Extension {
- public $assets_url;
+ private $_globals;
- public function __construct($assets_url) {
- $this->assets_url = $assets_url;
+ public function __construct($globals) {
+ $this->_globals = $globals;
}
public function getName() {
@@ -14,9 +14,7 @@ class Assets extends \Twig_Extension {
}
public function getGlobals() {
- return array(
- 'assets_url' => $this->assets_url
- );
+ return $this->_globals;
}
public function getFunctions() {
@@ -42,7 +40,7 @@ class Assets extends \Twig_Extension {
$output[] = '';
}
@@ -56,7 +54,7 @@ class Assets extends \Twig_Extension {
foreach($scripts as $script) {
$output[] = '';
}
diff --git a/views/layout.html b/views/layout.html
index db26984dd9..aea40fc835 100644
--- a/views/layout.html
+++ b/views/layout.html
@@ -16,9 +16,7 @@
{{ javascript(
- 'mailpoet_notice.js',
- 'mailpoet_modal.js'
-)}}
-
-
-
\ No newline at end of file
+ 'notice.js',
+ 'modal.js',
+ 'handlebars/handlebars.min.js'
+)}}
\ No newline at end of file