TagSpaces is an offline, open source, document manager with tagging support
ui changes, code styling
uggrock70192d94b4ee
diff --git a/data/assets/general.css b/data/assets/general.cssindex b0cdd3360..aebda1146 100644--- a/data/assets/general.css+++ b/data/assets/general.css@@ -204,9 +204,19 @@ li hr {padding-right: 10px;}+#clearSearchButton {+ padding-left: 10px;+ padding-right: 10px;+}++#showSearchOptionsButton {+ padding-left: 10px;+ padding-right: 10px;+}+#searchToolbar {border-radius: 4px;- width: 250px;+ width: 300px;background-color: #DBDBDB;display: none;margin-left: 4px;diff --git a/data/index.html b/data/index.htmlindex 1ef4f80f0..873972432 100644--- a/data/index.html+++ b/data/index.html@@ -222,10 +222,13 @@<div class="flexMaxWidth"></div><div id="searchToolbar"><div class="flexLayout">+ <button class="btn btn-link" id="clearSearchButton">+ <i class="fa fa-lg fa-eraser"></i>+ </button>+ <input class="flexMaxWidth" id="searchBox" data-i18n="[placeholder]ns.common:searchPlaceholder" type="text"><button class="btn btn-link" data-i18n="[title]ns.common:showAdvancedSearch" id="showSearchOptionsButton"><i class="fa fa-lg fa-angle-double-down"></i></button>- <input class="flexMaxWidth" id="searchBox" data-i18n="[placeholder]ns.common:searchPlaceholder" type="text"><button class="btn btn-link" data-i18n="[title]ns.common:searchPlaceholder" id="searchButton"><i class="fa fa-lg fa-search"></i></button>@@ -902,7 +905,7 @@</label></div><div class="form-group" style="margin-bottom: 5px;">- <button class="btn btn-default btn-sm" aria-hidden="true" id="cancelSearchButton"><i class="fa fa-eraser fa-lg"></i> <span>Cancel</span></button>+ <button class="btn btn-default btn-sm" aria-hidden="true" id="resetSearchButton"><i class="fa fa-undo fa-lg"></i> <span>Reset</span></button><button class="btn btn-primary btn-sm pull-right" aria-hidden="true" id="startSearchButton"><i class="fa fa-search fa-lg"></i> <span>Search</span></button></div></form>diff --git a/data/js/core.api.js b/data/js/core.api.jsindex 5c255862e..b63250cc3 100644--- a/data/js/core.api.js+++ b/data/js/core.api.js@@ -9,7 +9,10 @@*/define(function(require, exports, module) {'use strict';+console.log('Loading core.api.js ...');++ // Importing modulesvar tsSettings = require('tssetting');var tsIOApi = require('tsioapi');var tsPersManager = require('tspersmanager');@@ -26,6 +29,8 @@ define(function(require, exports, module) {var tsMeta = require('tsmeta');var tsExt = require('tsextapi');var tsExtManager = require('tsextmanager');++ // Defining variablesvar currentPath;var currentLocationObject;var currentPerspectiveID;@@ -44,6 +49,18 @@ define(function(require, exports, module) {var subfoldersDirBrowser;var directoryBrowser;+ // Loading animation related vars+ var $loadingAnimation = $('.loadingAnimation');+ var $statusBar = $('#statusBar');++ // UI and Layout functionalities+ var isFullWidth = false;+ var shouldOpenCol1 = true;+ var shouldOpenCol2 = true;+ var shouldOpenCol3 = false;+ var oneColumn = false;+ var saveOpenCol1 = false;+/*** Initalizes the application* @memberof TSCORE@@ -141,6 +158,10 @@ define(function(require, exports, module) {console.log('Document ready finished. Layout initialized');checkForNewVersion();});++ window.addEventListener('orientationchange', reLayout);++ $(window).on('resize', reLayout);}function switchInterfaceLanguage(language) {@@ -188,11 +209,10 @@ define(function(require, exports, module) {tsTagsUI.showAddTagsDialog();});Mousetrap.bind(tsSettings.getSearchKeyBinding(), function() {- tsCoreUI.showSearchArea();+ tsSearchUI.showSearchArea();});}- // TODOfunction checkForNewVersion() {if (tsSettings.getCheckForUpdates()) {tsIOApi.checkNewVersion();@@ -240,13 +260,6 @@ define(function(require, exports, module) {}}- function updateLogger() {- console.log('Updating logger...');- }-- var $loadingAnimation = $('.loadingAnimation');- var $statusBar = $('#statusBar');-function showLoadingAnimation() {$statusBar.hide();$loadingAnimation.show();@@ -319,14 +332,8 @@ define(function(require, exports, module) {return rows;}- // UI and Layout functionalities- var isFullWidth = false;- var shouldOpenCol1 = true;- var shouldOpenCol2 = true;- var shouldOpenCol3 = false;- var oneColumn = false;-function isOneColumn() {+return oneColumn;}@@ -406,14 +413,15 @@ define(function(require, exports, module) {}function hidePerspectiveMenu() {+$(".perspectiveMainMenuButton").hide();}function showPerspectiveMenu() {+$(".perspectiveMainMenuButton").show();}- //TODO: save state on file operations- var saveOpenCol1 = false;+function openFileViewer() {shouldOpenCol3 = true;saveOpenCol1 = shouldOpenCol1;@@ -443,13 +451,10 @@ define(function(require, exports, module) {}function reloadUI() {+location.reload();}- window.addEventListener('orientationchange', reLayout);-- $(window).on('resize', reLayout);-function createDocumentEvent(type, data) {var evt = document.createEvent('Events');evt.initEvent(type, false, false);@@ -489,7 +494,6 @@ define(function(require, exports, module) {exports.initApp = initApp;exports.reLayout = reLayout;exports.isOneColumn = isOneColumn;- exports.updateLogger = updateLogger;exports.showLoadingAnimation = showLoadingAnimation;exports.hideLoadingAnimation = hideLoadingAnimation;exports.reloadUI = reloadUI;diff --git a/data/js/core.ui.js b/data/js/core.ui.jsindex f28f39167..8f9265659 100644--- a/data/js/core.ui.js+++ b/data/js/core.ui.js@@ -1,17 +1,20 @@-/* Copyright (c) 2012-2015 The TagSpaces Authors. All rights reserved.+/* Copyright (c) 2012-2016 The TagSpaces Authors. All rights reserved.* Use of this source code is governed by a AGPL3 license that* can be found in the LICENSE file. */+/* global define, Handlebars, isNode, isFirefox */define(function(require, exports, module) {'use strict';+console.log('Loading core.ui.js ...');+var TSCORE = require('tscore');var TSPOSTIO = require("tspostioapi");var fileContent;var fileType;var waitingDialogTimeoutID;- var showWaitingDialog = function(message, title) {+ function showWaitingDialog(message, title) {if (!title) {title = $.i18n.t('ns.dialogs:titleWaiting');}@@ -32,14 +35,14 @@ define(function(require, exports, module) {waitingModal.draggable({handle: ".modal-header"});- };+ }- var hideWaitingDialog = function(message, title) {+ function hideWaitingDialog(message, title) {window.clearTimeout(waitingDialogTimeoutID);$('#waitingDialog').modal('hide');- };+ }- var showSuccessDialog = function(message) {+ function showSuccessDialog(message) {if (!message) {return;}@@ -59,9 +62,9 @@ define(function(require, exports, module) {maxVisible: 1,closeWith: ['button', 'click'],});- };+ }- var showAlertDialog = function(message, title) {+ function showAlertDialog(message, title) {if (!title) {title = $.i18n.t('ns.dialogs:titleAlert');}@@ -99,9 +102,9 @@ define(function(require, exports, module) {backdrop: 'static',show: true});*/- };+ }- var showConfirmDialog = function(title, message, okCallback, cancelCallback, confirmShowNextTime) {+ function showConfirmDialog(title, message, okCallback, cancelCallback, confirmShowNextTime) {if (!title) {title = $.i18n.t('ns.dialogs:titleConfirm');}@@ -138,9 +141,9 @@ define(function(require, exports, module) {confirmModal.draggable({handle: ".modal-header"});- };+ }- var showFileCreateDialog = function() {+ function showFileCreateDialog() {fileContent = TSCORE.Config.getNewTextFileContent();// Default new file in text filefileType = 'txt';@@ -178,9 +181,9 @@ define(function(require, exports, module) {$('#dialogFileCreate').draggable({handle: ".modal-header"});- };+ }- var showFileRenameDialog = function(filePath) {+ function showFileRenameDialog(filePath) {$('#renamedFileName').attr('filepath', filePath);$('#renamedFileName').val(TSCORE.TagUtils.extractFileName(filePath));@@ -207,9 +210,9 @@ define(function(require, exports, module) {$('#dialogFileRename').draggable({handle: ".modal-header"});- };+ }- var showFileDeleteDialog = function(filePath) {+ function showFileDeleteDialog(filePath) {console.log('Deleting file...');var dlgConfirmMsgId = 'ns.dialogs:fileDeleteContentConfirm';if (TSCORE.Config.getUseTrashCan()) {@@ -228,9 +231,9 @@ define(function(require, exports, module) {});});- };+ }- var showTagEditDialog = function() {+ function showTagEditDialog() {$('#newTagName').val(TSCORE.selectedTag);$('#formEditTag').validator();$('#formEditTag').submit(function(e) {@@ -255,9 +258,9 @@ define(function(require, exports, module) {$('#dialogEditTag').draggable({handle: ".modal-header"});- };+ }- var showDirectoryBrowserDialog = function(path) {+ function showDirectoryBrowserDialog(path) {require(['text!templates/DirectoryBrowserDialog.html','tsdirectorybrowser'@@ -271,9 +274,9 @@ define(function(require, exports, module) {$('#directoryBrowserDialog').i18n();TSCORE.IOUtils.listSubDirectories(path);});- };+ }- var showOptionsDialog = function() {+ function showOptionsDialog() {require(['text!templates/OptionsDialog.html','tsoptions'@@ -287,16 +290,16 @@ define(function(require, exports, module) {$('#dialogOptions').i18n();controller.reInitUI();});- };+ }- var showWelcomeDialog = function() { startGettingStartedTour(); };+ function showWelcomeDialog() { startGettingStartedTour(); }- var startGettingStartedTour = function() {+ function startGettingStartedTour() {var tsGettingStarted = require('tsgettingstarted');tsGettingStarted.startTour();- };+ }- var showMoveCopyFilesDialog = function() {+ function showMoveCopyFilesDialog() {require(['text!templates/MoveCopyFilesDialog.html'], function(uiTPL) {if ($('#dialogMoveCopyFiles').length < 1) {var uiTemplate = Handlebars.compile(uiTPL);@@ -369,9 +372,9 @@ define(function(require, exports, module) {});console.log('Selected files: ' + TSCORE.selectedFiles);});- };+ }- var showAboutDialog = function() {+ function showAboutDialog() {$('#dialogAboutTS').modal({backdrop: 'static',show: true@@ -379,9 +382,9 @@ define(function(require, exports, module) {$('#dialogAboutTS').draggable({handle: ".modal-header"});- };+ }- var initUI = function() {+ function initUI() {if (TSCORE.PRO) {//TSCORE.PRO.sayHi();}@@ -699,8 +702,7 @@ define(function(require, exports, module) {$(document).click(function() {TSCORE.hideAllDropDownMenus();});- };-+ }function disableTopToolbar() {$('#perspectiveSwitcherButton').prop('disabled', true);@@ -744,20 +746,6 @@ define(function(require, exports, module) {$('#fileMenuOpenNatively').parent().hide();} else if (isNode || isElectron) {$('#openFileInNewWindow').hide();- //handling window maximization- /*var nwwin = isNode ? gui.Window.get() : remote.getCurrentWindow();- nwwin.on('maximize', function() {- TSCORE.Config.setIsWindowMaximized(true);- TSCORE.Config.saveSettings();- });- nwwin.on('unmaximize', function() {- TSCORE.Config.setIsWindowMaximized(false);- TSCORE.Config.saveSettings();- }); */- // Disabling automatic maximazation of the main window- //if(TSCORE.Config.getIsWindowMaximized()){- // nwwin.maximize();- //}}// Disable send to feature on all platforms except android cordovaif (!isCordova) {@@ -769,7 +757,7 @@ define(function(require, exports, module) {}}- var showContextMenu = function(menuId, sourceObject) {+ function showContextMenu(menuId, sourceObject) {var leftPos = sourceObject.offset().left;var topPos = sourceObject.offset().top;if (sourceObject.offset().top + sourceObject.height() + $(menuId).height() > window.innerHeight) {@@ -784,9 +772,9 @@ define(function(require, exports, module) {left: leftPos,top: topPos});- };+ }- var hideAllDropDownMenus = function() {+ function hideAllDropDownMenus() {$('#tagGroupMenu').hide();$('#tagTreeMenu').hide();$('#directoryMenu').hide();@@ -795,9 +783,9 @@ define(function(require, exports, module) {$('.dirAltNavMenu').hide();$('#locationTagTreeMenu').hide();//$('#searchOptions').hide();- };+ }- var showLocationsPanel = function() {+ function showLocationsPanel() {TSCORE.openLeftPanel();$('#tagGroupsContent').hide();$('#contactUsContent').hide();@@ -805,9 +793,9 @@ define(function(require, exports, module) {$('#showTagGroups').removeClass('active');$('#contactUs').removeClass('active');$('#showLocations').addClass('active');- };+ }- var showTagsPanel = function() {+ function showTagsPanel() {TSCORE.openLeftPanel();$('#locationContent').hide();$('#contactUsContent').hide();@@ -815,9 +803,9 @@ define(function(require, exports, module) {$('#showLocations').removeClass('active');$('#contactUs').removeClass('active');$('#showTagGroups').addClass('active');- };+ }- var showContactUsPanel = function() {+ function showContactUsPanel() {TSCORE.openLeftPanel();$('#locationContent').hide();$('#tagGroupsContent').hide();@@ -825,7 +813,7 @@ define(function(require, exports, module) {$('#showLocations').removeClass('active');$('#showTagGroups').removeClass('active');$('#contactUs').addClass('active');- };+ }function createHTMLFile() {var filePath = TSCORE.currentPath + TSCORE.dirSeparator + TSCORE.TagUtils.beginTagContainer + TSCORE.TagUtils.formatDateTime4Tag(new Date(), true) + TSCORE.TagUtils.endTagContainer + '.html';diff --git a/data/js/search.ui.js b/data/js/search.ui.jsindex a7d7ceb07..e0100d395 100644--- a/data/js/search.ui.js+++ b/data/js/search.ui.js@@ -1,12 +1,13 @@-/* Copyright (c) 2016 The TagSpaces Authors. All rights reserved.+/* Copyright (c) 2015-2016 The TagSpaces Authors. All rights reserved.* Use of this source code is governed by a AGPL3 license that* can be found in the LICENSE file. *//* global define, Handlebars, isNode */define(function(require, exports, module) {'use strict';- console.log('Loading core.ui.js ...');+ console.log('Loading search.ui.js ...');var TSCORE = require('tscore');+ var TSPOSTIO = require("tspostioapi");var initUI = function() {// Search UI@@ -51,7 +52,13 @@ define(function(require, exports, module) {cancelSearch();});- $('#cancelSearchButton').on('click', function(e) {+ $('#resetSearchButton').on('click', function(e) {+ e.preventDefault();+ resetSearchOptions();+ $('#searchBox').val("");+ });++ $('#clearSearchButton').on('click', function(e) {e.preventDefault();$('#searchOptions').hide();cancelSearch();@@ -72,13 +79,6 @@ define(function(require, exports, module) {$('#searchFileType').on('change', function(e) {updateQuery();});-- // END Search UI-- // Hide drop downs by click and drag- $(document).click(function() {- TSCORE.hideAllDropDownMenus();- });};function parseQuery() {@@ -88,7 +88,7 @@ define(function(require, exports, module) {function updateQuery() {var query = "";if (!$('#searchRecursive').is(':checked')) {- query = "| ";+ query = "~ ";}var searchTerms = $('#searchTerms').val();@@ -120,11 +120,15 @@ define(function(require, exports, module) {$('#searchBox').val(query);}- function showSearchOptions() {+ function resetSearchOptions() {$('#searchRecursive').prop('checked', true);$('#searchTerms').val("");$('#searchTags').val("");$('#searchFileType').val("");+ }++ function showSearchOptions() {+ resetSearchOptions();var leftPosition = $(".col2").position().left + $(".col2").width();leftPosition = leftPosition - ($("#searchOptions").width() + 2);@@ -169,8 +173,8 @@ define(function(require, exports, module) {if (TSCORE.isOneColumn()) {TSCORE.closeLeftPanel();}- TSCORE.Search.nextQuery = '+' + tagQuery;- $('#searchBox').val('+' + tagQuery);+ TSCORE.Search.nextQuery = '~ +' + tagQuery;+ $('#searchBox').val('~ +' + tagQuery);TSCORE.PerspectiveManager.redrawCurrentPerspective();$('#showSearchButton').hide();$('#searchToolbar').show();