From 3186e667a23c1dda5a184f3dc9c951782c9307a9 Mon Sep 17 00:00:00 2001
From: bill bittner
Date: Wed, 5 Jul 2017 23:22:47 -0700
Subject: [PATCH] redirect on publish is working
---
public/assets/css/allStyle.css | 8 ++++++--
public/assets/css/componentStyle.css | 20 +++++++++++++++-----
public/assets/js/claimPublish.js | 23 +++--------------------
routes/serve-routes.js | 7 ++++---
views/partials/asset.handlebars | 5 +++--
views/partials/assetLinks.handlebars | 11 ++++++++++-
views/partials/assetMetadata.handlebars | 19 ++++++++++++++++++-
7 files changed, 59 insertions(+), 34 deletions(-)
diff --git a/public/assets/css/allStyle.css b/public/assets/css/allStyle.css
index cb258dea..7360bb7c 100644
--- a/public/assets/css/allStyle.css
+++ b/public/assets/css/allStyle.css
@@ -14,7 +14,7 @@
.main {
float: left;
- width: 75%;
+ width: 65%;
margin-right: 1%;
padding-right: 1%;
border-right: 1px lightgrey solid;
@@ -23,7 +23,7 @@
.sidebar {
float: left;
- width: 22%;
+ width: 32%;
}
footer {
@@ -105,6 +105,10 @@ table {
float: right;
}
+.wrap-words {
+ word-wrap: break-word;
+}
+
@media (max-width: 1250px) {
.wrapper {
diff --git a/public/assets/css/componentStyle.css b/public/assets/css/componentStyle.css
index 2f09f62f..06864bcb 100644
--- a/public/assets/css/componentStyle.css
+++ b/public/assets/css/componentStyle.css
@@ -16,7 +16,16 @@
.show-image, .show-video {
width: 100%;
- padding-top: 1em;
+}
+
+.table-metadata {
+ font-size: small;
+}
+
+.left-column {
+ width: 30%;
+ font-weight: bold;
+ vertical-align: top;
}
/* learn more */
@@ -37,16 +46,17 @@
.example-image, .example-code {
float: left;
- margin: 5px 15px 5px 0px;
+ margin: 2%;
}
.example-image {
- width: 20%;
+ width: 21%;
}
.example-code {
- padding: 2em;
- width: 60%;
+ float: right;
+ padding: 4%;
+ width: 62%;
background-color: lightgrey;
font-family: monospace;
color: #666;
diff --git a/public/assets/js/claimPublish.js b/public/assets/js/claimPublish.js
index e43424aa..22021a82 100644
--- a/public/assets/js/claimPublish.js
+++ b/public/assets/js/claimPublish.js
@@ -168,26 +168,9 @@ socket.on('publish-complete', function(msg){
var publishResults;
var directUrl = '/' + msg.name + '/' + msg.result.claim_id;
// build new publish area
- publishResults = 'Your publish is complete! View it here:
';
- publishResults += 'spee.ch' + directUrl + '
';
- publishResults += 'Copy to clipboard
';
- publishResults += 'View the transaction details
';
- publishResults += 'Reload
';
+ publishResults = 'Your publish is complete! You are being redicted to it
';
+ publishResults += 'if you do not get redirected, click here
';
// update publish area
document.getElementById('publish-active-area').innerHTML = publishResults;
- // update the link holder
- document.getElementById('direct-link-holder').innerText = 'https://spee.ch' + directUrl;
- // enable copy-to-clipboard
- var copyBtn = document.querySelector('.copy-button');
- copyBtn.addEventListener('click', function(event) {
- // select the text
- var text = document.getElementById('direct-link-holder');
- text.select();
- try {
- var successful = document.execCommand('copy');
- var msg = successful ? 'successful' : 'unsuccessful';
- } catch (err) {
- alert('Oops, unable to copy');
- }
- });
+ window.location.href = directUrl;
});
\ No newline at end of file
diff --git a/routes/serve-routes.js b/routes/serve-routes.js
index e9333814..558f3d5e 100644
--- a/routes/serve-routes.js
+++ b/routes/serve-routes.js
@@ -31,10 +31,10 @@ function serveFile ({ fileName, fileType, filePath }, res) {
res.status(200).sendFile(filePath, options);
}
-function servePage ({ fileName, filePath }, res) {
- logger.debug(`serving show page for ${fileName}`);
+function servePage (fileInfo, res) {
+ logger.debug(`serving show page for ${fileInfo.fileName}`);
// set default options
- res.status(200).render('show', { filePath });
+ res.status(200).render('show', { fileInfo });
}
function sendAnalyticsAndLog (headers, ip, originalUrl) {
@@ -61,6 +61,7 @@ module.exports = (app) => {
const mimetypes = headers['accept'].split(',');
if (mimetypes.includes('text/html')) {
postToStats('show', originalUrl, ip, 'success');
+ logger.debug('fileInfo', fileInfo);
servePage(fileInfo, res);
} else {
postToStats('serve', originalUrl, ip, 'success');
diff --git a/views/partials/asset.handlebars b/views/partials/asset.handlebars
index 85be4b89..4a475f8d 100644
--- a/views/partials/asset.handlebars
+++ b/views/partials/asset.handlebars
@@ -1,6 +1,7 @@
-
-
video loading...
+
{{fileInfo.name}}
+
diff --git a/views/partials/assetLinks.handlebars b/views/partials/assetLinks.handlebars
index 99ad20c4..378fd893 100644
--- a/views/partials/assetLinks.handlebars
+++ b/views/partials/assetLinks.handlebars
@@ -1,4 +1,13 @@
\ No newline at end of file
diff --git a/views/partials/assetMetadata.handlebars b/views/partials/assetMetadata.handlebars
index 6dd584d1..e0a60fd1 100644
--- a/views/partials/assetMetadata.handlebars
+++ b/views/partials/assetMetadata.handlebars
@@ -1,4 +1,21 @@
metadata
-
metadata goes here
+
\ No newline at end of file