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

Feature/developer meeting calendar #60

Merged
merged 2 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions content/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ draft: false
### Bi-weekly Meeting
There is the **bi-weekly** [KUKSA dev/user call on Zoom](https://eclipse.zoom.us/j/87644929505?pwd=cTRpYklVaS9xYjlhMXRtbS9IN0FCQT09) every Thursday on odd calendar weeks from 1-2pm (CET/CEST).

{{< tui-calendar >}}

### Chat
You can find us on Chat in [Gitter Channel](https://gitter.im/kuksa-val/community), or if you are a Matrix user using the [Gitter-Matrix bridge](https://matrix.to/#/#kuksa-val_community:gitter.im).
Expand Down
81 changes: 81 additions & 0 deletions layouts/shortcodes/tui-calendar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{{ $src := .Get "src" }}
<link rel="stylesheet" href="https://uicdn.toast.com/calendar/latest/toastui-calendar.min.css" />
<div>
<button onclick="prevMonth()">Prev Month</button>
<button onclick="nextMonth()">Next Month</button>
<button onclick="thisMonth()">This Month</button>
</div>
<div id="calendar" style="height: 600px;"></div>
<script src="https://uicdn.toast.com/calendar/latest/toastui-calendar.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/later/1.2.0/later.min.js"></script>
<script>
var calendar = new tui.Calendar('#calendar', {
defaultView: 'month',
isReadOnly: true,
month: {
taskView: false,
eventView: ['time'],
hourStart: 11,
hourEnd: 16
},
template: {
timegridDisplayPrimayTime: function (time) {
return moment(time).format('HH:mm');
},
},
// Add a click event listener to the calendar
usageStatistics: false,
disableClick: false,
});

// Recurring event rule
var textSched = 'at 11:00 am on Thursday every 2 weeks';
var schedule = later.parse.text(textSched);

// Create recurring events based on the rule
var start = new Date();
var end = new Date();
end.setHours(end.getHours() + 1); // 1 hour duration
var occurrences = later.schedule(schedule).next(1000); // Get next 10 occurrences
var recurringEvents = occurrences.map((date, i) => {
var end = new Date(date);
end.setHours(date.getHours() + 1)
return {

id: '1' + i,
calendarId: '1',
title: 'KUKSA Developer Meeting',
category: 'time',
dueDateClass: '',
start: date,
end: end
};
});
calendar.createEvents(recurringEvents);

calendar.on("clickEvent", function (event) {
var date = event.event.start.d.toDate();
// Format the date as dd-mm-yyyy and convert it to a string
const formattedDate = date.toLocaleDateString('en-GB', { day: '2-digit', month: '2-digit', year: 'numeric' }).replace(/\//g, '-');
var url = "https://github.com/eclipse/kuksa.val/wiki/" + formattedDate + "-Community-developer-meeting";
var win = window.open(url, '_blank');
win.focus();
});

function prevMonth() {
calendar.prev();
}

function nextMonth() {
calendar.next();
}

function thisMonth()
{
var currentDate = new Date();
var start = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate() - currentDate.getDay() + 1);
var end = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate() - currentDate.getDay() + 8);
calendar.setDate(start, end);
}

</script>
Loading