Skip to content

Commit

Permalink
Do a minor code cleanup.
Browse files Browse the repository at this point in the history
- Remove the links from the display. People won't be able to click on
  them anyways.
- Make `limit` a required settings field.
  • Loading branch information
nicomiguelino committed Jul 26, 2023
1 parent 0e5a251 commit a9478a3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
1 change: 0 additions & 1 deletion edge-apps/rss-reader/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<div class="feed-container">
<h2 class="feed-title mb-2"></h2>
<p class="feed-date mb-3"></p>
<p><a class="feed-link text-white" href="#"></a></p>
<p class="feed-description text-white mt-4">
</p>
</div>
Expand Down
4 changes: 2 additions & 2 deletions edge-apps/rss-reader/screenly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ settings:
help_text: Specify the URL to where to get the data from.
limit:
type: text
default: '1'
optional: true
default: ''
optional: false
title: Limit
help_text: Specify the number of feeds to include in the page.
16 changes: 4 additions & 12 deletions edge-apps/rss-reader/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,17 @@ const initApp = () => {

entries.forEach(entry => {
const title = entry.title
const link = entry.link
const date = moment(new Date(entry.pubDate))
.format('MMMM DD, YYYY, h:mm A')
// @TODO: Some feeds don't have a `contentSnippet` property.
// We should handle situations where the description is not available
// or uses a different property name. Alternatively, we could
// specify the name of the property in the settings.
const description = entry.contentSnippet
// @TODO: Handle content dynamically. Some have images, some have just text,
// some have both.
const description = entry.content

const feedTemplate = document.querySelector('#feed-template')
const feedContainer = feedTemplate.content.cloneNode(true)

feedContainer.querySelector('.feed-title').innerHTML = title
feedContainer.querySelector('.feed-date').innerHTML = date

feedLink = feedContainer.querySelector('.feed-link')
feedLink.innerHTML = link
feedLink.href = link
feedLink.target = '_blank'

feedDescription = feedContainer.querySelector('.feed-description')
feedDescription.innerHTML = description

Expand Down
4 changes: 4 additions & 0 deletions edge-apps/rss-reader/static/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ body {
font-family: Barlow, sans-serif;
}

a {
color: #FFFFFF;
}

p {
font-size: 1rem;
}
Expand Down

0 comments on commit a9478a3

Please sign in to comment.