summaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-07-13 09:20:11 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-07-13 09:20:11 +0000
commit628d05629b734371d3e850a95dadf0be30c5ef20 (patch)
tree58a9da4e8266ee45a0800996f9228e9d2a45108c /app/views
parenta74d55edd99a4bae23e7d9cbd76136ffa7707ccf (diff)
downloadredmine-628d05629b734371d3e850a95dadf0be30c5ef20.tar.gz
redmine-628d05629b734371d3e850a95dadf0be30c5ef20.zip
Role-based issue custom field visibility (#5037).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12012 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views')
-rw-r--r--app/views/custom_fields/_form.html.erb27
-rw-r--r--app/views/issues/_history.html.erb2
-rw-r--r--app/views/issues/index.api.rsb2
-rw-r--r--app/views/issues/show.api.rsb4
-rw-r--r--app/views/mailer/_issue.html.erb2
-rw-r--r--app/views/mailer/_issue.text.erb2
-rw-r--r--app/views/mailer/issue_add.html.erb2
-rw-r--r--app/views/mailer/issue_add.text.erb2
-rw-r--r--app/views/mailer/issue_edit.html.erb4
-rw-r--r--app/views/mailer/issue_edit.text.erb4
-rw-r--r--app/views/workflows/permissions.html.erb4
11 files changed, 41 insertions, 14 deletions
diff --git a/app/views/custom_fields/_form.html.erb b/app/views/custom_fields/_form.html.erb
index b6f7ddb1d..4c0b70243 100644
--- a/app/views/custom_fields/_form.html.erb
+++ b/app/views/custom_fields/_form.html.erb
@@ -64,6 +64,24 @@ when "IssueCustomField" %>
<p><%= f.check_box :is_for_all %></p>
<p><%= f.check_box :is_filter %></p>
<p><%= f.check_box :searchable %></p>
+ <p>
+ <label><%= l(:field_visible) %></label>
+ <label class="block">
+ <%= radio_button_tag 'custom_field[visible]', 1, @custom_field.visible?, :id => 'custom_field_visible_on' %>
+ <%= l(:label_visibility_public) %>
+ </label>
+ <label class="block">
+ <%= radio_button_tag 'custom_field[visible]', 0, !@custom_field.visible?, :id => 'custom_field_visible_off' %>
+ <%= l(:label_visibility_roles) %>:
+ </label>
+ <% Role.givable.sorted.each do |role| %>
+ <label class="block custom_field_role" style="padding-left:2em;">
+ <%= check_box_tag 'custom_field[role_ids][]', role.id, @custom_field.roles.include?(role) %>
+ <%= role.name %>
+ </label>
+ <% end %>
+ <%= hidden_field_tag 'custom_field[role_ids][]', '' %>
+ </p>
<% when "UserCustomField" %>
<p><%= f.check_box :is_required %></p>
@@ -97,3 +115,12 @@ when "IssueCustomField" %>
</div>
<% include_calendar_headers_tags %>
+
+<%= javascript_tag do %>
+function toggleCustomFieldRoles(){
+ var checked = $("#custom_field_visible_on").is(':checked');
+ $('.custom_field_role input').attr('disabled', checked);
+}
+$("#custom_field_visible_on, #custom_field_visible_off").change(toggleCustomFieldRoles);
+$(document).ready(toggleCustomFieldRoles);
+<% end %>
diff --git a/app/views/issues/_history.html.erb b/app/views/issues/_history.html.erb
index 470a55acf..94d98ccc7 100644
--- a/app/views/issues/_history.html.erb
+++ b/app/views/issues/_history.html.erb
@@ -8,7 +8,7 @@
<% if journal.details.any? %>
<ul class="details">
- <% details_to_strings(journal.details).each do |string| %>
+ <% details_to_strings(journal.visible_details).each do |string| %>
<li><%= string %></li>
<% end %>
</ul>
diff --git a/app/views/issues/index.api.rsb b/app/views/issues/index.api.rsb
index 5009ffa7e..c3bcfd74b 100644
--- a/app/views/issues/index.api.rsb
+++ b/app/views/issues/index.api.rsb
@@ -19,7 +19,7 @@ api.array :issues, api_meta(:total_count => @issue_count, :offset => @offset, :l
api.done_ratio issue.done_ratio
api.estimated_hours issue.estimated_hours
- render_api_custom_values issue.custom_field_values, api
+ render_api_custom_values issue.visible_custom_field_values, api
api.created_on issue.created_on
api.updated_on issue.updated_on
diff --git a/app/views/issues/show.api.rsb b/app/views/issues/show.api.rsb
index ce788a723..3878e71bd 100644
--- a/app/views/issues/show.api.rsb
+++ b/app/views/issues/show.api.rsb
@@ -18,7 +18,7 @@ api.issue do
api.estimated_hours @issue.estimated_hours
api.spent_hours(@issue.spent_hours) if User.current.allowed_to?(:view_time_entries, @project)
- render_api_custom_values @issue.custom_field_values, api
+ render_api_custom_values @issue.visible_custom_field_values, api
api.created_on @issue.created_on
api.updated_on @issue.updated_on
@@ -55,7 +55,7 @@ api.issue do
api.notes journal.notes
api.created_on journal.created_on
api.array :details do
- journal.details.each do |detail|
+ journal.visible_details.each do |detail|
api.detail :property => detail.property, :name => detail.prop_key do
api.old_value detail.old_value
api.new_value detail.value
diff --git a/app/views/mailer/_issue.html.erb b/app/views/mailer/_issue.html.erb
index 829f8d576..aee365e56 100644
--- a/app/views/mailer/_issue.html.erb
+++ b/app/views/mailer/_issue.html.erb
@@ -7,7 +7,7 @@
<li><%=l(:field_assigned_to)%>: <%=h issue.assigned_to %></li>
<li><%=l(:field_category)%>: <%=h issue.category %></li>
<li><%=l(:field_fixed_version)%>: <%=h issue.fixed_version %></li>
-<% issue.custom_field_values.each do |c| %>
+<% issue.visible_custom_field_values(users.first).each do |c| %>
<li><%=h c.custom_field.name %>: <%=h show_value(c) %></li>
<% end %>
</ul>
diff --git a/app/views/mailer/_issue.text.erb b/app/views/mailer/_issue.text.erb
index 554488049..a2d5a41b2 100644
--- a/app/views/mailer/_issue.text.erb
+++ b/app/views/mailer/_issue.text.erb
@@ -7,7 +7,7 @@
* <%=l(:field_assigned_to)%>: <%= issue.assigned_to %>
* <%=l(:field_category)%>: <%= issue.category %>
* <%=l(:field_fixed_version)%>: <%= issue.fixed_version %>
-<% issue.custom_field_values.each do |c| %>* <%= c.custom_field.name %>: <%= show_value(c) %>
+<% issue.visible_custom_field_values(users.first).each do |c| %>* <%= c.custom_field.name %>: <%= show_value(c) %>
<% end -%>
----------------------------------------
<%= issue.description %>
diff --git a/app/views/mailer/issue_add.html.erb b/app/views/mailer/issue_add.html.erb
index fb4a2dab6..99fd08d14 100644
--- a/app/views/mailer/issue_add.html.erb
+++ b/app/views/mailer/issue_add.html.erb
@@ -1,3 +1,3 @@
<%= l(:text_issue_added, :id => "##{@issue.id}", :author => h(@issue.author)) %>
<hr />
-<%= render :partial => 'issue', :formats => [:html], :locals => { :issue => @issue, :issue_url => @issue_url } %>
+<%= render :partial => 'issue', :formats => [:html], :locals => { :issue => @issue, :users => @users, :issue_url => @issue_url } %>
diff --git a/app/views/mailer/issue_add.text.erb b/app/views/mailer/issue_add.text.erb
index e990ff0d2..6e3b42725 100644
--- a/app/views/mailer/issue_add.text.erb
+++ b/app/views/mailer/issue_add.text.erb
@@ -1,4 +1,4 @@
<%= l(:text_issue_added, :id => "##{@issue.id}", :author => @issue.author) %>
----------------------------------------
-<%= render :partial => 'issue', :formats => [:text], :locals => { :issue => @issue, :issue_url => @issue_url } %>
+<%= render :partial => 'issue', :formats => [:text], :locals => { :issue => @issue, :users => @users, :issue_url => @issue_url } %>
diff --git a/app/views/mailer/issue_edit.html.erb b/app/views/mailer/issue_edit.html.erb
index 322251912..e3b6f5c6c 100644
--- a/app/views/mailer/issue_edit.html.erb
+++ b/app/views/mailer/issue_edit.html.erb
@@ -4,11 +4,11 @@
<%= l(:text_issue_updated, :id => "##{@issue.id}", :author => h(@journal.user)) %>
<ul>
-<% details_to_strings(@journal.details, false, :only_path => false).each do |string| %>
+<% details_to_strings(@journal_details, false, :only_path => false).each do |string| %>
<li><%= string %></li>
<% end %>
</ul>
<%= textilizable(@journal, :notes, :only_path => false) %>
<hr />
-<%= render :partial => 'issue', :formats => [:html], :locals => { :issue => @issue, :issue_url => @issue_url } %>
+<%= render :partial => 'issue', :formats => [:html], :locals => { :issue => @issue, :users => @users, :issue_url => @issue_url } %>
diff --git a/app/views/mailer/issue_edit.text.erb b/app/views/mailer/issue_edit.text.erb
index 395f8f626..173d2c4fe 100644
--- a/app/views/mailer/issue_edit.text.erb
+++ b/app/views/mailer/issue_edit.text.erb
@@ -1,6 +1,6 @@
<%= "(#{l(:field_private_notes)}) " if @journal.private_notes? -%><%= l(:text_issue_updated, :id => "##{@issue.id}", :author => @journal.user) %>
-<% details_to_strings(@journal.details, true).each do |string| -%>
+<% details_to_strings(@journal_details, true).each do |string| -%>
<%= string %>
<% end -%>
@@ -9,4 +9,4 @@
<% end -%>
----------------------------------------
-<%= render :partial => 'issue', :formats => [:text], :locals => { :issue => @issue, :issue_url => @issue_url } %>
+<%= render :partial => 'issue', :formats => [:text], :locals => { :issue => @issue, :users => @users, :issue_url => @issue_url } %>
diff --git a/app/views/workflows/permissions.html.erb b/app/views/workflows/permissions.html.erb
index b646146b0..6046201d3 100644
--- a/app/views/workflows/permissions.html.erb
+++ b/app/views/workflows/permissions.html.erb
@@ -62,7 +62,7 @@
</td>
<% for status in @statuses -%>
<td align="center" class="<%= @permissions[status.id][field] %>">
- <%= field_permission_tag(@permissions, status, field) %>
+ <%= field_permission_tag(@permissions, status, field, @role) %>
<% unless status == @statuses.last %><a href="#" class="repeat-value">&#187;</a><% end %>
</td>
<% end -%>
@@ -82,7 +82,7 @@
</td>
<% for status in @statuses -%>
<td align="center" class="<%= @permissions[status.id][field.id.to_s] %>">
- <%= field_permission_tag(@permissions, status, field) %>
+ <%= field_permission_tag(@permissions, status, field, @role) %>
<% unless status == @statuses.last %><a href="#" class="repeat-value">&#187;</a><% end %>
</td>
<% end -%>