Vote #68243
完了"Move" and "Copy" are not displayed when deployed in subdirectory
0%
説明
"Move" and "Copy" link are not displayed when Redmine 1.0.2 deployed in subdirectory (example: @script/server --path subdir@).
related issue: #6195
journals
I can confirm that, I'll try to have a look later.
--------------------------------------------------------------------------------
Eric: patch below, I'll let you take care of the tests though as it was your change ;-) Make sure to document the relative_url_root stuff in the environments if it's not the case already.
Here's a patch (read on though):
<pre><code class="diff">diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 6ba40eb..f4ad798 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -41,7 +41,7 @@ module ApplicationHelper
def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference)
if options.is_a?(String)
begin
- route = ActionController::Routing::Routes.recognize_path(options.gsub(/\?.*/,''), :method => options[:method] || :get)
+ route = ActionController::Routing::Routes.recognize_path(options.match(/\A#{ActionController::Base.relative_url_root}(.*)\?.*\z/)[1], :method => options[:method] || :get)
link_controller = route[:controller]
link_action = route[:action]
rescue ActionController::RoutingError # Parse failed, not a route</code></pre>
This will require you to make rails aware of the subdirectory though, I know passenger takes care of this, webrick doesn't. You can pass the subdirectory information either through an environment variable: @RAILS_RELATIVE_URL_ROOT="/redmine"@ or through an entry in the @config/environment.rb@:
<pre><code class="ruby">config.action_controller.relative_url_root = "/redmine"</code></pre>
--------------------------------------------------------------------------------
This problem happens to me.
+1
--------------------------------------------------------------------------------
Eric, you broke it, you fix it ;-) Seriously though, it seems more people get hit by this, anything amiss for commit?
--------------------------------------------------------------------------------
Felix Schäfer wrote:
> anything amiss for commit?
Time. I want to test it out, since that method is starting to get pretty nasty.
I'm thinking it might be a good idea to take another look at how Redmine is doing permissions and see if these things could be handled there (instead of running through the entire Routing system each time)...
--------------------------------------------------------------------------------
Eric Davis wrote:
> Time. I want to test it out, since that method is starting to get pretty nasty.
I was thinking more in the lines of code (no pun intended).
> I'm thinking it might be a good idea to take another look at how Redmine is doing permissions and see if these things could be handled there (instead of running through the entire Routing system each time)…
Nothing I'd be against, but I'd still want this fixed as soon as possible even if it's with a somewhat bloated solution rather than holding off until we have a good one (and IIRC you were the that made that change in the first place ;-) ). Now, we have 2 options until we find a better solution: go with this, or I'd be willing to find all places making problems so that we can revert the changes to that method.
--------------------------------------------------------------------------------
Felix Schäfer wrote:
> Nothing I'd be against, but I'd still want this fixed as soon as possible even if it's with a somewhat bloated solution rather than holding off until we have a good one
True.
> (and IIRC you were the that made that change in the first place ;-) ).
Hey, someone needs to keep you working. ;)
> Now, we have 2 options until we find a better solution: go with this, or I'd be willing to find all places making problems so that we can revert the changes to that method.
I think reverting is a step back. This code is some of Redmine's older code that has been needed to be upgraded for years. I'll try to take a look at it this weekend and make a decision.
--------------------------------------------------------------------------------
Decided to just revert the changes and go back to the older @link_to_if_authorized@. I don't have the time or desire to go through the entire permissions system to get it to support REST urls properly.
r4257 r4258
--------------------------------------------------------------------------------
Merged into 1.0-stable for release in 1.0.3
--------------------------------------------------------------------------------
related_issues
duplicates,Closed,6601,No 'move' or 'copy' options on the issue page
duplicates,Closed,6650,Missing "Add News" button
duplicates,Closed,6627,missing "add new file" in Files section