TableCellResult

From $1

    Table of contents
    No headers
    /**
     * Table Cell: Search result detail
     * Outputs search result related information
     */
    // page, file, comment
    var resultType = $type;
    var class = $class;
    var pageId = $pageId;
    var fileId = $fileId; // optional
    var commentId = $commentId;
    var cellPage = $page ?? wiki.getpage(num.cast(pageId));
    var cellFile = $file;
    var cellComment = $comment;
    
    // support loading files by id
    if (resultType == "file" && cellFile is nil)
        let cellFile = wiki.getfile(num.cast(fileId));
    
    let class ..= "result-detail result-type-" .. resultType;
    
    switch (resultType) {
    default:
    case "page":
        Template("MindTouch/Reports/Controls/TableCellPage", {
            page: cellPage,
            class: class
        });
    
    case "file":
        <td class=(class)>
            <div class="details">
            <a href=(cellFile.uri)>cellFile.name</a>;
            <span class="in">
                " " .. wiki.localize("MindTouch.Reports.data.title.in") .. " ";
                <a href=(cellPage.uri)>cellPage.path</a>;
            </span>
        </div>
        </td>
    
    case "comment":
        <td class=(class)>
            <div class="details">
            <a href=(cellComment.uri) title=(cellComment.text)>"Comment #"..cellComment.number</a>;
            <span class="in">
                " " .. wiki.localize("MindTouch.Reports.data.title.in") .. " ";
                <a href=(cellPage.uri)>cellPage.path</a>;
            </span>
            </div>
        </td>
    }
    
    
    Tags: (Edit tags)
    • No tags
     
    Comments (0)

     
    Powered by MindTouch Core