Merge branch 'search2' into staging

pull/1/head
ansuz 5 years ago
commit 3779e63a34

@ -227,16 +227,7 @@
} }
} }
::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */ .tools_placeholder-color(@cryptpad_color_grey);
color: @cryptpad_color_grey;
opacity: 1; /* Firefox */
}
:-ms-input-placeholder { /* Internet Explorer 10-11 */
color: @cryptpad_color_grey;
}
::-ms-input-placeholder { /* Microsoft Edge */
color: @cryptpad_color_grey;
}
span.cp-password-container { span.cp-password-container {
display: flex; display: flex;

@ -222,7 +222,7 @@
#cp-app-drive-search { #cp-app-drive-search {
display: flex; display: inline-flex;
align-items: center; align-items: center;
max-width: 400px; max-width: 400px;
font-size: 30px; font-size: 30px;
@ -230,7 +230,7 @@
input { input {
background: transparent; background: transparent;
color: @colortheme_drive-color; color: @colortheme_drive-color;
.tools_placeholder-color(@colortheme_drive-color); .tools_placeholder-color(@cryptpad_color_grey);
outline-width: 0px; outline-width: 0px;
border-radius: 0; border-radius: 0;
width: 100%; width: 100%;
@ -256,7 +256,19 @@
color: @colortheme_drive-color; color: @colortheme_drive-color;
} }
} }
.cp-app-drive-search-spinner {
display: inline-flex;
color: @colortheme_drive-color;
font-size: 40px;
align-items: center;
justify-content: center;
}
.cp-app-drive-search-noresult {
font-size: 30px;
padding: 15px;
font-style: italic;
color: @cryptpad_color_grey;
}
/* TREE */ /* TREE */

@ -2,13 +2,9 @@
&::-webkit-input-placeholder { /* WebKit, Blink, Edge */ &::-webkit-input-placeholder { /* WebKit, Blink, Edge */
color: @color;; color: @color;;
} }
&:-moz-placeholder { /* Mozilla Firefox 4 to 18 */ &::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
color: @color; color: @color;
opacity: 1; opacity: 1; /* Firefox */
}
&::-moz-placeholder { /* Mozilla Firefox 19+ */
color: @color;
opacity: 1;
} }
&:-ms-input-placeholder { /* Internet Explorer 10-11 */ &:-ms-input-placeholder { /* Internet Explorer 10-11 */
color: @color; color: @color;

@ -234,9 +234,9 @@ define([
return LS; return LS;
}; };
var getViewModeClass = function () { var getViewModeClass = function (forceList) {
var mode = APP.store[LS_VIEWMODE]; var mode = APP.store[LS_VIEWMODE];
if (mode === 'list') { return 'cp-app-drive-content-list'; } if (mode === 'list' || forceList) { return 'cp-app-drive-content-list'; }
return 'cp-app-drive-content-grid'; return 'cp-app-drive-content-grid';
}; };
var getViewMode = function () { var getViewMode = function () {
@ -3234,18 +3234,26 @@ define([
$searchIcon.clone().appendTo($div); $searchIcon.clone().appendTo($div);
var $spinnerContainer = $(h('div.cp-app-drive-search-spinner'));
var spinner = UI.makeSpinner($spinnerContainer);
var $input = APP.Search.$input = $('<input>', { var $input = APP.Search.$input = $('<input>', {
id: 'cp-app-drive-search-input', id: 'cp-app-drive-search-input',
placeholder: Messages.fm_searchName,
type: 'text', type: 'text',
draggable: false, draggable: false,
tabindex: 1, tabindex: 1,
}).keyup(function (e) { }).keyup(function (e) {
var lastValue = search.value;
search.value = $input.val().trim();
if (lastValue === search.value) { return; }
if (search.to) { window.clearTimeout(search.to); } if (search.to) { window.clearTimeout(search.to); }
if ($input.val().trim() === "") { if (search.value === "") {
search.cursor = 0; search.cursor = 0;
APP.displayDirectory([SEARCH]); APP.displayDirectory([SEARCH]);
return; return;
} }
spinner.spin();
if (e.which === 13) { if (e.which === 13) {
var newLocation = [SEARCH, $input.val()]; var newLocation = [SEARCH, $input.val()];
search.cursor = $input[0].selectionStart; search.cursor = $input[0].selectionStart;
@ -3290,12 +3298,26 @@ define([
$div.append(cancel); $div.append(cancel);
$list.append($div); $list.append($div);
$spinnerContainer.appendTo($list);
setTimeout(function () { setTimeout(function () {
$input.focus(); $input.focus();
}); });
$list.closest('#cp-app-drive-content-folder').addClass('cp-app-drive-content-list'); if (typeof(value) === "string" && value.trim()) {
spinner.spin();
} else {
return;
}
setTimeout(function () {
//$list.closest('#cp-app-drive-content-folder').addClass('cp-app-drive-content-list');
var filesList = manager.search(value); var filesList = manager.search(value);
if (!filesList.length) {
Messages.fm_noResult = "No result found"; // XXX
$list.append(h('div.cp-app-drive-search-noresult', Messages.fm_noResult));
spinner.hide();
return;
}
var sortable = {}; var sortable = {};
var sortableFolders = []; var sortableFolders = [];
filesList.forEach(function (r) { filesList.forEach(function (r) {
@ -3357,6 +3379,8 @@ define([
addEl(obj, false); addEl(obj, false);
}); });
setTimeout(collapseDrivePath); setTimeout(collapseDrivePath);
spinner.hide();
});
}; };
var displayRecent = function ($list) { var displayRecent = function ($list) {
@ -3612,13 +3636,12 @@ define([
var $dirContent = $('<div>', {id: FOLDER_CONTENT_ID}); var $dirContent = $('<div>', {id: FOLDER_CONTENT_ID});
$dirContent.data('path', path); $dirContent.data('path', path);
if (!isSearch && !isTags) { if (!isTags) {
var mode = getViewMode(); $dirContent.addClass(getViewModeClass(isSearch));
if (mode) { if (!isSearch) {
$dirContent.addClass(getViewModeClass());
}
createViewModeButton(APP.toolbar.$bottomR); createViewModeButton(APP.toolbar.$bottomR);
} }
}
var $list = $('<ul>').appendTo($dirContent); var $list = $('<ul>').appendTo($dirContent);

Loading…
Cancel
Save