JSFiddle - React, Tailwind, and code Playground
by kirky93
JavaScript
/** Gets the file's path by its containing folder's id.
* @param folderId
**/
function fetchPathForFile(file) {
fileAudit.path = Folder.path(
{
id: file.folderId
}
);
return fileAudit.path;
}
/**
* Adds a description of the view to the breadcrumbs.
* @returns path.
*/
function addAuditToPath(path) {
path.push(
{
name: 'Audit'
}
);
return fileAudit.path;
}
/**
* Start-up logic for initializing the controller.
*/
function activate() {
/* Fetch File. */
fileAudit.file = File.get(
{
id: $stateParams.fileId
}
);
/* Fetch and set path by the file's parent folderId */
fileAudit.file.$promise.then(
function(file) {
fetchPathForFile(file).$promise.then(
addAuditToPath
);
}
);
}