diff options
| author | ryderr <r@okfoc.us> | 2014-10-29 13:36:03 -0400 |
|---|---|---|
| committer | ryderr <r@okfoc.us> | 2014-10-29 13:36:03 -0400 |
| commit | 2757e9b2d7d21228165fcdedd214ecb725fa43d7 (patch) | |
| tree | b5fa18d4ba7a2cd917d49b3c17bee5a30707e7ce | |
| parent | 4e159d6b08512cd9a2370763ef296bd0111baf7f (diff) | |
| parent | 503c1eb313d01d3a73fac1e31b774749893b55d4 (diff) | |
Merge branch 'master' of github.com:okfocus/vvalls
| -rw-r--r-- | public/assets/javascripts/ui/_router.js | 26 | ||||
| -rw-r--r-- | public/assets/javascripts/ui/editor/ColorControl.js | 2 | ||||
| -rw-r--r-- | public/assets/javascripts/ui/reader/ReaderView.js | 1 | ||||
| -rw-r--r-- | public/assets/javascripts/ui/reader/ShareView.js | 27 | ||||
| -rw-r--r-- | public/assets/javascripts/ui/z_share.js | 25 | ||||
| -rw-r--r-- | server/lib/middleware.js | 7 | ||||
| -rw-r--r-- | server/lib/views/index.js | 10 | ||||
| -rw-r--r-- | views/controls/reader/about-room.ejs | 10 | ||||
| -rw-r--r-- | views/partials/meta.ejs | 18 | ||||
| -rw-r--r-- | views/partials/scripts.ejs | 1 | ||||
| -rw-r--r-- | views/projects/list-projects.ejs | 1 |
11 files changed, 58 insertions, 70 deletions
diff --git a/public/assets/javascripts/ui/_router.js b/public/assets/javascripts/ui/_router.js index c7b625a..0c95664 100644 --- a/public/assets/javascripts/ui/_router.js +++ b/public/assets/javascripts/ui/_router.js @@ -40,8 +40,6 @@ var SiteRouter = Router.extend({ "/project/:name": 'projectViewer', "/project/:name/edit": 'projectEditor', "/project/:name/view": 'projectViewer', - - "/test/wallpaper": 'testWallpaper', }, mobileRoutes: { @@ -213,29 +211,5 @@ var SiteRouter = Router.extend({ // this.documentModal.destroy(name) }, - testWallpaper: function(e){ - var content = document.getElementById("content") - content.style.width = "680px" - content.style.margin = "0 auto" - var wm = new WallpaperManager() - app.on('wallpaper-ready', function(){ - var black = [0,0,0,0] - var white = [255,255,255,1.0] - var swatches = wm.buildSwatches(black, white, 4) - document.body.style.backgroundColor = "#eee" - swatches.forEach(function(swatch){ - swatch.style.margin = "4px" - swatch.style.border = "1px solid lime" - swatch.style.backgroundColor = "#888" - content.appendChild(swatch) - swatch.onclick = function(){ - dataUrl = swatch.toDataURL() - document.body.style.backgroundImage = "url(" + dataUrl + ")" - } - }) - }) - wm.init() - }, - }) diff --git a/public/assets/javascripts/ui/editor/ColorControl.js b/public/assets/javascripts/ui/editor/ColorControl.js index 72e9fb1..d1a8c7b 100644 --- a/public/assets/javascripts/ui/editor/ColorControl.js +++ b/public/assets/javascripts/ui/editor/ColorControl.js @@ -101,7 +101,7 @@ var ColorControl = View.extend({ initialState: null, - begin: function(){ + begin: function(){ this.initialState = this.serialize() }, diff --git a/public/assets/javascripts/ui/reader/ReaderView.js b/public/assets/javascripts/ui/reader/ReaderView.js index 8531244..c132609 100644 --- a/public/assets/javascripts/ui/reader/ReaderView.js +++ b/public/assets/javascripts/ui/reader/ReaderView.js @@ -9,6 +9,7 @@ var ReaderView = View.extend({ initialize: function(){ this.mediaPlayer = new MediaPlayer ({ parent: this }) + this.shareView = new ShareView ({ parent: this }) }, load: function(name){ diff --git a/public/assets/javascripts/ui/reader/ShareView.js b/public/assets/javascripts/ui/reader/ShareView.js new file mode 100644 index 0000000..35c23ca --- /dev/null +++ b/public/assets/javascripts/ui/reader/ShareView.js @@ -0,0 +1,27 @@ +var ShareView = View.extend({ + el: ".share", + + events: { + "click #share_facebook": "facebook", + "click #share_twitter": "twitter", + }, + + initialize: function(opt){ + this.parent = opt.parent + }, + + 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); + 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); + window.open(url, "_blank") + } + +}) diff --git a/public/assets/javascripts/ui/z_share.js b/public/assets/javascripts/ui/z_share.js deleted file mode 100644 index d31aa89..0000000 --- a/public/assets/javascripts/ui/z_share.js +++ /dev/null @@ -1,25 +0,0 @@ -var share = { - init: function(){ - share.bind() - }, - bind: function(){ - $("#facebook").click(share.facebook) - $("#twitter").click(share.twitter) - }, - url: "http://vvalls.com/", - facebook_msg: "", - twitter_msg: "", - openLink: function (url) { - window.open(url, "_blank"); - }, - facebook: function () { - var url = "https://www.facebook.com/share.php?u=" + encodeURIComponent(share.url) + "&t=" + encodeURIComponent(share.facebook_msg); - share.openLink(url); - return false; - }, - twitter: function () { - var url = "https://twitter.com/home?status=" + encodeURIComponent(share.url + " " + share.twitter_msg); - share.openLink(url); - return false; - } -} diff --git a/server/lib/middleware.js b/server/lib/middleware.js index 0bf16ce..870451a 100644 --- a/server/lib/middleware.js +++ b/server/lib/middleware.js @@ -40,10 +40,15 @@ var middleware = { res.locals.user = req.user || { _id: undefined } res.locals.config = config res.locals.profile = null + res.locals.ogImage = "" + res.locals.ogTitle = "Vvalls" + res.locals.ogUrl = "http://vvalls.com/" + res.locals.ogDescription = "3D gallery space, fully customizable" + res.locals.ogAuthor = "Vvalls" res.locals.opt = {} next() }, - + ensureProject: function (req, res, next) { if (req.params.slug) { Project.findOne({ slug: req.params.slug }, function(err, project){ diff --git a/server/lib/views/index.js b/server/lib/views/index.js index 5768ace..0b5a1fe 100644 --- a/server/lib/views/index.js +++ b/server/lib/views/index.js @@ -56,6 +56,10 @@ var views = module.exports = { res.redirect('/') return } + var ogImage + if (req.project.media.length && req.project.media[0].media.type == "image") { + ogImage = req.project.media[0].media.url + } res.render('reader', { name: util.sanitize(req.project.name), description: util.sanitize(req.project.description), @@ -65,6 +69,9 @@ var views = module.exports = { canEdit: req.isOwner || req.isCollaborator, editlink: "/project/" + req.project.slug + "/edit", noui: !! (req.query.noui === '1'), + ogTitle: req.project.name, + ogUrl: "http://vvalls.com/project/" + req.project.slug + "/", + ogImage: ogImage, }) }) }, @@ -159,6 +166,9 @@ var views = module.exports = { isOwnProfile: isOwnProfile, profile: user, projects: projects || [], + ogTitle: "Vvalls: Profile of " + user.displayName, + ogUrl: "http://vvalls.com/profile/" + user.username + "/", + ogImage: user.photo, }) } }, diff --git a/views/controls/reader/about-room.ejs b/views/controls/reader/about-room.ejs index c0ca9f7..c9ad626 100644 --- a/views/controls/reader/about-room.ejs +++ b/views/controls/reader/about-room.ejs @@ -1,7 +1,7 @@ <div class="aboutRoom vvbox"> <h1> - [[- name ]], - <a href="[[- authorlink ]]">[[- author ]]</a> + <span class="roomName">[[- name ]]</span>, + <a href="[[- authorlink ]]" class="authorName">[[- author ]]</a> </h1> [[ if (description) { ]] <span class="txt">[[- description ]]</span> @@ -11,13 +11,11 @@ <div class="share"> <h2>Share on–</h2> - <a href="#">Facebook</a> - <a href="#">Twitter</a> + <a id="share_facebook">Facebook</a> + <a id="share_twitter">Twitter</a> </div> [[ if (canEdit) { ]] <a href="[[- editlink ]]" class="btn warn marg">Edit Room</a> [[ } ]] </div> - - diff --git a/views/partials/meta.ejs b/views/partials/meta.ejs index 6ff45cb..c50fc01 100644 --- a/views/partials/meta.ejs +++ b/views/partials/meta.ejs @@ -18,16 +18,14 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> - <meta name="keywords" content=""/> - <meta name="description" content="" /> - <meta name="author" content="" /> - <link rel="shortcut icon" href="/favicon.ico"/> - <meta property="og:title" content=""/> - <meta property="og:type" content="website"/> - <meta property="og:image" content="" /> - <link rel="image_src" href=""/> - <meta property="og:url" content=""/> - <meta property="og:site_name" content="" /> + <meta name="description" content="[[- ogDescription ]]" /> + <meta name="author" content="[[- ogAuthor ]]" /> + <link rel="shortcut icon" href="/favicon.ico" /> + <meta property="og:title" content="[[- ogTitle ]]" /> + <meta property="og:type" content="website" /> + <meta property="og:image" content="[[- ogImage ]]" /> + <meta property="og:url" content="[[- ogUrl ]]" /> + <meta property="og:site_name" content="Vvalls" /> <link rel="icon" href="/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"> <link href='/assets/stylesheets/ionicons.css' rel='stylesheet' type='text/css'> diff --git a/views/partials/scripts.ejs b/views/partials/scripts.ejs index 0373a3e..af16099 100644 --- a/views/partials/scripts.ejs +++ b/views/partials/scripts.ejs @@ -114,6 +114,7 @@ <script type="text/javascript" src="/assets/javascripts/ui/editor/WallpaperPicker.js"></script> <script type="text/javascript" src="/assets/javascripts/ui/reader/ReaderView.js"></script> +<script type="text/javascript" src="/assets/javascripts/ui/reader/ShareView.js"></script> <script type="text/javascript" src="/assets/javascripts/ui/reader/MediaPlayer.js"></script> <script type="text/javascript" src="/assets/javascripts/ui/reader/Tracker.js"></script> diff --git a/views/projects/list-projects.ejs b/views/projects/list-projects.ejs index 5ecaec1..2749b0e 100644 --- a/views/projects/list-projects.ejs +++ b/views/projects/list-projects.ejs @@ -9,7 +9,6 @@ [[ } else { ]] <a href="/project/[[- project.slug ]]" class="projectItem" data-userid="[[- project.user_id ]]"> [[ } ]] - <span class="room" style="background-color: rgb([[- project.color ]]);"> <span class="mask" style="background-image: url([[- project.photo ]]);"> </span> |
