Add properties for pads in the drive

pull/1/head
yflory 8 years ago
parent 29174b2922
commit 66a80ea50c

@ -16,16 +16,17 @@
</div> </div>
<div id="content"> <div id="content">
</div> </div>
<div id="treeContextMenu" class="contextMenu dropdown clearfix" oncontextmenu="return false;"> <div id="treeContextMenu" class="contextMenu dropdown clearfix">
<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="#" data-icon="fa-folder-open" class="open dropdown-item" data-localization="fc_open">Open</a></li> <li><a tabindex="-1" href="#" data-icon="fa-folder-open" class="open dropdown-item" data-localization="fc_open">Open</a></li>
<li><a tabindex="-1" href="#" data-icon="fa-eye" class="open_ro dropdown-item" data-localization="fc_open_ro">Open (read-only)</a></li> <li><a tabindex="-1" href="#" data-icon="fa-eye" class="open_ro dropdown-item" data-localization="fc_open_ro">Open (read-only)</a></li>
<li><a tabindex="-1" href="#" data-icon="fa-pencil" class="rename editable dropdown-item" data-localization="fc_rename">Rename</a></li> <li><a tabindex="-1" href="#" data-icon="fa-pencil" class="rename editable dropdown-item" data-localization="fc_rename">Rename</a></li>
<li><a tabindex="-1" href="#" data-icon="fa-trash" class="delete editable dropdown-item" data-localization="fc_delete">Delete</a></li> <li><a tabindex="-1" href="#" data-icon="fa-trash" class="delete editable dropdown-item" data-localization="fc_delete">Delete</a></li>
<li><a tabindex="-1" href="#" data-icon="fa-folder" class="newfolder editable dropdown-item" data-localization="fc_newfolder">New folder</a></li> <li><a tabindex="-1" href="#" data-icon="fa-folder" class="newfolder editable dropdown-item" data-localization="fc_newfolder">New folder</a></li>
<li><a tabindex="-1" href="#" data-icon="fa-database" class="properties dropdown-item" data-localization="fc_prop">Properties</a></li>
</ul> </ul>
</div> </div>
<div id="contentContextMenu" class="contextMenu dropdown clearfix" oncontextmenu="return false;"> <div id="contentContextMenu" class="contextMenu dropdown clearfix">
<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="#" data-icon="fa-folder" class="newfolder editable dropdown-item" data-localization="fc_newfolder">New folder</a></li> <li><a tabindex="-1" href="#" data-icon="fa-folder" class="newfolder editable dropdown-item" data-localization="fc_newfolder">New folder</a></li>
<li><a tabindex="-1" href="#" data-icon="fa-file-word-o" class="newdoc own editable dropdown-item" data-type="pad" data-localization="button_newpad">New pad</a></li> <li><a tabindex="-1" href="#" data-icon="fa-file-word-o" class="newdoc own editable dropdown-item" data-type="pad" data-localization="button_newpad">New pad</a></li>
@ -34,19 +35,20 @@
<li><a tabindex="-1" href="#" data-icon="fa-calendar" class="newdoc own editable dropdown-item" data-type="poll" data-localization="button_newpoll">New poll</a></li> <li><a tabindex="-1" href="#" data-icon="fa-calendar" class="newdoc own editable dropdown-item" data-type="poll" data-localization="button_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">
<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="#" data-icon="fa-folder-open" class="open dropdown-item" data-localization="fc_open">Open</a></li> <li><a tabindex="-1" href="#" data-icon="fa-folder-open" class="open dropdown-item" data-localization="fc_open">Open</a></li>
<li><a tabindex="-1" href="#" data-icon="fa-eye" class="open_ro dropdown-item" data-localization="fc_open_ro">Open (read-only)</a></li> <li><a tabindex="-1" href="#" data-icon="fa-eye" class="open_ro dropdown-item" data-localization="fc_open_ro">Open (read-only)</a></li>
<li><a tabindex="-1" href="#" data-icon="fa-trash" class="delete dropdown-item" data-localization="fc_delete">Delete</a></li> <li><a tabindex="-1" href="#" data-icon="fa-trash" class="delete dropdown-item" data-localization="fc_delete">Delete</a></li>
<li><a tabindex="-1" href="#" data-icon="fa-database" class="properties dropdown-item" data-localization="fc_prop">Properties</a></li>
</ul> </ul>
</div> </div>
<div id="trashTreeContextMenu" class="contextMenu dropdown clearfix" oncontextmenu="return false;"> <div id="trashTreeContextMenu" class="contextMenu dropdown clearfix">
<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="#" data-icon="fa-trash-o" class="empty editable dropdown-item" data-localization="fc_empty">Empty the trash</a></li> <li><a tabindex="-1" href="#" data-icon="fa-trash-o" class="empty editable dropdown-item" data-localization="fc_empty">Empty the trash</a></li>
</ul> </ul>
</div> </div>
<div id="trashContextMenu" class="contextMenu dropdown clearfix" oncontextmenu="return false;"> <div id="trashContextMenu" class="contextMenu dropdown clearfix">
<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="#" data-icon="fa-eraser" class="remove editable dropdown-item" data-localization="fc_remove">Delete permanently</a></li> <li><a tabindex="-1" href="#" data-icon="fa-eraser" class="remove editable dropdown-item" data-localization="fc_remove">Delete permanently</a></li>
<li><a tabindex="-1" href="#" data-icon="fa-repeat" class="restore editable dropdown-item" data-localization="fc_restore">Restore</a></li> <li><a tabindex="-1" href="#" data-icon="fa-repeat" class="restore editable dropdown-item" data-localization="fc_restore">Restore</a></li>

@ -382,6 +382,8 @@ define([
} }
hasFolder = true; hasFolder = true;
hide.push($menu.find('a.open_ro')); hide.push($menu.find('a.open_ro'));
// TODO: folder properties in the future?
hide.push($menu.find('a.properties'));
} }
if (path && path.length > 4) { if (path && path.length > 4) {
hide.push($menu.find('a.restore')); hide.push($menu.find('a.restore'));
@ -1838,6 +1840,23 @@ define([
} }
}); });
var getProperties = function (el) {
if (!filesOp.isFile(el)) { return; }
var base = window.location.origin;
var $d = $('<div>');
$('<strong>').text('PROPERTIES').appendTo($d);
$('<br>').appendTo($d);
$('<br>').appendTo($d);
$('<label>', {'for': 'propLink'}).text("LINK").appendTo($d);
$('<br>').appendTo($d);
$('<input>', {'id': 'propLink', 'disabled': 'disabled', 'value': base + el}).appendTo($d);
$('<br>').appendTo($d);
$('<label>', {'for': 'propROLink'}).text("RO LINK").appendTo($d);
$('<br>').appendTo($d);
$('<input>', {'id': 'propROLink', 'disabled': 'disabled'}).val(getReadOnlyUrl(base + el)).appendTo($d);
return $d.html();
};
$contextMenu.on("click", "a", function(e) { $contextMenu.on("click", "a", function(e) {
e.stopPropagation(); e.stopPropagation();
var paths = $(this).data('paths'); var paths = $(this).data('paths');
@ -1880,6 +1899,13 @@ define([
}; };
filesOp.createNewFolder(paths[0].path, null, onCreated); filesOp.createNewFolder(paths[0].path, null, onCreated);
} }
else if ($(this).hasClass("properties")) {
if (paths.length !== 1) { return; }
console.log(paths[0].path);
var el = filesOp.findElement(files, paths[0].path);
var prop = getProperties(el);
Cryptpad.alert(prop, undefined, true);
}
module.hideMenu(); module.hideMenu();
}); });

Loading…
Cancel
Save