Skip to content

Instantly share code, notes, and snippets.

@exoego
Last active December 2, 2015 01:06
Show Gist options
  • Save exoego/a6f0673d8067e03bff63 to your computer and use it in GitHub Desktop.
Save exoego/a6f0673d8067e03bff63 to your computer and use it in GitHub Desktop.
Redmine - View Customize - Shows gannt view starting 2 monthes ago
// ガントチャートを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