0

redmineの添付ファイル機能を拡張するプラグインに取り組んでいます。

特定の役割を持つユーザーのみが表示できるチェックボックスを追加する必要があります

私は完全にルビーの初心者です。これは、他のプラグインとRedmineのドキュメントを参照した後に思いついたものです。

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 %> 

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

チェックボックスが表示されません。

4

1 に答える 1

0

条件に応じて、チェックボックスの無効化および読み取り専用プロパティを使用できます。

<%= f.check_box :private_attachment, :disabled => true, :readonly => true %>
于 2013-03-19T07:39:29.657 に答える