Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfnuesse <felix.nuesse@t-online.de>2018-06-20 23:40:10 +0300
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-07-12 17:49:38 +0300
commitdf9bae41bbae73220df134e8fc92d084ed03fa64 (patch)
tree05bf46b71e0bc08fb821d30599250384de92a43d /apps/files/js/tagsplugin.js
parentedd2ab219416f2a0dd9c5afd15fac9bb973370d7 (diff)
Removed old code
Signed-off-by: fnuesse <felix.nuesse@t-online.de> Removed duplicate collapse-button and changed api-endpoints Signed-off-by: fnuesse <felix.nuesse@t-online.de> Removed app-navigation-caption from apps.scss Signed-off-by: fnuesse <felix.nuesse@t-online.de> Changed api-endpoints Signed-off-by: fnuesse <felix.nuesse@t-online.de> Fixed Codestyle (.js) Signed-off-by: fnuesse <felix.nuesse@t-online.de> Hid away extended Settings Signed-off-by: fnuesse <felix.nuesse@t-online.de> Fixed reverse state Signed-off-by: fnuesse <felix.nuesse@t-online.de> Fixed Missing reverse after changing sort-strategy Signed-off-by: fnuesse <felix.nuesse@t-online.de> Fixed Copyright-Header Signed-off-by: fnuesse <felix.nuesse@t-online.de> Removed UI-Flickering Signed-off-by: fnuesse <felix.nuesse@t-online.de> hid dotmenu on toggle while favorites are empty Signed-off-by: fnuesse <felix.nuesse@t-online.de> Added Draggable to listelements (WIP) Signed-off-by: fnuesse <felix.nuesse@t-online.de> Rebuild appnavigation.php with recursive function to allow easy implementation of sublists Signed-off-by: fnuesse <felix.nuesse@t-online.de> Fixed draggable Sublist-Elements Signed-off-by: fnuesse <felix.nuesse@t-online.de> Fixed draggable Sublist-Elements Signed-off-by: fnuesse <felix.nuesse@t-online.de> Added date-modified sorting option to quickaccess Signed-off-by: fnuesse <felix.nuesse@t-online.de> Added custom order sorting option to quickaccess Signed-off-by: fnuesse <felix.nuesse@t-online.de> Added custom order sorting option to quickaccess Signed-off-by: fnuesse <felix.nuesse@t-online.de> Added fallback for custom ordering Signed-off-by: fnuesse <felix.nuesse@t-online.de>
Diffstat (limited to 'apps/files/js/tagsplugin.js')
-rw-r--r--apps/files/js/tagsplugin.js141
1 files changed, 66 insertions, 75 deletions
diff --git a/apps/files/js/tagsplugin.js b/apps/files/js/tagsplugin.js
index ce35f8bcdfd..7729a540d32 100644
--- a/apps/files/js/tagsplugin.js
+++ b/apps/files/js/tagsplugin.js
@@ -10,11 +10,11 @@
/* global Handlebars */
-(function(OCA) {
+(function (OCA) {
_.extend(OC.Files.Client, {
- PROPERTY_TAGS: '{' + OC.Files.Client.NS_OWNCLOUD + '}tags',
- PROPERTY_FAVORITE: '{' + OC.Files.Client.NS_OWNCLOUD + '}favorite'
+ PROPERTY_TAGS: '{' + OC.Files.Client.NS_OWNCLOUD + '}tags',
+ PROPERTY_FAVORITE: '{' + OC.Files.Client.NS_OWNCLOUD + '}favorite'
});
var TEMPLATE_FAVORITE_MARK =
@@ -30,7 +30,7 @@
* @param {boolean} state true if starred, false otherwise
* @return {string} icon class for star image
*/
- function getStarIconClass(state) {
+ function getStarIconClass (state) {
return state ? 'icon-starred' : 'icon-star';
}
@@ -40,7 +40,7 @@
* @param {boolean} state true if starred, false otherwise
* @return {Object} jQuery object
*/
- function renderStar(state) {
+ function renderStar (state) {
if (!this._template) {
this._template = Handlebars.compile(TEMPLATE_FAVORITE_MARK);
}
@@ -57,7 +57,7 @@
* @param {Object} $favoriteMarkEl favorite mark element
* @param {boolean} state true if starred, false otherwise
*/
- function toggleStar($favoriteMarkEl, state) {
+ function toggleStar ($favoriteMarkEl, state) {
$favoriteMarkEl.removeClass('icon-star icon-starred').addClass(getStarIconClass(state));
$favoriteMarkEl.toggleClass('permanent', state);
}
@@ -65,73 +65,64 @@
/**
* Remove Item from Quickaccesslist
*
- * @param {String} $appfolder folder to be removed
+ * @param {String} appfolder folder to be removed
*/
- function removeFavoriteFromList(appfolder) {
+ function removeFavoriteFromList (appfolder) {
- var qaKey= 'quickaccess-list';
- var listUL = document.getElementById(qaKey);
- var list = listUL.getElementsByTagName('li');
- var appname=appfolder.substring(appfolder.lastIndexOf("/")+1, appfolder.length);
+ var quickAccessList = 'sublist-favorites';
+ var collapsibleButtonId = 'button-collapse-favorites';
+ var listULElements = document.getElementById(quickAccessList);
+ var listLIElements = listULElements.getElementsByTagName('li');
+ var appName = appfolder.substring(appfolder.lastIndexOf("/") + 1, appfolder.length);
- for(var i = 0; i <= list.length-1; i++) {
- if(appname === list[i].getElementsByTagName('a')[0].innerHTML){
- list[i].remove();
+ for (var i = 0; i <= listLIElements.length - 1; i++) {
+ if (appName === listLIElements[i].getElementsByTagName('a')[0].innerHTML) {
+ listLIElements[i].remove();
}
}
- if(listUL.childElementCount==0){
- var dotmenu = document.getElementById("quickaccessbutton");
- dotmenu.style.display='none';
-
- var collapsibleButton = document.getElementById("button-collapseQuickAccess");
- collapsibleButton.style.display='none';
-
- $("#favorites-toggle" ).removeClass('collapsible');
+ if (listULElements.childElementCount === 0) {
+ var collapsibleButton = document.getElementById(collapsibleButtonId);
+ collapsibleButton.style.display = 'none';
+ $("#favorites-toggle").removeClass('collapsible');
}
}
/**
* Add Item to Quickaccesslist
*
- * @param {String} $appfolder folder to be added
+ * @param {String} appfolder folder to be added
*/
- function addFavoriteToList(appfolder) {
- var qaKey= 'quickaccess-list';
- var listUL = document.getElementById(qaKey);
- var list = listUL.getElementsByTagName('li');
-
- var appname=appfolder.substring(appfolder.lastIndexOf("/")+1, appfolder.length);
-
- var a = document.createElement('A');
- a.setAttribute("href","/cloud/index.php/apps/files/?dir="+appfolder);
- a.setAttribute("class","nav-icon-files svg");
- a.innerHTML=appname;
-
- var len=list.length+1;
- var li = document.createElement('li');
- li.setAttribute("data-id", "/cloud/index.php/apps/files/?dir="+appfolder);
- li.setAttribute("class", "nav-"+appname);
- li.setAttribute("folderpos", len.toString());
- li.appendChild(a);
-
-
- if(listUL.childElementCount<=0){
- listUL.appendChild(li);
- var dotmenu = document.getElementById("quickaccessbutton");
- dotmenu.style.display='';
-
- var collapsibleButton = document.getElementById("button-collapseQuickAccess");
- collapsibleButton.style.display='';
-
- $("#favorites-toggle" ).addClass('collapsible');
- }else{
- list[list.length-1].after(li);
+ function addFavoriteToList (appfolder) {
+ var quickAccessList = 'sublist-favorites';
+ var collapsibleButtonId = 'button-collapse-favorites';
+ var listULElements = document.getElementById(quickAccessList);
+ var listLIElements = listULElements.getElementsByTagName('li');
+
+ var appName = appfolder.substring(appfolder.lastIndexOf("/") + 1, appfolder.length);
+
+ var innerTagA = document.createElement('A');
+ innerTagA.setAttribute("href", "/cloud/index.php/apps/files/?dir=" + appfolder);
+ innerTagA.setAttribute("class", "nav-icon-files svg");
+ innerTagA.innerHTML = appName;
+
+ var length = listLIElements.length + 1;
+ var innerTagLI = document.createElement('li');
+ innerTagLI.setAttribute("data-id", "/cloud/index.php/apps/files/?dir=" + appfolder);
+ innerTagLI.setAttribute("class", "nav-" + appName);
+ innerTagLI.setAttribute("folderpos", length.toString());
+ innerTagLI.appendChild(innerTagA);
+
+
+ if (listULElements.childElementCount <= 0) {
+ listULElements.appendChild(innerTagLI);
+ var collapsibleButton = document.getElementById(collapsibleButtonId);
+ collapsibleButton.style.display = '';
+
+ $("#favorites-toggle").addClass('collapsible');
+ } else {
+ listLIElements[listLIElements.length - 1].after(innerTagLI);
}
-
- //list[list.length-1].after(li);
- //document.getElementById('menu-favorites').classList.toggle('open');
- //this.QuickSort(list, 0, list.length - 1);
}
OCA.Files = OCA.Files || {};
@@ -155,12 +146,12 @@
'shares.link'
],
- _extendFileActions: function(fileActions) {
+ _extendFileActions: function (fileActions) {
var self = this;
fileActions.registerAction({
name: 'Favorite',
- displayName: function(context) {
+ displayName: function (context) {
var $file = context.$file;
var isFavorite = $file.data('favorite') === true;
@@ -177,7 +168,7 @@
mime: 'all',
order: -100,
permissions: OC.PERMISSION_NONE,
- iconClass: function(fileName, context) {
+ iconClass: function (fileName, context) {
var $file = context.$file;
var isFavorite = $file.data('favorite') === true;
@@ -187,7 +178,7 @@
return 'icon-starred';
},
- actionHandler: function(fileName, context) {
+ actionHandler: function (fileName, context) {
var $favoriteMarkEl = context.$file.find('.favorite-mark');
var $file = context.$file;
var fileInfo = context.fileList.files[$file.index()];
@@ -219,7 +210,7 @@
tags,
$favoriteMarkEl,
isFavorite
- ).then(function(result) {
+ ).then(function (result) {
context.fileInfoModel.trigger('busy', context.fileInfoModel, false);
// response from server should contain updated tags
var newTags = result.tags;
@@ -235,10 +226,10 @@
});
},
- _extendFileList: function(fileList) {
+ _extendFileList: function (fileList) {
// extend row prototype
var oldCreateRow = fileList._createRow;
- fileList._createRow = function(fileData) {
+ fileList._createRow = function (fileData) {
var $tr = oldCreateRow.apply(this, arguments);
var isFavorite = false;
if (fileData.tags) {
@@ -253,7 +244,7 @@
return $tr;
};
var oldElementToFile = fileList.elementToFile;
- fileList.elementToFile = function($el) {
+ fileList.elementToFile = function ($el) {
var fileInfo = oldElementToFile.apply(this, arguments);
var tags = $el.attr('data-tags');
if (_.isUndefined(tags)) {
@@ -266,22 +257,22 @@
};
var oldGetWebdavProperties = fileList._getWebdavProperties;
- fileList._getWebdavProperties = function() {
+ fileList._getWebdavProperties = function () {
var props = oldGetWebdavProperties.apply(this, arguments);
props.push(OC.Files.Client.PROPERTY_TAGS);
props.push(OC.Files.Client.PROPERTY_FAVORITE);
return props;
};
- fileList.filesClient.addFileInfoParser(function(response) {
+ fileList.filesClient.addFileInfoParser(function (response) {
var data = {};
var props = response.propStat[0].properties;
var tags = props[OC.Files.Client.PROPERTY_TAGS];
var favorite = props[OC.Files.Client.PROPERTY_FAVORITE];
if (tags && tags.length) {
- tags = _.chain(tags).filter(function(xmlvalue) {
+ tags = _.chain(tags).filter(function (xmlvalue) {
return (xmlvalue.namespaceURI === OC.Files.Client.NS_OWNCLOUD && xmlvalue.nodeName.split(':')[1] === 'tag');
- }).map(function(xmlvalue) {
+ }).map(function (xmlvalue) {
return xmlvalue.textContent || xmlvalue.text;
}).value();
}
@@ -296,7 +287,7 @@
});
},
- attach: function(fileList) {
+ attach: function (fileList) {
if (this.allowedLists.indexOf(fileList.id) < 0) {
return;
}
@@ -312,7 +303,7 @@
* @param {Object} $favoriteMarkEl favorite mark element
* @param {boolean} isFavorite Was the item favorited before
*/
- applyFileTags: function(fileName, tagNames, $favoriteMarkEl, isFavorite) {
+ applyFileTags: function (fileName, tagNames, $favoriteMarkEl, isFavorite) {
var encodedPath = OC.encodePath(fileName);
while (encodedPath[0] === '/') {
encodedPath = encodedPath.substr(1);
@@ -325,10 +316,10 @@
}),
dataType: 'json',
type: 'POST'
- }).fail(function(response) {
+ }).fail(function (response) {
var message = '';
// show message if it is available
- if(response.responseJSON && response.responseJSON.message) {
+ if (response.responseJSON && response.responseJSON.message) {
message = ': ' + response.responseJSON.message;
}
OC.Notification.show(t('files', 'An error occurred while trying to update the tags' + message), {type: 'error'});