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?

1 Answer 1

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)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.