Skip to content

Redmine 2.6.5 #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 31 commits into
base: Redmine_2.6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ba3d651
Update to Redmine 3.0.1 + Misc
AllTaken Apr 1, 2015
df01eff
Merge pull request #8 from AllTaken/Redmine_3.0.1
alexwais Apr 1, 2015
4228b15
adding memoization to hidden_attribute_names
victorlcampos Sep 9, 2015
645d273
Merge pull request #12 from visagio/memoize_hidden_fields_name
alexwais Sep 9, 2015
50f13ce
Calling original methods from Issue overridden with alias_method_chai…
lucasarnaud Dec 1, 2015
aab87d1
Fixing memoization issue - hidden fields kept hidden after changing s…
lucasarnaud Dec 17, 2015
665713d
Replace 'table' by 'div' to make plugin compatible with Redmine 3.2.
Jan 22, 2016
f7a9a80
Applies the updates from the views of Redmine 3.2 into the plugin ones
Feb 24, 2016
1cda2e8
Retirando labels e grids dos e-mails de notificação
lucasarnaud Mar 9, 2016
7ada09c
Merge branch 'escondendo-label-grid-dos-emails' into redmine-3.2-esco…
lucasarnaud Mar 9, 2016
dbbfd9b
Fixes a bug that causes an error screen when opening an issue that co…
Mar 15, 2016
6943ec6
Merge pull request #14 from Neticoa/master
alexwais Apr 9, 2016
3675ce3
Merge pull request #18 from visagio/redmine-3.2-escondendo-label-grid…
alexwais Apr 9, 2016
60d5686
Merge commit 'dbbfd9b76a99cc453c2869c86c50d2ee7e53fbec' into redmine-…
lucasarnaud Apr 15, 2016
dd6aafd
Fix end tag
xhervy Apr 19, 2016
be0bab2
Merge pull request #20 from xhervy/master
alexwais Apr 19, 2016
14ef899
Merge pull request #21 from visagio/redmine-3.2-escondendo-label-grid…
alexwais Apr 19, 2016
a33234a
increment version
alexwais Apr 19, 2016
2d5078e
Update README.md
alexwais Apr 19, 2016
acac46e
make test 3.3 pass
victorlcampos May 28, 2016
2e30b57
make redmine 3.3 test pass
victorlcampos Jul 16, 2016
80a7cef
speedup project completely_hidden_attribute_names
victorlcampos Jul 19, 2016
9dbe093
improve some queries to use pluck, not map
victorlcampos Jul 19, 2016
3b2cbc8
use default history view
victorlcampos Jul 19, 2016
75917f4
remove hidden from queries
victorlcampos Jul 26, 2016
7c92ff7
Changes status spacing
Jul 23, 2018
cf8e327
Fix big fields in pdf export
Jul 24, 2018
207363c
feat: Update ReadMe for compatibility with Redmine 2.6.5
lbpo91 Aug 21, 2018
4285508
feat: Change Redmine version required and provide copy of needed file
lbpo91 Aug 21, 2018
bfa70e8
fix: Adapt app/views/queries/_form.html.erb for Redmine 2.6.5
lbpo91 Sep 21, 2018
f00becd
Fix(QueryCustomFieldColumn): Fixing Queries Issue list duplicating fi…
Daniellinsweil Jun 7, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@ Corresponding issue on redmine.org: [#12005](http://www.redmine.org/issues/12005

- Configure hidden fields in workflows, thus per status and roles.

- Hidden fields don't show up for respective users on issues (views, table, forms, history), available columns & filters, exported .csv and .pdf files.
- Hidden fields don't show up for respective users on issues (views, table, forms, history), exported .csv and .pdf files.

- Completely hidden fields (fields that are configured to not be visible anywhere for the user) are removed from available columns & filters.


###Compatibility

The plugin was developed and tested with Redmine version 2.5.2.
The plugin was developed and tested with Redmine version 3.2.0.

For using with version 2.6.5:

- Use branch 2.6.5.

- Copy the directory **pdf/** located on **util/** to the path **<redmine_root_path>/lib/redmine/export/**

###Installation

Expand Down
27 changes: 0 additions & 27 deletions app/views/issues/_history.html.erb

This file was deleted.

89 changes: 70 additions & 19 deletions app/views/issues/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
<%= link_to_if @prev_issue_id,
"\xc2\xab #{l(:label_previous)}",
(@prev_issue_id ? issue_path(@prev_issue_id) : nil),
:title => "##{@prev_issue_id}" %> |
:title => "##{@prev_issue_id}",
:accesskey => accesskey(:previous) %> |
<% if @issue_position && @issue_count %>
<span class="position"><%= l(:label_item_position, :position => @issue_position, :count => @issue_count) %></span> |
<% end %>
<%= link_to_if @next_issue_id,
"#{l(:label_next)} \xc2\xbb",
(@next_issue_id ? issue_path(@next_issue_id) : nil),
:title => "##{@next_issue_id}" %>
:title => "##{@next_issue_id}",
:accesskey => accesskey(:next) %>
</div>
<% end %>

Expand All @@ -31,45 +33,94 @@
<% end %>
</p>

<table class="attributes">
<%= issue_fields_rows do |rows|

#adding unless stmts to hide 'hidden' fields

rows.left l(:field_status), h(@issue.status.name), :class => 'status' unless @issue.hidden_attribute?('status')
rows.left l(:field_priority), h(@issue.priority.name), :class => 'priority' unless @issue.hidden_attribute?('priority_id')

<div class="attributes">
<%= issue_fields_rows do |rows|
i = 0
unless @issue.hidden_attribute?('status')
rows.left l(:field_status), h(@issue.status.name), :class => 'status'
i += 1
end

unless @issue.hidden_attribute?('priority_id')
if i % 2 == 0
rows.left l(:field_priority), h(@issue.priority.name), :class => 'priority'
else
rows.right l(:field_priority), h(@issue.priority.name), :class => 'priority'
end
i += 1
end
unless @issue.disabled_core_fields.include?('assigned_to_id') || @issue.hidden_attribute?('assigned_to_id')
rows.left l(:field_assigned_to), avatar(@issue.assigned_to, :size => "14").to_s.html_safe + (@issue.assigned_to ? link_to_user(@issue.assigned_to) : "-"), :class => 'assigned-to'
if i % 2 == 0
rows.left l(:field_assigned_to), avatar(@issue.assigned_to, :size => "14").to_s.html_safe + (@issue.assigned_to ? link_to_user(@issue.assigned_to) : "-"), :class => 'assigned-to'
else
rows.right l(:field_assigned_to), avatar(@issue.assigned_to, :size => "14").to_s.html_safe + (@issue.assigned_to ? link_to_user(@issue.assigned_to) : "-"), :class => 'assigned-to'
end
i += 1
end

unless @issue.disabled_core_fields.include?('category_id') || @issue.hidden_attribute?('category_id')
rows.left l(:field_category), h(@issue.category ? @issue.category.name : "-"), :class => 'category'
if i % 2 == 0
rows.left l(:field_category), h(@issue.category ? @issue.category.name : "-"), :class => 'category'
else
rows.right l(:field_category), h(@issue.category ? @issue.category.name : "-"), :class => 'category'
end
i += 1
end
unless @issue.disabled_core_fields.include?('fixed_version_id') || @issue.hidden_attribute?('fixed_version_id')
rows.left l(:field_fixed_version), (@issue.fixed_version ? link_to_version(@issue.fixed_version) : "-"), :class => 'fixed-version'
if i % 2 == 0
rows.left l(:field_fixed_version), (@issue.fixed_version ? link_to_version(@issue.fixed_version) : "-"), :class => 'fixed-version'
else
rows.right l(:field_fixed_version), (@issue.fixed_version ? link_to_version(@issue.fixed_version) : "-"), :class => 'fixed-version'
end
i += 1
end

unless @issue.disabled_core_fields.include?('start_date') || @issue.hidden_attribute?('start_date')
rows.right l(:field_start_date), format_date(@issue.start_date), :class => 'start-date'
if i % 2 == 0
rows.left l(:field_start_date), format_date(@issue.start_date), :class => 'start-date'
else
rows.right l(:field_start_date), format_date(@issue.start_date), :class => 'start-date'
end
i += 1
end
unless @issue.disabled_core_fields.include?('due_date') || @issue.hidden_attribute?('due_date')
rows.right l(:field_due_date), format_date(@issue.due_date), :class => 'due-date'
if i % 2 == 0
rows.left l(:field_due_date), format_date(@issue.due_date), :class => 'due-date'
else
rows.right l(:field_due_date), format_date(@issue.due_date), :class => 'due-date'
end
i += 1
end
unless @issue.disabled_core_fields.include?('done_ratio') || @issue.hidden_attribute?('done_ratio')
rows.right l(:field_done_ratio), progress_bar(@issue.done_ratio, :width => '80px', :legend => "#{@issue.done_ratio}%"), :class => 'progress'
if i % 2 == 0
rows.left l(:field_done_ratio), progress_bar(@issue.done_ratio, :width => '80px', :legend => "#{@issue.done_ratio}%"), :class => 'progress'
else
rows.right l(:field_done_ratio), progress_bar(@issue.done_ratio, :width => '80px', :legend => "#{@issue.done_ratio}%"), :class => 'progress'
end
i += 1
end

unless @issue.disabled_core_fields.include?('estimated_hours') || @issue.hidden_attribute?('estimated_hours')
unless @issue.estimated_hours.nil?
rows.right l(:field_estimated_hours), l_hours(@issue.estimated_hours), :class => 'estimated-hours'
if i % 2 == 0
rows.left l(:field_estimated_hours), l_hours(@issue.estimated_hours), :class => 'estimated-hours'
else
rows.right l(:field_estimated_hours), l_hours(@issue.estimated_hours), :class => 'estimated-hours'
end
i += 1
end
end
if User.current.allowed_to?(:view_time_entries, @project)
rows.right l(:label_spent_time), (@issue.total_spent_hours > 0 ? link_to(l_hours(@issue.total_spent_hours), project_issue_time_entries_path(@project, @issue)) : "-"), :class => 'spent-time'
if i % 2 == 0
rows.left l(:label_spent_time), (@issue.total_spent_hours > 0 ? link_to(l_hours(@issue.total_spent_hours), issue_time_entries_path(@issue)) : "-"), :class => 'spent-time'
else
rows.right l(:label_spent_time), (@issue.total_spent_hours > 0 ? link_to(l_hours(@issue.total_spent_hours), issue_time_entries_path(@issue)) : "-"), :class => 'spent-time'
end
end
end %>
<%= render_custom_fields_rows(@issue) %>
<%= call_hook(:view_issues_show_details_bottom, :issue => @issue) %>
</table>
</div>

<% if @issue.description? || @issue.attachments.any? -%>
<hr />
Expand Down
2 changes: 1 addition & 1 deletion app/views/mailer/issue_edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% if @journal.private_notes? %>
(<%= l(:field_private_notes) %>)
<% end %>
<%= l(:text_issue_updated, :id => "##{@issue.id}", :author => h(@journal.user)) %>
<%= l(:text_issue_updated, :id => link_to("##{@issue.id}", @issue_url), :author => h(@journal.user)).html_safe %>

<ul>
<% details_to_strings(@journal_details, false, :only_path => false, :user => @auser).each do |string| %>
Expand Down
88 changes: 88 additions & 0 deletions app/views/queries/_form.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<%= error_messages_for 'query' %>

<div class="box">
<div class="tabular">
<%= hidden_field_tag 'gantt', '1' if params[:gantt] %>

<p><label for="query_name"><%=l(:field_name)%></label>
<%= text_field 'query', 'name', :size => 80 %></p>

<% if User.current.admin? || User.current.allowed_to?(:manage_public_queries, @project) %>
<p><label><%=l(:field_visible)%></label>
<label class="block"><%= radio_button 'query', 'visibility', Query::VISIBILITY_PRIVATE %> <%= l(:label_visibility_private) %></label>
<label class="block"><%= radio_button 'query', 'visibility', Query::VISIBILITY_ROLES %> <%= l(:label_visibility_roles) %>:</label>
<% Role.givable.sorted.each do |role| %>
<label class="block role-visibility"><%= check_box_tag 'query[role_ids][]', role.id, @query.roles.include?(role), :id => nil %> <%= role.name %></label>
<% end %>
<label class="block"><%= radio_button 'query', 'visibility', Query::VISIBILITY_PUBLIC %> <%= l(:label_visibility_public) %></label>
<%= hidden_field_tag 'query[role_ids][]', '' %>
</p>
<% end %>

<p><label for="query_is_for_all"><%=l(:field_is_for_all)%></label>
<%= check_box_tag 'query_is_for_all', 1, @query.project.nil?,
:disabled => ([email protected]_record? && (@query.project.nil? || (@query.is_public? && !User.current.admin?))) %></p>

<% unless params[:gantt] %>
<fieldset><legend><%= l(:label_options) %></legend>
<p><label for="query_default_columns"><%=l(:label_default_columns)%></label>
<%= check_box_tag 'default_columns', 1, @query.has_default_columns?, :id => 'query_default_columns',
:onclick => 'if (this.checked) {$("#columns").hide();} else {$("#columns").show();}' %></p>

<p><label for="query_group_by"><%= l(:field_group_by) %></label>
<%= select 'query', 'group_by', @query.groupable_columns.collect {|c| [c.caption, c.name.to_s]}, :include_blank => true %></p>

<p><label><%= l(:button_show) %></label>
<%= available_block_columns_tags(@query) %></p>

</fieldset>
<% else %>
<fieldset><legend><%= l(:label_options) %></legend>
<p><label><%= l(:button_show) %></label>
<label class="inline"><%= check_box_tag "query[draw_relations]", "1", @query.draw_relations %> <%= l(:label_related_issues) %></label>
<label class="inline"><%= check_box_tag "query[draw_progress_line]", "1", @query.draw_progress_line %> <%= l(:label_gantt_progress_line) %></label>
</p>
</fieldset>
<% end %>
</div>

<fieldset id="filters"><legend><%= l(:label_filter_plural) %></legend>
<%= render :partial => 'queries/filters', :locals => {:query => query}%>
</fieldset>

<% unless params[:gantt] %>
<fieldset><legend><%= l(:label_sort) %></legend>
<% 3.times do |i| %>
<%= content_tag(:span, "#{i+1}:", :class => 'query_sort_criteria_count')%>
<%= label_tag "query_sort_criteria_attribute_" + i.to_s,
l(:description_query_sort_criteria_attribute), :class => "hidden-for-sighted" %>
<%= select_tag("query[sort_criteria][#{i}][]",
options_for_select([[]] + query.available_and_visible_columns.select(&:sortable?).collect {|column| [column.caption, column.name.to_s]}, @query.sort_criteria_key(i)),
:id => "query_sort_criteria_attribute_" + i.to_s)%>
<%= label_tag "query_sort_criteria_direction_" + i.to_s,
l(:description_query_sort_criteria_direction), :class => "hidden-for-sighted" %>
<%= select_tag("query[sort_criteria][#{i}][]",
options_for_select([[], [l(:label_ascending), 'asc'], [l(:label_descending), 'desc']], @query.sort_criteria_order(i)),
:id => "query_sort_criteria_direction_" + i.to_s) %>
<br />
<% end %>
</fieldset>
<% end %>

<% unless params[:gantt] %>
<%= content_tag 'fieldset', :id => 'columns', :style => (query.has_default_columns? ? 'display:none;' : nil) do %>
<legend><%= l(:field_column_names) %></legend>
<%= render_query_columns_selection(query) %>
<% end %>
<% end %>

</div>

<%= javascript_tag do %>
$(document).ready(function(){
$("input[name='query[visibility]']").change(function(){
var checked = $('#query_visibility_1').is(':checked');
$("input[name='query[role_ids][]'][type=checkbox]").attr('disabled', !checked);
}).trigger('change');
});
<% end %>
10 changes: 6 additions & 4 deletions init.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require 'redmine'
require 'pdf'

ActionDispatch::Callbacks.to_prepare do
require_dependency 'issue'
Expand All @@ -15,19 +14,22 @@
require_dependency 'query'
Query.send(:include, RedmineWorkflowHiddenFields::QueryPatch)
QueryColumn.send(:include, RedmineWorkflowHiddenFields::QueryColumnPatch)
QueryCustomFieldColumn.send(:include, RedmineWorkflowHiddenFields::QueryCustomFieldColumnPatch)
require_dependency 'workflow_permission'
WorkflowPermission.send(:include, RedmineWorkflowHiddenFields::WorkflowPermissionPatch)
require_dependency 'workflows_helper'
WorkflowsHelper.send(:include, RedmineWorkflowHiddenFields::WorkflowsHelperPatch)
require_dependency 'redmine/export/pdf/issues_pdf_helper'
Redmine::Export::PDF::IssuesPdfHelper.send(:include, RedmineWorkflowHiddenFields::IssuesPdfHelperPatch)
end

Redmine::Plugin.register :redmine_workflow_hidden_fields do
requires_redmine :version_or_higher => '2.5.2'
requires_redmine :version_or_higher => '2.6.5'

name 'Redmine Workflow Hidden Fields plugin'
author 'Alexander Wais, et al.'
author 'Alexander Wais, David Robinson, et al.'
description "Provides a 'hidden' issue field permission for workflows"
version '0.1.2'
version '0.3.0'
url 'https://github.com/alexwais/redmine_workflow_hidden_fields'
author_url 'http://www.redmine.org/issues/12005'
end
Loading