Table of contents
    No headers
    /***
        USAGE:
    
        MantisIssue(bug)
            show link for a bug entry
    
        EXPECTED INPUTS:
            bug
                id
                summary
                days_open
                days_left
    ***/
    
    // read input parameters
    var bug = $0 ?? $bug;
    
    // define constants
    var href = "http://bugs.developer.mindtouch.com/view.php";
    var priorities = {
        10: { text: "none", color: nil },
        20: { text: "low", color: "green" },
        30: { text: "normal", color: nil },
        40: { text: "high", color: "red" },
        50: { text: "urgent", color: "red" },
        60: { text: "immediate", color: "red" }
    };
    var severities = {
        10: { text: "feature", color: nil },
        20: { text: "trivial", color: nil },
        30: { text: "text", color: nil },
        40: { text: "tweak", color: nil },
        50: { text: "minor", color: nil },
        60: { text: "major", color: "red" },
        70: { text: "crash", color: "red" },
        80: { text: "block", color: "red" }
    };
    var statuses = {
        10: { text: "new", color: nil },
        20: { text: "feedback", color: nil },
        30: { text: "acknowledged", color: nil },
        40: { text: "confirmed", color: nil },
        50: { text: "assigned", color: nil },
        80: { text: "resolved", color: nil },
        90: { text: "closed", color: nil }
    };
    
    var priority = priorities[bug.priority];
    var severity = severities[bug.severity];
    var status = bug.status ?? 0;
    
    var color;
    if(priority.color || severity.color) {
        if(priority.color && severity.color) {
            let color = (bug.priority > bug.severity) ? priority.color : severity.color;
        } else if(priority.color) {
            let color = priority.color;
        } else {
            let color = severity.color;
        }
    }
    if(color) {
        <span style=("color: " .. color)>
            "(";
            if(priority.color) {
                priority.text; " priority";
                if(severity.color) {
                    ", ";
                }
            }
            if(severity.color) {
                severity.text; " severity";
            }
            ") ";
        </span>
    }
    var style = (status >= 80) ? "text-decoration:line-through" : nil;
    <a href=(href & { id: bug.id }) style=(style)> bug.id; ": "; bug.summary; " ("; bug.days_open; " days old, "; bug.days_left; " days left)"; </a>
    
    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by