From eb32379e2f02a84bc959a4eb80cff3c9cd27b2bc Mon Sep 17 00:00:00 2001 From: Jacob Asper Date: Tue, 14 Jun 2022 14:27:53 -0400 Subject: [PATCH 1/8] added truncation class --- public/css/style.css | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/public/css/style.css b/public/css/style.css index 83ba31d..c2f652f 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -257,6 +257,14 @@ main { background-color: #dbdbdb; } +.text-truncate { + display: inline-block; + max-width: 100%; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + .json { display: block; white-space: pre-wrap; From 855edeaeba484ee3e31c95380af627b21c3704ed Mon Sep 17 00:00:00 2001 From: Jacob Asper Date: Tue, 14 Jun 2022 14:32:31 -0400 Subject: [PATCH 2/8] added trunctation class to keywords in js --- views/index.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/index.ejs b/views/index.ejs index 6f349c9..63570e9 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -60,7 +60,7 @@
  • -
    {

    name: '<%= resources[i].name %>',
    url: target="_blank">'<%= resources[i].url %>',
    keywords: [<%= resources[i].keywords.map(keyword => `'${keyword}'`).join(", ") %>]
    },
    +
    {

    name: '<%= resources[i].name %>',
    url: target="_blank">'<%= resources[i].url %>',

    keywords: [<%= resources[i].keywords.map(keyword => `'${keyword}'`).join(", ") %>]


    },
  • <% } %> From 7f9822b360acbce937ac80c410f5dce4ed420679 Mon Sep 17 00:00:00 2001 From: Jacob Asper Date: Tue, 14 Jun 2022 14:39:36 -0400 Subject: [PATCH 3/8] formatted elements in indent div --- public/css/style.css | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/public/css/style.css b/public/css/style.css index c2f652f..48143de 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -274,6 +274,13 @@ main { padding-left: 2rem; margin-top: -2rem; line-height: 2; + font-size: 1em; +} + +.indent * { + line-height: 2; + font-size: 1em; + margin: 0; } /* documentation */ From 437bdc512905f6e44bef86e855ae31a3226d8cb9 Mon Sep 17 00:00:00 2001 From: Jacob Asper Date: Tue, 14 Jun 2022 14:55:21 -0400 Subject: [PATCH 4/8] styled everything in indent and bolded a tag --- public/css/style.css | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index 48143de..cffb84b 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -272,15 +272,19 @@ main { .indent { padding-left: 2rem; - margin-top: -2rem; - line-height: 2; - font-size: 1em; + margin-top: -.8rem; } + .indent * { - line-height: 2; + line-height: 1; font-size: 1em; margin: 0; + text-align: left; + font-weight: 400; +} +.indent a { + font-weight: 700; } /* documentation */ From fcdf7ee500ab6aa23abcea15d1358e09f8db32d2 Mon Sep 17 00:00:00 2001 From: Jacob Asper Date: Tue, 14 Jun 2022 14:56:01 -0400 Subject: [PATCH 5/8] added semantic html to code blocks --- views/index.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/index.ejs b/views/index.ejs index 63570e9..5a2d51a 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -60,7 +60,7 @@
  • -
    {

    name: '<%= resources[i].name %>',
    url: target="_blank">'<%= resources[i].url %>',

    keywords: [<%= resources[i].keywords.map(keyword => `'${keyword}'`).join(", ") %>]


    },
    +
    {

    name: '<%= resources[i].name %>',


    url: target="_blank">'<%= resources[i].url %>',


    keywords: [<%= resources[i].keywords.map(keyword => `'${keyword}'`).join(", ") %>]

    },
  • <% } %> From c585cbb89a785d166307f30a6f74587775309e8a Mon Sep 17 00:00:00 2001 From: Jacob Asper Date: Tue, 14 Jun 2022 15:02:09 -0400 Subject: [PATCH 6/8] moved quotes and comma outside of a tag --- views/index.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/index.ejs b/views/index.ejs index 5a2d51a..6f83d08 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -60,7 +60,7 @@
  • -
    {

    name: '<%= resources[i].name %>',


    url: target="_blank">'<%= resources[i].url %>',


    keywords: [<%= resources[i].keywords.map(keyword => `'${keyword}'`).join(", ") %>]

    },
    +
    {

    name: '<%= resources[i].name %>',


    url: ' target="_blank"><%= resources[i].url %>',


    keywords: [<%= resources[i].keywords.map(keyword => `'${keyword}'`).join(", ") %>]

    },
  • <% } %> From ddc900247ccba55ed46d6334b671fd4b497606b3 Mon Sep 17 00:00:00 2001 From: brianschnee Date: Tue, 14 Jun 2022 15:56:02 -0400 Subject: [PATCH 7/8] altered formatting of
     and  elements in
     index.ejs and main.js
    
    ---
     public/css/style.css | 17 +++++++++++------
     public/js/main.js    | 12 +++++++++++-
     views/index.ejs      | 12 +++++++++++-
     3 files changed, 33 insertions(+), 8 deletions(-)
    
    diff --git a/public/css/style.css b/public/css/style.css
    index cffb84b..f9d35e9 100644
    --- a/public/css/style.css
    +++ b/public/css/style.css
    @@ -265,24 +265,29 @@ main {
     	text-overflow: ellipsis;
     }
     
    -.json {
    -	display: block;
    -	white-space: pre-wrap;
    +.json,
    +code {
    +	white-space: pre-line;
    +}
    +
    +.indent h4,
    +.indent h5,
    +.indent h6 {
    +	padding: 0;
     }
     
     .indent {
     	padding-left: 2rem;
    -	margin-top: -.8rem;
     }
     
    -
     .indent * {
    -	line-height: 1;
    +	line-height: 1.5; /* If this value is changed, make sure it is atleast 1 to avoid clipping when text wraps */
     	font-size: 1em;
     	margin: 0;
     	text-align: left;
     	font-weight: 400;
     }
    +
     .indent a {
     	font-weight: 700;
     }
    diff --git a/public/js/main.js b/public/js/main.js
    index 56d876f..d915c2d 100644
    --- a/public/js/main.js
    +++ b/public/js/main.js
    @@ -63,7 +63,17 @@ function renderMatches(matches) {
     
     			// Create an element that looks like a JSON object for every match
     			li.innerHTML = `
    -				
    {

    name: '${match.name}',
    url: '${match.url}',
    keywords: [${match.keywords.map(keyword => `'${keyword}'`).join(", ")}]
    },
    +
    +					
    +						{
    +							
    +

    name: ${match.name},

    +
    url: '${match.url}',
    +
    keywords: [${match.keywords.map(keyword => `'${keyword}'`).join(", ")}]
    +
    + }, +
    +
    `; list.appendChild(li); diff --git a/views/index.ejs b/views/index.ejs index 6f83d08..49d1311 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -60,7 +60,17 @@
  • -
    {

    name: '<%= resources[i].name %>',


    url: ' target="_blank"><%= resources[i].url %>',


    keywords: [<%= resources[i].keywords.map(keyword => `'${keyword}'`).join(", ") %>]

    },
    +
    +											
    +												{
    +													
    +

    name: '<%= resources[i].name %>',

    +
    url: ' target="_blank"><%= resources[i].url %>',
    +
    keywords: [<%= resources[i].keywords.map(keyword => `'${keyword}'`).join(", ") %>]
    +
    + }, +
    +
  • <% } %> From 67638eb5ba8afe8e893c12298b6c3b3cc9f8c587 Mon Sep 17 00:00:00 2001 From: brianschnee Date: Tue, 14 Jun 2022 16:13:35 -0400 Subject: [PATCH 8/8] change how the case is handled when the resources.js file is not able to import data into server.js --- server.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/server.js b/server.js index f13c0b2..a8e45ec 100644 --- a/server.js +++ b/server.js @@ -10,14 +10,13 @@ app.use(express.static(__dirname + '/public')); app.use('/public', express.static(__dirname + '/public')); app.get('/', (req, res) => { - try { - if (resources) { - res.render('index.ejs', { resources }); - } else { - throw new Error('Resources not found.') - } - } catch (err) { - console.error(err); + if (resources) { + res.render('index.ejs', { resources }); + } else { + // respond with status 500 if the resources array could not be loaded from resources.js + res.status(500).json({ + error: 'Resources were not able to be loaded from "resources.js."' + }); } });