Loriowar / redmine_issues_tree

Provides a tree view of the Redmine issues list
GNU General Public License v3.0
115 stars 72 forks source link

Tree doesn't expand #2

Closed omarix closed 8 years ago

omarix commented 9 years ago

Hi , Installed redmine_issues_tree on my redmine 3.1.0, the installation passed smoothly, but as the attached screenshot illustrates, the tree doesn't expand and web server returned 404 error, tree_children was not found.

<p>The requested URL /projects/project_name/issues_trees/3/tree_children was not found on this server.</p>

issue

I copied both required hooks on./app/views/issues/index.html.erb, I'm not sure if it's the right place, I didn't found the index.html, In bellow is how the hooks are inserted:

# head -15 ./plugins/redmine_issues_tree/app/views/issues/index.html.erb
<%# issues_tree patch %>
<%= call_hook(:view_issues_index_header, {issues: @issues, project: @project, query: @query}) %>
<%# end patch %>

<div class="contextual">
<% if !@query.new_record? && @query.editable_by?(User.current) %>
  <%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %>
  <%= delete_link query_path(@query) %>
<% end %>

  <%# issues_tree patch %>
  <%= call_hook(:view_issues_index_contextual, {issues: @issues, project: @project, query: @query}) %>
  <%# end patch %>
</div>

If you need any further information to track this issue, please be my guest.

Regards

Loriowar commented 9 years ago

Looks like you haven't routes. Try to find in rake routes following actions:

In my case, routes looks follows:

tree_index_project_issues_trees           GET               /projects/:project_id/issues_trees/tree_index(.:format)                           issues_trees#tree_index
redirect_with_params_project_issues_trees POST              /projects/:project_id/issues_trees/redirect_with_params(.:format)                 issues_trees#redirect_with_params
tree_children_project_issues_tree         GET               /projects/:project_id/issues_trees/:id/tree_children(.:format)                    issues_trees#tree_children
omarix commented 9 years ago

Thank you @Loriowar , I have the same result:

root@redmain:/opt/redmine/redmine-3.1.0/plugins# rake routes |grep issues_trees 
(in /opt/redmine/redmine-3.1.0)
          tree_index_project_issues_trees GET                 /projects/:project_id/issues_trees/tree_index(.:format)                           issues_trees#tree_index
redirect_with_params_project_issues_trees POST                /projects/:project_id/issues_trees/redirect_with_params(.:format)                 issues_trees#redirect_with_params
        tree_children_project_issues_tree GET                 /projects/:project_id/issues_trees/:id/tree_children(.:format)                    issues_trees#tree_children
omarix commented 9 years ago

is this a bug or I missed some thing ?

wednowsxp commented 9 years ago

same here, new installed redmine 3.1, just installed this plugin, the tree doesn't expand. no action

zsd881224 commented 9 years ago

same error. I installed redmine 3.1 with bitnami package. When I executed 'rake routes', I got this error: Mysql2::Error: Access denied for user 'root'@'localhost' (using password: NO)

mwalimu82 commented 9 years ago

Same for me

alxRlja commented 9 years ago

hi! same situation for me.

2015-09-10_11-24-08

Loriowar commented 9 years ago

Added branches for Redmine 2.6.6, 3.0.4 and 3.1.0. All versions was tested under corresponding Redmine versions. In case of error, please, provide complete information about environment, versions of plugins and gems, DB-dump and any other information which can help repeat error on local machine of developer.

omarix commented 9 years ago

Many thanx for your support

alxRlja commented 8 years ago

Hi. I have done the required according to the previous comments.

1) I'm using redmine 3.1 with bitnami package , Windows server 2008 64 2) Executed 'rake routes' (because of Bitnami execution was successful with command
rake routes RAILS_ENV=production 3) rake routes RAILS_ENV=production | grep issues_trees shows same path as you: tree_index_project_issues_trees GET /projects/:project_id/issues_trees/tree_index(.:format) issues_trees#tree_index redirect_with_params_project_issues_trees POST /projects/:project_id/issues_trees/redirect_with_params(.:f ormat) issues_trees#redirect_with_params tree_children_project_issues_tree GET /projects/:project_id/issues_trees/:id/tree_children(.:form at) issues_trees#tree_children

however, as shown on Image, once tree is expanded, the PATH is incomplete. Correct path is http://rm01/redmine/ but path in tree is only http://rm01/

I'm missing something?

Thank you!

issuetree

mwalimu82 commented 8 years ago

For me it still does not work but I am not sure if I installed the correct plugin. I used https://github.com/Loriowar/redmine_issues_tree.git but you wrote that there are branches for several redmine versions. Where can I download a specific branch? Best regards and many thanks

Loriowar commented 8 years ago

Problem with custom Redmine dislocation like "http://my_domain.com/redmine/" still alive. I'll try to fix this in closest future. For now, you can use subdomain, for example "http://redmine.my_domain.com/". This approach works perfect.

cubNg commented 8 years ago

Hi all, I'm new to Git and Redmine. I found this plugin, it very usefull but I also get same pbolem here, can't expand. So, I would like to suggest one solution, it work on me ('cause I'm new with Git, I write down here):

  1. I use Bitnami, install on Win7. But I hope other install case will same.
  2. Modify file: issues_trees_controller.rb
    • In: d:\Bitnami\redmine\apps\redmine\htdocs\plugins\redmine_issues_tree\app\controllers\
    • At: line 27
    • before: url_for_load_tree_children: "/projects/#{ @project.identifier}/issues_trees/",
    • after: url_for_load_tree_children: "/redmine/projects/#{ @project.identifier}/issues_trees/",
Loriowar commented 8 years ago

Yes, this one of way for dirty fixing of the bug. But this way break work of the plugin for all other users with Redmine on subdomain. May you try to remove leading slash and check working of the plugin? I.e. change /projects/#{ @project.identifier}/issues_trees/ to projects/#{ @project.identifier}/issues_trees/

If it is work for you I can fix this bug properly.

xJom commented 8 years ago

I tried to add a configurable settings item named tree_children_base, before the url_for_load_tree_children: But even following CrazyCubs hard-coded solution renders a duplication of the path in the Ajax-call.

I also tried adding it harded coded on line 17 in the file tree.issues.initializer.js and the same result, where the part url_for_load_tree_children gets duplicated, like:

http://localhost/redmine/projects/cm_ci/issues_trees/redmine/projects/cm_ci/issues_trees/48/tree_children

I also tried to remove the / in front of projects, but the result was the same, with the duplication above, so maybe I do have another problem?

Loriowar commented 8 years ago

Well, I understood approach for solve this issue. There are several ways:

xJom commented 8 years ago

Yes, but I think it is working with your solution. Just removing the slash (/) before projects in the URL. But then, the other problem arises, and the tree still doesn't expand...

But there is something that is not working correctly with the ajax jsQuery-call in lines 16-24 in the file tree.issues.initializer.js.

Same problem is discussed here: https://developer.jboss.org/thread/153370?_sscc=t But the solution is outrageously ugly. ;)

I am not really familiar with the API - http://api.jquery.com/jquery.ajax/ - so I want help with understanding the $.ajax-call.

CarzyCob - did you try just removing the / as Loriowar suggested?

cubNg commented 8 years ago

To @Loriowar, I'm sorry about hardcode. Hope you don't mind and keep to continue to improve this plugin. I think this is must-need-plugin for redmine up to now :+1:

To @xJom, I try in sequence (as below), you can refer and gain for your own result :smile: :

  1. I try remove '/', restart Servers (using Bitnami...Tool), it back to issue (not expand)
  2. I add /redmine (hardcode, line 27), not restart Servers, It happen issue like you (duplication of the path)
  3. I keep /redmine, then restart servers, It's back to work. (honestly, I don't know why ?!)

\ Notice:

I just new to ruby and also have less knowledge about network (domain, subdomain,...). So I hope this can help in some case.

xJom commented 8 years ago

Doing a fresh install of the plugin and adding /redmine hard-coded on line 27, and restarting servers worked for me, too... Wow... I am stumped.

Having the / in front of redmine solved it also for the Configure solution.

I will add it as a pull request.

xJom commented 8 years ago

There you go - no Russian translation from me. I am even worse on Russian, than on the jquery ajax API... ;)

xJom commented 8 years ago

issue_tree_config

iq2luc commented 8 years ago

Hi Loriowar,

I think the proper way to fix it would be to use Redmine::Utils::relative_url_root, so this way no manual configuration needed, as the correct URL is retrieved from redmine configuration, i.e.: url_for_load_tree_children: "#{Redmine::Utils::relative_url_root}/projects/#{ @project.identifier}/issues_trees/",

Thanks, Luc

diff --git a/app/controllers/issues_trees_controller.rb b/app/controllers/issues_trees_controller.rb
index 7f76e82..e820b18 100644
--- a/app/controllers/issues_trees_controller.rb
+++ b/app/controllers/issues_trees_controller.rb
@@ -24,7 +24,7 @@ class IssuesTreesController < ApplicationController
     # put in data-attributes number of column with tree; +1 due to a column with checkboxes
     # additionally put an url for retrieve a children for issues
     @tree_data = { treetable_column_number: (@query.columns.index{|col| col.name == :subject} || 0) + 1,
-                   url_for_load_tree_children: "/projects/#{ @project.identifier}/issues_trees/",
+                   url_for_load_tree_children: "#{Redmine::Utils::relative_url_root}/projects/#{ @project.identifier}/issues_trees/",
                    action_for_load_tree_children: '/tree_children',
                    query_params: query_params }
Loriowar commented 8 years ago

Yeah, you're right. Something like this I will planning to do on this weekend. Thanks.

xJom commented 8 years ago

Confirmed that it works well!

Loriowar commented 8 years ago

I fixed this bug in the master branch using path-helper and template for js. Please, test it on your installation. If it is ok for you, I will release a new version of this plugin and add changes in all supported versions.

xJom commented 8 years ago

Works for me!

Loriowar commented 8 years ago

Excellent! Thanks for all. I will release a new version of the plugin in next few days. For now, bug fixed only in master branch.