summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/lib
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-11-20 12:01:29 -0500
committerJules Laplace <jules@okfoc.us>2015-11-20 12:01:29 -0500
commit4b6821cee2b7a35e2124a899a13c7559628f075e (patch)
tree6ea48247d64b9530d4fc5e2b02b1cf0abb5a8701 /StoneIsland/www/js/lib
parentc270b104afaf2a529f4151daee77737ab1c56eaa (diff)
loader and stuff frm last nite
Diffstat (limited to 'StoneIsland/www/js/lib')
-rw-r--r--StoneIsland/www/js/lib/blogs/StoryView.js6
-rw-r--r--StoneIsland/www/js/lib/nav/NavView.js16
-rw-r--r--StoneIsland/www/js/lib/products/ProductView.js5
3 files changed, 15 insertions, 12 deletions
diff --git a/StoneIsland/www/js/lib/blogs/StoryView.js b/StoneIsland/www/js/lib/blogs/StoryView.js
index 70ac061f..84684ff7 100644
--- a/StoneIsland/www/js/lib/blogs/StoryView.js
+++ b/StoneIsland/www/js/lib/blogs/StoryView.js
@@ -1,5 +1,7 @@
var StoryView = ScrollableView.extend({
+ loaded: false,
+
el: "#story",
template: $("#story .template").html(),
@@ -23,19 +25,19 @@ var StoryView = ScrollableView.extend({
},
populate: function(data){
+ if (this.loaded) { console.warn("populate called twice"); return }
+ this.loaded = true
this.data = data
this.$loader.hide()
this.$content.empty()
// id title image[uri caption] body
this.data.forEach(function(row){
var t = this.template.replace(/{{id}}/, row.id)
- .replace(/{{title}}/, row.title)
.replace(/{{body}}/, row.body.replace(/\n/g, "<br>"))
var li = document.createElement("li")
li.dataset.id = row.id
li.innerHTML = row.title
this.sections[row.id] = row
- //console.log("ok");
this.$links.append(li)
this.$content.append(t)
}.bind(this))
diff --git a/StoneIsland/www/js/lib/nav/NavView.js b/StoneIsland/www/js/lib/nav/NavView.js
index baa4df69..55865abb 100644
--- a/StoneIsland/www/js/lib/nav/NavView.js
+++ b/StoneIsland/www/js/lib/nav/NavView.js
@@ -11,6 +11,7 @@ var NavView = View.extend({
"click .archive": "archive",
"click .login": "login",
+ "click .account": "account",
"click .faq": "faq",
"click .search": "search",
@@ -74,15 +75,14 @@ var NavView = View.extend({
},
login: function(){
- if (auth.logged_in()) {
- this.el.className = "account"
- }
- else {
- this.hide()
- app.router.go("account/login")
- }
+ this.hide()
+ auth.last_view = app.view
+ app.router.go("account/login")
},
-
+ account: function(){
+ this.el.className = "account"
+ },
+
back: function(){
this.el.className = ""
},
diff --git a/StoneIsland/www/js/lib/products/ProductView.js b/StoneIsland/www/js/lib/products/ProductView.js
index 5fe1fe7b..84889db1 100644
--- a/StoneIsland/www/js/lib/products/ProductView.js
+++ b/StoneIsland/www/js/lib/products/ProductView.js
@@ -193,13 +193,14 @@ var ProductView = ScrollableView.extend({
save: function(){
// add to cart
if ( ! auth.logged_in() ) {
- auth.defer_add_to_cart = { size: this.size, code: this.code }
+ auth.deferred_product = { size: this.size, code: this.code }
}
else if ( ! auth.has_cart() ) {
auth.deferred_product = { size: this.size, code: this.code }
auth.create_cart(auth.defer_add_to_cart)
}
- else {
+ else {
+ // ADD TO CART!
}
},