I am working on a plug-in to extend the file attachment feature of redmine.
For which I need to add a checkbox that is only visible by users with a particular role
I am totally noob on ruby. This is what i came up with after referring some other plug-ins and redmine documentation.
in plugins/myplugin/app/view/attachments/_form.html.erb
<% if view_private_attachment = User.current.allowed_to?(:view_private_attachments, @project) %>
<%= check_box_tag :private_attachment, true, false %>
<%= label_tag :private_attachment, 'Private Attachment', :style => 'font-weight:bold;' %>
<% end %>
In plugins/myplugin/app/init.d
Redmine::Plugin.register :myplugin do
name 'myplugin'
author 'njan'
description 'This is a plugin for Redmine'
version '0.0.1'
url 'http://example.com/path/to/plugin'
author_url 'http://example.com/about'
project_module :issue_tracking do
permission :view_private_attachments, { }
end
end
The check box is not getting displayed .