Skip to content

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

Bootstrap experiments 2

uggrockbfed8710f3e2
diff --git a/data/ext/perspectiveBasic/extension.js b/data/ext/perspectiveBasic/extension.js
index 20a7cd37b..3ffed6b7f 100644
--- a/data/ext/perspectiveBasic/extension.js
+++ b/data/ext/perspectiveBasic/extension.js
@@ -256,7 +256,7 @@ define(function(require, exports, module) {
.click( function() {
selectFile(this, $(this).attr("filepath"));
} )
- // .dropdown( 'attach' , '#fileMenu' );
+ .dropdown( 'attach' , '#fileMenu' );
fileTable.$('.fileTitleButton')
.draggable({
@@ -271,14 +271,14 @@ define(function(require, exports, module) {
.click( function() {
selectFile(this, $(this).attr("filepath"));
} )
- // .dropdown( 'attach' , '#fileMenu' );
+ .dropdown( 'attach' , '#fileMenu' );
fileTable.$('.extTagButton')
.click( function() {
selectFile(this, $(this).attr("filepath"));
TSCORE.openTagMenu(this, $(this).attr("tag"), $(this).attr("filepath"));
} )
- // .dropdown( 'attach' , '#extensionMenu' );
+ .dropdown( 'attach' , '#extensionMenu' );
fileTable.$('.tagButton')
.draggable({
@@ -294,7 +294,7 @@ define(function(require, exports, module) {
selectFile(this, $(this).attr("filepath"));
TSCORE.openTagMenu(this, $(this).attr("tag"), $(this).attr("filepath"));
} )
- // .dropdown( 'attach' , '#tagMenu' );
+ .dropdown( 'attach' , '#tagMenu' );
if(viewMode == "files") {
console.debug("Change to FileView");
diff --git a/data/ext/perspectiveDefault/perspectiveUI.js b/data/ext/perspectiveDefault/perspectiveUI.js
index c1c95c77e..5d2074310 100644
--- a/data/ext/perspectiveDefault/perspectiveUI.js
+++ b/data/ext/perspectiveDefault/perspectiveUI.js
@@ -67,33 +67,35 @@ console.debug("Loading UI for perspectiveDefault");
ExtUI.prototype.buildUI = function() {
console.debug("Init UI module");
-
- this.viewToolbar.append($("<button>", {
- //text: "New",
+
+ this.viewToolbar.append($("<a>", {
class: "btn btn-small",
- disabled: true,
+ disabled: false,
title: "Create new file",
id: this.extensionID+"CreateFileButton",
})
.append( $("<i>", { class: "icon-file", }) )
.append("New")
- );
-
+ .click(function() {
+ $( "#dialog-filecreate" ).dialog( "open" );
+ })
+ );
+
this.viewToolbar.append($("<button>", {
text: "Subdirs",
class: "btn btn-small",
- disabled: true,
+ disabled: false,
title: "Show subfolders content. \nOn subfolder with many files, this step can take some time!",
id: this.extensionID+"IncludeSubDirsButton",
- }));
-
+ }));
+
this.viewToolbar.append($("<button>", {
text: "Add Tag",
class: "btn btn-small",
- disabled: true,
+ disabled: false,
title: "Tag Selected Files",
id: this.extensionID+"TagButton",
- }));
+ }));
this.viewToolbar.append($("<input>", {
type: "checkbox",
@@ -145,7 +147,7 @@ console.debug("Loading UI for perspectiveDefault");
// autocomplete: "off", // Error: cannot call methods on autocomplete prior to initialization; attempted to call method 'off'
title: "This filter applies to current directory without subdirectories.",
id: this.extensionID+"FilterBox",
- })));
+ })));
this.viewContainer.append($("<table>", {
cellpadding: "0",
@@ -293,14 +295,14 @@ console.debug("Loading UI for perspectiveDefault");
.click( function() {
self.selectFile(this, $(this).attr("filepath"));
} )
- //.dropdown( 'attach' , '#fileMenu' );
+ .dropdown( 'attach' , '#fileMenu' );
this.fileTable.$('.extTagButton')
.click( function() {
self.selectFile(this, $(this).attr("filepath"));
TSCORE.openTagMenu(this, $(this).attr("tag"), $(this).attr("filepath"));
} )
- //.dropdown( 'attach' , '#extensionMenu' );
+ .dropdown( 'attach' , '#extensionMenu' );
this.fileTable.$('.thumbImg')
.dblclick( function() {
@@ -331,13 +333,13 @@ console.debug("Loading UI for perspectiveDefault");
self.selectFile(this, $(this).attr("filepath"));
TSCORE.openTagMenu(this, $(this).attr("tag"), $(this).attr("filepath"));
} )
- //.dropdown( 'attach' , '#tagMenu' );
+ .dropdown( 'attach' , '#tagMenu' );
$('#'+this.extensionID+"FileTable_wrapper").show();
- $( "#"+this.extensionID+"CreateFileButton" ).button( "enable" );
+ // $( "#"+this.extensionID+"CreateFileButton" ).button( "enable" );
- $( "#"+this.extensionID+"IncludeSubDirsButton" ).button( "enable" );
+ // $( "#"+this.extensionID+"IncludeSubDirsButton" ).button( "enable" );
}
@@ -403,10 +405,7 @@ console.debug("Loading UI for perspectiveDefault");
var self = this;
// Initialize file buttons
- $( "#"+this.extensionID+"CreateFileButton" )
- .click(function() {
- $( "#dialog-filecreate" ).dialog( "open" );
- });
+
$( "#"+this.extensionID+"IncludeSubDirsButton" )
.click(function() {
diff --git a/data/index.html b/data/index.html
index dd17fa779..8e70b6688 100644
--- a/data/index.html
+++ b/data/index.html
@@ -14,6 +14,7 @@
<link rel="stylesheet" type="text/css" href="libs/jquerylayout/layout-default-latest.css">
<link rel="stylesheet" type="text/css" href="libs/jsoneditor/jsoneditor.css">
<link rel="stylesheet" type="text/css" href="libs/datatables/css/jquery.dataTables.css">
+ <link rel="stylesheet" type="text/css" href="libs/jquerydropdown/jquery.dropdown.css">
<link rel="stylesheet/less" type="text/css" href="css/tagspaces.less">
<script type="text/javascript" data-main="loader" src="libs/requirejs/require.js"></script>
</head>
@@ -22,13 +23,6 @@
<div id="container" style="display: none;">
<div class="ui-layout-north">
<a href="http://tagspaces.org" target="_new"><span id="logo">TagSpaces<sup id="appVersion" style="font-size: 0.6em; color: #BFBFBF"></sup></span></a>
- <div class="btn-group">
- <button id="reloadTagSpace" class="btn btn-small" >Select Location</button>
- <button id="selectTagSpace" class="btn btn-small dropdown-toggle" data-toggle="dropdown">
- <span class="caret"></span>
- </button>
- <ul style="z-index: 10000" class="dropdown-menu" id="favoritesList"></ul>
- </div>
<span id="loadingAnimation">&nbsp;</span>
<a id="openAboutBox" href="#dialogAbout" role="button" class="btn btn-small pull-right " data-toggle="modal"><i class="icon-comment"></i> About</a>
<a id="openOptions" href="#dialogOptions" role="button" class="btn btn-small pull-right" title="Options Dialog" data-toggle="modal"><i class="icon-wrench"></i> Options</a>
@@ -38,11 +32,17 @@
<div class="ui-layout-west" style="padding: 2px;">
<div id="directoryNavigator" class="west-center" style="padding: 0">
- <div id="directoryNavigatorNorth" style="padding: 0" >
- <button id="editLocation" title="Choose Location" class="btn btn-small"><i class="icon-hand-up"></i></button>
+ <div id="directoryNavigatorNorth" style="padding: 0;" >
+ <div class="btn-group" style=" width: 100%;">
+ <button id="reloadTagSpace" style="text-align: left; width: 85%;" class="btn btn-small" >Select Location</button>
+ <button id="selectTagSpace" style="width: 15%;" class="btn btn-small dropdown-toggle">
+ <span class="caret"></span>
+ </button>
+ </div>
+ <!--button id="editLocation" title="Choose Location" class="btn btn-small"><i class="icon-hand-up"></i></button>
<button id="editLocation" title="Refresh Location" class="btn btn-small"><i class="icon-refresh"></i></button>
<button id="editLocation" title="Edit Location" class="btn btn-small"><i class="icon-edit"></i></button>
- <button id="editLocation" title="Remove Location" class="btn btn-small"><i class="icon-remove"></i></button>
+ <button id="editLocation" title="Remove Location" class="btn btn-small"><i class="icon-remove"></i></button-->
</div>
<div id="dirTree" style="padding: 0; height: 100%;">
@@ -307,6 +307,8 @@
<div id="settingsPlainJSON" style="width: 100%; height: 100%;"></div>
</div>
+ <ul class="contextMenu" id="favoritesList"></ul>
+
<ul id="tagSuggestionsMenu" class="dropdown-menu has-tip anchor-right"></ul>
<ul id="fileMenu" class="dropdown-menu has-tip">
diff --git a/data/js/directories.ui.js b/data/js/directories.ui.js
index ef77df292..882ab02f1 100644
--- a/data/js/directories.ui.js
+++ b/data/js/directories.ui.js
@@ -1,413 +1,465 @@
-/* Copyright (c) 2012 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. */
-define(function(require, exports, module) {
-"use strict";
-
- console.debug("Loading DirectoriesUI...");
-
- var TSCORE = require("tscore");
-
- var directoryHistory = [];
-
- var dir4ContextMenu = null;
-
- var nameCurrentFavorite = undefined;
-
- function openFavorite(path, title) {
- console.debug("Opening favorite in : "+path+" title: "+title);
-
- document.title = title + " | " + TSCORE.Config.DefaultSettings.appName;
-
- $( "#reloadTagSpace" ).attr("title",path);
-
- // Clears the directory history
- directoryHistory = new Array();
- navigateToDirectory(path);
- }
-
- // Updates the directory subtree
- function updateSubDirs(dirList) {
- console.debug("Updating subdirs(TSCORE)..."+JSON.stringify(dirList));
-
- // Sort the dirList alphabetically
- dirList.sort(function(a,b) { return a.title.localeCompare(b.title); });
-
- for(var i=0; i < directoryHistory.length; i++) {
- if(directoryHistory[i].key == TSCORE.currentPath) {
- directoryHistory[i]["children"] = new Array();
- for(var j=0; j < dirList.length; j++) {
- directoryHistory[i]["children"].push(dirList[j]);
- }
- }
- }
-
- generateDirPath();
- handleDirCollapsion();
- }
-
- function generateDirPath() {
- console.debug("Generating Directory Path...");
- $("#dirTree").empty();
-
- // Code based on http://jsbin.com/eqape/1/edit
- $("#dirTree").addClass("ui-accordion ui-accordion-icons ui-widget ui-helper-reset")
- for(var i=0; i < directoryHistory.length; i++) {
- $("#dirTree").append($("<h3>", {
- class: "ui-accordion-header ui-helper-reset ui-state-default ui-corner-top ui-corner-bottom"
- })
- .hover(function() { $(this).toggleClass("ui-state-hover"); })
- // Add plus button to h3
- .append($("<span>", {
- class: "ui-icon ui-icon-triangle-1-e",
- style: "position:relative!important; display:inline-block;",
- })
- .click(function() {
- $(this)
- // .toggleClass("ui-icon-triangle-1-s")
- .parent().toggleClass("ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom").end()
- .parent().next().toggleClass("ui-accordion-content-active").toggle();
- return false;
- })
- )
- // Add directory button to h3
- .append($("<button>", {
- class: "dirButton",
- key: directoryHistory[i].key,
- title: directoryHistory[i].key,
- text: directoryHistory[i].title,
- })
- .droppable({
- accept: '.fileTitleButton,.fileButton',
- hoverClass: "dirButtonActive",
- drop: function( event, ui ) {
- var filePath = ui.draggable.attr("filepath");
- var fileName = TSCORE.TagUtils.extractFileName(filePath);
- var targetDir = $(this).attr("key");
- console.log("Moving file: "+filePath+" to "+targetDir);
- TSCORE.IO.renameFile(filePath, targetDir+TSCORE.TagUtils.DIR_SEPARATOR+fileName);
- }
- })
- .click(function() {
- navigateToDirectory($(this).attr("key"));
- })
- )
- // Add settings button to h3
- .append($("<span>", {
- class: "ui-icon ui-icon-gear",
- key: directoryHistory[i].key,
- title: "Directorys options",
- style: "float: right!important; position:relative!important; vertical-align: middle; display:inline-block;",
- })
- //.dropdown( 'attach' , '#directoryMenu' )
- .click( function(event) {
- dir4ContextMenu = $(this).attr("key");
- })
- )
- );
-
- var dirButtons = $("<div>").appendTo( "#dirTree" );
- dirButtons.attr("style","margin: 0px; padding: 5px;");
- dirButtons.addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom")
- dirButtons.hide();
- if(directoryHistory[i]["children"].length <= 0) {
- dirButtons.append("No subfolders found.");
- } else {
- for(var j=0; j < directoryHistory[i]["children"].length; j++) {
- dirButtons.append($("<button>", {
- class: "dirButton",
- key: directoryHistory[i]["children"][j].key,
- title: directoryHistory[i]["children"][j].key,
- text: directoryHistory[i]["children"][j].title,
- })
- .droppable({
- accept: ".fileTitleButton,.fileButton",
- hoverClass: "dirButtonActive",
- drop: function( event, ui ) {
- var filePath = ui.draggable.attr("filepath");
- var fileName = TSCORE.TagUtils.extractFileName(filePath);
- var targetDir = $(this).attr("key");
- console.log("Moving file: "+filePath+" to "+targetDir);
- TSCORE.IO.renameFile(filePath, targetDir+TSCORE.TagUtils.DIR_SEPARATOR+fileName);
- }
- })
- .click( function() {
- navigateToDirectory($(this).attr("key"));
- })
- );
- }
- }
- }
- }
-
- function handleDirCollapsion() {
- $("#dirTree").find("h3").each(function(index) {
- console.log("Entered h3 "+$(this).next().text());
- var key = $(this).find("button").attr("key");
- if(!getDirectoryCollapsed(key)) {
- $(this).toggleClass("ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom").end();
- $(this).next().toggleClass("ui-accordion-content-active").toggle();
- }
- });
- }
-
- function getDirectoryCollapsed(directoryPath) {
- for(var i=0; i < directoryHistory.length; i++) {
- if(directoryHistory[i].key == directoryPath) {
- return directoryHistory[i].collapsed;
- }
- }
- }
-
- function setDirectoryCollapse(directoryPath, collapsed) {
- for(var i=0; i < directoryHistory.length; i++) {
- if(directoryHistory[i].key == directoryPath) {
- directoryHistory[i].collapsed = collapsed;
- }
- }
- }
-
- function navigateToDirectory(directoryPath) {
- console.log("Navigating to directory: "+directoryPath);
-
- // Cleaning the directory path from \\ \ and /
- if( (directoryPath.lastIndexOf('/')+1 == directoryPath.length) || (directoryPath.lastIndexOf('\\')+1 == directoryPath.length)) {
- directoryPath = directoryPath.substring(0,directoryPath.length-1);
- }
- if( (directoryPath.lastIndexOf('\\\\')+1 == directoryPath.length)) {
- directoryPath = directoryPath.substring(0,directoryPath.length-2);
- }
-
- var directoryFoundOn = -1;
- for(var i=0; i < directoryHistory.length; i++) {
- if(directoryHistory[i].key == directoryPath) {
- directoryHistory[i].collapsed = false;
- directoryFoundOn = i;
- } else {
- directoryHistory[i].collapsed = true;
- }
- }
-
- // Removes the history only if it is a completely new path
- if(directoryFoundOn >= 0) {
- var diff = directoryHistory.length - (directoryFoundOn+1);
- if(diff > 0) {
- directoryHistory.splice(directoryFoundOn+1, diff);
- }
- }
-
- // If directory path not in history then add it to the history
- if(directoryFoundOn < 0) {
- var parentLocation = directoryPath.substring(0, directoryPath.lastIndexOf(TSCORE.TagUtils.DIR_SEPARATOR));
- var parentFound = -1;
- for(var i=0; i < directoryHistory.length; i++) {
- if(directoryHistory[i].key == parentLocation) {
- parentFound = i;
- }
- }
- if(parentFound >= 0) {
- var diff = directoryHistory.length - (parentFound+1);
- if(diff > 0) {
- directoryHistory.splice(parentFound+1, diff);
- }
- }
-
- var locationTitle = directoryPath.substring(directoryPath.lastIndexOf(TSCORE.TagUtils.DIR_SEPARATOR)+1,directoryPath.length);
- directoryHistory.push({
- "title": locationTitle,
- "key" : directoryPath,
- "collapsed" : false,
- });
- }
-
- TSCORE.currentPath = directoryPath;
- TSCORE.IO.getSubdirs(directoryPath);
- TSCORE.IO.listDirectory(directoryPath);
- }
-
- function initButtons() {
-
- $( "#selectLocalDirectory" )
- .button({
- text: false,
- icons: {
- primary: "ui-icon-folder-open"
- }
- })
- .click(function() {
- TSCORE.IO.selectDirectory();
- return false;
- })
- }
-
- function initContextMenus() {
- // Context menu for the tags in the file table and the file viewer
- $( "#directoryMenu" ).menu({
- select: function( event, ui ) {
- console.debug("Tag menu action: "+ui.item.attr( "action" ));
- switch (ui.item.attr( "action" )) {
- case "reloadDirectory":
- navigateToDirectory(dir4ContextMenu);
- break;
- case "createDirectory":
- $( "#dialog-dircreate" ).dialog("open");
- break;
- case "openDirectory":
- TSCORE.IO.openDirectory(dir4ContextMenu);
- break;
- }
- }
- });
- }
-
- function initDialogs() {
- var newDirName = $( "#dirname" );
-
- // TODO evtl add smarttag and the others...
- var allFields = $( [] ).add( newDirName );
-
- var tips = $( ".validateTips" );
-
- function updateTips( t ) {
- tips
- .text( t )
- .addClass( "ui-state-highlight" );
- setTimeout(function() {
- tips.removeClass( "ui-state-highlight", 1500 );
- }, 500 );
- }
-
- function checkLength( o, n, min, max ) {
- if ( o.val().length > max || o.val().length < min ) {
- o.addClass( "ui-state-error" );
- updateTips( "Length of " + n + " must be between " +
- min + " and " + max + "." );
- return false;
- } else {
- return true;
- }
- }
-
- function checkRegexp( o, regexp, n ) {
- if ( !( regexp.test( o.val() ) ) ) {
- o.addClass( "ui-state-error" );
- updateTips( n );
- return false;
- } else {
- return true;
- }
- }
-
- $( "#dialog-dircreate" ).dialog({
- autoOpen: false,
- height: 200,
- width: 350,
- modal: true,
- buttons: {
- "Create": function() {
- var bValid = true;
- allFields.removeClass( "ui-state-error" );
-
- bValid = bValid && checkLength( newDirName, "directory name", 3, 100 );
-
- bValid = bValid && checkRegexp( newDirName, /^([0-9a-z_])+$/i, "Directory name may consist of a-z, 0-9, underscores." );
- // From jquery.validate.js (by joern), contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
- // bValid = bValid && checkRegexp( email, /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i, "eg. [email protected]" );
- // bValid = bValid && checkRegexp( password, /^([0-9a-zA-Z])+$/, "Password field only allow : a-z 0-9" );
- if ( bValid ) {
- TSCORE.IO.createDirectory(dir4ContextMenu+TSCORE.TagUtils.DIR_SEPARATOR+newDirName.val());
- navigateToDirectory(dir4ContextMenu);
- $( this ).dialog( "close" );
- }
- },
- Cancel: function() {
- $( this ).dialog( "close" );
- }
- },
- close: function() {
- allFields.val( "" ).removeClass( "ui-state-error" );
- }
- });
-
- $( "#dialog-confirmfavoritedelete" ).dialog({
- autoOpen: false,
- resizable: false,
- height:140,
- modal: true,
- buttons: {
- "Delete": function() {
- TSCORE.Config.deleteFavorite(nameCurrentFavorite);
- initFavorites();
- openFavorite(TSCORE.Config.Settings["tagspacesList"][0].path, TSCORE.Config.Settings["tagspacesList"][0].name);
- $( this ).dialog( "close" );
- },
- Cancel: function() {
- $( this ).dialog( "close" );
- }
- }
- });
-
- $( "#dialogFavoriteCreate" ).dialog({
- autoOpen: false,
- resizable: false,
- height:240,
- modal: true,
- buttons: {
- "Create": function() {
- TSCORE.Config.createFavorite($("#favoriteName").val(), $("#favoriteLocation").val());
- initFavorites();
- openFavorite(TSCORE.Config.Settings["tagspacesList"][0].path, TSCORE.Config.Settings["tagspacesList"][0].name);
- $( this ).dialog( "close" );
- },
- Cancel: function() {
- $( this ).dialog( "close" );
- }
- }
- });
- }
-
- function initFavorites() {
- console.debug("Creating location menu...");
-
- $( "#favoritesList" ).empty();
-
- var favoritesList = TSCORE.Config.Settings["tagspacesList"]
- for (var i=0; i < favoritesList.length; i++) {
- $( "#favoritesList" ).append(
- $('<li>', { title: favoritesList[i].path, name: favoritesList[i].name}).append(
- $('<a>', { href: "javascript:void(0);", text: favoritesList[i].name} )));
- };
- $( "#favoritesList" ).append('<li><hr></li>');
- $( "#favoritesList" ).append('<li name="createFavorite" id="createNewLocation" ><a href="javascript:void(0);"><span class="ui-icon ui-icon-document"></span>New Location</a></li>');
- // $( "#favoritesList" ).append('<li name="editFavorite"><a href="javascript:void(0);"><span class="ui-icon ui-icon-pencil"></span>Edit Location</a></li>');
- $( "#favoritesList" ).append('<li name="deleteFavorite"><a href="javascript:void(0);"><span class="ui-icon ui-icon-trash"></span>Remove Location</a></li>');
-
-/*
- case "createFavorite":
- $("#favoriteName").val("");
- $("#favoriteLocation").val("");
- $("#dialogFavoriteCreate").dialog("open");
- break;
- case "editFavorite":
- console.debug("Editing fav... under dev...");
- $("#dialogFavoriteEdit").dialog("open");
- break;
- case "deleteFavorite":
- $( "#dialog-confirmfavoritedelete" ).dialog("open");
- break;
- default:
- nameCurrentFavorite = ui.item.attr( "name" );
- openFavorite(ui.item.attr( "title" ), ui.item.attr( "name" ));
- $( "#favoritesList" ).hide();
- break;
-*/
- }
-
- // Public API definition
- exports.openFavorite = openFavorite;
- exports.updateSubDirs = updateSubDirs;
- exports.initDialogs = initDialogs;
- exports.initButtons = initButtons;
- exports.initContextMenus = initContextMenus;
- exports.initFavorites = initFavorites;
+/* Copyright (c) 2012 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. */
+define(function(require, exports, module) {
+"use strict";
+
+ console.debug("Loading DirectoriesUI...");
+
+ var TSCORE = require("tscore");
+
+ var directoryHistory = [];
+
+ var dir4ContextMenu = null;
+
+ var nameCurrentFavorite = undefined;
+
+ function openFavorite(path, title) {
+ console.debug("Opening favorite in : "+path+" title: "+title);
+
+ document.title = title + " | " + TSCORE.Config.DefaultSettings.appName;
+
+ $( "#reloadTagSpace" ).button({
+ label: title
+ });
+ $( "#reloadTagSpace" ).attr("title",path);
+
+ // Clears the directory history
+ directoryHistory = new Array();
+ navigateToDirectory(path);
+ }
+
+ // Updates the directory subtree
+ function updateSubDirs(dirList) {
+ console.debug("Updating subdirs(TSCORE)..."+JSON.stringify(dirList));
+
+ // Sort the dirList alphabetically
+ dirList.sort(function(a,b) { return a.title.localeCompare(b.title); });
+
+ for(var i=0; i < directoryHistory.length; i++) {
+ if(directoryHistory[i].key == TSCORE.currentPath) {
+ directoryHistory[i]["children"] = new Array();
+ for(var j=0; j < dirList.length; j++) {
+ directoryHistory[i]["children"].push(dirList[j]);
+ }
+ }
+ }
+
+ generateDirPath();
+ handleDirCollapsion();
+ }
+
+ function generateDirPath() {
+ console.debug("Generating Directory Path...");
+ $("#dirTree").empty();
+
+ // Code based on http://jsbin.com/eqape/1/edit
+ $("#dirTree").addClass("ui-accordion ui-accordion-icons ui-widget ui-helper-reset")
+ for(var i=0; i < directoryHistory.length; i++) {
+ $("#dirTree").append($("<h3>", {
+ class: "ui-accordion-header ui-helper-reset ui-state-default ui-corner-top ui-corner-bottom"
+ })
+ .hover(function() { $(this).toggleClass("ui-state-hover"); })
+ // Add plus button to h3
+ .append($("<span>", {
+ class: "ui-icon ui-icon-triangle-1-e",
+ style: "position:relative!important; display:inline-block;",
+ })
+ .click(function() {
+ $(this)
+ // .toggleClass("ui-icon-triangle-1-s")
+ .parent().toggleClass("ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom").end()
+ .parent().next().toggleClass("ui-accordion-content-active").toggle();
+ return false;
+ })
+ )
+ // Add directory button to h3
+ .append($("<button>", {
+ class: "dirButton",
+ key: directoryHistory[i].key,
+ title: directoryHistory[i].key,
+ text: directoryHistory[i].title,
+ })
+ .droppable({
+ accept: '.fileTitleButton,.fileButton',
+ hoverClass: "dirButtonActive",
+ drop: function( event, ui ) {
+ var filePath = ui.draggable.attr("filepath");
+ var fileName = TSCORE.TagUtils.extractFileName(filePath);
+ var targetDir = $(this).attr("key");
+ console.log("Moving file: "+filePath+" to "+targetDir);
+ TSCORE.IO.renameFile(filePath, targetDir+TSCORE.TagUtils.DIR_SEPARATOR+fileName);
+ }
+ })
+ .click(function() {
+ navigateToDirectory($(this).attr("key"));
+ })
+ )
+ // Add settings button to h3
+ .append($("<span>", {
+ class: "ui-icon ui-icon-gear",
+ key: directoryHistory[i].key,
+ title: "Directorys options",
+ style: "float: right!important; position:relative!important; vertical-align: middle; display:inline-block;",
+ })
+ .dropdown( 'attach' , '#directoryMenu' )
+ .click( function(event) {
+ dir4ContextMenu = $(this).attr("key");
+ })
+ )
+ );
+
+ var dirButtons = $("<div>").appendTo( "#dirTree" );
+ dirButtons.attr("style","margin: 0px; padding: 5px;");
+ dirButtons.addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom")
+ dirButtons.hide();
+ if(directoryHistory[i]["children"].length <= 0) {
+ dirButtons.append("No subfolders found.");
+ } else {
+ for(var j=0; j < directoryHistory[i]["children"].length; j++) {
+ dirButtons.append($("<button>", {
+ class: "dirButton",
+ key: directoryHistory[i]["children"][j].key,
+ title: directoryHistory[i]["children"][j].key,
+ text: directoryHistory[i]["children"][j].title,
+ })
+ .droppable({
+ accept: ".fileTitleButton,.fileButton",
+ hoverClass: "dirButtonActive",
+ drop: function( event, ui ) {
+ var filePath = ui.draggable.attr("filepath");
+ var fileName = TSCORE.TagUtils.extractFileName(filePath);
+ var targetDir = $(this).attr("key");
+ console.log("Moving file: "+filePath+" to "+targetDir);
+ TSCORE.IO.renameFile(filePath, targetDir+TSCORE.TagUtils.DIR_SEPARATOR+fileName);
+ }
+ })
+ .click( function() {
+ navigateToDirectory($(this).attr("key"));
+ })
+ );
+ }
+ }
+ }
+ }
+
+ function handleDirCollapsion() {
+ $("#dirTree").find("h3").each(function(index) {
+ console.log("Entered h3 "+$(this).next().text());
+ var key = $(this).find("button").attr("key");
+ if(!getDirectoryCollapsed(key)) {
+ $(this).toggleClass("ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom").end();
+ $(this).next().toggleClass("ui-accordion-content-active").toggle();
+ }
+ });
+ }
+
+ function getDirectoryCollapsed(directoryPath) {
+ for(var i=0; i < directoryHistory.length; i++) {
+ if(directoryHistory[i].key == directoryPath) {
+ return directoryHistory[i].collapsed;
+ }
+ }
+ }
+
+ function setDirectoryCollapse(directoryPath, collapsed) {
+ for(var i=0; i < directoryHistory.length; i++) {
+ if(directoryHistory[i].key == directoryPath) {
+ directoryHistory[i].collapsed = collapsed;
+ }
+ }
+ }
+
+ function navigateToDirectory(directoryPath) {
+ console.log("Navigating to directory: "+directoryPath);
+
+ // Cleaning the directory path from \\ \ and /
+ if( (directoryPath.lastIndexOf('/')+1 == directoryPath.length) || (directoryPath.lastIndexOf('\\')+1 == directoryPath.length)) {
+ directoryPath = directoryPath.substring(0,directoryPath.length-1);
+ }
+ if( (directoryPath.lastIndexOf('\\\\')+1 == directoryPath.length)) {
+ directoryPath = directoryPath.substring(0,directoryPath.length-2);
+ }
+
+ var directoryFoundOn = -1;
+ for(var i=0; i < directoryHistory.length; i++) {
+ if(directoryHistory[i].key == directoryPath) {
+ directoryHistory[i].collapsed = false;
+ directoryFoundOn = i;
+ } else {
+ directoryHistory[i].collapsed = true;
+ }
+ }
+
+ // Removes the history only if it is a completely new path
+ if(directoryFoundOn >= 0) {
+ var diff = directoryHistory.length - (directoryFoundOn+1);
+ if(diff > 0) {
+ directoryHistory.splice(directoryFoundOn+1, diff);
+ }
+ }
+
+ // If directory path not in history then add it to the history
+ if(directoryFoundOn < 0) {
+ var parentLocation = directoryPath.substring(0, directoryPath.lastIndexOf(TSCORE.TagUtils.DIR_SEPARATOR));
+ var parentFound = -1;
+ for(var i=0; i < directoryHistory.length; i++) {
+ if(directoryHistory[i].key == parentLocation) {
+ parentFound = i;
+ }
+ }
+ if(parentFound >= 0) {
+ var diff = directoryHistory.length - (parentFound+1);
+ if(diff > 0) {
+ directoryHistory.splice(parentFound+1, diff);
+ }
+ }
+
+ var locationTitle = directoryPath.substring(directoryPath.lastIndexOf(TSCORE.TagUtils.DIR_SEPARATOR)+1,directoryPath.length);
+ directoryHistory.push({
+ "title": locationTitle,
+ "key" : directoryPath,
+ "collapsed" : false,
+ });
+ }
+
+ TSCORE.currentPath = directoryPath;
+ TSCORE.IO.getSubdirs(directoryPath);
+ TSCORE.IO.listDirectory(directoryPath);
+ }
+
+ function initButtons() {
+ $( "#reloadTagSpace" )
+ .button()
+ .click(function() {
+ $( "#selectTagSpace" ).tooltip( "disable" );
+ $("#favoritesList").width($( "#reloadTagSpace" ).width()+$("#selectTagSpace").width());
+ $("#favoritesList").show().position({
+ my: "left top",
+ at: "left bottom",
+ of: $( "#reloadTagSpace" )
+ });
+ $( document ).one( "click", function() {
+ $("#favoritesList").hide();
+ });
+ return false;
+ })
+ .next()
+ .button({
+ text: false,
+ icons: {
+ primary: "ui-icon-triangle-1-s"
+ }
+ })
+ .click(function() {
+ $("#favoritesList").width($( "#reloadTagSpace" ).width()+$("#selectTagSpace").width());
+ $("#favoritesList").show().position({
+ my: "left top",
+ at: "left bottom",
+ of: $( "#reloadTagSpace" )
+ });
+ $( document ).one( "click", function() {
+ $("#favoritesList").hide();
+ });
+ return false;
+ })
+ .parent()
+ .buttonset()
+ .next()
+ .hide()
+ .menu();
+
+ $( "#selectTagSpace" ).tooltip();
+
+ $( "#selectLocalDirectory" )
+ .button({
+ text: false,
+ icons: {
+ primary: "ui-icon-folder-open"
+ }
+ })
+ .click(function() {
+ TSCORE.IO.selectDirectory();
+ return false;
+ })
+ }
+
+ function initContextMenus() {
+ // Context menu for the tags in the file table and the file viewer
+ $( "#directoryMenu" ).menu({
+ select: function( event, ui ) {
+ console.debug("Tag menu action: "+ui.item.attr( "action" ));
+ switch (ui.item.attr( "action" )) {
+ case "reloadDirectory":
+ navigateToDirectory(dir4ContextMenu);
+ break;
+ case "createDirectory":
+ $( "#dialog-dircreate" ).dialog("open");
+ break;
+ case "openDirectory":
+ TSCORE.IO.openDirectory(dir4ContextMenu);
+ break;
+ }
+ }
+ });
+ }
+
+ function initDialogs() {
+ var newDirName = $( "#dirname" );
+
+ // TODO evtl add smarttag and the others...
+ var allFields = $( [] ).add( newDirName );
+
+ var tips = $( ".validateTips" );
+
+ function updateTips( t ) {
+ tips
+ .text( t )
+ .addClass( "ui-state-highlight" );
+ setTimeout(function() {
+ tips.removeClass( "ui-state-highlight", 1500 );
+ }, 500 );
+ }
+
+ function checkLength( o, n, min, max ) {
+ if ( o.val().length > max || o.val().length < min ) {
+ o.addClass( "ui-state-error" );
+ updateTips( "Length of " + n + " must be between " +
+ min + " and " + max + "." );
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ function checkRegexp( o, regexp, n ) {
+ if ( !( regexp.test( o.val() ) ) ) {
+ o.addClass( "ui-state-error" );
+ updateTips( n );
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ $( "#dialog-dircreate" ).dialog({
+ autoOpen: false,
+ height: 200,
+ width: 350,
+ modal: true,
+ buttons: {
+ "Create": function() {
+ var bValid = true;
+ allFields.removeClass( "ui-state-error" );
+
+ bValid = bValid && checkLength( newDirName, "directory name", 3, 100 );
+
+ bValid = bValid && checkRegexp( newDirName, /^[a-z]([0-9a-z_])+$/i, "Directory name may consist of a-z, 0-9, underscores, begin with a letter." );
+ // From jquery.validate.js (by joern), contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
+ // bValid = bValid && checkRegexp( email, /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i, "eg. [email protected]" );
+ // bValid = bValid && checkRegexp( password, /^([0-9a-zA-Z])+$/, "Password field only allow : a-z 0-9" );
+ if ( bValid ) {
+ TSCORE.IO.createDirectory(dir4ContextMenu+TSCORE.TagUtils.DIR_SEPARATOR+newDirName.val());
+ navigateToDirectory(dir4ContextMenu);
+ $( this ).dialog( "close" );
+ }
+ },
+ Cancel: function() {
+ $( this ).dialog( "close" );
+ }
+ },
+ close: function() {
+ allFields.val( "" ).removeClass( "ui-state-error" );
+ }
+ });
+
+ $( "#dialog-confirmfavoritedelete" ).dialog({
+ autoOpen: false,
+ resizable: false,
+ height:140,
+ modal: true,
+ buttons: {
+ "Delete": function() {
+ TSCORE.Config.deleteFavorite(nameCurrentFavorite);
+ initFavorites();
+ openFavorite(TSCORE.Config.Settings["tagspacesList"][0].path, TSCORE.Config.Settings["tagspacesList"][0].name);
+ $( this ).dialog( "close" );
+ },
+ Cancel: function() {
+ $( this ).dialog( "close" );
+ }
+ }
+ });
+
+ $( "#dialogFavoriteCreate" ).dialog({
+ autoOpen: false,
+ resizable: false,
+ height:240,
+ modal: true,
+ buttons: {
+ "Create": function() {
+ TSCORE.Config.createFavorite($("#favoriteName").val(), $("#favoriteLocation").val());
+ initFavorites();
+ openFavorite(TSCORE.Config.Settings["tagspacesList"][0].path, TSCORE.Config.Settings["tagspacesList"][0].name);
+ $( this ).dialog( "close" );
+ },
+ Cancel: function() {
+ $( this ).dialog( "close" );
+ }
+ }
+ });
+ }
+
+ function initFavorites() {
+ console.debug("Creating location menu...");
+
+ $( "#favoritesList" ).menu();
+ $( "#favoritesList" ).menu("disable");
+ $( "#favoritesList" ).empty();
+
+ var favoritesList = TSCORE.Config.Settings["tagspacesList"]
+ for (var i=0; i < favoritesList.length; i++) {
+ $( "#favoritesList" ).append(
+ $('<li>', { title: favoritesList[i].path, name: favoritesList[i].name}).append(
+ $('<a>', { href: "javascript:void(0);", text: favoritesList[i].name} )));
+ };
+ $( "#favoritesList" ).append('<li><hr></li>');
+ $( "#favoritesList" ).append('<li name="createFavorite" id="createNewLocation" ><a href="javascript:void(0);"><span class="ui-icon ui-icon-document"></span>New Location</a></li>');
+ // $( "#favoritesList" ).append('<li name="editFavorite"><a href="javascript:void(0);"><span class="ui-icon ui-icon-pencil"></span>Edit Location</a></li>');
+ $( "#favoritesList" ).append('<li name="deleteFavorite"><a href="javascript:void(0);"><span class="ui-icon ui-icon-trash"></span>Remove Location</a></li>');
+
+ $( "#favoritesList" ).menu("destroy").menu({
+ select: function( event, ui ) {
+ var commandName = ui.item.attr( "name" );
+ switch (commandName) {
+ case "createFavorite":
+ $("#favoriteName").val("");
+ $("#favoriteLocation").val("");
+ $("#dialogFavoriteCreate").dialog("open");
+ break;
+ case "editFavorite":
+ console.debug("Editing fav... under dev...");
+ $("#dialogFavoriteEdit").dialog("open");
+ break;
+ case "deleteFavorite":
+ $( "#dialog-confirmfavoritedelete" ).dialog("open");
+ break;
+ default:
+ nameCurrentFavorite = ui.item.attr( "name" );
+ openFavorite(ui.item.attr( "title" ), ui.item.attr( "name" ));
+ $( "#favoritesList" ).hide();
+ break;
+ }
+ }
+ });
+ $( "#favoritesList" ).hide();
+ }
+
+ // Public API definition
+ exports.openFavorite = openFavorite;
+ exports.updateSubDirs = updateSubDirs;
+ exports.initDialogs = initDialogs;
+ exports.initButtons = initButtons;
+ exports.initContextMenus = initContextMenus;
+ exports.initFavorites = initFavorites;
});
\ No newline at end of file
diff --git a/data/js/fileopener.js b/data/js/fileopener.js
index 334d58778..491e21d3f 100644
--- a/data/js/fileopener.js
+++ b/data/js/fileopener.js
@@ -164,7 +164,7 @@ define(function(require, exports, module) {
.click( function() {
TSCORE.openTagMenu(this, $(this).attr("tag"), $(this).attr("filepath"));
})
- //.dropdown( 'attach' , '#tagMenu' );
+ .dropdown( 'attach' , '#tagMenu' );
// Clear filetoolbox
$( "#filetoolbox" ).empty();
diff --git a/data/js/perspective.manager.js b/data/js/perspective.manager.js
index 99d73ac73..bc41bb0a8 100644
--- a/data/js/perspective.manager.js
+++ b/data/js/perspective.manager.js
@@ -40,11 +40,11 @@ var initViews = function () {
require([extPath], function(perspective) {
perspectives.push(perspective);
initViewsUI(perspective);
- try {
+ //try {
perspective.init();
- } catch(e) {
- console.debug("Error while executing 'init' on "+perspectives[i].ID+" - "+e);
- }
+ //} catch(e) {
+ // console.debug("Error while executing 'init' on "+perspectives[i].ID+" - "+e);
+ //}
});
}
}
diff --git a/data/js/tags.ui.js b/data/js/tags.ui.js
index 34622dda5..fc07da19d 100644
--- a/data/js/tags.ui.js
+++ b/data/js/tags.ui.js
@@ -428,7 +428,7 @@ define(function(require, exports, module) {
key: TSCORE.Config.Settings["tagGroups"][i].key,
title: "Taggroup options",
})
- //.dropdown( 'attach' , '#tagGroupMenu' )
+ .dropdown( 'attach' , '#tagGroupMenu' )
.click( function(event) {
//console.debug("Clicked in taggroup setting");
TSCORE.selectedTag = $(this).attr("tag");
@@ -444,8 +444,8 @@ define(function(require, exports, module) {
tagButtons.hide();
for(var j=0; j < TSCORE.Config.Settings["tagGroups"][i]["children"].length; j++) {
tagButtons.append($("<a>", {
- "data-toggle": "dropdown",
- "href": "#",
+ // "data-toggle": "dropdown",
+ // "href": "#",
"class": "btn btn-small dropdown-toggle btn-success tagButton",
"tag": TSCORE.Config.Settings["tagGroups"][i]["children"][j].title,
"parentKey": TSCORE.Config.Settings["tagGroups"][i].key,
@@ -466,8 +466,8 @@ define(function(require, exports, module) {
.append($("<span>", {
class: "caret",
}))
+ .dropdown( 'attach' , '#tagTreeMenu' )
);
- //.dropdown( 'attach' , '#tagTreeMenu' )
}
}
diff --git a/data/libs/jquerydropdown/MIT-LICENSE.txt b/data/libs/jquerydropdown/MIT-LICENSE.txt
new file mode 100644
index 000000000..741585591
--- /dev/null
+++ b/data/libs/jquerydropdown/MIT-LICENSE.txt
@@ -0,0 +1,26 @@
+Copyright 2012 jQuery Foundation and other contributors,
+http://jqueryui.com/
+
+This software consists of voluntary contributions made by many
+individuals (AUTHORS.txt, http://jqueryui.com/about) For exact
+contribution history, see the revision history and logs, available
+at http://jquery-ui.googlecode.com/svn/
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/data/libs/jquerydropdown/jquery.dropdown.css b/data/libs/jquerydropdown/jquery.dropdown.css
new file mode 100644
index 000000000..122ee7d9e
--- /dev/null
+++ b/data/libs/jquerydropdown/jquery.dropdown.css
@@ -0,0 +1,101 @@
+.dropdown-menu {
+ font: 14px sans-serif;
+ position: absolute;
+ z-index: 9999999;
+ display: none;
+}
+
+.dropdown-menu UL {
+ min-width: 160px;
+ list-style: none;
+ background: #FFF;
+ border: solid 1px #DDD;
+ border: solid 1px rgba(0, 0, 0, .2);
+ border-radius: 6px;
+ box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
+ overflow: visible;
+ padding: 4px 0;
+ margin: 0;
+}
+
+.dropdown-menu.has-tip {
+ margin-top: 8px;
+}
+
+.dropdown-menu.has-tip:before {
+ position: absolute;
+ top: -6px;
+ left: 9px;
+ content: '';
+ border-left: 7px solid transparent;
+ border-right: 7px solid transparent;
+ border-bottom: 7px solid #CCC;
+ border-bottom-color: rgba(0, 0, 0, 0.2);
+ display: inline-block;
+}
+
+.dropdown-menu.has-tip.anchor-right:before {
+ left: auto;
+ right: 9px;
+}
+
+.dropdown-menu.has-tip:after {
+ position: absolute;
+ top: -5px;
+ left: 10px;
+ content: '';
+ border-left: 6px solid transparent;
+ border-right: 6px solid transparent;
+ border-bottom: 6px solid #FFF;
+ display: inline-block;
+}
+
+.dropdown-menu.has-tip.anchor-right:after {
+ left: auto;
+ right: 10px;
+}
+
+
+.dropdown-menu.has-scroll UL {
+ max-height: 358px;
+ overflow: auto;
+}
+
+.dropdown-menu LI {
+ list-style: none;
+ padding: 0;
+ margin: 0;
+ line-height: 18px;
+}
+
+.dropdown-menu LI > A,
+.dropdown-menu LABEL {
+ display: block;
+ color: #555;
+ text-decoration: none;
+ line-height: 18px;
+ padding: 3px 15px;
+ white-space: nowrap;
+}
+
+.dropdown-menu LI > A:hover,
+.dropdown-menu LABEL:hover {
+ background-color: #08C;
+ color: #FFF;
+ cursor: pointer;
+}
+
+.dropdown-menu .divider {
+ height: 1px;
+ background: #E5E5E5;
+ margin: 5px 1px;
+ overflow: hidden;
+}
+
+.dropdown-menu.has-icons LI > A {
+ padding-left: 30px;
+ background-position: 8px center;
+ background-repeat: no-repeat;
+}
+
+/* .dropdown-menu .undo A { background-image: url(icons/arrow-curve-180-left.png); } */
\ No newline at end of file
diff --git a/data/libs/jquerydropdown/jquery.dropdown.js b/data/libs/jquerydropdown/jquery.dropdown.js
new file mode 100644
index 000000000..4e1ad8edc
--- /dev/null
+++ b/data/libs/jquerydropdown/jquery.dropdown.js
@@ -0,0 +1,83 @@
+/*
+ * jQuery dropdown: A simple dropdown plugin
+ *
+ * Inspired by Bootstrap: http://twitter.github.com/bootstrap/javascript.html#dropdowns
+ *
+ * Copyright 2011 Cory LaViska for A Beautiful Site, LLC. (http://abeautifulsite.net/)
+ *
+ * Dual licensed under the MIT or GPL Version 2 licenses
+ *
+*/
+if(jQuery) (function($) {
+
+ $.extend($.fn, {
+ dropdown: function(method, data) {
+
+ switch( method ) {
+ case 'hide':
+ hideDropdowns();
+ return $(this);
+ case 'attach':
+ return $(this).attr('data-dropdown', data);
+ case 'detach':
+ hideDropdowns();
+ return $(this).removeAttr('data-dropdown');
+ case 'disable':
+ return $(this).addClass('dropdown-disabled');
+ case 'enable':
+ hideDropdowns();
+ return $(this).removeClass('dropdown-disabled');
+ }
+
+ }
+ });
+
+ function showMenu(event) {
+
+ var trigger = $(this),
+ dropdown = $( $(this).attr('data-dropdown') ),
+ isOpen = trigger.hasClass('dropdown-open'),
+ hOffset = parseInt($(this).attr('data-horizontal-offset') || 0),
+ vOffset = parseInt($(this).attr('data-vertical-offset') || 0);
+
+ if( trigger !== event.target && $(event.target).hasClass('dropdown-ignore') ) return;
+
+ event.preventDefault();
+ event.stopPropagation();
+
+ hideDropdowns();
+
+ if( isOpen || trigger.hasClass('dropdown-disabled') ) return;
+
+ dropdown
+ .css({
+ left: dropdown.hasClass('anchor-right') ?
+ trigger.offset().left - (dropdown.outerWidth() - trigger.outerWidth()) + hOffset : trigger.offset().left + hOffset,
+ top: trigger.offset().top + trigger.outerHeight() + vOffset
+ })
+ .show();
+
+ trigger.addClass('dropdown-open');
+
+ };
+
+ function hideDropdowns(event) {
+
+ var targetGroup = event ? $(event.target).parents().andSelf() : null;
+ if( targetGroup && targetGroup.is('.dropdown-menu') && !targetGroup.is('A') ) return;
+
+ $('BODY')
+ .find('.dropdown-menu').hide().end()
+ .find('[data-dropdown]').removeClass('dropdown-open');
+ };
+
+ $(function () {
+ $('BODY').on('click.dropdown', '[data-dropdown]', showMenu);
+ $('HTML').on('click.dropdown', hideDropdowns);
+ // Hide on resize (IE7/8 trigger this when any element is resized...)
+ if( !$.browser.msie || ($.browser.msie && $.browser.version >= 9) ) {
+ $(window).on('resize.dropdown', hideDropdowns);
+ }
+ });
+
+})(jQuery);
\ No newline at end of file
diff --git a/data/loader.js b/data/loader.js
index a77d0656b..6bd596f82 100644
--- a/data/loader.js
+++ b/data/loader.js
@@ -45,6 +45,8 @@ require.config({
jsoneditorcss: 'libs/jsoneditor/jsoneditor',
jquerylayout: 'libs/jquerylayout/jquery.layout-1.3.0.rc30.77',
jquerylayoutcss: 'libs/jquerylayout/layout-default-latest',
+ jquerydropdown: 'libs/jquerydropdown/jquery.dropdown',
+ jquerydropdowncss: 'libs/jquerydropdown/jquery.dropdown',
less: 'libs/less/less-1.3.3.min',
jqueryeditinplace: 'libs/jqueryeditinplace/jquery.editinplace',
@@ -65,7 +67,7 @@ require.config({
'jquery',
'jqueryui',
]
- },
+ },
'bootstrap': {
deps: [
'jquery',
@@ -81,11 +83,6 @@ require.config({
'jquery',
]
},
- 'dynatree': {
- deps: [
- 'jquery'
- ]
- },
'datatables': {
deps: [
'jquery'
@@ -109,6 +106,7 @@ define(function (require, exports, module) {
require("datatables");
require("jsoneditor");
require("jquerylayout");
+ require("jquerydropdown");
require("less");
require("jqueryeditinplace");