Defect #6513
closed"Move" and "Copy" are not displayed when deployed in subdirectory
0%
Description
"Move" and "Copy" link are not displayed when Redmine 1.0.2 deployed in subdirectory (example: script/server --path subdir
).
related issue: #6195
Files
Related issues
Updated by Felix Schäfer almost 14 years ago
I can confirm that, I'll try to have a look later.
Updated by Felix Schäfer almost 14 years ago
- Status changed from New to 7
- Assignee set to Eric Davis
- Target version set to 1.0.3
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):
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
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
:
config.action_controller.relative_url_root = "/redmine"
Updated by Felix Schäfer almost 14 years ago
Eric, you broke it, you fix it ;-) Seriously though, it seems more people get hit by this, anything amiss for commit?
Updated by Eric Davis almost 14 years ago
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)...
Updated by Felix Schäfer almost 14 years ago
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.
Updated by Eric Davis almost 14 years ago
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.
Updated by Eric Davis almost 14 years ago
- Status changed from 7 to Resolved
- Resolution set to Fixed
Updated by Eric Davis almost 14 years ago
- Status changed from Resolved to Closed
Merged into 1.0-stable for release in 1.0.3