Project

General

Profile

Actions

Defect #6513

closed

"Move" and "Copy" are not displayed when deployed in subdirectory

Added by Go MAEDA over 13 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
2010-09-28
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

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

Issue6195_subdir_problem.png (48.1 KB) Issue6195_subdir_problem.png Go MAEDA, 2010-09-28 03:45

Related issues

Has duplicate Redmine - Defect #6601: No 'move' or 'copy' options on the issue pageClosed2010-10-07

Actions
Has duplicate Redmine - Defect #6650: Missing "Add News" buttonClosed2010-10-12

Actions
Has duplicate Redmine - Defect #6627: missing "add new file" in Files sectionClosed2010-10-11

Actions
Actions #1

Updated by Felix Schäfer over 13 years ago

I can confirm that, I'll try to have a look later.

Actions #2

Updated by Felix Schäfer over 13 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"
Actions #3

Updated by Fernando Hartmann over 13 years ago

This problem happens to me.

+1

Actions #4

Updated by Felix Schäfer over 13 years ago

Eric, you broke it, you fix it ;-) Seriously though, it seems more people get hit by this, anything amiss for commit?

Actions #5

Updated by Eric Davis over 13 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)...

Actions #6

Updated by Felix Schäfer over 13 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.

Actions #7

Updated by Eric Davis over 13 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.

Actions #8

Updated by Eric Davis over 13 years ago

  • Status changed from 7 to Resolved
  • Resolution set to Fixed

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

Actions #9

Updated by Eric Davis over 13 years ago

  • Status changed from Resolved to Closed

Merged into 1.0-stable for release in 1.0.3

Actions

Also available in: Atom PDF