Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
feat(ui): Add navigation bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Einaudi authored and arnaudruffin committed Dec 14, 2016
1 parent af1a720 commit 51daa26
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 34 deletions.
73 changes: 45 additions & 28 deletions client/jdropit-send.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,34 +84,7 @@ SenderHandler.prototype = {


this.socket.on('server_receiver_ready', function (receiverId) {
$('#copyLinkContainer').hide();
$('#transfertMessage').html("Transfer in progress...");

//init container
var transferContainer = $('#transferContainer');
transferContainer.show();

var rowReceiverTemplate = $("#rowReceiverTemplate");
var newRow = rowReceiverTemplate.clone();
newRow.removeAttr("id");
newRow.show();
var linkRemove = newRow.find(".icon-delete");
linkRemove.on("click", function (e) {
e.preventDefault();
newRow.hide();
});
linkRemove.tooltip();

var pbContainer = newRow.children(".col-xs-7");
var transferProgressBar = pbContainer.find("progress");
var displayProgressBar = pbContainer.find(".text-xs-center");
displayProgressBar.attr("id", "progress-"+receiverId);
transferProgressBar.attr("aria-describedby", "progress-"+receiverId);
transferContainer.append(newRow);
that.receiverInfos[receiverId] = new ReceiverInfo(pbContainer, transferProgressBar, displayProgressBar, linkRemove);

that.startUpload(receiverId);

that.receiverIsReady(receiverId);
});


Expand All @@ -138,6 +111,18 @@ SenderHandler.prototype = {
});
},

setNavigationStep: function(step) {
$(".o-stepbar > ol > li").each(function (idx) {
if(step > idx) {
$(this).removeClass("current");
$(this).addClass("done");
}
else if(step == idx){
$(this).addClass("current");
}
});
},

fileIsReady: function (fileToTransfert) {
var sizeDisplay = fileToTransfert.size > (1024 * 1024) ? Math.round(fileToTransfert.size / 1024 / 1024) + " Mo" :
fileToTransfert.size > 1024 ? Math.round(fileToTransfert.size / 1024) + " Ko" : fileToTransfert.size + " o";
Expand All @@ -153,6 +138,38 @@ SenderHandler.prototype = {
$('#copyLinkContainer').show(500);
$('#warning-window').show(500);
$('#selectFileContainer').hide(500);
this.setNavigationStep(1);
},

receiverIsReady: function(receiverId) {
$('#copyLinkContainer').hide();
this.setNavigationStep(2);
$('#transfertMessage').html("Transfer in progress...");

//init container
var transferContainer = $('#transferContainer');
transferContainer.show();

var rowReceiverTemplate = $("#rowReceiverTemplate");
var newRow = rowReceiverTemplate.clone();
newRow.removeAttr("id");
newRow.show();
var linkRemove = newRow.find(".icon-delete");
linkRemove.on("click", function (e) {
e.preventDefault();
newRow.hide();
});
linkRemove.tooltip();

var pbContainer = newRow.children(".col-xs-7");
var transferProgressBar = pbContainer.find("progress");
var displayProgressBar = pbContainer.find(".text-xs-center");
displayProgressBar.attr("id", "progress-"+receiverId);
transferProgressBar.attr("aria-describedby", "progress-"+receiverId);
transferContainer.append(newRow);
this.receiverInfos[receiverId] = new ReceiverInfo(pbContainer, transferProgressBar, displayProgressBar, linkRemove);

this.startUpload(receiverId);
},

startUpload: function (receiverId) {
Expand Down
2 changes: 1 addition & 1 deletion public/css/justdropit.css
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ header {
}

main {
padding: 1.5rem 0px 1.1rem;
padding: 2rem 0px 1.1rem;
}

main em {
Expand Down
2 changes: 1 addition & 1 deletion views/header.jade
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ header(role="banner")
div.col-xs-12
h1 Just drop it
small «Let us ease your file transfer»

block extra_header

script.
function enableNotifications() {
Expand Down
20 changes: 16 additions & 4 deletions views/send.jade
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,23 @@ block extra_scripts
sendFile(#{isLocal});
enableNotifications();
}
block extra_header
nav.o-stepbar
ol
li.stepbar-item.current
a.stepbar-link(title="Select your file")
span.step-number 1
span.step-title Select your file
li.stepbar-item
a.stepbar-link(title="Share it with your friends")
span.step-number 2
span.step-title Share it with your friends
li.stepbar-item
a.stepbar-link(title="Transferring")
span.step-number 3
span.step-title Transferring
block content
div.row#selectFileContainer
div.col-xs-12
h2 Select your file
div.col-xs-12
p.lead Either drop a file below:
div.upload-drop-zone#drop-zone Just drag and drop a file here
Expand All @@ -53,7 +66,6 @@ block content
input#file(type="file")
div.row#copyLinkContainer(style="display: none;")
div.col-xs-12
h2 Ready to transfer!
p.lead Tell your friend to go to this url:
div.text-muted
p#generatedurl
Expand All @@ -62,7 +74,7 @@ block content
div#transferContainer(style="display: none;")
div.row
div.col-xs-12
em The transfer will start as soon as your friends open the link.
em Each transfer will start as soon as your friends open the link.

p.text-muted#generatedurlreminder
p  
Expand Down

0 comments on commit 51daa26

Please sign in to comment.