0

I am trying to make the "private issue" checkbox "checked by default" using a plug-in.

I need to add the below check to the redmine default view

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

The default view is

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

How can i make use of deface gem to make this work?

born
  • 265
  • 3
  • 18

1 Answers1

1

I managed to patch a view using deface

1 You should add some patch for deface in init.rb

source: 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 Create an override in YOUR_PLUGIN/app/overrides/issues/show.rb with code something like this

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)

gotva
  • 5,919
  • 2
  • 25
  • 35