Skip to content

Commit

Permalink
Merge pull request #481 from Xpirix/roadmap_calendar
Browse files Browse the repository at this point in the history
Add buttons to add release dates to calendar
  • Loading branch information
Xpirix authored Dec 2, 2024
2 parents d8de55f + bd0d1f2 commit 0bec165
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 1 deletion.
3 changes: 3 additions & 0 deletions content/resources/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ sidebar: true
# Road Map
{{< roadmap >}}

{{< button class="is-primary1 is-rounded" link="https://qgis.org/schedule.ics" text="Subscribe to the roadmap iCalendar" >}}


Releases and development of QGIS follow a timebased schedule (roadmap).

- Even version numbers (2.18, 3.2 etc) are release versions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $level-item-spacing: ($block-spacing * 0.5) !default

.level
@extend %block
align-items: center
// align-items: center
justify-content: space-between
code
border-radius: $radius
Expand Down
67 changes: 67 additions & 0 deletions themes/hugo-bulma-blocks-theme/layouts/shortcodes/roadmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ <h3 class="title">Long Term Release (LTR)</h3>
<p class="is-size-7">Sec.</p>
</div>
</div>

<button id="addPrToCalendar" class="button is-small is-light" title="Add to Calendar">
<span class="icon is-small">
<i class="fas fa-calendar"></i>
</span>
</button>
</nav>
</div>
</div>
Expand Down Expand Up @@ -146,6 +152,11 @@ <h3 class="title">Latest Release</h3>
<p class="is-size-7">Sec.</p>
</div>
</div>
<button id="addLatestPrToCalendar" class="button is-small is-light" title="Add to Calendar">
<span class="icon is-small">
<i class="fas fa-calendar"></i>
</span>
</button>
</nav>
</div>
</div>
Expand Down Expand Up @@ -233,6 +244,11 @@ <h3 class="title">Development Version</h3>
<p class="is-size-7">Sec.</p>
</div>
</div>
<button id="addFreezeToCalendar" class="button is-small is-light" title="Add to Calendar">
<span class="icon is-small">
<i class="fas fa-calendar"></i>
</span>
</button>
</nav>
</div>
</div>
Expand Down Expand Up @@ -277,6 +293,11 @@ <h3 class="title">Development Version</h3>
<p class="is-size-7">Sec.</p>
</div>
</div>
<button id="addPackageToCalendar" class="button is-small is-light" title="Add to Calendar">
<span class="icon is-small">
<i class="fas fa-calendar"></i>
</span>
</button>
</nav>
</div>
</div>
Expand Down Expand Up @@ -354,6 +375,11 @@ <h3 class="title">Development Version</h3>
let nextFreezeDateStr = {{ .nextfreezedate }};
let nextReleaseDateStr = {{ .nextreleasedate }};
let nextPointReleaseDateStr = {{ .nextpointreleasedate }};
let nextLtrVersion = {{ .next_ltr_version }};
let nextLrVersion = {{ .next_lr_version }};
let devVersion = {{ .devversion }};
let nextVersion = {{ .nextversion }};

{{ end }}
// We need to correct the date string format for Safari otherwise it will return NaN
const nextFreezeDate = new Date(nextFreezeDateStr.replace(" ", "T").replace(" UTC", "Z"))
Expand All @@ -364,4 +390,45 @@ <h3 class="title">Development Version</h3>
initializeClock('latest-point-release', nextPointReleaseDate);
initializeClock('freeze', nextFreezeDate);
initializeClock('package', nextReleaseDate);

function createiCalendar(event) {
// Format the date/time in the iCalendar format (UTC)
const formatDate = (date) =>
date.toISOString().replace(/-|:|\.\d+/g, "");
// Create the iCalendar file content
const icsContent = `
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
SUMMARY:${event.title}
DTSTART:${formatDate(event.start)}
DTEND:${formatDate(event.end)}
END:VEVENT
END:VCALENDAR
`.trim();

// Create a blob and a download link
const blob = new Blob([icsContent], { type: "text/calendar" });
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
link.download = "event.ics";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
function addEventToCalendar(buttonId, eventTitle, eventDate) {
document.getElementById(buttonId).addEventListener("click", () => {
const event = {
title: eventTitle,
start: eventDate,
end: eventDate,
};
createiCalendar(event);
});
}

addEventToCalendar("addPrToCalendar", `QGIS Point Release ${nextLtrVersion}`, nextPointReleaseDate);
addEventToCalendar("addLatestPrToCalendar", `QGIS Point Release ${nextLrVersion}`, nextPointReleaseDate);
addEventToCalendar("addFreezeToCalendar", `QGIS Feature Freeze ${devVersion}`, nextFreezeDate);
addEventToCalendar("addPackageToCalendar", `QGIS Long-term Release ${nextVersion}`, nextReleaseDate);
</script>

0 comments on commit 0bec165

Please sign in to comment.