Last active
December 2, 2015 01:06
-
-
Save exoego/a6f0673d8067e03bff63 to your computer and use it in GitHub Desktop.
Redmine - View Customize - Shows gannt view starting 2 monthes ago
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ガントチャートを2ヶ月前開始で表示 | |
// Shows gannt view starting 2 months ago | |
$(document).ready(function(){ | |
// configurable | |
var monthsAgo = 2; | |
var monthsRange = 6; | |
// ----- | |
var now = new Date(); | |
var thisMonth = now.getMonth() + 1; | |
var thisYear = now.getFullYear(); | |
var diff = thisMonth - monthsAgo; | |
var startMonth = (diff > 0) ? diff : diff + 12; | |
var startYear = (diff > 0) ? thisYear : thisYear - 1; | |
var link = $("#main-menu a.gantt"); | |
var original = link.attr("href"); | |
var modified = original + "?months=" + monthsRange + "&month=" + startMonth + "&year=" + startYear; | |
link.attr("href", modified); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment