Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Quick-Access to favorite folder in left sidepanel in files-app (Cleanup) #10246

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
e86df3b
Added FavoritesQuickaccess-Sidebar
Jun 1, 2018
c484744
Added FavoritesQuickaccess-Sidebar
Jun 2, 2018
055243a
Added Files-FavoritesQuickaccess-Toggle
Jun 2, 2018
b563db1
Fixed CSS for SpacerElement
Jun 2, 2018
32651d4
Removed Unnessessary Alerts and added Translations
Jun 2, 2018
994a1c2
Tried fixing initial Quick-Access Checkboxstate
Jun 2, 2018
1fadbd3
Tried fixing initial Quick-Access Checkboxstate
Jun 2, 2018
e347f77
Merge remote-tracking branch 'origin/master'
Jun 3, 2018
c1a8e81
Changed double-Quotes to single-Quotes
Jun 3, 2018
749fd5f
Revert webdavurl which was changed by mistake
Jun 3, 2018
cabd514
Revert quota-icon which was changed by mistake
Jun 3, 2018
81e651d
Changed the Folderhandling from custom-designed to nextcloud-Navigati…
Jun 4, 2018
c0ef6fc
Moved CSS-Spacerclass to apps.scss for global usage
newhinton Jun 7, 2018
ac98314
Renamed settings-caption in apps.scss to app-navigation-caption
newhinton Jun 7, 2018
6588bbe
Removed old input-tag for showQuickAccess-state
newhinton Jun 7, 2018
dbc72cd
Removed old spacer element in files.scss
newhinton Jun 7, 2018
675d0ac
Changed style of favorites-sublist and disabled the ability to disabl…
newhinton Jun 7, 2018
7e42f12
Added toggleable QuickAccess
newhinton Jun 16, 2018
cf8a527
Deleted wrongly commited File
newhinton Jun 16, 2018
1d0ec1b
Added quickaccess-state persistence
newhinton Jun 16, 2018
3a731e1
Started implementing sorting-algorithm for proper alphabetical display
newhinton Jun 16, 2018
c6f0749
Finished Sorting of Quickaccess elements
newhinton Jun 17, 2018
245e1c0
Implemented persistence for reverse-list and sorting-strategy
newhinton Jun 17, 2018
69f52fa
Implemented initial sorting for reverse-list and sorting-strategy
newhinton Jun 17, 2018
9a07345
Refactored Code
newhinton Jun 17, 2018
916fbd7
Refactored Code
newhinton Jun 17, 2018
deb2049
Refactored Code
newhinton Jun 17, 2018
1f57988
Fixed complete app-breakdown if no favorites are set
newhinton Jun 17, 2018
7596d02
Hid three-dot menu if no favorites are selected
newhinton Jun 18, 2018
cc41b9f
Added responsive folderadding
newhinton Jun 18, 2018
3be815d
Added collapsible to quickaccesslist
newhinton Jun 18, 2018
5ee8c7a
Refactored Code
newhinton Jun 18, 2018
2987154
Fixed css-flashing
newhinton Jun 18, 2018
2962814
Fixed menu if initially empty
newhinton Jun 18, 2018
084f1a5
Changed toggle
newhinton Jun 18, 2018
d21c13b
Fixed Codestyle and changed linkgeneration
newhinton Jun 20, 2018
3c854f5
Fixed Codestyle
newhinton Jun 20, 2018
4e16832
Fixed Codestyle (Renamed Variables)
newhinton Jun 20, 2018
38f5c52
Added copyright notice
newhinton Jun 20, 2018
52c501e
Removed old code
newhinton Jun 20, 2018
adc9907
Removed duplicate collapse-button and changed api-endpoints
newhinton Jun 20, 2018
77ad5b5
Removed app-navigation-caption from apps.scss
newhinton Jun 20, 2018
47a862c
Changed api-endpoints
newhinton Jun 20, 2018
b346a57
Fixed Codestyle (.js)
newhinton Jun 20, 2018
8b1cf58
Hid away extended Settings
newhinton Jun 21, 2018
f597a93
Fixed reverse state
newhinton Jun 21, 2018
9191f0e
Fixed Missing reverse after changing sort-strategy
newhinton Jun 21, 2018
01773fa
Fixed Copyright-Header
newhinton Jun 21, 2018
b1a6eb7
Removed UI-Flickering
newhinton Jun 21, 2018
8c26137
hid dotmenu on toggle while favorites are empty
newhinton Jun 21, 2018
7bdb1e3
Added Draggable to listelements (WIP)
newhinton Jun 22, 2018
74272bd
Rebuild appnavigation.php with recursive function to allow easy imple…
newhinton Jun 25, 2018
7724d4c
Fixed draggable Sublist-Elements
newhinton Jun 25, 2018
f17b14e
Fixed draggable Sublist-Elements
newhinton Jun 25, 2018
38219e9
Added date-modified sorting option to quickaccess
newhinton Jun 26, 2018
1620cac
Added custom order sorting option to quickaccess
newhinton Jun 26, 2018
24c2209
Added custom order sorting option to quickaccess
newhinton Jun 26, 2018
63ce668
Added fallback for custom ordering
newhinton Jun 26, 2018
2cfae6f
Set Quickaccess-ordering to custom order
newhinton Jun 26, 2018
c7a4bed
Fix collapsible-Button when list was emptied (or got first element)
newhinton Jun 26, 2018
0ac7134
Fixed Bad url-generation in javascript for new quickaccessitems
newhinton Jun 26, 2018
8b3dbba
Fixed vertical scrolling in sortable-list which leads to "hidden" navbar
newhinton Jun 27, 2018
7131707
Removed unnessessary console logs
newhinton Jun 27, 2018
6059ec9
Fixed Bounds in custom sorting
newhinton Jun 27, 2018
c38af2c
Reformatted code
newhinton Jun 27, 2018
b7fe0be
Fixed horizontalscroll on sortable-list
newhinton Jun 27, 2018
c395b8c
Added drop-animation to sortable-list
newhinton Jun 27, 2018
8b9a6cb
Added icon-change on drag
newhinton Jun 28, 2018
80031f7
Fixed Navbar-closing in app when favorites-list is toggled on mobile
newhinton Jul 3, 2018
daefeb5
Refactored Code
newhinton Jul 3, 2018
e79f749
Changed to alphabetical sorting
newhinton Jul 5, 2018
9809a7e
Fixed deletion of folder with identical names
newhinton Jul 5, 2018
3721228
Removed ability to add files to the quickaccess
newhinton Jul 5, 2018
c2fb31d
Fixed wrong path-generation when added from favorites-star
newhinton Jul 5, 2018
abec4ea
Removed Element from navbar when favorite-star in detailview is toggl…
newhinton Jul 5, 2018
d6ea2c1
Merge remote-tracking branch 'origin/master'
newhinton Jul 15, 2018
cd8bda3
forkupdate from nextcloud/server
newhinton Jul 15, 2018
d9d6285
removed sorting code from files app
newhinton Jul 15, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3rdparty
Submodule 3rdparty updated 815 files
96 changes: 3 additions & 93 deletions apps/files/js/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,6 @@
*/
$currentContent: null,

/**
* Strategy by which the quickaccesslist is sorted
*
* Possible Strategies:
* customorder
* datemodified
* date
* alphabet
*
*/
$sortingStrategy: 'alphabet',

/**
* Key for the quick-acces-list
*/
Expand All @@ -66,13 +54,7 @@
this._activeItem = null;
this.$currentContent = null;
this._setupEvents();

var scope=this;
$.get(OC.generateUrl("/apps/files/api/v1/quickaccess/get/SortingStrategy"), function (data, status) {
scope.$sortingStrategy=data;
scope.setInitialQuickaccessSettings();
});

this.setInitialQuickaccessSettings();
},

/**
Expand Down Expand Up @@ -210,56 +192,8 @@
* Sort initially as setup of sidebar for QuickAccess
*/
setInitialQuickaccessSettings: function () {

var quickAccesKey = this.$quickAccessListKey;
var list = document.getElementById(quickAccesKey).getElementsByTagName('li');

var sort = true;
var reverse = false;
if (this.$sortingStrategy === 'datemodified') {
sort = false;
reverse = false;

var scope = this;
$.get(OC.generateUrl("/apps/files/api/v1/quickaccess/get/FavoriteFolders/"), function (data, status) {
for (var i = 0; i < data.favoriteFolders.length; i++) {
for (var j = 0; j < list.length; j++) {
if (scope.getCompareValue(list, j, 'alphabet').toLowerCase() === data.favoriteFolders[i].name.toLowerCase()) {
list[j].setAttribute("mtime", data.favoriteFolders[i].mtime);
}
}
}
scope.QuickSort(list, 0, list.length - 1);
scope.reverse(list);
});

} else if (this.$sortingStrategy === 'alphabet') {
sort = true;
} else if (this.$sortingStrategy === 'date') {
sort = true;
} else if (this.$sortingStrategy === 'customorder') {
var scope = this;
$.get(OC.generateUrl("/apps/files/api/v1/quickaccess/get/CustomSortingOrder"), function (data, status) {
var ordering = JSON.parse(data);
for (var i = 0; i < ordering.length; i++) {
for (var j = 0; j < list.length; j++) {
if (scope.getCompareValue(list, j, 'alphabet').toLowerCase() === ordering[i].name.toLowerCase()) {
list[j].setAttribute("folderPosition", ordering[i].id);
}
}
}
scope.QuickSort(list, 0, list.length - 1);
});
sort = false;
}

if (sort) {
this.QuickSort(list, 0, list.length - 1);
}
if (reverse) {
this.reverse(list);
}

var list = document.getElementById( this.$quickAccessListKey).getElementsByTagName('li');
this.QuickSort(list, 0, list.length - 1);
},

/**
Expand Down Expand Up @@ -308,21 +242,7 @@
* This method allows easy access to the element which is sorted by.
*/
getCompareValue: function (nodes, int, strategy) {

if ((typeof strategy === 'undefined')) {
strategy = this.$sortingStrategy;
}

if (strategy === 'alphabet') {
return nodes[int].getElementsByTagName('a')[0].innerHTML.toLowerCase();
} else if (strategy === 'date') {
return nodes[int].getAttribute('folderPosition').toLowerCase();
} else if (strategy === 'datemodified') {
return nodes[int].getAttribute('mtime');
} else if (strategy === 'customorder') {
return nodes[int].getAttribute('folderPosition');
}
return nodes[int].getElementsByTagName('a')[0].innerHTML.toLowerCase();
},

/**
Expand All @@ -332,16 +252,6 @@
swap: function (list, j, i) {
list[i].before(list[j]);
list[j].before(list[i]);
},

/**
* Reverse QuickAccess-List
*/
reverse: function (list) {
var len = list.length - 1;
for (var i = 0; i < len / 2; i++) {
this.swap(list, i, len - i);
}
}

};
Expand Down
127 changes: 1 addition & 126 deletions apps/files/lib/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,30 +199,6 @@ public function getRecentFiles() {
return new DataResponse(['files' => $files]);
}

/**
* Returns a list of favorites modifed folder.
*
* @NoAdminRequired
*
* @return DataResponse
*/
public function getFavoritesFolder() {
$nodes = $this->userFolder->searchByTag('_$!<Favorite>!$_', $this->userSession->getUser()->getUID());

$favorites = [];
$i = 0;
foreach ($nodes as &$node) {

$favorites[$i]['id'] = $node->getId();
$favorites[$i]['name'] = $node->getName();
$favorites[$i]['path'] = $node->getInternalPath();
$favorites[$i]['mtime'] = $node->getMTime();
$i++;
}

return new DataResponse(['favoriteFolders' => $favorites]);
}

/**
* Return a list of share types for outgoing shares
*
Expand Down Expand Up @@ -284,6 +260,7 @@ public function updateFileSorting($mode, $direction) {
* @NoAdminRequired
*
* @param bool $show
* @return Response
*/
public function showHiddenFiles($show) {
$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', (int)$show);
Expand Down Expand Up @@ -316,108 +293,6 @@ public function getShowQuickAccess() {
return $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_Quick_Access', 0);
}

/**
* quickaccess-sorting-strategy
*
* @NoAdminRequired
*
* @param string $strategy
* @return Response
*/
public function setSortingStrategy($strategy) {
$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_sorting_strategy', (String)$strategy);
return new Response();
}

/**
* Get reverse-state for quickaccess-list
*
* @NoAdminRequired
*
* @return String
*/
public function getSortingStrategy() {
return $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_sorting_strategy', 'alphabet');
}

/**
* Toggle for reverse quickaccess-list
*
* @NoAdminRequired
*
* @param bool $reverse
* @return Response
*/
public function setReverseQuickaccess($reverse) {
$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_reverse_list', (int)$reverse);
return new Response();
}

/**
* Get reverse-state for quickaccess-list
*
* @NoAdminRequired
*
* @return bool
*/
public function getReverseQuickaccess() {
if ($this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_reverse_list', false)) {
return true;
}
return false;
}

/**
* Set state for show sorting menu
*
* @NoAdminRequired
*
* @param bool $show
* @return Response
*/
public function setShowQuickaccessSettings($show) {
$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_show_settings', (int)$show);
return new Response();
}

/**
* Get state for show sorting menu
*
* @NoAdminRequired
*
* @return bool
*/
public function getShowQuickaccessSettings() {
if ($this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_show_settings', false)) {
return true;
}
return false;
}

/**
* Set sorting-order for custom sorting
*
* @NoAdminRequired
*
* @param String $order
* @return Response
*/
public function setSortingOrder($order) {
$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_custom_sorting_order', (String)$order);
return new Response();
}

/**
* Get sorting-order for custom sorting
*
* @NoAdminRequired
*
* @return String
*/
public function getSortingOrder() {
return $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_custom_sorting_order', "");
}

/**
* Get sorting-order for custom sorting
*
Expand Down