Permalink
Browse files

fix saving issues #112

  • Loading branch information...
enjalot committed Nov 2, 2013
1 parent 16f9248 commit a23461ee28143e02af37162203355d1bc1deedbf
Showing with 40 additions and 41 deletions.
  1. +2 −2 server.js
  2. +5 −4 src/ui/ui.js
  3. +0 −2 static/css/style.css
  4. +1 −0 static/header.js
  5. +6 −7 static/tributary-ui.js
  6. +11 −10 static/tributary-ui.min.js
  7. +15 −16 static/tributary.min.js
View
@@ -152,6 +152,7 @@ function save_endpoint(req,res,next) {
var data = req.body.gist;
var token = req.session.access_token;
var gistid = req.params['gistid'];
+ console.log("SAVING", gistid);
save(gistid, data, token, function(err, response) {
if(!err) {
//post save
@@ -176,6 +177,7 @@ function fork_endpoint(req,res,next) {
var token = req.session.access_token;
var user = req.session.user;
var gistid = req.params['gistid'];
+ console.log("FORKING", gistid);
//get the user of this gist
if(!gistid || !user) {
@@ -217,7 +219,6 @@ function fork_endpoint(req,res,next) {
function onResponse(err, response) {
if(!err) {
//post fork. but only if user is authenticated
- console.log("after fork");
after_fork(oldgist, response, token, function(error, newgist) {
if(!error) {
return res.send(newgist);
@@ -681,7 +682,6 @@ function api_users(req,res,next) {
}
var sort = {}
sort[sortBy] = ascdsc
- console.log("SORT", sort)
//TODO: make sure this is secure in the future
$users.find(query, fields, opts).sort(sort).toArray(function(err, users) {
if(err) res.send(err);
View
@@ -31,13 +31,14 @@ if(window) {
//tributary.loadGist(data.gist, _assemble);
} else if(data.request === "save") {
//postMessage the host frame with the tributary.context information
- //get screenshot
+ //TODO: should be a way to auto-screenshot on save if we want it. now it will lose the race for saving.
+ //people who save more than once will take a screenshot. can always manually take a screen too
if(!tributary.__config__.get("thumbnail")) {
tributary._screenshot();
- } else {
- var json = serializeGist();
- event.source.postMessage({request: "save", config: json, salt: data.salt}, event.origin)
}
+ var json = serializeGist();
+ event.source.postMessage({request: "save", config: json, salt: data.salt}, event.origin)
+
} else if(data.request === "description") {
//update the gist's description
tributary.__config__.set("description", data.description);
View
@@ -566,8 +566,6 @@ px 68 160 252 344 436 528 620 712 804 896 */
/*background-color: #ffffff;*/
- /*background-color: #ffffff;*/
-
background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0)), to(rgba(66, 66, 66, 0.6)));
background-image: -webkit-linear-gradient(top, rgba(255, 255, 255, 0), rgba(66, 66, 66, 0.6));
background-image: -moz-linear-gradient(top, rgba(255, 255, 255, 0), rgba(66, 66, 66, 0.6));
View
@@ -1,6 +1,7 @@
(function(){
//Get a reference to our iframe window so we can postMessage to it
var sandbox = d3.select("#sandbox").node().contentWindow;
+ var saveType;
var _origin = header.origin;
View
@@ -26,14 +26,13 @@ TributaryUi = function(tributary) {
} else if (data.request === "save") {
if (!tributary.__config__.get("thumbnail")) {
tributary._screenshot();
- } else {
- var json = serializeGist();
- event.source.postMessage({
- request: "save",
- config: json,
- salt: data.salt
- }, event.origin);
}
+ var json = serializeGist();
+ event.source.postMessage({
+ request: "save",
+ config: json,
+ salt: data.salt
+ }, event.origin);
} else if (data.request === "description") {
tributary.__config__.set("description", data.description);
} else if (data.request === "exitfullscreen") {
View
@@ -1,5 +1,5 @@
-;(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
-// Backbone.js 1.0.0
+;(function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0].call(u.exports,function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s<n.length;s++)i(n[s]);return i})({1:[function(require,module,exports){
+(function(){// Backbone.js 1.0.0
// (c) 2010-2013 Jeremy Ashkenas, DocumentCloud Inc.
// Backbone may be freely distributed under the MIT license.
@@ -1571,8 +1571,9 @@
}).call(this);
+})()
},{"underscore":2}],2:[function(require,module,exports){
-// Underscore.js 1.4.4
+(function(){// Underscore.js 1.4.4
// http://underscorejs.org
// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
// Underscore may be freely distributed under the MIT license.
@@ -2799,6 +2800,7 @@
}).call(this);
+})()
},{}],3:[function(require,module,exports){
var Backbone = require("backbone");
@@ -2828,14 +2830,13 @@ TributaryUi = function(tributary) {
} else if (data.request === "save") {
if (!tributary.__config__.get("thumbnail")) {
tributary._screenshot();
- } else {
- var json = serializeGist();
- event.source.postMessage({
- request: "save",
- config: json,
- salt: data.salt
- }, event.origin);
}
+ var json = serializeGist();
+ event.source.postMessage({
+ request: "save",
+ config: json,
+ salt: data.salt
+ }, event.origin);
} else if (data.request === "description") {
tributary.__config__.set("description", data.description);
} else if (data.request === "exitfullscreen") {
View

Large diffs are not rendered by default.

Oops, something went wrong.

0 comments on commit a23461e

Please sign in to comment.