Quantcast
Channel: redmine - Enjoy*Study
Viewing all articles
Browse latest Browse all 84

期日近くになったら警告を表示する(Redmine View Customize Plugin)

$
0
0

上記の問い合わせに対応したサンプルコードを書いてみました。(これが求めているものなのかはちょっと怪しいかも...)

期日まで残り3日になったらチケット画面に警告を表示します。

設定内容

  • Path pattern: .*
  • Insertion position: Bottom of issue detail
$(function() {const daysLeft = 3;

  const dueDateArray = $('#issue_due_date').val().split('-');
  const alertDate = newDate(dueDateArray[0], dueDateArray[1] - 1, dueDateArray[2] - daysLeft);

  const now = newDate();
  const nowDate = newDate(now.getFullYear(), now.getMonth(), now.getDate());

  if (nowDate >= alertDate) {
    $('#content').prepend('<div class="warning">It is only ' + daysLeft + ' days until the due date.</div>');
  }})

動作

f:id:onozaty:20200327233745p:plain


Viewing all articles
Browse latest Browse all 84