14
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

RedmineのView Customize pluginでチケットの履歴をフィルタ

Last updated at Posted at 2016-06-24

Redmineでチケットを課題管理に使っていたところ、コメント代わりに追加されていく注記が目立たず、見落としかねないので、「View Customize plugin」を使って注記だけ表示するフィルタ機能を作成してみました。

履歴の上部にリンクが表示され、クリックで全表示、注記のみ表示を切り替えます。

Redmine 3.1.1
redmine-view-customize 1.1.2
https://github.com/onozaty/redmine-view-customize

Path pattern: /issues/[0-9]+
Type: JavaScript
Code:

$(function() { 
    var $history = $("#history"); 
    var func = function() { 
        var mode = $(this).attr("data-mode"); 
        if (mode == "showAll") {
            $history.find("div.journal").show(); 
            $history.find("div.journal.has-notes").find("ul.details").show(); 
        } else if (mode == "commentOnly") { 
            // 注記を持たない履歴を非表示
            $history.find("div.journal").not(".has-notes").hide();
            // 注記を持つ履歴の注記以外の内容を非表示 
            $history.find("div.journal.has-notes").find("ul.details").hide(); 
        } 
        $("#history").find("span.history_fillter_links a:hidden").show(); 
        $(this).hide(); 
        return false; 
    } 
    var $links = $("<span class='history_fillter_links'></span>").prependTo($history); 
    $("<a data-mode='showAll' href='#' >show All</a>") 
    .appendTo($links).click(func); 
    $("<a data-mode='commentOnly' href='#' >comment Only</a>") 
    .appendTo($links).click(func).click(); // 初期表示時フィルタを有効化
}); 

注記が目立つようにStyleSheetも追加

Path pattern: /issues/[0-9]+
Type: StyleSheet
Code:

#history > div.has-notes div.wiki { 
        margin-left:22px; 
        padding:3px; 
        background-color:#ffffdd; 
        border: 1px solid #d7d7d7; 
}
14
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?