Skip to content

Instantly share code, notes, and snippets.

@Martin-Alexander
Last active November 22, 2017 22:01
Show Gist options
  • Save Martin-Alexander/8d2509d6a7c0e8d6f5ac354dc8f55f95 to your computer and use it in GitHub Desktop.
Save Martin-Alexander/8d2509d6a7c0e8d6f5ac354dc8f55f95 to your computer and use it in GitHub Desktop.
<div class="btn-group mt-1 mx-auto">
<button id="gantt-day" type="button" class="gantt-period btn btn-sm btn-secondary">Day</button>
<button id="gantt-week" type="button" class="gantt-period btn btn-sm btn-secondary">Week</button>
<button id="gantt-month" type="button" class="gantt-period btn btn-sm btn-secondary">Month</button>
</div>
<script>
document.querySelectorAll(".gantt-period").forEach(function(button) {
button.addEventListener("click", function(event) {
railsGantt.gantt.change_view_mode(event.currentTarget.innerHTML);
document.querySelectorAll(".gantt-period").forEach(function(button) {
button.classList.remove("active");
});
event.currentTarget.classList.add("active");
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment