New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load upcoming events on example page #649
Load upcoming events on example page #649
Conversation
src/main/webapp/onelive/index.html
Outdated
function loadUpcomingEvents() { | ||
$.ajax({ | ||
type: 'GET', | ||
url: 'http://localhost:8080/calendar/onelive', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
localhost:8080?
Isn't this service up and running?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes. I forgot to change it. I'll update
src/main/webapp/onelive/index.html
Outdated
payload.items[i].startTime = start.toString().substring(16, 21); | ||
payload.items[i].endTime = end.toString().substring(16, 21); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try .toLocaleDateString() and .toLocaleTimeString()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessary but check those methods out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I'll check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works! Thanks 🤩
Rewrite the function using toLocalDateString method and toLocalTimeString method
} | ||
}, | ||
error: function () { | ||
console.log("Error occurred while loading upcoming events"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Console logs should not be in the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
<a href="" target="_blank"> | ||
<div class="card card-event shadow shadow-lg--hover mb-1"> | ||
<div class="card-body"> | ||
<span class="h5 mr-1 card-event-date">12</span> | ||
<span class="small text-muted mr-4 text-capitalize">APR, SUN</span> | ||
<span class="mr-5"> 7.00 - 8.00 pm</span> | ||
<span class="font-weight-bold ml-1">Energy harvesting in wearable electronics</span> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a dummy event?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
* Add a link to event card component * Load upcoming events on onelive page * Fix bugs * Add required changes Rewrite the function using toLocalDateString method and toLocalTimeString method * Change ajax get URL
Purpose
The purpose of this PR is to fix #648
Goals
Load upcoming events on example page for testing purposes.
Approach
Updated the component to hold a link
Got data in JSON format using Calendar API of sef-data-holder
Used Mustache.js to render
Loaded upcoming events on a duplicate onelive page
Screenshots
Preview Link
https://pr-649-sef-site.surge.sh/onelive/
Checklist
Related PRs
N/A
Test environment
Ubuntu 19.04
Google Chrome
JRE: 1.8.0_202-release-1483-b44 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Learning
N/A