Recent pads improvements
This commit is contained in:
@@ -509,6 +509,10 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
&.cp-app-drive-element-separator {
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
.cp-app-drive-element {
|
||||
@@ -521,6 +525,12 @@
|
||||
&.cp-app-drive-element {
|
||||
position: relative;
|
||||
}
|
||||
&.cp-app-drive-element-separator {
|
||||
display: block;
|
||||
height: auto;
|
||||
width: auto;
|
||||
border: none !important;
|
||||
}
|
||||
input {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
@@ -600,6 +610,14 @@
|
||||
height: @variables_bar-height;
|
||||
line-height: @variables_bar-height;
|
||||
}
|
||||
&.cp-app-drive-element-separator {
|
||||
position: relative;
|
||||
height: 1.5 * @variables_bar-height;
|
||||
line-height: 1.5 * @variables_bar-height;
|
||||
span {
|
||||
position: absolute;
|
||||
}
|
||||
}
|
||||
&.cp-app-drive-element-header {
|
||||
cursor: default;
|
||||
color: @drive_table-header-fg;
|
||||
|
||||
@@ -2454,24 +2454,51 @@ define([
|
||||
var displayRecent = function ($list) {
|
||||
var filesList = manager.getRecentPads();
|
||||
var limit = 20;
|
||||
|
||||
var now = new Date();
|
||||
var last1 = new Date(now);
|
||||
last1.setDate(last1.getDate()-1);
|
||||
var last7 = new Date(now);
|
||||
last7.setDate(last7.getDate()-7);
|
||||
var last28 = new Date(now);
|
||||
last28.setDate(last28.getDate()-28);
|
||||
|
||||
var header7, header28, headerOld;
|
||||
var i = 0;
|
||||
filesList.forEach(function (id) {
|
||||
if (i >= limit) { return; }
|
||||
// Check path (pad exists and not in trash)
|
||||
$list.append(h('li.cp-app-drive-element-separator', h('span', Messages.drive_active1Day)));
|
||||
filesList.some(function (arr) {
|
||||
if (i >= limit) { return true; }
|
||||
var id = arr[0];
|
||||
var file = arr[1];
|
||||
if (!file || !file.atime) { return; }
|
||||
|
||||
if (file.atime <= last28 && i >= limit) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var paths = manager.findFile(id);
|
||||
if (!paths.length) { return; }
|
||||
var path = paths[0];
|
||||
if (manager.isPathIn(path, [TRASH])) { return; }
|
||||
// Display the pad
|
||||
var file = manager.getFileData(id);
|
||||
if (!file) {
|
||||
//debug("Unsorted or template returns an element not present in filesData: ", href);
|
||||
file = { title: Messages.fm_noname };
|
||||
//return;
|
||||
|
||||
|
||||
if (!header7 && file.atime < last1) {
|
||||
$list.append(h('li.cp-app-drive-element-separator', h('span', Messages.drive_active7Days)));
|
||||
header7 = true;
|
||||
}
|
||||
if (!header28 && file.atime < last7) {
|
||||
$list.append(h('li.cp-app-drive-element-separator', h('span', Messages.drive_active28Days)));
|
||||
header28 = true;
|
||||
}
|
||||
if (!headerOld && file.atime < last28) {
|
||||
$list.append(h('li.cp-app-drive-element-separator', h('span', Messages.drive_activeOld)));
|
||||
headerOld = true;
|
||||
}
|
||||
|
||||
// Display the pad
|
||||
var $icon = getFileIcon(id);
|
||||
var ro = manager.isReadOnlyFile(id);
|
||||
// ro undefined mens it's an old hash which doesn't support read-only
|
||||
// ro undefined means it's an old hash which doesn't support read-only
|
||||
var roClass = typeof(ro) === 'undefined' ? ' cp-app-drive-element-noreadonly' :
|
||||
ro ? ' cp-app-drive-element-readonly' : '';
|
||||
var $element = $('<li>', {
|
||||
|
||||
@@ -268,9 +268,21 @@ define([
|
||||
assert(function (cb) {
|
||||
console.log('START DRIVE utils');
|
||||
var files = JSON.parse(JSON.stringify(example));
|
||||
|
||||
var href6 = "/pad/#67a9385b07352be53e40746d2be6ccd7XAYSuJYYqa9NfmInyGbj7LNy/";
|
||||
var id6 = 1000000000006;
|
||||
var data = {
|
||||
href: href6,
|
||||
title: 'Title6',
|
||||
atime: +new Date(),
|
||||
ctime: +new Date()
|
||||
};
|
||||
files.filesData[id6] = data;
|
||||
|
||||
var fo = FO.init(files, config);
|
||||
fo.fixFiles();
|
||||
|
||||
|
||||
if (fo.isFile({}) || fo.isFile(href1) || !fo.isFile(href1, true) || !fo.isFile(id1)) {
|
||||
console.log("DRIVE utils: isFile returns an incorrect value");
|
||||
return cb();
|
||||
@@ -283,6 +295,10 @@ define([
|
||||
console.log("DRIVE utils: isReadOnlyFile returns false for a 'view' file");
|
||||
return cb();
|
||||
}
|
||||
if (typeof fo.isReadOnlyFile(id6) !== "undefined") {
|
||||
console.log("DRIVE utils: isReadOnlyFile should return undefined for a v0 hash");
|
||||
return cb();
|
||||
}
|
||||
if (!fo.hasSubfolder(files.root.Folder) || fo.hasSubfolder(files.root.Folder2)) {
|
||||
console.log("DRIVE utils: hasSubfolder returns an incorrect value");
|
||||
return cb();
|
||||
@@ -303,7 +319,7 @@ define([
|
||||
console.log("DRIVE utils: 'find' returns an incorrect value");
|
||||
return cb();
|
||||
}
|
||||
if (fo.getFiles().length !== 4 || fo.getFiles(['trash']).length !== 2) {
|
||||
if (fo.getFiles().length !== 5 || fo.getFiles(['trash']).length !== 2) {
|
||||
console.log("DRIVE utils: getFiles returns an incorrect value");
|
||||
return cb();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user