Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

pull/1/head
ansuz 8 years ago
commit 2dfe182d8d

@ -220,7 +220,7 @@ define(function () {
"Quiconque se trouve en possession de celle-ci peut modifier ou supprimer tous les fichiers de ce gestionnaire.<br>" + "Quiconque se trouve en possession de celle-ci peut modifier ou supprimer tous les fichiers de ce gestionnaire.<br>" +
'<input type="text" id="fm_backupUrl" value="{0}"/>'; '<input type="text" id="fm_backupUrl" value="{0}"/>';
out.fm_backup_title = 'URL de secours'; out.fm_backup_title = 'URL de secours';
out.fm_nameFile = 'Comment souhaitez-vous nommer ce fichier ?';
// File - Context menu // File - Context menu
out.fc_newfolder = "Nouveau dossier"; out.fc_newfolder = "Nouveau dossier";
out.fc_rename = "Renommer"; out.fc_rename = "Renommer";

@ -217,6 +217,7 @@ define(function () {
"Anybody with that URL can edit or remove all the files in your file manager.<br>" + "Anybody with that URL can edit or remove all the files in your file manager.<br>" +
'<input type="text" id="fm_backupUrl" value="{0}"/>'; '<input type="text" id="fm_backupUrl" value="{0}"/>';
out.fm_backup_title = 'Backup URL'; out.fm_backup_title = 'Backup URL';
out.fm_nameFile = 'How would you like to name that file?';
// File - Context menu // File - Context menu
out.fc_newfolder = "New folder"; out.fc_newfolder = "New folder";
out.fc_rename = "Rename"; out.fc_rename = "Rename";

@ -270,11 +270,11 @@ define([
'class': 'lag' 'class': 'lag'
}); });
var title; var title;
if (typeof lag !== "undefined") { if (lag) {
lagErrors = 0; lagErrors = 0;
firstConnection = false; firstConnection = false;
title = Messages.lag + ' : ' + lag + ' ms\n'; title = Messages.lag + ' : ' + lag + ' ms\n';
if (lag.waiting || lag > 1000) { if (lag && lag.waiting || lag > 1000) {
lagLight.addClass('lag-orange'); lagLight.addClass('lag-orange');
title += Messages.orangeLight; title += Messages.orangeLight;
} else { } else {

@ -180,6 +180,9 @@ span.fa-folder-open {
display: flex; display: flex;
flex-flow: column; flex-flow: column;
} }
#content.readonly {
background: #e6e6e6;
}
#content h1 { #content h1 {
padding-left: 10px; padding-left: 10px;
margin-top: 10px; margin-top: 10px;

@ -3,6 +3,7 @@
@tree-lines-col: #888; @tree-lines-col: #888;
@content-bg: @tree-bg; @content-bg: @tree-bg;
@content-bg-ro: darken(@content-bg, 10%);
@content-fg: @tree-fg; @content-fg: @tree-fg;
@info-box-bg: #ddddff; @info-box-bg: #ddddff;
@info-box-border: #bbb; @info-box-border: #bbb;
@ -219,6 +220,9 @@ span {
flex: 1; flex: 1;
display: flex; display: flex;
flex-flow: column; flex-flow: column;
&.readonly {
background: @content-bg-ro;
}
h1 { h1 {
padding-left: 10px; padding-left: 10px;
margin-top: 10px; margin-top: 10px;

@ -29,10 +29,10 @@
<div id="contentContextMenu" class="contextMenu dropdown clearfix" oncontextmenu="return false;"> <div id="contentContextMenu" class="contextMenu dropdown clearfix" oncontextmenu="return false;">
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu" style="display:block;position:static;margin-bottom:5px;"> <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu" style="display:block;position:static;margin-bottom:5px;">
<li><a tabindex="-1" href="#" class="newfolder editable dropdown-item" data-localization="fc_newfolder">New folder</a></li> <li><a tabindex="-1" href="#" class="newfolder editable dropdown-item" data-localization="fc_newfolder">New folder</a></li>
<li><a tabindex="-1" href="#" class="newdoc own editable dropdown-item" data-type="pad" data-localization="fc_newpad" target="_blank">New pad</a></li> <li><a tabindex="-1" href="#" class="newdoc own editable dropdown-item" data-type="pad" data-localization="fc_newpad">New pad</a></li>
<li><a tabindex="-1" href="#" class="newdoc own editable dropdown-item" data-type="code" data-localization="fc_newcode" target="_blank">New code</a></li> <li><a tabindex="-1" href="#" class="newdoc own editable dropdown-item" data-type="code" data-localization="fc_newcode">New code</a></li>
<li><a tabindex="-1" href="#" class="newdoc own editable dropdown-item" data-type="slide" data-localization="fc_newslide" target="_blank">New slide</a></li> <li><a tabindex="-1" href="#" class="newdoc own editable dropdown-item" data-type="slide" data-localization="fc_newslide">New slide</a></li>
<li><a tabindex="-1" href="#" class="newdoc own editable dropdown-item" data-type="poll" data-localization="fc_newpoll" target="_blank">New poll</a></li> <li><a tabindex="-1" href="#" class="newdoc own editable dropdown-item" data-type="poll" data-localization="fc_newpoll">New poll</a></li>
</ul> </ul>
</div> </div>
<div id="defaultContextMenu" class="contextMenu dropdown clearfix" oncontextmenu="return false;"> <div id="defaultContextMenu" class="contextMenu dropdown clearfix" oncontextmenu="return false;">

@ -18,6 +18,9 @@ define([
var $iframe = $('#pad-iframe').contents(); var $iframe = $('#pad-iframe').contents();
var ifrw = $('#pad-iframe')[0].contentWindow; var ifrw = $('#pad-iframe')[0].contentWindow;
Cryptpad.addLoadingScreen(); Cryptpad.addLoadingScreen();
var onConnectError = function (info) { var onConnectError = function (info) {
Cryptpad.errorLoadingScreen(Messages.websocketError); Cryptpad.errorLoadingScreen(Messages.websocketError);
@ -127,8 +130,14 @@ define([
var setEditable = function (state) { var setEditable = function (state) {
APP.editable = state; APP.editable = state;
if (!state) { $iframe.find('[draggable="true"]').attr('draggable', false); } if (!state) {
else { $iframe.find('[draggable="false"]').attr('draggable', true); } $iframe.find('#content').addClass('readonly');
$iframe.find('[draggable="true"]').attr('draggable', false);
}
else {
$iframe.find('#content').removeClass('readonly');
$iframe.find('[draggable="false"]').attr('draggable', true);
}
}; };
// Icons // Icons
@ -170,6 +179,15 @@ define([
var error = filesOp.error; var error = filesOp.error;
var $tree = $iframe.find("#tree");
var $content = $iframe.find("#content");
var $driveToolbar = $iframe.find("#driveToolbar");
var $contextMenu = $iframe.find("#treeContextMenu");
var $contentContextMenu = $iframe.find("#contentContextMenu");
var $defaultContextMenu = $iframe.find("#defaultContextMenu");
var $trashTreeContextMenu = $iframe.find("#trashTreeContextMenu");
var $trashContextMenu = $iframe.find("#trashContextMenu");
// TOOLBAR // TOOLBAR
var getLastName = function (cb) { var getLastName = function (cb) {
@ -196,16 +214,6 @@ define([
var lastSelectTime; var lastSelectTime;
var selectedElement; var selectedElement;
var $tree = $iframe.find("#tree");
var $content = $iframe.find("#content");
var $driveToolbar = $iframe.find("#driveToolbar");
var $contextMenu = $iframe.find("#treeContextMenu");
var $contentContextMenu = $iframe.find("#contentContextMenu");
var $defaultContextMenu = $iframe.find("#defaultContextMenu");
var $trashTreeContextMenu = $iframe.find("#trashTreeContextMenu");
var $trashContextMenu = $iframe.find("#trashContextMenu");
if (!APP.readOnly) { if (!APP.readOnly) {
setEditable(true); setEditable(true);
} }
@ -281,6 +289,9 @@ define([
removeInput(); removeInput();
removeSelected(); removeSelected();
var $name = $element.find('.name'); var $name = $element.find('.name');
if (!$name.length) {
$name = $element.find('.element');
}
$name.hide(); $name.hide();
var name = path[path.length - 1]; var name = path[path.length - 1];
var $input = $('<input>', { var $input = $('<input>', {
@ -855,6 +866,18 @@ define([
return $block; return $block;
}; };
var createPadFromRootHandler = function (e) {
var type = $(this).data('type');
if (!type) {
throw new Error("Unable to get the pad type...");
}
var onNamed = function (name) {
if (!name) { return; }
var path = '/#?name=' + encodeURIComponent(name) + '&path=' + encodeURIComponent(currentPath);
window.open('/' + type + path);
};
Cryptpad.prompt(Messages.fm_nameFile, Cryptpad.getDefaultName({type: type}), onNamed);
};
var createNewButton = function (isInRoot) { var createNewButton = function (isInRoot) {
if (!APP.editable) { return; } if (!APP.editable) { return; }
@ -904,18 +927,7 @@ define([
}; };
filesOp.createNewFolder(currentPath, null, onCreated); filesOp.createNewFolder(currentPath, null, onCreated);
}); });
$block.find('a.newdoc').click(function () { $block.find('a.newdoc').click(createPadFromRootHandler);
var type = $(this).data('type');
if (!type) {
throw new Error("Unable to get the pad type...");
}
var onNamed = function (name) {
var path = '/#?name=' + encodeURIComponent(name) + '&path=' + encodeURIComponent(currentPath);
console.log(path);
window.open('/' + type + path);
};
Cryptpad.prompt("How would you like to name your file?", Cryptpad.getDefaultName({type: type}), onNamed);
});
} }
return $block; return $block;
@ -1287,7 +1299,10 @@ define([
var $modeButton = createViewModeButton().appendTo($toolbar.find('.rightside')); var $modeButton = createViewModeButton().appendTo($toolbar.find('.rightside'));
var $title = createTitle(path).appendTo($toolbar.find('.rightside')); var $title = createTitle(path).appendTo($toolbar.find('.rightside'));
createNewButton(isInRoot).appendTo($toolbar.find('.leftside'));
// NewButton can be undefined if we're in read only mode
$toolbar.find('.leftside').append(createNewButton(isInRoot));
var $folderHeader = getFolderListHeader(); var $folderHeader = getFolderListHeader();
var $fileHeader = getFileListHeader(true); var $fileHeader = getFileListHeader(true);
@ -1587,7 +1602,8 @@ define([
} }
else if ($(this).hasClass("newdoc")) { else if ($(this).hasClass("newdoc")) {
var type = $(this).data('type') || 'pad'; var type = $(this).data('type') || 'pad';
$(this).attr('href','/' + type + '/#?path=' + encodeURIComponent(path)); createPadFromRootHandler.apply(this);
e.preventDefault();
} }
module.hideMenu(); module.hideMenu();
}); });
@ -1853,7 +1869,6 @@ define([
$backupButton.attr('title', Messages.fm_backup_title); $backupButton.attr('title', Messages.fm_backup_title);
$backupButton.on('click', function() { $backupButton.on('click', function() {
var url = window.location.origin + window.location.pathname + '#' + editHash; var url = window.location.origin + window.location.pathname + '#' + editHash;
//TODO change text & transalte
Cryptpad.alert(Messages._getKey('fm_alert_backupUrl', [url])); Cryptpad.alert(Messages._getKey('fm_alert_backupUrl', [url]));
$('#fm_backupUrl').val(url); $('#fm_backupUrl').val(url);
$('#fm_backupUrl').click(function () { $('#fm_backupUrl').click(function () {

Loading…
Cancel
Save