Trac:修订间差异

来自Gea-Suan Lin's Wiki
跳到导航 跳到搜索
此页面具有访问限制。如果您看见此消息,则说明您没有权限访问此页面。
第102行: 第102行:
    <!--
    <!--
    // Run immediately.
    // Run immediately.
    (function() {
    (function($) {
      // Due date css handling
      // Due date css handling
      var d = new Date();
      var d = new Date();
第117行: 第117行:
      // Due date (newticket) set to 00:00:00
      // Due date (newticket) set to 00:00:00
      if ('/newticket' === document.location.pathname) {
      if ('/newticket' === document.location.pathname) {
        var el = jQuery('#field-due_date');
        var el = $('#field-due_date');
        el.val(el.val().replace(/T.+Z/, 'T00:00:00Z'));
        el.val(el.val().replace(/T.+Z/, 'T00:00:00Z'));
      }
      }


      // Closed tickets handling
      // Closed tickets handling
      jQuery('tr:has(a.closed)').addClass('ticket_closed');
      $('tr:has(a.closed)').addClass('ticket_closed');


      // Datepicker
      // Datepicker
      if (jQuery.datepicker) {
      if ($.datepicker) {
        jQuery.datepicker.setDefaults({
        $.datepicker.setDefaults({
          firstDay: 0,
          firstDay: 0,
          selectOtherMonths: true,
          selectOtherMonths: true,
第133行: 第133行:
        });
        });
      }
      }
    })();
    })(jQuery);


    // Run after content loaded.
    // Run after content loaded.

2018年3月1日 (四) 00:28的版本

Trac是一套问题追踪系统英语:Issue tracking system)。

简介

优点

  • 简单,专注在事情的记录上,而不是限制行为上。

缺点

  • 目前还是不支援Python 3。

安装

目前有安装的

除了基本安装外,还会安装这些套件:

以前有安装的

以前会安装,但现在因为自己用而没有装上:

看到的

看过但还没用过的:

设定

trac.ini

让系统吃code.jquery.com所提供的jQuery以及jQuery UI[1],稍微降低服务器的负载,另外也有机会与外部网站共用cache:

[trac]
jquery_location = https://code.jquery.com/jquery-1.12.4.min.js
jquery_ui_location = https://code.jquery.com/ui/1.12.1/jquery-ui.min.js
jquery_ui_theme_location = https://code.jquery.com/ui/1.12.1/themes/start/jquery-ui.css

site.html

templates/site.html里做了一些事情进行客制化。

CSS

  • 全部使用sans-serif字型。
  • 修正button因为CSS效果而有时会按不到的问题。
  • 针对今天到期与过期的票用不同的标示标出。
  • 将已经关掉的票变淡。
  • 让编辑区域使用等宽字型。
  • 让可用范围变宽。
    <style type="text/css">
    <!--
    body, th, tr {
        font-family: sans-serif;
    }
    input[type=button]:active, input[type=submit]:active,
    input[type=reset]:active {
        position: relative;
        top: 0;
        left: 0;
    }
    table.tickets tr.duedate_overdue {
        font-weight: bold;
    }
    table.tickets tr.duedate_today {
        border: 2px solid;
    }
    table.subtickets tr.ticket_closed, .closed.ticket {
        opacity: 0.5;
    }
    textarea {
        font-family: monospace;
    }
    #content.ticket {
        width: 78em;
    }
    -->
    </style>

JavaScript

  • 用JavaScript针对今天到期以及过期的票增加CSS。
  • 将新票里的Due Date改为零点零分零秒。
  • 将票里的attachments与modify内容展开。
  • 将日历选择器中,关闭动画效果[2],另外将每周的第一天设为星期天[2],并且允许选择其他月份的日期[2]
    <script>
    <!--
    // Run immediately.
    (function($) {
        // Due date css handling
        var d = new Date();
        var today = (new Date(d.getTime() - d.getTimezoneOffset() * 60000)).toISOString().slice(0, 10);
        document.querySelectorAll('table.tickets td.due_date').forEach(function(el) {
            var due = el.innerText.trim();
            if (due < today) {
                el.parentElement.classList.add('duedate_overdue');
            } else if (due === today) {
                el.parentElement.classList.add('duedate_today');
            }
        });

        // Due date (newticket) set to 00:00:00
        if ('/newticket' === document.location.pathname) {
            var el = $('#field-due_date');
            el.val(el.val().replace(/T.+Z/, 'T00:00:00Z'));
        }

        // Closed tickets handling
        $('tr:has(a.closed)').addClass('ticket_closed');

        // Datepicker
        if ($.datepicker) {
            $.datepicker.setDefaults({
                firstDay: 0,
                selectOtherMonths: true,
                showAnim: '',
                showOtherMonths: true
            });
        }
    })(jQuery);

    // Run after content loaded.
    jQuery(function() {
        // Layout
        jQuery('#attachments').removeClass('collapsed');
        jQuery('#modify').parent().removeClass('collapsed');
    });
    //-->
    </script>

参考资料

外部链接