Vote #68163
完了Allow unchecking all trackers in Roadmap view sidebar
0%
説明
h2. Extensive subject
Allow a Roadmap view, without any related issues, when at least one tracker is configured by a Redmine Administrator as to show its issues by default on the roadmap[1].
h2. Introduction
I noticed some unexpected behaviour in the roadmap view a while ago which I already discussed over IRC with Eric Davis. Here follows an extraction.
h2. Discussion
Mischa The Evil wrote:
When I deselect all trackers I expect to recieve a roadmap view showing all versions without any related issues. Instead, I recieve the roadmap with the related issues in the trackers that are selected by the Redmine Administrator as to be shown on the roadmap by default.
This is due to the fact that when I deselect all trackers no @:tracker_ids@ params are passed to the @VersionsController@ hence
@selected_tracker_ids = (default_trackers || selectable_trackers).collect {|t| t.id.to_s }
becomes assigned[2].If the url is manually crafted into something like "/roadmap?tracker_ids%5B%5D=none" (notice the explicit @none@-value) the expected roadmap view is rendered though.
There doesn't seem to be any hidden fields for none that are selected. It seems rather caused by the @retrieve_selected_tracker_ids@ method in the @VersionsController@ (source:/trunk/app/controllers/versions_controller.rb#L147), which checks if any @tracker_ids@-params are in the URL and because I deselected all trackers there aren't any.
class VersionsController < ApplicationController ... def index @trackers = @project.trackers.find(:all, :order => 'position') retrieve_selected_tracker_ids(@trackers, @trackers.select {|t| t.is_in_roadmap?}) ... end ... ... private ... def retrieve_selected_tracker_ids(selectable_trackers, default_trackers=nil) if ids = params[:tracker_ids] @selected_tracker_ids = (ids.is_a? Array) ? ids.collect { |id| id.to_i.to_s } : ids.split('/').collect { |id| id.to_i.to_s } else @selected_tracker_ids = (default_trackers || selectable_trackers).collect {|t| t.id.to_s } end end end
Eric Davis wrote:
If you unselect everything, I would think it would return nothing and not the default.
Mischa The Evil wrote:
Redmine returns the default there because of a specific setting for each of the trackers to show the tracker in the roadmap whether or not. It's code from the time we also had the seperate changelog view[3].
Eric Davis wrote:
Hmm...
Mischa The Evil wrote:
Indeed, my reaction was the same at first. I was so far able to trace the issue back to the @retrieve_selected_tracker_ids@ method in the @VersionsController@.
Eric Davis wrote:
What do you think we should do?
Mischa The Evil wrote:
I can't tell (yet). Especially since it's acceptable that an admin configures all the trackers to be not shown on the roadmap by default. Thus I conclude upto now that Redmine can't rely on the existance of the @tracker_ids@-param in the URL if we want to be able to recieve the expected none setting... :S
I'll add it as a feature request on Redmine to accept an explicit @none@-setting for the selected_trackers on the roadmap.
h2. Footnotes
fn1. See RedmineIssueTrackingSetup.
fn2. The following graph shows the trace to this assignment. I took it from a full HTML-export from FreeMind (which I attach also as attachment:retrieve_selected_tracker_ids-FreeMind_html_export.zip).
!retrieve_selected_tracker_ids.png!
fn3. This view is removed by JPL in r3162 which relates to issue #2972.
journals
Just for those wondering, this is still present in 1.4.3, although it's no big deal for us...
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
I just noticed this issue again. I haven't tested this thoroughly but the following patch should do the trick:
<pre><code class="diff">
app/views/versions/_sidebar.html.erb | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/views/versions/_sidebar.html.erb b/app/views/versions/_sidebar.html.erb
index abfe9c67c..6b34b34b8 100644
--- a/app/views/versions/_sidebar.html.erb
+++ b/app/views/versions/_sidebar.html.erb
@@ -3,6 +3,7 @@
<ul>
<% @trackers.each do |tracker| %>
<li>
+ <%= hidden_field_tag "tracker_ids[]", nil, :id => nil %>
<label>
<%= check_box_tag("tracker_ids[]", tracker.id,
(@selected_tracker_ids.include? tracker.id.to_s),
</code></pre>
--------------------------------------------------------------------------------
Here's a proper patch file, produced by @git format-patch@, against trunk @ r21200. It includes the diff I posted above and a crude and rudimentary, but functioning system test.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
The patched behavior is more natural than the current behavior. To me, this is rather a "Defect" than a "Feature".
Setting the target version to 5.0.0.
--------------------------------------------------------------------------------
Committed the patch. Thank you for your contribution.
--------------------------------------------------------------------------------
Mischa, Go, why did you choose a system test for this case? A functional test should be enough to cover this.
--------------------------------------------------------------------------------
I made some changes:
* fixed that hidden tag is render multiple
* added assertions to existing test
* remove the system test.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
related_issues
relates,Closed,2972,Improve Changelog feature (separate tab and merge Roadmap features)
relates,New,32278,Display Global Roadmap without any tracker