summaryrefslogtreecommitdiff
path: root/public/assets/javascripts
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-01-28 11:49:10 -0500
committerJules Laplace <jules@okfoc.us>2015-01-28 11:49:10 -0500
commite3ff5315f7ea7421431658077253c4d71f0f5731 (patch)
tree62a06e26c77ca9454cc0535f39da698319713eac /public/assets/javascripts
parent79fee7f24d43873fc35295eab1d2a089d373e133 (diff)
parent3059c3203d2cec4e2e745be8c21c6d3fbddb0c14 (diff)
Merge branch 'subscriptions' of github.com:okfocus/vvalls into subscriptions
Diffstat (limited to 'public/assets/javascripts')
-rw-r--r--public/assets/javascripts/app.js4
-rw-r--r--public/assets/javascripts/mx/mx.js14
-rw-r--r--public/assets/javascripts/ui/_router.js10
-rw-r--r--public/assets/javascripts/ui/site/EditSubscriptionModal.js21
4 files changed, 41 insertions, 8 deletions
diff --git a/public/assets/javascripts/app.js b/public/assets/javascripts/app.js
index 41edafe..a146325 100644
--- a/public/assets/javascripts/app.js
+++ b/public/assets/javascripts/app.js
@@ -3,7 +3,7 @@ if (is_mobile) {
$("html").addClass("mobile")
}
else {
- $("html").addClass("desktop")
+ $("html").addClass("desktop")
}
@@ -23,6 +23,8 @@ app.launch = function () {
var movements
+ app.devicePixelRatio = is_mobile ? devicePixelRatio : 1
+
scene = new MX.Scene().addTo('#scene')
scene.width = window.innerWidth
scene.height = window.innerHeight
diff --git a/public/assets/javascripts/mx/mx.js b/public/assets/javascripts/mx/mx.js
index d59a551..ab9a9a0 100644
--- a/public/assets/javascripts/mx/mx.js
+++ b/public/assets/javascripts/mx/mx.js
@@ -162,24 +162,24 @@ var MX = MX || (function (undefined) {
Object.defineProperty(this, 'width', {
get: function () {
return width
- || parseInt(self.el.style.width*devicePixelRatio, 10)
+ || parseInt(self.el.style.width, 10) * app.devicePixelRatio
|| 0
},
set: function (val) {
width = val
- this.el.style.width = (width/devicePixelRatio) + 'px'
+ this.el.style.width = (width/app.devicePixelRatio) + 'px'
}
})
Object.defineProperty(this, 'height', {
get: function () {
return height
- || parseInt(self.el.style.height*devicePixelRatio, 10)
+ || parseInt(self.el.style.height, 10) * app.devicePixelRatio
|| 0
},
set: function (val) {
height = val
- this.el.style.height = (height/devicePixelRatio) + 'px'
+ this.el.style.height = (height/app.devicePixelRatio) + 'px'
}
})
}
@@ -302,9 +302,9 @@ var MX = MX || (function (undefined) {
+ (-this.y).toFixed(floatPrecision) + 'px,'
+ (-this.z).toFixed(floatPrecision) + 'px) '
+ 'scale3d('
- + (devicePixelRatio * this.scaleX).toFixed(floatPrecision) + ','
- + (devicePixelRatio * this.scaleY).toFixed(floatPrecision) + ','
- + (devicePixelRatio * this.scaleZ).toFixed(floatPrecision) + ') '
+ + (app.devicePixelRatio * this.scaleX).toFixed(floatPrecision) + ','
+ + (app.devicePixelRatio * this.scaleY).toFixed(floatPrecision) + ','
+ + (app.devicePixelRatio * this.scaleZ).toFixed(floatPrecision) + ') '
if (rotationTranslation) {
transformString += rotationTranslation.before
diff --git a/public/assets/javascripts/ui/_router.js b/public/assets/javascripts/ui/_router.js
index 3532428..9e7ce75 100644
--- a/public/assets/javascripts/ui/_router.js
+++ b/public/assets/javascripts/ui/_router.js
@@ -9,6 +9,7 @@ var SiteRouter = Router.extend({
"click [data-role='new-project-modal']": 'newProject',
"click [data-role='edit-project-modal']": 'editProject',
"click [data-role='edit-profile-modal']": 'editProfile',
+ "click [data-role='edit-subscription-modal']": 'editSubscription',
"click [data-role='new-document-modal']": 'newDocument',
"click [data-role='edit-document-modal']": 'editDocument',
"click [data-role='destroy-document-modal']": 'destroyDocument',
@@ -29,6 +30,7 @@ var SiteRouter = Router.extend({
"/profile": 'profile',
"/profile/edit": 'editProfile',
+ "/profile/billing": 'editSubscription',
"/profile/:name": 'profile',
"/about/:name/edit": 'editDocument',
"/about/new": 'newDocument',
@@ -56,6 +58,7 @@ var SiteRouter = Router.extend({
"/profile": 'profile',
"/profile/edit": 'editProfile',
+ "/profile/billing": 'editSubscription',
"/profile/:name": 'profile',
"/project/:name": 'projectViewer',
@@ -69,6 +72,7 @@ var SiteRouter = Router.extend({
this.newProjectModal = new NewProjectModal()
this.editProjectModal = new EditProjectModal()
this.editProfileModal = new EditProfileModal()
+ this.editSubscriptionModal = new EditSubscriptionModal()
this.passwordForgotModal = new PasswordForgot()
this.documentModal = new DocumentModal()
this.profileView = new ProfileView()
@@ -195,6 +199,12 @@ var SiteRouter = Router.extend({
this.editProfileModal.load()
},
+ editSubscription: function(e){
+ e && e.preventDefault()
+ window.history.pushState(null, document.title, "/profile/billing")
+
+ this.editSubscriptionModal.load()
+ },
newDocument: function(e){
diff --git a/public/assets/javascripts/ui/site/EditSubscriptionModal.js b/public/assets/javascripts/ui/site/EditSubscriptionModal.js
new file mode 100644
index 0000000..1b3b859
--- /dev/null
+++ b/public/assets/javascripts/ui/site/EditSubscriptionModal.js
@@ -0,0 +1,21 @@
+
+var EditSubscriptionModal = ModalFormView.extend({
+ el: ".mediaDrawer.editSubscription",
+ action: "/api/subscription",
+ method: "put",
+
+ fixedClose: true,
+
+ events: {
+ "click [data-role='changePasswordToggle']": 'togglePasswordFields'
+ },
+
+ load: function(){
+ this.reset()
+ $.get("/api/subscription", function(data){
+
+ this.show()
+ }.bind(this))
+ },
+
+})