【问题标题】:Modifying redmine views using deface使用 deface 修改 redmine 视图
【发布时间】:2013-03-22 11:49:46
【问题描述】:

我正在尝试使用插件将“私人问题”复选框设置为“默认选中”。

我需要在 redmine 默认视图中添加以下检查

:checked => @issue.new_record? || @issue.is_private,

默认视图是

<%= f.check_box :is_private, :no_label => true %>

我怎样才能利用 deface gem 来完成这项工作?

【问题讨论】:

    标签: ruby-on-rails-3 redmine-plugins deface


    【解决方案1】:

    我设法使用 deface 修补视图

    1 你应该在 init.rb 中为 deface 添加一些补丁

    来源:https://github.com/jbbarth/redmine_organizations/blob/master/init.rb#L3

    Rails.application.paths["app/overrides"] ||= []
    Rails.application.paths["app/overrides"] << File.expand_path("../app/overrides", __FILE__)
    

    2 在 YOUR_PLUGIN/app/overrides/issues/show.rb 中使用类似这样的代码创建覆盖

    Deface::Override.new(
      :virtual_path => "issues/show",
      :name => "private_issue_check_box",
      :replace => CSS_SELECTOR_FOR_CHECK_BOX,
      :text => "<%= f.check_box :is_private, :no_label => true, :checked => @issue.new_record? || @issue.is_private %>",
      :disabled => false)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-02-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多