Skip to content
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

Merged
merged 5 commits into from Apr 10, 2020

Conversation

Piumal1999
Copy link
Member

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

8b4d5339-22a4-4c52-b2c7-202e2a98f80d

Preview Link

https://pr-649-sef-site.surge.sh/onelive/

Checklist

  • This PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.
  • I have read and understood the development best practices guidelines ( http://bit.ly/sef-best-practices )
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation

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

function loadUpcomingEvents() {
$.ajax({
type: 'GET',
url: 'http://localhost:8080/calendar/onelive',
Copy link
Member

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?

Copy link
Member Author

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

Comment on lines 342 to 343
payload.items[i].startTime = start.toString().substring(16, 21);
payload.items[i].endTime = end.toString().substring(16, 21);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try .toLocaleDateString() and .toLocaleTimeString()

Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I'll check

Copy link
Member Author

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
@Gravewalker666 Gravewalker666 merged commit d44c0e0 into sef-global:onelive-events Apr 10, 2020
}
},
error: function () {
console.log("Error occurred while loading upcoming events");
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@jayasanka-sack
Copy link
Member

The preview isn't working
Screenshot 2020-04-11 at 15 18 03

Comment on lines +2107 to +2114
<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>
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@Piumal1999
Copy link
Member Author

The preview isn't working
Screenshot 2020-04-11 at 15 18 03

The event in the calendar is not in the suitable format. It was added as full day event. Have to add the events as limited time events

Piumal1999 added a commit to Piumal1999/sef-site that referenced this pull request Apr 25, 2020
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants