summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-11-06 15:48:27 -0500
committerJules Laplace <jules@okfoc.us>2014-11-06 15:48:27 -0500
commite6cac4737904750a80173ba8e7745d2b41370bd6 (patch)
treea836b464dde30d3fec307d32737b91569a224706
parent69cf6a5005dcd0e7fcebcc1db9bd290b5fb63ed1 (diff)
share vvbox comes up when clicking save
-rw-r--r--public/assets/javascripts/ui/editor/EditorSettings.js10
-rw-r--r--public/assets/javascripts/ui/editor/EditorView.js4
-rw-r--r--public/assets/javascripts/ui/reader/ReaderView.js1
-rw-r--r--public/assets/javascripts/ui/reader/ShareView.js38
-rwxr-xr-xpublic/assets/stylesheets/app.css34
-rw-r--r--views/controls/editor/collaborators.ejs57
-rw-r--r--views/controls/editor/share.ejs19
-rwxr-xr-xviews/editor.ejs1
8 files changed, 116 insertions, 48 deletions
diff --git a/public/assets/javascripts/ui/editor/EditorSettings.js b/public/assets/javascripts/ui/editor/EditorSettings.js
index 2b29961..026607a 100644
--- a/public/assets/javascripts/ui/editor/EditorSettings.js
+++ b/public/assets/javascripts/ui/editor/EditorSettings.js
@@ -110,7 +110,6 @@ var EditorSettings = FormView.extend({
clear: function(e){
e.preventDefault()
-
Scenery.removeAll()
},
@@ -215,6 +214,7 @@ var EditorSettings = FormView.extend({
clickSave: function(){
this.toggle(false)
this.save()
+ this.isVisible = true
},
success: function(data){
@@ -226,7 +226,13 @@ var EditorSettings = FormView.extend({
Minotaur.hide()
window.history.pushState(null, document.title, "/project/" + data.slug + "/edit")
-
+
+ this.parent.share.setLink( "http://vvalls.com/project/" + data.slug )
+ if (this.isVisible) {
+ this.isVisible = false
+ this.parent.share.show()
+ }
+
this.parent.data = data
},
diff --git a/public/assets/javascripts/ui/editor/EditorView.js b/public/assets/javascripts/ui/editor/EditorView.js
index 2872ab9..3773366 100644
--- a/public/assets/javascripts/ui/editor/EditorView.js
+++ b/public/assets/javascripts/ui/editor/EditorView.js
@@ -21,6 +21,7 @@ var EditorView = View.extend({
this.textEditor = new TextEditor ({ parent: this })
this.collaborators = new Collaborators ({ parent: this })
this.presets = new Presets ({ parent: this })
+ this.share = new ShareView ({ parent: this })
},
load: function(name){
@@ -41,6 +42,8 @@ var EditorView = View.extend({
ready: function(data){
$("#map").hide()
+ this.data = data
+
this.settings.load(data)
this.info.load(data)
},
@@ -70,6 +73,7 @@ var EditorView = View.extend({
hideExtras: function(){
this.mediaEditor.hide()
this.textEditor.hide()
+ this.share.hide()
Scenery.resize.hide()
Scenery.hovering = false
}
diff --git a/public/assets/javascripts/ui/reader/ReaderView.js b/public/assets/javascripts/ui/reader/ReaderView.js
index c132609..9e0d21e 100644
--- a/public/assets/javascripts/ui/reader/ReaderView.js
+++ b/public/assets/javascripts/ui/reader/ReaderView.js
@@ -29,6 +29,7 @@ var ReaderView = View.extend({
ready: function(data){
$("#map").hide()
+ this.data = data
data.rooms && Rooms.deserialize(data.rooms)
data.walls && Walls.deserialize(data.walls)
data.media && Scenery.deserialize(data.media)
diff --git a/public/assets/javascripts/ui/reader/ShareView.js b/public/assets/javascripts/ui/reader/ShareView.js
index 4e5f832..8a205ba 100644
--- a/public/assets/javascripts/ui/reader/ShareView.js
+++ b/public/assets/javascripts/ui/reader/ShareView.js
@@ -2,31 +2,59 @@ var ShareView = View.extend({
el: ".share",
events: {
+ "keydown": "stopPropagation",
"click #share_facebook": "facebook",
"click #share_twitter": "twitter",
+ "click #share_embed": "embed",
},
initialize: function(opt){
this.parent = opt.parent
+ this.$link = this.$("#share_link")
+ },
+
+ toggle: function(state){
+ if (typeof state == "boolean") {
+ this.$el.toggleClass("active", state)
+ }
+ else {
+ this.$el.toggleClass("active")
+ }
+ },
+ show: function(){
+ this.toggle(true)
+ },
+ hide: function(){
+ this.toggle(false)
+ },
+
+ setLink: function(url){
+ this.$link.val( url )
+ },
+ getLink: function(){
+ var link = window.location.origin + window.location.pathname
+ link = link.replace(/\/edit\/?$/, "")
+ return link
},
facebook: function (e) {
e.preventDefault()
- var msg = $(".roomName").html() + " on VValls"
- var url = "https://www.facebook.com/share.php?u=" + encodeURIComponent(window.location.origin + window.location.pathname) + "&t=" + encodeURIComponent(msg);
+ var link = this.getLink()
+ var msg = app.controller.data.name + " on VValls"
+ var url = "https://www.facebook.com/share.php?u=" + encodeURIComponent(link) + "&t=" + encodeURIComponent(msg)
window.open(url, "_blank")
},
twitter: function (e) {
e.preventDefault()
- var msg = $(".roomName").html() + " on VValls"
- var url = "https://twitter.com/home?status=" + encodeURIComponent(window.location.origin + window.location.pathname + " " + msg);
+ var link = this.getLink()
+ var msg = app.controller.data.name + " on VValls"
+ var url = "https://twitter.com/home?status=" + encodeURIComponent(link + " " + msg)
window.open(url, "_blank")
},
embed: function (e) {
e.preventDefault()
-
},
})
diff --git a/public/assets/stylesheets/app.css b/public/assets/stylesheets/app.css
index 90454be..3fe9741 100755
--- a/public/assets/stylesheets/app.css
+++ b/public/assets/stylesheets/app.css
@@ -2544,13 +2544,25 @@ a[data-role="forgot-password"] {
text-decoration: none;
font-size: 12px;
font-weight: 600;
+ cursor: pointer;
}
-.share a:nth-child(3){
+.share a:nth-child(3), .share a:nth-child(4) {
margin-left:4px;
}
.share a:hover{
text-decoration:underline;
}
+.vvbox.share {
+ width: 300px
+}
+.vvbox.share #share_link {
+ width: 100%;
+ margin-top: 4px;
+ padding: 3px;
+ font-weight: 300;
+ font-size: 11px;
+}
+
/* COLLABORATORS */
@@ -2639,6 +2651,26 @@ a[data-role="forgot-password"] {
font-weight: 300;
font-style: italic;
}
+#collaborator-url-rapper {
+ display: none;
+ background: #fff;
+ border: 1px solid;
+ box-shadow: -3px 3px 0;
+ padding: 10px;
+ font-weight: 300;
+ font-size: 14px;
+ margin: 10px 0;
+}
+#collaborator-url {
+ font-size: 16px;
+ width: 500px;
+ border: 1px solid;
+ font-size: 14px;
+ padding: 5px;
+ font-weight: 300;
+ margin-top: 5px;
+ display: block;
+}
/* MARCHING ANTS ANIMATION */
diff --git a/views/controls/editor/collaborators.ejs b/views/controls/editor/collaborators.ejs
index b658bf6..8ad8c00 100644
--- a/views/controls/editor/collaborators.ejs
+++ b/views/controls/editor/collaborators.ejs
@@ -4,29 +4,29 @@
<div class="rap">
<div class="holder">
<div class="inner vvbox">
- <h2>Collaborators</h2>
+ <h2>Collaborators</h2>
- <p>
- To invite others to contribute to this project, submit their email address below. They'll receive an email with instructions to join this blog and register if they're not a Vvalls user yet.
- </p>
+ <p>
+ To invite others to contribute to this project, submit their email address below. They'll receive an email with instructions to join this project and register if they're not a Vvalls user yet.
+ </p>
- <form>
- <input type="text" id="collaborator-email" name="email">
- <input type="submit" id="collaborator-invite" value="Invite to this project">
- </form>
+ <form>
+ <input type="text" id="collaborator-email" name="email">
+ <input type="submit" id="collaborator-invite" value="Invite to this project">
+ </form>
- <div id="collaborator-url-rapper">
- We've sent a link to join this project to <span id="collaborator-dummy-email"></span>.
- You can also send this link yourself:
- <input type="text" id="collaborator-url">
- </div>
+ <div id="collaborator-url-rapper">
+ We've sent a link to join this project to <span id="collaborator-dummy-email"></span>.
+ You can also send this link yourself:
+ <input type="text" id="collaborator-url">
+ </div>
- <ul id="collaborator-list">
- </ul>
- </div>
+ <ul id="collaborator-list">
+ </ul>
+ </div>
+ </div>
</div>
</div>
-</div>
<script type="text/html" id="collaborator-template">
<li>
@@ -38,26 +38,3 @@
<span class="role">owner</span>
</li>
</script>
-
-<style>
-#collaborator-url-rapper {
- display: none;
- background: #fff;
- border: 1px solid;
- box-shadow: -3px 3px 0;
- padding: 10px;
- font-weight: 300;
- font-size: 14px;
- margin: 10px 0;
-}
-#collaborator-url {
- font-size: 16px;
- width: 500px;
- border: 1px solid;
- font-size: 14px;
- padding: 5px;
- font-weight: 300;
- margin-top: 5px;
- display: block;
-}
-</style>
diff --git a/views/controls/editor/share.ejs b/views/controls/editor/share.ejs
new file mode 100644
index 0000000..97f4ceb
--- /dev/null
+++ b/views/controls/editor/share.ejs
@@ -0,0 +1,19 @@
+<div class="vvbox settings share">
+ <h4>Project Saved</h4>
+
+ <div class="setting">
+ <h2>Share on–</h2>
+ <a id="share_facebook">Facebook</a>
+ <a id="share_twitter">Twitter</a>
+ <a id="share_embed">Embed</a>
+ </div>
+
+ <div class="setting">
+ Send people this link:
+ <input type="text" id="share_link">
+ </div>
+
+</div>
+
+<style>
+</style> \ No newline at end of file
diff --git a/views/editor.ejs b/views/editor.ejs
index 29db917..b031759 100755
--- a/views/editor.ejs
+++ b/views/editor.ejs
@@ -20,6 +20,7 @@
[[ include controls/editor/color-control ]]
[[ include controls/editor/text-editor ]]
[[ include controls/editor/collaborators ]]
+ [[ include controls/editor/share ]]
[[ include controls/editor/settings ]]
[[ include controls/editor/presets ]]
</div>