Merge branch 'newCk' into staging

This commit is contained in:
yflory
2017-06-20 14:57:19 +02:00
15 changed files with 264 additions and 89 deletions

View File

@@ -227,6 +227,7 @@ span.fa-folder-open {
display: flex;
flex-flow: column;
flex: 1;
min-width: 0;
}
#content {
box-sizing: border-box;
@@ -461,6 +462,8 @@ span.fa-folder-open {
z-index: 100;
box-sizing: content-box;
padding: 0 6px;
display: flex;
flex-flow: row;
/* The container <div> - needed to position the dropdown content */
}
#driveToolbar .newPadContainer {
@@ -479,15 +482,10 @@ span.fa-folder-open {
font-family: FontAwesome;
}
#driveToolbar button.element {
border-radius: 2px;
background: #888;
color: #eee;
font-size: 14px;
border: 1px solid #888;
font-weight: bold;
}
#driveToolbar button.element:hover {
background: #777;
height: 26px;
width: 26px;
padding: 0;
box-sizing: border-box;
}
#driveToolbar button.new {
padding: 0 5px;
@@ -515,7 +513,7 @@ span.fa-folder-open {
margin-right: 2px;
}
#driveToolbar .leftside {
width: 250px;
width: auto;
margin: 0;
padding: 0;
display: inline-block;
@@ -527,6 +525,7 @@ span.fa-folder-open {
float: right;
}
#driveToolbar .path {
flex: 1;
width: 100%;
height: 30px;
line-height: 30px;

View File

@@ -276,7 +276,9 @@ span {
display: flex;
flex-flow: column;
flex: 1;
}
// Needed to avoid the folder's path to overflows
// https://stackoverflow.com/questions/38223879/white-space-nowrap-breaks-flexbox-layout
min-width: 0;}
#content {
box-sizing: border-box;
background: @content-bg;
@@ -533,6 +535,8 @@ span {
z-index: 100;
box-sizing: content-box;
padding: 0 6px;
display: flex;
flex-flow: row;
.newPadContainer {
display: inline-block;
@@ -549,15 +553,10 @@ span {
font-family: FontAwesome;
}
&.element {
border-radius: 2px;
background: @toolbar-button-bg;
color: @toolbar-button-fg;
font-size: 14px;
border: 1px solid @toolbar-button-border;
font-weight: bold;
&:hover {
background: @toolbar-button-bg-hover;
}
height: 26px;
width: 26px;
padding: 0;
box-sizing: border-box;
}
&.new {
padding: 0 5px;
@@ -588,7 +587,7 @@ span {
}
.leftside {
width: 250px;
width: auto;
margin: 0;
padding: 0;
display: inline-block;
@@ -600,6 +599,7 @@ span {
float: right;
}
.path {
flex: 1;
width: 100%;
height: 30px;
line-height: 30px;

View File

@@ -650,7 +650,10 @@ define([
};
var updatePathSize = function () {
$driveToolbar.find('.path').css('max-width', 'calc(100vw - '+$tree.width()+'px - 50px)');
return;
var $tb = $driveToolbar;
var w = $tree.width() + $tb.find('.leftside').width() + $tb.find('.rightside').width();
$driveToolbar.find('.path').css('max-width', 'calc(100vw - '+w+'px)');
};
var getSelectedPaths = function ($element) {
@@ -1339,10 +1342,10 @@ define([
});
var $listButton = $('<button>', {
'class': 'element'
'class': 'element btn btn-secondary'
}).append($listIcon.clone());
var $gridButton = $('<button>', {
'class': 'element'
'class': 'element btn btn-secondary'
}).append($gridIcon.clone());
$listButton.click(function () {
@@ -1381,6 +1384,12 @@ define([
content: Messages.fm_folder
});
options.push({tag: 'hr'});
options.push({
tag: 'a',
attributes: {'class': 'uploadFile'},
content: Messages.uploadButton
});
options.push({tag: 'hr'});
}
AppConfig.availablePadTypes.forEach(function (type) {
if (type === 'drive') { return; }
@@ -1427,6 +1436,20 @@ define([
$block.find('a.newFolder').click(function () {
filesOp.addFolder(currentPath, null, onCreated);
});
$block.find('a.uploadFile').click(function () {
var $input = $('<input>', {
'type': 'file',
'style': 'display: none;'
}).on('change', function (e) {
var file = e.target.files[0];
var ev = {
target: $content[0]
};
APP.FM.handleFile(file, ev);
if (callback) { callback(); }
});
$input.click();
});
}
$block.find('a.newdoc').click(function () {
var type = $(this).attr('data-type') || 'pad';
@@ -1437,16 +1460,6 @@ define([
return $block;
};
var createUploadButton = function () {
var inTrash = filesOp.isPathIn(currentPath, [TRASH]);
if (inTrash) { return; }
var data = {
FM: APP.FM,
target: $content[0]
};
return Cryptpad.createButton('upload', false, data);
};
var hideNewButton = function () {
$iframe.find('.dropdown-bar-content').hide();
};
@@ -1620,8 +1633,8 @@ define([
var $toolbar = $driveToolbar;
$toolbar.html('');
$('<div>', {'class': 'leftside'}).appendTo($toolbar);
$('<div>', {'class': 'rightside'}).appendTo($toolbar);
$('<div>', {'class': 'path unselectable'}).appendTo($toolbar);
$('<div>', {'class': 'rightside'}).appendTo($toolbar);
return $toolbar;
};
@@ -1846,6 +1859,9 @@ define([
}
var $list = $('<ul>').appendTo($dirContent);
// NewButton can be undefined if we're in read only mode
$toolbar.find('.leftside').append(createNewButton(isInRoot));
createTitle(path).appendTo($toolbar.find('.path'));
updatePathSize();
@@ -1879,11 +1895,6 @@ define([
}
updateContextButton();
// NewButton can be undefined if we're in read only mode
$toolbar.find('.leftside').append(createNewButton(isInRoot));
$toolbar.find('.leftside').append(createUploadButton());
var $folderHeader = getFolderListHeader();
var $fileHeader = getFileListHeader(true);