Skip to content

TagSpaces is an offline, open source, document manager with tagging support

redesigning file properties functionality

uggrock6ab0728133ab
diff --git a/data/assets/core.css b/data/assets/core.css
index 40b65af6a..9f6821b93 100644
--- a/data/assets/core.css
+++ b/data/assets/core.css
@@ -555,4 +555,22 @@ input a.resetFilter {
#showNewFileDialog {
padding-left: 13px;
+}
+
+#toggleFileProperitesButton {
+ padding-top: 0px;
+ padding-bottom: 0px;
+ padding-left: 10px;
+ padding-right: 10px;
+ margin-right: 7px;
+ border: 1px solid transparent;
+}
+
+.buttonToggled {
+ border: 1px solid lightgray !important;
+ background-color: #dedede !important;
+}
+
+#filePropertiesArea {
+ padding: 10px;
}
\ No newline at end of file
diff --git a/data/assets/layout.css b/data/assets/layout.css
index 654fcafc5..8bd4d37c5 100644
--- a/data/assets/layout.css
+++ b/data/assets/layout.css
@@ -258,7 +258,6 @@
-ms-flex-line-pack: stretch;
max-width: 100%;
- /*min-width: 50%;*/
z-index: 1030;
}
@@ -267,20 +266,31 @@
-webkit-flex: 0 1 auto;
-ms-flex: 0 1 auto;
+ display: flex;
+ display: -ms-flex;
+ display: -webkit-flex;
+
min-height: 80px;
box-shadow: 0px 2px 2px 0px rgba(0,0,0,0.1);
z-index: 1;
}
.col3 .row1 nav {
- min-height: 80px;
+ flex:1;
margin-bottom: 0;
}
+.row-divider {
+ height: 5px;
+ background: transparent;
+ cursor: row-resize;
+ top: auto;
+}
+
.col3 .row2 {
- flex: 1 1 auto;
- -webkit-flex: 1 1 auto;
- -ms-flex: 1 1 auto;
+ flex: 1;
+ /*-webkit-flex: 1 1 auto;
+ -ms-flex: 1 1 auto; */
display: flex;
display: -webkit-flex;
@@ -298,6 +308,10 @@
min-height: 0px;
}
+#filePropertiesArea {
+ display: none;
+}
+
#tagsContainer {
width: 100%;
max-height: 55px;
diff --git a/data/index.html b/data/index.html
index c8092ac8f..4775c46cf 100644
--- a/data/index.html
+++ b/data/index.html
@@ -268,7 +268,7 @@
<div class="row2 appBackgroundTile" id="viewContainers"></div>
</div>
- <div class="col3" style="display: none;">
+ <div class="col3">
<div class="row1">
<nav class="navbar navbar-default" role="navigation">
<div class="btn-toolbar flexLayout" >
@@ -319,11 +319,6 @@
<li class="noWrap"><a id="openDirectory" data-i18n="[title]ns.common:openContainingFolderTooltip">
<i class="fa fa-folder-open fa-fw"></i>
&nbsp;<span data-i18n="ns.common:openContainingFolder"></span></a></li>
- <li class="divider"></li>
- <li class="noWrap"><a id="openProperties" data-i18n="[title]ns.common:filePropertiesTooltip">
- <i class="fa fa-briefcase fa-fw"></i>
- &nbsp;<span data-i18n="ns.common:fileProperties"></span>
- <span class="pull-right label label-default keyShortcut">Alt+Enter</span></a></li>
</ul>
</div>
<div class="flexMaxWidth flexLayout">
@@ -334,11 +329,9 @@
</button>
</div>
<div id="tagsContainer" class="ui-droppable flexLayout">
- <button id="addTagFileViewer" type="button" data-i18n="[title]ns.common:addTags"
- class="btn btn-small extTagButton dropdown-toggle" data-toggle="dropdown">
- <i class="fa fa-plus-square"></i>
+ <button class="btn btn-link" data-i18n="[title]ns.common:openNextFileTooltip" id="toggleFileProperitesButton">
+ <i class="fa fa-info-circle fa-lg"></i>
</button>
- <ul class="dropdown-menu" id="tagSuggestionsMenu"></ul>
<span id="fileTags" class="flexMaxWidth"></span>
<div id="fileViewerMainToolbar" class="btn-group">
<button class="btn btn-link pull-right" data-i18n="[title]ns.common:openNextFileTooltip" id="nextFileButton">
@@ -358,6 +351,29 @@
</button>
</div>
</div>
+ <div class="form" id="filePropertiesArea">
+ <div class="form-group">
+ <label class="control-label" for="filePathProperty" data-i18n="ns.dialogs:filePropertiesPath"></label>
+ <input class="form-control uneditable-input input-sm" readonly="true" type="text" name="filePathProperty" id="filePathProperty" />
+ </div>
+ <div class="form-group">
+ <label class="control-label" for="fileNameProperty" data-i18n="ns.dialogs:filePropertiesName"></label>
+ <input class="form-control uneditable-input input-sm" readonly="true" type="text" name="fileNameProperty" id="fileNameProperty" />
+ </div>
+ <div class="form-group">
+ <label class="control-label" for="fileSizeProperty" data-i18n="ns.dialogs:filePropertiesSize"></label>
+ <input class="form-control uneditable-input input-sm" readonly="true" type="text" name="fileSizeProperty" id="fileSizeProperty" />
+ </div>
+ <div class="form-group">
+ <label class="control-label" for="fileLMDTProperty" data-i18n="ns.dialogs:filePropertiesLMDT"></label>
+ <input class="form-control uneditable-input input-sm" readonly="true" type="text" name="fileLMDTProperty" id="fileLMDTProperty" />
+ </div>
+ <div class="form-group">
+ <label class="control-label" for="fileDescriptionProperty" data-i18n="ns.dialogs:filePropertiesDescription"></label><button class="btn btn-link" id="editFileDescriptionButton" data-i18n="" style="color: #1DD19F;">Edit</button>
+ <textarea class="form-control uneditable-input input-sm" rows="3" type="text" name="fileDescriptionProperty"
+ id="fileDescriptionProperty" placeholder="File description can be added here in TagSpaces PRO"></textarea>
+ </div>
+ </div>
</nav>
</div>
<div class="row2" id="viewer" allowfullscreen></div>
diff --git a/data/js/fileopener.js b/data/js/fileopener.js
index 9a70a7ae2..0e88c8d48 100644
--- a/data/js/fileopener.js
+++ b/data/js/fileopener.js
@@ -17,6 +17,8 @@ define(function(require, exports, module) {
var _isFileChanged = false;
var _tsEditor;
var generatedTagButtons;
+ var filePropertiesOpened = false;
+
$.fn.editableform.buttons = '<button type="submit" class="btn btn-primary editable-submit"><i class="fa fa-check fa-lg"></i></button><button type="button" class="btn editable-cancel"><i class="fa fa-times fa-lg"></i></button>';
$.fn.editableform.template = '' +
'<form class="form-inline editableform flexMaxWidth">' +
@@ -73,15 +75,9 @@ define(function(require, exports, module) {
$('#editDocument').on("click", function() {
editFile(_openedFilePath);
});
- $('#saveDocument').on("click", function() {
- saveFile();
- });
- $('#closeFile').on("click", function() {
- closeFile();
- });
- $('#closeOpenedFile').on("click", function() {
- closeFile();
- });
+ $('#saveDocument').on("click", saveFile);
+ $('#closeFile').on("click", closeFile);
+ $('#closeOpenedFile').on("click", closeFile);
$('#nextFileButton').on("click", function() {
TSCORE.FileOpener.openFile(TSCORE.PerspectiveManager.getNextFile(_openedFilePath));
TSCORE.PerspectiveManager.selectFile(TSCORE.FileOpener.getOpenedFilePath());
@@ -101,7 +97,7 @@ define(function(require, exports, module) {
});
$('#toggleFullWidthButton').on("click", TSCORE.toggleFullWidth);
$('#fullscreenFile').on("click", switchToFullScreen);
- $('#openProperties').on("click", showFilePropertiesDialog);
+ //$('#openProperties').on("click", showFilePropertiesDialog);
$('#deleteFile').on("click", function() {
TSCORE.showFileDeleteDialog(_openedFilePath);
});
@@ -111,9 +107,6 @@ define(function(require, exports, module) {
$('#openDirectory').on("click", function() {
TSCORE.IO.openDirectory(TSCORE.TagUtils.extractParentDirectoryPath(_openedFilePath));
});
- $('#printFile').on("click", function() {
- $('iframe').get(0).contentWindow.print();
- });
$('#renameFile').on("click", function() {
if (_isFileChanged) {
TSCORE.showAlertDialog($.i18n.t('ns.dialogs:operationNotPermittedInEditModeAlert'));
@@ -159,6 +152,19 @@ define(function(require, exports, module) {
TSCORE.showAddTagsDialog();
}
});
+
+ $('#toggleFileProperitesButton').on('click', toggleFileProperties);
+ }
+
+ function toggleFileProperties() {
+ if(filePropertiesOpened) {
+ $('#filePropertiesArea').hide();
+ $('#toggleFileProperitesButton').removeClass('buttonToggled');
+ } else {
+ $('#filePropertiesArea').show();
+ $('#toggleFileProperitesButton').addClass('buttonToggled');
+ }
+ filePropertiesOpened = !filePropertiesOpened;
}
function isFileChanged() {
@@ -173,13 +179,11 @@ define(function(require, exports, module) {
$fileExt.text($fileExt.text() + '*');
$fileTitle.editable('disable');
$('#fileTags').find('button').prop('disabled', true);
- $('#addTagFileViewer').prop('disabled', true);
}
if (!value) {
$fileExt.text(TSCORE.TagUtils.extractFileExtension(_openedFilePath));
$fileTitle.editable('enable');
$('#fileTags').find('button').prop('disabled', false);
- $('#addTagFileViewer').prop('disabled', false);
}
_isFileChanged = value;
}
@@ -273,7 +277,6 @@ define(function(require, exports, module) {
}
$('#fileTags').find('button').prop('disabled', false);
- $('#addTagFileViewer').prop('disabled', false);
_isEditMode = false;
_isFileChanged = false;
@@ -347,7 +350,9 @@ define(function(require, exports, module) {
});
}
}
- initTagSuggestionMenu(filePath);
+
+ // initTagSuggestionMenu(filePath);
+
// Clearing file selection on file load and adding the current file path to the selection
TSCORE.PerspectiveManager.clearSelectedFiles();
TSCORE.selectedFiles.push(filePath);
@@ -376,7 +381,7 @@ define(function(require, exports, module) {
});*/
Mousetrap.unbind(TSCORE.Config.getPropertiesDocumentKeyBinding());
Mousetrap.bindGlobal(TSCORE.Config.getPropertiesDocumentKeyBinding(), function() {
- showFilePropertiesDialog();
+ toggleFileProperties();
return false;
});
Mousetrap.unbind(TSCORE.Config.getEditDocumentKeyBinding());
@@ -393,8 +398,21 @@ define(function(require, exports, module) {
}
function setFileProperties(fileProperties) {
-
_openedFileProperties = fileProperties;
+ $('#fileNameProperty').val(TSCORE.TagUtils.extractFileName(_openedFileProperties.path));
+ $('#filePathProperty').val(TSCORE.TagUtils.extractContainingDirectoryPath(_openedFileProperties.path));
+ $('#fileSizeProperty').val(TSCORE.TagUtils.formatFileSize(_openedFileProperties.size, true) + " / " + _openedFileProperties.size);
+ $('#fileLMDTProperty').val(new Date(_openedFileProperties.lmdt).toISOString().substring(0,19).split('T').join(' '));
+ $('#fileLMDTProperty').attr("title", new Date(_openedFileProperties.lmdt));
+ var description = TSCORE.Meta.getDescriptionFromMetaFile(_openedFileProperties.path);
+ $('#fileDescriptionProperty').val(description).attr('readonly', 'readonly');
+
+ if (TSCORE.PRO) {
+ $('#fileDescriptionProperty').attr('readonly', false);
+ $('#filePropertiesDialogButton').on("click", function() {
+ TSCORE.Meta.addMetaDescriptionToFile(_openedFileProperties.path, $('#fileDescriptionProperty').val());
+ });
+ }
}
function updateEditorContent(fileContent) {
@@ -523,6 +541,7 @@ define(function(require, exports, module) {
});
}
+ // TODO refactor or remove, move add / remove tags dialog
function initTagSuggestionMenu(filePath) {
var tags = TSCORE.TagUtils.extractTags(filePath);
var suggTags = TSCORE.TagUtils.suggestTags(filePath);
@@ -576,40 +595,6 @@ define(function(require, exports, module) {
}
}
- function showFilePropertiesDialog() {
- require(['text!templates/FilePropertiesDialog.html'], function(uiTPL) {
- if ($('#dialogFileProperties').length < 1) {
- var uiTemplate = Handlebars.compile(uiTPL);
- $('body').append(uiTemplate());
- }
-
- $('#filePathProperty').val(_openedFileProperties.path);
- $('#fileSizeProperty').val(_openedFileProperties.size);
- $('#fileLMDTProperty').val(new Date(_openedFileProperties.lmdt));
- var description = TSCORE.Meta.getDescriptionFromMetaFile(_openedFileProperties.path);
- $('#fileDescriptionProperty').val(description).attr('readonly', 'readonly');
-
- if (TSCORE.PRO) {
- $('#fileDescriptionProperty').attr('readonly', false);
- $('#filePropertiesDialogButton').on("click", function() {
- TSCORE.Meta.addMetaDescriptionToFile(_openedFileProperties.path, $('#fileDescriptionProperty').val());
- });
- }
- var $fileTagsProperty = $('#fileTagsProperty');
- $fileTagsProperty.children().remove();
- $fileTagsProperty.append(generatedTagButtons);
- $fileTagsProperty.find('.caret').hide();
- // hiding the dropdown trigger
- $('#dialogFileProperties').i18n().modal({
- backdrop: 'static',
- show: true
- });
- $('#dialogFileProperties').draggable({
- handle: ".modal-header"
- });
- });
- }
-
// Public API definition
exports.initUI = initUI;
exports.openFile = openFile;