CenterForDigitalHumanities / TPEN-NL

0 stars 0 forks source link

Static Page import #4

Closed cubap closed 3 years ago

cubap commented 4 years ago

proof of concept a few static pages (like contextual essay) from existing site and tie them into an existing test project to show it working in the interface

thehabes commented 4 years ago

I found out how it is making direct links (newberry.js)

else if(tool === "partialTrans"){
    var currentCanvasLabel = transcriptionFolios[currentFolio-1]["label"];
    var utlID = "";    
    if(currentCanvasLabel.split("_").length - 1 === 2){ //Must be in format like FP_000_000
        //We need to get the UTL canvas id for this particular canvas to support direct linking to the transcription for this object
        utlID = currentCanvasLabel.substring(0,currentCanvasLabel.lastIndexOf("_")).toLowerCase();
        iframeDirectLink = buildIframeDirectLink("content/transcript_"+utlID+"?response_type=embed");
        $("#partialTransSplit").children("iframe").attr("data_src", iframeDirectLink);
    }
    else{
        //This is not a UTL canvas or a canvas with a different label format.  Default to list of partial trans
        //The default is already populated in the html, so do nothing and the default will fire.
    }
    splitScreen.find("iframe").attr("src", splitScreen.find("iframe").attr("data_src"));
    splitScreen.height(Page.height() - 40).scrollTop(0); // header space
    splitScreen.css("width", splitWidthAdjustment);
}
else if(tool === "essay"){
    var currentCanvasLabel = transcriptionFolios[currentFolio-1]["label"];
    var utlID = "";
    if(currentCanvasLabel.split("_").length - 1 === 2){ //Must be in format like FP_000_000
        //We need to get the UTL canvasID for this particular canvas to support direct linking to the essay for this object
        utlID = currentCanvasLabel.substring(0, currentCanvasLabel.lastIndexOf("_")).toLowerCase();
        iframeDirectLink = buildIframeDirectLink("content/about_"+utlID+"?response_type=embed");
        $("#essaySplit").children("iframe").attr("data_src", iframeDirectLink);
    }
    else{
        //This is not a UTL canvas or a canvas with a different @id format.  Default to list of essays
        //The default is already populated in the html, so do nothing and the default will fire.
    }
    splitScreen.find("iframe").attr("src", splitScreen.find("iframe").attr("data_src"));
    splitScreen.height(Page.height() - 40).scrollTop(0); // header space
    splitScreen.css("width", splitWidthAdjustment);
}
thehabes commented 4 years ago
/*
 * Make the direct Iframe links when possible for background essays and partial transcriptions.
 * It will always default to the page that shows them all for malformed direct links.
 */
function buildIframeDirectLink(pathPiece){
    var link = homeLink+pathPiece;
    return link;
}
thehabes commented 4 years ago
/*
 * There are many links/buttons to send one off to pages in the paleography site. 
 * This function will set those based off of the URL detected, that way we don't have
 * to hard code links.
 */
function setPaleographyLinks(){
    var devOrProd = document.location.host;
    // ex. transcribe-dev.library.utoronto.ca or transcribe.library.utoronto.ca
    var lang = document.location.pathname;
    // ex. /paleography/newberryTrans.html
    var parojectLink = "";
    if(devOrProd.indexOf("transcribe-dev.library") > -1){
        switch(lang){
            case "/paleography/newberryTrans.html":
                homeLink = "https://paleography-dev.library.utoronto.ca/";
            break;
            case "/paleography/italianTranscription.html":
                homeLink ="https://italian-paleography-dev.library.utoronto.ca/";
            break;
            default:
                homeLink = "https://paleography-dev.library.utoronto.ca/";
        }
    }
    else if(devOrProd.indexOf("transcribe.library") > -1){
        switch(lang){
            case "/paleography/newberryTrans.html":
                homeLink = "https://paleography.library.utoronto.ca/";
            break;
            case "/paleography/italianTranscription.html":
                homeLink ="https://italian-paleography.library.utoronto.ca/";
            break;
            default:
                homeLink = "https://paleography.library.utoronto.ca/";
        }
    }
    else{
        //We are not in an environment we do not expect.  For now, let's just point to paleography dev.
        switch(lang){
            case "/paleography/newberryTrans.html":
                homeLink = "https://paleography-dev.library.utoronto.ca/";
            break;
            case "/paleography/italianTranscription.html":
                homeLink ="https://italian-paleography-dev.library.utoronto.ca/";
            break;
            default:
                homeLink = "https://paleography-dev.library.utoronto.ca/";
        }
    }
    setIframeLinks();
    $("#homeBtn").attr("href", homeLink);
    $("#projectsBtn").attr("href", homeLink+"my-transcriptions");
    $("#helpContact").attr("href", homeLink+"contact");
}

So yeah we can do this.

thehabes commented 4 years ago

Example of static page https://centerfordigitalhumanities.github.io/Newberry-French-paleography/background-essay/31.html

thehabes commented 4 years ago

Did you catch this week's comment of the week? //We are not in an environment we do not expect. For now, let's just point to paleography dev.

cubap commented 3 years ago

Essays are in and revised. The _pages are not all in yet