Fixed breadcrumb action feedback and optimisation
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
33bac270db
commit
9d3af829f2
2 changed files with 9 additions and 7 deletions
|
@ -33,7 +33,7 @@
|
||||||
*/
|
*/
|
||||||
var BreadCrumb = function(options){
|
var BreadCrumb = function(options){
|
||||||
this.$el = $('<div class="breadcrumb"></div>');
|
this.$el = $('<div class="breadcrumb"></div>');
|
||||||
this.$menu = $('<div class="popovermenu menu menu-center"><ul></ul></div>');
|
this.$menu = $('<div class="popovermenu menu-center"><ul></ul></div>');
|
||||||
options = options || {};
|
options = options || {};
|
||||||
if (options.onClick) {
|
if (options.onClick) {
|
||||||
this.onClick = options.onClick;
|
this.onClick = options.onClick;
|
||||||
|
@ -84,6 +84,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
setDirectoryInfo: function(dirInfo) {
|
setDirectoryInfo: function(dirInfo) {
|
||||||
|
console.log(dirInfo);
|
||||||
if (dirInfo !== this.dirInfo) {
|
if (dirInfo !== this.dirInfo) {
|
||||||
this.dirInfo = dirInfo;
|
this.dirInfo = dirInfo;
|
||||||
this.render();
|
this.render();
|
||||||
|
@ -144,13 +145,12 @@
|
||||||
}
|
}
|
||||||
this.breadcrumbs.push($crumb);
|
this.breadcrumbs.push($crumb);
|
||||||
this.$el.append($crumb);
|
this.$el.append($crumb);
|
||||||
if (this.onClick) {
|
// Only add feedback if not menu
|
||||||
$crumb.on('click', this.onClick);
|
if (this.onClick && i !== 0) {
|
||||||
|
$link.on('click', this.onClick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var err = new Error();
|
|
||||||
console.log(err.stack);
|
|
||||||
// Menu creation
|
// Menu creation
|
||||||
this._createMenu();
|
this._createMenu();
|
||||||
for (var i = 0; i < parts.length; i++) {
|
for (var i = 0; i < parts.length; i++) {
|
||||||
|
@ -165,7 +165,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_.each(this._detailViews, function(view) {
|
_.each(this._detailViews, function(view) {
|
||||||
view.render({
|
view.render({
|
||||||
dirInfo: this.dirInfo
|
dirInfo: this.dirInfo
|
||||||
|
@ -188,7 +187,8 @@
|
||||||
hoverClass: 'canDrop'
|
hoverClass: 'canDrop'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// Menu is destroyed on every change, we need to init it
|
||||||
|
OC.registerMenu($('.crumbmenu'), $('.crumbmenu > .popovermenu'));
|
||||||
this._resize();
|
this._resize();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -836,11 +836,13 @@
|
||||||
* Event handler when clicking on a bread crumb
|
* Event handler when clicking on a bread crumb
|
||||||
*/
|
*/
|
||||||
_onClickBreadCrumb: function(e) {
|
_onClickBreadCrumb: function(e) {
|
||||||
|
console.log('Clicked breadcrumb ', e);
|
||||||
var $el = $(e.target).closest('.crumb'),
|
var $el = $(e.target).closest('.crumb'),
|
||||||
$targetDir = $el.data('dir');
|
$targetDir = $el.data('dir');
|
||||||
|
|
||||||
if ($targetDir !== undefined && e.which === 1) {
|
if ($targetDir !== undefined && e.which === 1) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
console.log('Triggered dir change');
|
||||||
this.changeDirectory($targetDir, true, true);
|
this.changeDirectory($targetDir, true, true);
|
||||||
this.updateSearch();
|
this.updateSearch();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue