diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..804a1a6
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+build
+js/templates.js
+vendor
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 3db1d2c..4769878 100644
--- a/Makefile
+++ b/Makefile
@@ -72,6 +72,9 @@ depsmin:
wget https://github.com/varun-raj/medium-editor-autolist/raw/master/dist/autolist.min.js
mv autolist.min.js vendor/autolist.js
+js-templates:
+ handlebars js/templates -f js/templates.js
+
clean:
rm -rf $(build_dir)
diff --git a/appinfo/info.xml b/appinfo/info.xml
index 44365d6..71d855d 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -17,6 +17,6 @@
https://user-images.githubusercontent.com/733715/38871311-dac5a80a-4226-11e8-961d-63b276380b6b.png
https://user-images.githubusercontent.com/733715/38871255-b07a7d5a-4226-11e8-8403-650cbea50be0.png
-
+
diff --git a/js/script.js b/js/script.js
index 219a5c4..ba6bfaa 100644
--- a/js/script.js
+++ b/js/script.js
@@ -290,10 +290,12 @@ View.prototype = {
return digits[1] + '#' + rgb.toString(16).toUpperCase();
},
renderContent: function () {
- var source = $('#content-tpl').html();
- var template = Handlebars.compile(source);
- var html = template({notes: this._notes.getAll()});
-
+ var html = Handlebars.templates['notes']({
+ notes: this._notes.getAll(),
+ cancelTxt: t('quicknotes', 'Cancel'),
+ saveTxt: t('quicknotes', 'Save'),
+ emptyTxt: t('quicknotes', 'Nothing here. Take your quick notes.'),
+ });
$('#div-content').html(html);
// Init masonty grid to notes.
@@ -510,9 +512,14 @@ View.prototype = {
});
},
renderNavigation: function () {
- var source = $('#navigation-tpl').html();
- var template = Handlebars.compile(source);
- var html = template({colors: this._notes.getColors(), notes: this._notes.getAll()});
+ var html = Handlebars.templates['navigation']({
+ colors: this._notes.getColors(),
+ notes: this._notes.getAll(),
+ newNoteTxt: t('quicknotes', 'New note'),
+ allNotesTxt: t('quicknotes', 'All notes'),
+ colorsTxt: t('quicknotes', 'Colors'),
+ notesTxt: t('quicknotes', 'Notes'),
+ });
$('#app-navigation ul').html(html);
diff --git a/js/templates/navigation.handlebars b/js/templates/navigation.handlebars
new file mode 100644
index 0000000..e358d66
--- /dev/null
+++ b/js/templates/navigation.handlebars
@@ -0,0 +1,33 @@
+
+
+
+ {{allNotesTxt}}
+
+
+
+
+ {{colorsTxt}}
+
+ -
+
+ {{#each colors}}
+
+ {{/each}}
+
+
+
+
+
+ {{notesTxt}}
+
+ {{#each notes}}
+
+ {{/each}}
+
+
diff --git a/templates/part.note-modal-editable.php b/js/templates/notes.handlebars
similarity index 53%
rename from templates/part.note-modal-editable.php
rename to js/templates/notes.handlebars
index 9d51dff..0fe1d20 100644
--- a/templates/part.note-modal-editable.php
+++ b/js/templates/notes.handlebars
@@ -1,3 +1,38 @@
+{{#if notes}}
+
+ {{#each notes}}
+
+
+ {{#if isshared}}
+
+
+ {{{ content }}}
+
+ {{else}}
+
+
+
+
+ {{{ title }}}
+
+
+
+ {{{ content }}}
+
+ {{/if}}
+
+
+ {{/each}}
+
@@ -25,11 +60,23 @@
-
-
+
+
+
+
+
-
+{{else}}
+
+{{/if}}
diff --git a/templates/main.php b/templates/main.php
index 7c35751..8a9780b 100644
--- a/templates/main.php
+++ b/templates/main.php
@@ -1,5 +1,6 @@
- {{#if notes}}
-
- {{#each notes}}
- inc('part.note')); ?>
- {{/each}}
-
- inc('part.note-modal-editable')); ?>
- {{else}}
-
-
- t('Nothing here. Take your quick notes.')); ?>
-
- {{/if}}
-
diff --git a/templates/part.navigation.php b/templates/part.navigation.php
index 7034eb1..3052017 100644
--- a/templates/part.navigation.php
+++ b/templates/part.navigation.php
@@ -1,50 +1 @@
-
-t('New note')); ?>
-
-
-
\ No newline at end of file
diff --git a/templates/part.note.php b/templates/part.note.php
deleted file mode 100644
index bae5767..0000000
--- a/templates/part.note.php
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
- {{#if isshared}}
-
-
{{{ content }}}
- {{else}}
-
-
{{{ content }}}
- {{/if}}
-
-