gpt4 book ai didi

Redmine - 将 "Spent Time"字段添加到问题显示

转载 作者:行者123 更新时间:2023-12-03 21:21:59 26 4
gpt4 key购买 nike

我将如何将“花费的时间”添加为要显示在问题列表中的列?

最佳答案

合并 Eric 和 Joel 的答案,这是我需要做的才能将“花费时间”列添加到 Redmine 1.0.3。不确定是否有更好的方法来添加翻译文本。

为了给新字段一个本地化名称,添加到 config/locales/en.yml 字段定义末尾的第 299 行附近:

  field_spent_hours: Spent time

要添加新列,请使用内容创建 lib/spent_time_query_patch.rb:

# Based on http://github.com/edavis10/question_plugin/blob/master/lib/question_query_patch.rb
require_dependency 'query'

module QueryPatch
def self.included(base) # :nodoc:
base.extend(ClassMethods)

# Same as typing in the class
base.class_eval do
unloadable # Send unloadable so it will not be unloaded in development
base.add_available_column(QueryColumn.new(:spent_hours))
end

end

module ClassMethods
unless Query.respond_to?(:available_columns=)
# Setter for +available_columns+ that isn't provided by the core.
def available_columns=(v)
self.available_columns = (v)
end
end

unless Query.respond_to?(:add_available_column)
# Method to add a column to the +available_columns+ that isn't provided by the core.
def add_available_column(column)
self.available_columns << (column)
end
end
end
end

要实际加载上面的 used_time_query_patch,创建 config/initializers/spent_time_query_patch.rb 内容:
require 'spent_time_query_patch'

Query.class_eval do
include QueryPatch
end

关于Redmine - 将 "Spent Time"字段添加到问题显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/321403/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com