Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalnjs committed Oct 17, 2023
1 parent 300a087 commit baed5cc
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 13 deletions.
2 changes: 1 addition & 1 deletion frontend/pages/articles.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<% const articles = cms.articles.sort((a, b) => new Date(b.date) - new Date(a.date)); for (let i = 0; i < articles.length; i++) { const article = articles[i]; %>
<a class="article<% if (i % 3 === 0) { %> left<% } else if (i === 1 || (i - 1) % 3 === 0) { %> middle<% } else if ((i - 2) % 3 === 0) { %> right<% } %>" href="<%- vars.domain %>/articles/<%= new Date(article.date).getFullYear() %>/<%= article.slug %>" title="<%= article.title %>">
<div class="inner">
<img src="<% if (article.images[0] != null) { %><%- vars.asset_prefix %><%= article.images[0].path %>" <% if (article.images[0].width < article.images[0].height) { %>style="width: min-content;" <% } } else { %> "<% } %><% if (article.images[0].description != "") { %>alt="<%= article.images[0].description %>"<% } %> />
<img src="<% if (article.images[0] != null) { %><%- vars.asset_prefix %><%= article.images[0].path %>" <% if (article.images[0].width < article.images[0].height) { %>style="width: min-content;" <% if (article.images[0].description != "") { %>alt="<%= article.images[0].description %>"<% } %><% } } else { %> "<% } %> />
<h3><%= article.title %></h3>
<% if (article.description != null) { %><h4><%= article.description.slice(0, 50) %>...</h4><% } %>
<p><% var date = new Date(article.date); if (date.isToday()) { %>Today<% } else if (ifYesterday(date)) { %>Yesterday<% } else { %><%= date.toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }) %><% } %><% if ((article.author != "") && (article.author != null)) { %> / <%= article.author %><% } %></p>
Expand Down
2 changes: 1 addition & 1 deletion frontend/pages/artworks.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<% const artworks = cms.artworks.sort((a, b) => new Date(b.date) - new Date(a.date)); for (let i = 0; i < artworks.length; i++) { const artwork = artworks[i]; %>
<a class="article<% if (i % 3 === 0) { %> left<% } else if (i === 1 || (i - 1) % 3 === 0) { %> middle<% } else if ((i - 2) % 3 === 0) { %> right<% } %>" href="<%- vars.domain %>/artworks/<%= artwork.slug %>" title="<%= artwork.title %>">
<div class="inner">
<img src="<% if (artwork.artwork != null) { %><%- vars.asset_prefix %><%= artwork.artwork.path %>" <% if (artwork.artwork.width < artwork.artwork.height) { %>style="width: min-content;" <% } } else { %> "<% } %><% if (artwork.artwork.description != "") { %>alt="<%= artwork.artwork.description %>"<% } %> />
<img src="<% if (artwork.artwork != null) { %><%- vars.asset_prefix %><%= artwork.artwork.path %>" <% if (artwork.artwork.width < artwork.artwork.height) { %>style="width: min-content;" <% if (artwork.artwork.description != "") { %>alt="<%= artwork.artwork.description %>"<% } %><% } } else { %> "<% } %> />
<h3><%= artwork.title %></h3>
<% if (artwork.description != null) { %><h4><%= artwork.description.slice(0, 50) %>...</h4><% } %>
<p><% var date = new Date(artwork.date); if (date.isToday()) { %>Today<% } else if (ifYesterday(date)) { %>Yesterday<% } else { %><%= date.toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }) %><% } %><% if ((artwork.author != "") && (artwork.author != null)) { %> / <%= artwork.author %><% } %></p>
Expand Down
2 changes: 1 addition & 1 deletion frontend/pages/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<% for (let i = 0; i < 3 && i < cms.articles.length; i++) { const article = cms.articles.sort((a, b) => new Date(b.date) - new Date(a.date))[i]; %>
<a class="article<% if (i % 3 === 0) { %> left<% } else if (i === 1 || (i - 1) % 3 === 0) { %> middle<% } else if ((i - 2) % 3 === 0) { %> right<% } %>" href="<%- vars.domain %>/articles/<%= new Date(article.date).getFullYear() %>/<%= article.slug %>" title="<%= article.title %>">
<div class="inner">
<img src="<% if (article.images[0] != null) { %><%- vars.asset_prefix %><%= article.images[0].path %>" <% if (article.images[0].width < article.images[0].height) { %>style="width: min-content;" <% } } else { %> "<% } %><% if (article.images[0].description != "") { %>alt="<%= article.images[0].description %>"<% } %> />
<img src="<% if (article.images[0] != null) { %><%- vars.asset_prefix %><%= article.images[0].path %>" <% if (article.images[0].width < article.images[0].height) { %>style="width: min-content;" <% if (article.images[0].description != "") { %>alt="<%= article.images[0].description %>"<% } %><% } } else { %> "<% } %> />
<h3><%= article.title %></h3>
<% if (article.description != null) { %><h4><%= article.description.slice(0, 50) %>...</h4><% } %>
<p><% var date = new Date(article.date); if (date.isToday()) { %>Today<% } else if (ifYesterday(date)) { %>Yesterday<% } else { %><%= date.toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }) %><% } %><% if ((article.author != "") && (article.author != null)) { %> / <%= article.author %><% } %></p>
Expand Down
59 changes: 51 additions & 8 deletions frontend/pages/newspaper.ejs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<html lang="en">
<html lang="en" style="background: var(--background) !important;">

<head>
<%- include('../partials/head.ejs'); %>
Expand Down Expand Up @@ -46,8 +46,21 @@
<div class="content">
<% for (article of newspaper.articles) { article = cms.articles.find(a => a._id === article._id); if (article) { %>
<div class="article <%= article._id %>">
<% if (article.images[0] != null) { %>
<div class="images">
<% for (image of article.images) { if (image._id === article.images[0]._id) { %>
<a class="image" href="<%- vars.asset_prefix %><%= image.path %>" data-lightbox="<%= image._id %>" <% if (image.description != "") { %> data-title="<%= image.description %>" <% } %> title="<%= image.description %>"><img src="<%- vars.asset_prefix %><%= image.path %>" /><% if (image.description != "") { %><h2><%= image.description %></h2><% } %></a>
<% } else { %>
<a class="image" style="background-image: url('<%- vars.asset_prefix %><%= image.path %>');<% if ((image.height / image.width) >= 1.25) { %> width: <%= image.width %>px;<% } %>" href="<%- vars.asset_prefix %><%= image.path %>" data-lightbox="<%= image._id %>" <% if (image.description != "") { %> data-title="<%= image.description %>" <% } %> title="<%= image.description %>"><% if (image.description != "") { %><h2><%= image.description %></h2><% } %></a>
<% } } %>
</div>
<% } %>
<h2><%= article.title %></h2>
<style>.article-i .content .<%= article._id %>:before { content: '(<% if ((article.author != "") && (article.author != null)) { %><%- article.author %><% } else { %><%= cms.siteDetails[0].title %> Writers<% } %>) — ' }</style>
<style>
.article-i .content .<%=article._id %>:before {
content: '(<% if ((article.author != "") && (article.author != null)) { %><%- article.author %><% } else { %><%= cms.siteDetails[0].title %> Writers<% } %>) — '
}
</style>
<%- article.content.replaceAll('/.spaces/', vars.asset_url) %>
</div>
<br />
Expand All @@ -59,19 +72,49 @@
<% if (newspaper.articles.length != 0) { %>
<div class="content mobileOnly">
<% for (article of newspaper.articles) { article = cms.articles.find(a => a._id === article._id); if (article) { %>
<h2><%= article.title %></h2>
<style>.article-i .content:before { content: '(<% if ((article.author != "") && (article.author != null)) { %><%- article.author %><% } else { %><%= cms.siteDetails[0].title %> Writers<% } %>) — ' }</style>
<%- article.content.replaceAll('/.spaces/', vars.asset_url) %>
<div class="article <%= article._id %>">
<% if (article.images[0] != null) { %>
<div class="images">
<% for (image of article.images) { if (image._id === article.images[0]._id) { %>
<a class="image" href="<%- vars.asset_prefix %><%= image.path %>" data-lightbox="<%= image._id %>" <% if (image.description != "") { %> data-title="<%= image.description %>" <% } %> title="<%= image.description %>"><img src="<%- vars.asset_prefix %><%= image.path %>" /><% if (image.description != "") { %><h2><%= image.description %></h2><% } %></a>
<% } else { %>
<a class="image" style="background-image: url('<%- vars.asset_prefix %><%= image.path %>');<% if ((image.height / image.width) >= 1.25) { %> width: <%= image.width %>px;<% } %>" href="<%- vars.asset_prefix %><%= image.path %>" data-lightbox="<%= image._id %>" <% if (image.description != "") { %> data-title="<%= image.description %>" <% } %> title="<%= image.description %>"><% if (image.description != "") { %><h2><%= image.description %></h2><% } %></a>
<% } } %>
</div>
<% } %>
<h2><%= article.title %></h2>
<style>
.article-i .content .<%=article._id %>:before {
content: '(<% if ((article.author != "") && (article.author != null)) { %><%- article.author %><% } else { %><%= cms.siteDetails[0].title %> Writers<% } %>) — '
}
</style>
<%- article.content.replaceAll('/.spaces/', vars.asset_url) %>
</div>
<br />
<% } } %>
</div>
<% } %>
<% } else if (newspaper.articles.length != 0) { %>
<div class="content">
<% for (article of newspaper.articles) { article = cms.articles.find(a => a._id === article._id); if (article) { %>
<h2><%= article.title %></h2>
<style>.article-i .content:before { content: '(<% if ((article.author != "") && (article.author != null)) { %><%- article.author %><% } else { %><%= cms.siteDetails[0].title %> Writers<% } %>) — ' }</style>
<%- article.content.replaceAll('/.spaces/', vars.asset_url) %>
<div class="article <%= article._id %>">
<% if (article.images[0] != null) { %>
<div class="images">
<% for (image of article.images) { if (image._id === article.images[0]._id) { %>
<a class="image" href="<%- vars.asset_prefix %><%= image.path %>" data-lightbox="<%= image._id %>" <% if (image.description != "") { %> data-title="<%= image.description %>" <% } %> title="<%= image.description %>"><img src="<%- vars.asset_prefix %><%= image.path %>" /><% if (image.description != "") { %><h2><%= image.description %></h2><% } %></a>
<% } else { %>
<a class="image" style="background-image: url('<%- vars.asset_prefix %><%= image.path %>');<% if ((image.height / image.width) >= 1.25) { %> width: <%= image.width %>px;<% } %>" href="<%- vars.asset_prefix %><%= image.path %>" data-lightbox="<%= image._id %>" <% if (image.description != "") { %> data-title="<%= image.description %>" <% } %> title="<%= image.description %>"><% if (image.description != "") { %><h2><%= image.description %></h2><% } %></a>
<% } } %>
</div>
<% } %>
<h2><%= article.title %></h2>
<style>
.article-i .content .<%=article._id %>:before {
content: '(<% if ((article.author != "") && (article.author != null)) { %><%- article.author %><% } else { %><%= cms.siteDetails[0].title %> Writers<% } %>) — '
}
</style>
<%- article.content.replaceAll('/.spaces/', vars.asset_url) %>
</div>
<br />
<% } } %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/pages/search.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<% }); %>
<% filteredArticles.sort((a, b) => new Date(b.date) - new Date(a.date)).forEach(article => { %>
<a class="article" href="<%- vars.domain %>/articles/<%= new Date(article.date).getFullYear() %>/<%= article.slug %>" title="Article: <%= article.title %>">
<img src="<% if (article.images[0] != null) { %><%- vars.asset_prefix %><%= article.images[0].path %><% } else { %> <% } %>"<% if (article.images[0].description != "") { %>alt="<%= article.images[0].description %>"<% } %> />
<img src="<% if (article.images[0] != null) { %><%- vars.asset_prefix %><%= article.images[0].path %>" <% if (article.images[0].description != "") { %>alt="<%= article.images[0].description %>"<% } %><% } else { %> "<% } %> />
<div class="inner">
<h3>Article: <%= article.title %></h3>
<% if (article.description != null) { %><h4><%= article.description.slice(0, 50) %>...</h4><% } %>
Expand Down
2 changes: 1 addition & 1 deletion frontend/pages/tag.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<% if (filteredArticles.length != 0) { const articles = filteredArticles.sort((a, b) => b._created - a._created); for (let i = 0; i < articles.length; i++) { const article = articles[i]; %>
<a class="article<% if (i % 3 === 0) { %> left<% } else if (i === 1 || (i - 1) % 3 === 0) { %> middle<% } else if ((i - 2) % 3 === 0) { %> right<% } %>" href="<%- vars.domain %>/articles/<%= new Date(article.date).getFullYear() %>/<%= article.slug %>" title="<%= article.title %>">
<div class="inner">
<img src="<% if (article.images[0] != null) { %><%- vars.asset_prefix %><%= article.images[0].path %>" <% if (article.images[0].width < article.images[0].height) { %>style="width: min-content;" <% } } else { %> "<% } %><% if (article.images[0].description != "") { %>alt="<%= article.images[0].description %>"<% } %> />
<img src="<% if (article.images[0] != null) { %><%- vars.asset_prefix %><%= article.images[0].path %>" <% if (article.images[0].width < article.images[0].height) { %>style="width: min-content;" <% if (article.images[0].description != "") { %>alt="<%= article.images[0].description %>"<% } %><% } } else { %> "<% } %> />
<h3><%= article.title %></h3>
<% if (article.description != null) { %><h4><%= article.description.slice(0, 50) %>...</h4><% } %>
<p><% var date = new Date(article.date); if (date.isToday()) { %>Today<% } else if (ifYesterday(date)) { %>Yesterday<% } else { %><%= date.toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }) %><% } %><% if ((article.author != "") && (article.author != null)) { %> / <%= article.author %><% } %></p>
Expand Down

0 comments on commit baed5cc

Please sign in to comment.