-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
First stab at reverse hierarchical display (bug 106) #128
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,16 +141,54 @@ export class FolderNode extends BaseNode { | |
return node; | ||
} | ||
|
||
get fullNameParts() { | ||
getFullNameParts(includeAccountNode) { | ||
let parts = []; | ||
let node = this; // eslint-disable-line consistent-this | ||
while (node && !(node instanceof AccountNode)) { | ||
parts.unshift(node.item.name); | ||
while (node) { | ||
let isAcctNode = node instanceof AccountNode; | ||
if (includeAccountNode || !isAcctNode) { | ||
parts.unshift(node.item.name); | ||
} | ||
if (isAcctNode) { | ||
break; | ||
} | ||
node = node.parent; | ||
} | ||
|
||
return parts; | ||
} | ||
|
||
get fullPathReversed() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should separate the display and data aspects. We can get the reversed parts with On the gmail and empty components thing, I think we could generally filter out empty components in getFullNameparts, and maybe add an option skipGmail that would then always skip [Gmail] folders. |
||
let fullFolderPathComponents = this.getFullNameParts(true).filter((val) => { | ||
// Filter out [Gmail] and empty path components. | ||
return val !== "" && !val.includes("["); | ||
}); | ||
|
||
if (fullFolderPathComponents.length === 0) { | ||
return ''; | ||
} | ||
|
||
let display = ''; | ||
for (var i = fullFolderPathComponents.length - 1; i >= 1; i--) { | ||
if (display !== '') { | ||
display += ' ← '; | ||
} | ||
display += fullFolderPathComponents[i]; | ||
} | ||
|
||
if (display !== '') { | ||
display += ' ← '; | ||
} | ||
|
||
display += '<b>' + fullFolderPathComponents[0] + '</b>'; | ||
|
||
return display; | ||
} | ||
|
||
get fullNameParts() { | ||
return this.getFullNameParts(false); | ||
} | ||
|
||
} | ||
|
||
export class AccountNode extends FolderNode { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(untested)