Project

General

Profile

Projects Tree View Plugin - Version 0.0.1

Added by Chris Peterson about 15 years ago

This plugin will turn the projects index view into a tree view that can be expanded and collapsed. It propagates the tree view to the project show page's subprojects list.

Install Instructions:

1) Extract projects_tree_view.zip to /path/to/redmine/vendor/plugins/
2) Restart Redmine
3) Enjoy Project Tree Goodness!


Replies (128)

RE: Projects Tree View Plugin - Version 0.0.1 - Added by m p over 14 years ago

hi guys,

i get the error:

ActionView::TemplateError (undefined method `each' for nil:NilClass) on line #18 of projects/index.rhtml:
15: </thead>
16: <tbody>
17: <% ancestors = [] >
18: <
for project in Projects Projects >
19: <
rowid = "" >
20: <
classes = "" >
21: <
spanicon = "" %>

I am using:
Redmine 0.8.7

About your application's environment
Ruby version 1.8.7 (i486-linux)
RubyGems version 1.3.1
Rails version 2.1.2
Active Record version 2.1.2
Action Pack version 2.1.2
Active Resource version 2.1.2
Action Mailer version 2.1.2
Active Support version 2.1.2
Edge Rails revision unknown
Application root /opt/redmine
Environment production
Database adapter mysql
Database schema version 101

About your Redmine plugins
Redmine Schedules plugin 0.4.2
Stuff To Do Plugin 0.3.0
Issue Due Date 0.1.0
Redmine Workload plugin 0.0.1
Redmine Question plugin 0.2.0
Redmine Code Review plugin 0.2.8
Budget 0.2.0
Timesheet Plugin 0.0.1
My Effort plugin 0.1.0
Redmine Whining plugin 0.0.2
Charts Plugin 0.0.14
Redmine Status Updates 0.1.1
Redmine Issues Group plugin 0.1.4
Project Scores Plugin 0.0.1
Redmine Vote plugin 0.0.2
Redmine Local Avatars plugin 0.0.2
Redmine Todo Lists plugin 0.0.3.8.1
Redmine Bugcloud plugin 0.0.1
Projects Tree View plugin 0.0.2
Google Analytics plugin 0.2.0
Redmine User Import plugin 0.0.1
Rate Plugin 0.1.0
Redmine Graphs plugin 0.1.0

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Andrew R Jackson about 14 years ago

A couple notes about this plugin (all based on Redmine 0.9.1):

1. Regarding the Mount-Point Bug

This plugin doesn't work when Redmine is provided at a mount-point rather than at the URI root. e.g. http://your.site.moc/redmine wouldn't work. All our Redmines are available at such mount-points (or sub-URIs, whatever). This is the open issue mentioned here: http://github.com/MischaTheEvil/projects_tree_view/issues#issue/1

To fix this, edit vendor/plugins/projects_tree_view/init.rb and replace the code in method view_layouts_base_html_head with this instead:

              outBuff = ''
              baseurl = url_for(:controller => 'plugin_assets', :action => 'index')
              outBuff << javascript_include_tag(baseurl + "/projects_tree_view/javascripts/projects_tree_view.js")
              outBuff << stylesheet_link_tag(baseurl + "/projects_tree_view/stylesheets/projects_tree_view.css")
              outBuff

This is what other plugins seem to do to include plugin-specific js and css, regardless of sub-URI.

2. Restoring the New Subproject Link on the Overview Page

Redmine 0.9.1 brought in a useful little link on the Overview page which says New Subproject. Very useful if your Redmine site relies heavily on nested subproject (which ours does). However, the app/views/projects/show.rhtml file in this plugin is missing that--perhaps it's based on 0.8.X code other than trunk as it indicates. Dunno, but no worries:

To fix this, edit vendor/plugins/projects_tree_view/app/views/projects/show.rhtml and add these lines at the very top:

<div class="contextual">
  <% if User.current.allowed_to?(:add_subprojects, @project) %>
      <%= link_to l(:label_subproject_new), {:controller => 'projects', :action => 'add', :parent_id => @project}, :class => 'icon icon-add' %>
  <% end %>
</div>

3. Subprojects Tree Doesn't Expand

It would be cool if the Subprojects tree shown on the Overview page would be expandable and allow users to navigate right to an sub project below this one--even one 2-3 levels below the current one! Also, we'd like direct links to the Forums page and main Wiki page for those sub-projects, if available.

So we changed out almost all the code in show.rhtml to support this. Image attached.

subprojAfter.png (10.1 KB) subprojAfter.png Expandable subproj tree and link-icons for Forums and Wiki

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Felipe Campo about 14 years ago

Hello Andrew , could you post the show.rhtml thar works, currenty Im havin the same problem with the plugin and the 0.9.2 version of redmine.

this is what its in my log

ActionController::RoutingError (No route matches "/plugin_assets/projects_tree_view/javascripts/projects_tree_view.js" with {:method=>:get}):

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Mark Hines about 14 years ago

We have recently installed this plugin in our system. On Firefox, it works fine. However, as a standard, our company uses IE. On IE, the "minus"symbol is always displayed, and is hidden behind the main project. We are unable to click it.

Can this plugin be upgraded to be compliant with IE? Or, what kind of steps need to be taken so we can use this with IE?

I have attached a screen shot of what we're seeing on IE. Don't mind the Japanese.... it's merely the Project view page, with the "test" project expanded using the "plus" button. By looking at the screen shot, you can see the minus hidden behind the main project.(Note:we did white out sections of the screen so I don't get in trouble from my company)

If you could please either address this issue or explain how we can implement the IE handling ourselves, we would greatly appreciate it.

Thank you very much.

Best Regards,
Mark

screen.JPG (103 KB) screen.JPG screen print

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Andrew R Jackson about 14 years ago

Felipe Campo wrote:

Hello Andrew , could you post the show.rhtml thar works, currenty Im havin the same problem with the plugin and the 0.9.2 version of redmine.

Hi Felipe, actually, I think that's addressed with the changes to init.rb that I mention in "1. Regarding the Mount-Point Bug" above. I needed to use the baseUrl to get both the .js file and the .css file tags to have the correct URLs. As a result, I get this in the HTML:

src="/myRedmineMount/plugin_assets/projects_tree_view/javascripts/projects_tree_view.js" 

Which I can verify manually works by adding http://myhost.com to the front.

I don't have much more to offer than that. I can tell you that after restarting Redmine, you should see that .js file in two places as the following find command shows:

[ redmine]$ find . -type f -name "projects_tree_view.js" 
./public/plugin_assets/projects_tree_view/javascripts/projects_tree_view.js
./vendor/plugins/projects_tree_view/assets/javascripts/projects_tree_view.js
[ redmine]$ 

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Andrew R Jackson about 14 years ago

Mark Hines wrote:

We have recently installed this plugin in our system. On Firefox, it works fine. However, as a standard, our company uses IE. On IE, the "minus"symbol is always displayed, and is hidden behind the main project. We are unable to click it.

My measly comments are these:
If this is Redmine 0.9.x, can you verify that you've got a working link tag with href="/myMount/plugin_assets/projects_tree_view/stylesheets/projects_tree_view.css" on the page? If it's not getting loaded for some reason (eg1: url mount bug like I had; eg2: post 0.9.x incompatibility) then that would explain things).

Regardless, it's important to note that IE is extremely aggressive about caching .css and .js resources. To the point that it will often ignore page cache meta tag instruction. This is why some sites add some kind of counter to such URLs, sometimes as a NVP in the query string (.css?version=99117837) or in the path (.../styles/99117837-myStyles.css). That counter gets increased with every restart or better, with every change to such page resources.

Anyway, that observation leads me to suggest manually clearing the cache on 1 IE browser exhibiting this problem. If you fiddle with the projects_view_tree.css to fix this issue, you may need to redo that check. If it is an issue, to fix it for your other IE users you may need to take an approach like I described. There's a few heavy-handed ways to do that, so maybe someone with more insight will reply with better ideas.

I did see a similar problem in IE8 when changing my projects_view_tree.css to use less-ugly [+] and [-] icons; the problem was I still saw the ugly [-] icon when I shouldn't. However, for me that turned out to be 1 redmine worker processes (of 3) that wasn't getting killed during a restart. A kill -9 took care of the problem, so no tricks were needed for me.

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Mark Hines about 14 years ago

Thanks for your help.

We actually discovered it today.... we also had copies of the bullet_toggle_plus.png and bullet_toggle_minus.png files in /var/lib/redmine/public/images/. IE was picking up this file plus the same file in /var/lib/redmine/public/plugin_assets/projects_tree_view/images/, so it displayed 2 pictures. Firefox apparently recognized that there were duplicate files inside the path, and just displayed one. IE wasn't smart enough to do that.

After eliminating the files in /var/lib/redmine/public/images/, we got this up and running with no issues.

Let me know if you have any questions.

Thanks and Best Regards,
Mark

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Dmitry Koroban about 14 years ago

I have Bitnami Redmine 0.9.2 and plugin 0.0.2 from this link: http://www.redmine.org/attachments/1807/projects_tree_view.zip
Plugin still causes Error 500 even with patches by Andrew R Jackson applied.
What do I need to make it work?

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Andrew R Jackson about 14 years ago

Dmitry Koroban wrote:

I have Bitnami Redmine 0.9.2 and plugin 0.0.2 from this link: http://www.redmine.org/attachments/1807/projects_tree_view.zip
Plugin still causes Error 500 even with patches by Andrew R Jackson applied.
What do I need to make it work?

I didn't really run across an Error other than MtE's acknowledged URL-mount bug, which appeared easy enough to solve. However, maybe with some more information, something will pop out.

  1. Grab the latest version of the plugin using 'git'
    • I notice you say you have 0.0.2 of the plugin and it looks like the version downloable here at redmine.org is out-of-date. I used a newer version that fixes some bugs and maybe is more 0.9.x ready or something.
    • Grab the newer (very latest) version from MtE's area on github using a command like this:
      • git clone git://github.com/MischaTheEvil/projects_tree_view.git
    • Get rid of the old version, deploy this version (likely 0.0.3, which is what I have; but maybe you'll get an even newer version), make my changes if they seem appropriate.
    • Hopefully that addresses the issue you are having. If not, please provide all of the following:
  2. What rails environment are you running under?
    • "production" or "development"
    • I don't know why this would be useful--I only make use of "production"--but Rails folks always seem to ask this question, so maybe it will help someone help you.
  3. What's the URL of the offending page?
    • You can fake the host, but provide the full path and query string (if any) please.
  4. Supply more information about the error
    1. Provide the full stack trace of the error from the *.log file(s).
      • The relevant logs are likely in .../redmine/log/.
      • The production.log and development.log tend to be rather useless. The useful stuff (like say, the STDERR stream where the exeception and backtrace appear) is in the port-number logs. For example, I use "thin" to run redmine with two processes listening on 6101 and 6102, so mine are thin.6101.log and thin.6102.log
  5. Screenshot of the error?
    • Skip point (2) above if the screenie shows the URL.

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Dmitry Koroban about 14 years ago

Thank you for detailed answer. I'll try version from git and will report results.

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Dmitry Koroban about 14 years ago

Git version seems to work fine. Thank you Andrew!

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Joachim Fritschi almost 14 years ago

The create subproject button disappears from all projects after installation of the plugin from git. This is problematic if you grant a user only "create subproject" but not the "create project" right.

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Andrew R Jackson almost 14 years ago

Joachim Fritschi wrote:

The create subproject button disappears from all projects after installation of the plugin from git.

I have not experienced this. On the contrary, I love the "Create Subproject" button--it was new to me with my installation of a more recent Redmine and my mucking around with this (also great, especially after mods) plugin.

Is it a particular case, such as the button disappearing only for users w/o create project permission (but who have create subproject permission)--whereas it's fine for regular users who can create projects?

That wouldn't be too surprising, say if the addition of the Create Subproject button preceded the ability to grant users subproject creation permission independently of being able to create top-level projects. If so, then one would expect the test condition for whether to put the Create Subproject button or not to test create project permission rather than the [now more appropriate] create subproject permission.

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Andrew R Jackson almost 14 years ago

Joachim Fritschi wrote:

The create subproject button disappears from all projects after installation of the plugin from git. This is problematic if you grant a user only "create subproject" but not the "create project" right.

I checked this out and it doesn't seem to be the case.
  1. Created a user who could create subprojects but couldn't create (or anything else) projects.
  2. Assigned that user to a project.
  3. Logged in as that user and went to that project.
  4. Used the great Create subproject button [which correctly appeared] to create a subproject. Works.
  5. Within the subproject, used the same user and same Create subproject button to create a sub-subproject. Works.

For reference, my app/views/projects/show.rhtml has this at the top:

<div class="contextual">
  <% if User.current.allowed_to?(:add_subprojects, @project) %>
    <%= link_to l(:label_subproject_new),
        {:controller => 'projects', :action => 'add', :parent_id => @project},
        :class => 'icon icon-add' %>
  <% end %>
</div>

Which as I noted above, is what I was worried might be wrong. It's not, from the looks of things. But since I've obviously edited that file a bit (see all my posts here), I thought I better mention what I have.

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Joachim Fritschi almost 14 years ago

I have tried again. Still doesn't work. I'm running a 0.9.3 stable release (r3507) and tried out the latest version from git. I am using LDAP authentication for the users.

I'm using the same process you decribed:

Give a user a role that only has the create subproject permission for one empty project (no active modules).
No other permissions a granted for the project. Browse the project as the user. The create subproject icon does not appear.

I will try to find out more and report back...

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Francesco Trigger almost 14 years ago

Hi, i installed the plugin and it shows the Tree in the project Tab, but i am not able to collapse the tree, it remains open from the root project to the very last sub project.

Is there someone who can help me with that problem.

i am using redmine 0.93 bitnami edition and the latest github version of the plugin.

Thanks!

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Joachim Fritschi almost 14 years ago

I finally had the time to track down my subproject issue with the latest version from git. The issue is that the vendor/plugins/projects_tree_view/app/views/projects/show.rhtml does not include the subproject button like the original redmine show.rhtml does.

I have appended a patch that resolves the issue for me and adds the button code that is shipped with redmine but gets overridden by the plugin.

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Jiří Znamenáček over 13 years ago

Hello. I apologize for this simple question but I'm new to RoR development (and still very puzzled by it) and I haven't found any clue in documentation for Redmine. Here's the problem:

I need an alternative project view but this plugin is doing too much (and replacing base files seems wrong to me) so I wrote another one for myself. I just changed default CSS for the project listing fow now (maybe some JavaScript for collapsing will folllow). But looking in the code I haven't found better place to insert my CSS than through view_layouts_base_html_head hook in app/views/layouts/base.rhtml which inserts my code to every page. Is there a way to insert it just for app/views/projects/index.rhtml? (I was looking at :header_tags but no clues there too.)

Thank you very much, JZ

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Bruno Prado over 13 years ago

Private projects are shown as <Private Project> (figure below) to those who are not member of the project. They should not be showed, indeed.

Table Customer is displaced, like in the figure:

And, also, the list is out of order when a project has its name changed (in the example, the project So... had its name changed).

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Jeroen Kouwe over 13 years ago

Andrew R Jackson wrote:

3. Subprojects Tree Doesn't Expand

It would be cool if the Subprojects tree shown on the Overview page would be expandable and allow users to navigate right to an sub project below this one--even one 2-3 levels below the current one! Also, we'd like direct links to the Forums page and main Wiki page for those sub-projects, if available.

So we changed out almost all the code in show.rhtml to support this. Image attached.

Would it be possible to post your modified show.rhtml here? Judging from the attached image, we really like your implementation of the expandable sub-projects tree!

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Andrew R Jackson over 13 years ago

Jeroen Kouwe wrote:

So we changed out almost all the code in show.rhtml to support this. Image attached.

Would it be possible to post your modified show.rhtml here? Judging from the attached image, we really like your implementation of the expandable sub-projects tree!

Yep, no problem. avendor/plugins/projects_tree_view/app/views/projects/show.rhtml is attached.

Note:
  • The page shows the new Subproject button at the top [if user has permission to add new ones].
  • We're not using the stock [+] icon.
  • Near the top you'll see a block of code with orienting comments. It builds the data structure of the sub-projects, then the HTML view of that is generated. As the comments indicate, there's standard checks for boards and wikis which add the icons you see in my subprojAfter.png above.

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Andrew R Jackson over 13 years ago

Andrew R Jackson wrote:

  • Near the top you'll see a block of code with orienting comments. It builds the data structure of the sub-projects

Probably that bit of code could be modified to sort the children before adding them to the data structure. Then the issue of the children not being sorted, even after renaming a project, would be fixed.

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Andrew R Jackson over 13 years ago

Andrew R Jackson wrote:

  • Near the top you'll see a block of code with orienting comments. It builds the data structure of the sub-projects

Probably that bit of code could be modified to sort the children before adding them to the data structure. Then the issue of the children not being sorted, even after renaming a project, would be fixed.

Seemed too easy.

Well, anyway, the attached version of vendor/plugins/projects_tree_view/app/views/projects/show.rhtml might be better since it dynamically sorts the children (alphabetically) for presentation in the expandable subproject tree. If you rename a project and then go to its parent page, that project should appear in the appropriate place.

RE: Projects Tree View Plugin - Version 0.0.1 - Added by Jeroen Kouwe over 13 years ago

Wow, that was fast! Thanks for sharing and the updated version!
We are testing the plugin with your show.rhtml and everything seems to work fine. I don't like the <Private project> 'problem' though (see comment of Bruno Prado above). I'm a complete Ruby/Rails and Redmine newbie but maybe will try to hack the plugin some further for our own needs.

By the way, I like Redmine a lot from what I've seen and tried so far, compliments to all contributors!

(26-50/128)