Project

General

Profile

Custom Tabs

Added by John Goerzen over 16 years ago

At www.redmine.org, the Download tab displays a wiki page. How can I set up a custom tab like this in my Redmine installation?


Replies (21)

RE: Custom Tabs - Added by Jean-Philippe Lang over 16 years ago

This tab was added by inserting:

menu.push :download, { :controller => 'wiki', :action => 'index', :page => 'Download', :id => 'redmine' }, :caption => 'Download'

in lib/redmine.rb inside:

Redmine::MenuManager.map :project_menu do |menu|
  ...
end

RE: Custom Tabs - Added by Adrian Tarau about 16 years ago

Any chance for some settings to be able to add custom tabs? How do I add an external URL? Typo3 seems to have something like this : http://forge.typo3.org/projects/show/typo3-v5 , see Newsgroup tab.

Thanks.

RE: Custom Tabs - Added by Mischa The Evil about 16 years ago

Adrian Tarau wrote:

Any chance for some settings to be able to add custom tabs? How do I add an external URL?

You can try a plugin called redmine_tab which lets you setup a tab with a custom (external) URL.

Adrian Tarau wrote:

Typo3 seems to have something like this : http://forge.typo3.org/projects/show/typo3-v5 , see Newsgroup tab.

This is a self-designed, fully-integrated plugin which interacts with the newsgroup webinterface which Typo3 uses. This (in first instance) has nothing to do with your current issue if you just want to setup a custom tab which loads an external URL...

HTH and greetings...

RE: Custom Tabs - Added by James Turnbull about 16 years ago

Hmmm I have no idea if that plug-in is actually working currently. It was kind of a PoC at the time. Might need some tweaking.

Regards

James Turnbull

RE: Custom Tabs - Added by Mischa The Evil about 16 years ago

It works, though it needs (at least) one slight change since it references a wrong custom field name.

Furthermore it does the job like expected.. :-)

RE: Custom Tabs - Added by Adrian Tarau about 16 years ago

So does it work or not? :)

James Turnbull = jamtur01?

RE: Custom Tabs - Added by Mischa The Evil about 16 years ago

The plugin works, even without the slight change (which I will post here later tonight, currently watching "Ocean's twelve" ;-)

Indeed, James Turnbull == jamtur01 afaik...

RE: Custom Tabs - Added by Adrian Tarau about 16 years ago

Great, many thanks

RE: Custom Tabs - Added by Mischa The Evil about 16 years ago

Here comes the small change:

After installation of the plugin modify line 9 in ../vendor/plugins/redmine_tab/app/views/settings/_settings.rhtml from:

               options_from_collection_for_select(string_fields, :id, :name, @settings['iframe_tab'].to_i) %><br />

to:

               options_from_collection_for_select(string_fields, :id, :name, @settings['iframe_text'].to_i) %><br />

RE: Custom Tabs - Added by Adrian Tarau about 16 years ago

Works like a charm ... how do I configure it? :)

I have a new tab called "Tab" and when I click on it I get 404.

settings.rhtml has this text : _This will allow you to create a tab that references a custom iframe. You will need to go to 'Admin -> Custom fields' and create a field of type 'Long text' for the iframe. Inside your project you will need to add your iframe link as the value of this field. Then using the Modules tab select the relevant tab to add the new tab to your menu.

What type of custom field? I presume project. What name to use? I tried with iframe_text , it doesn't work.
Can you please post some detailed instruction? :)

Also, how do I change the tab name?

Thanks.

RE: Custom Tabs - Added by Mischa The Evil about 16 years ago

Adrian Tarau wrote:

What type of custom field? I presume project.

Correct

Adrian Tarau wrote:

What name to use? I tried with iframe_text , it doesn't work.

Doesn't matter which name you use

Make sure the format of the project custom field (pcf) is long text. After creating the pcf fill it (project-settings) with a value like:

<IFRAME SRC="http://www.google.nl" WIDTH=450 HEIGHT=450>
If you can see this, your browser doesn't 
understand IFRAME.  However, we'll still 
<A HREF="http://www.google.com">link</A> 
you to the file.
</IFRAME>

Now, configure the plugin (admin -> information -> tab plugin -> configure) to use the newly created pcf as the pcf which holds the iFrame Text.

Adrian Tarau wrote:

Also, how do I change the tab name?

While typing my earlier replies on this thread, I was in the assumption that the name of the tab also could be adjusted through a pcf-value. This party also due to the fact that such a setting is already implemented.
Though after testing this extensively this isn't working. I asked on IRC either, but didn't get a reply.

As a quick 'n dirty fix you could hard-code the name by changing the following in ../vendor/plugins/redmine_tab/init.rb from:

 # A new item is added to the project menu
  menu :project_menu, :tabs, :controller => 'tab', :action => 'show'

to:

 # A new item is added to the project menu
  menu :project_menu, "WANTEDNAME", :controller => 'tab', :action => 'show'

RE: Custom Tabs - Added by Adrian Tarau about 16 years ago

Got it but still doesn't work :| http://projects.intellisoftsystems.com/projects/show/commons

This long-text(named IFrameAsTab) field is display in project home page and Tab still gives me 404. I did the plug-in configuration in admin -> information -> tab plugin -> configure.

RE: Custom Tabs - Added by Mischa The Evil about 16 years ago

Did you also made the change I posted earlier?

I have regged myself to your redmine instance. Can you give me (temporarily) sufficient permissions on a project to see the tab? You can provide the group i'm member of the permission to 'view tabs'...

Btw: I've had some discussion on IRC with James and he told me he has updated the plugin on github, and took notice of the problem with the tabname. He wrote it down on his todo-list...

HTH.

RE: Custom Tabs - Added by James Turnbull about 16 years ago

The code on Github now fixes the error Mischa spotted and I'll try to make it a bit less crapola in the next few days but I am a little time poor right now. I am sure some Rails guru can do a 1000% better job that my rather clumsy method with a little work. :)

Cheers

James

RE: Custom Tabs - Added by Adrian Tarau about 16 years ago

Mischa : I did changed

options_from_collection_for_select(string_fields, :id, :name, @settings['iframe_tab'].to_i) %><br />

with
options_from_collection_for_select(string_fields, :id, :name, @settings['iframe_text'].to_i) %><br />

I'll check again letter(I don't have access right now to this system).

You user has Reporter rights, but anyway I allowed Anonymous to see Tab module(I forgot about security).

James : I will install your changes latter this day and post some feedback here.

Thanks again for your help

RE: Custom Tabs - Added by Adrian Tarau about 16 years ago

Well, I took the latest sources and it still doesn't work.

What & where to check :) ?

RE: Custom Tabs - Added by Eric Davis about 16 years ago

James Turnbull wrote:

The code on Github now fixes the error Mischa spotted and I'll try to make it a bit less crapola in the next few days but I am a little time poor right now. I am sure some Rails guru can do a 1000% better job that my rather clumsy method with a little work. :)

Hehe. If you need any help feel free to ping me. I check here every day or so and can also be found on IRC and github as edavis10. If I wasn't so time poor also, I would fork your plugin and help you clean it up.

Eric

RE: Custom Tabs - Added by Mischa The Evil about 16 years ago

Adrian Tarau wrote:

Well, I took the latest sources and it still doesn't work.

I just browsed the project I am now a member of at your site but I don't see the tab-module... Are you sure that you've activated the tab-module for the IntelliCommons project? Do you actually see the tab?
Besides the tab-name thingy the plugin is working here at my test-setup so it will probably be a missed configuration-step I guess...

RE: Custom Tabs - Added by Adrian Tarau about 16 years ago

Yep, it is active. I can see it even without login(Anonymous mode).

And why do I see the iframe project field in home page? Do you see it when you access the project page? What version of Redmine do you use? I'm using 0.7.3

Let me do some screen-shoots.

IFrameAsTab: <IFRAME SRC="http://www.google.nl" WIDTH=450 HEIGHT=450> If you can see this, your browser doesn't understand IFRAME. However, we'll still <A HREF="http://www.google.com">link</A> you to the file. </IFRAME>

intellicommons1.png (55.2 KB) intellicommons1.png Project home page
intellicommons2.png (57.2 KB) intellicommons2.png Project configuration page
intellicommons3.png (41.4 KB) intellicommons3.png Tab plugin installed
intellicommons4.png (41.8 KB) intellicommons4.png Tab plugin settings

RE: Custom Tabs - Added by Mischa The Evil about 16 years ago

Re:

Yep, it is active. I can see it even without login(Anonymous mode)

Hmm, that's odd... See "Recap" later in this post for some more detailed instructions. I indeed can see the tab also, though only in the screeny, not in real :S

And why do I see the iframe project field in home page? Do you see it when you access the project page?

Yes, I see those too. That's the intended behaviour of project custom fields. For this use of project custom fields specific I have made a patch (#1746) which enhances the project custom fields with one more flag ("Hide on overview") which by itself enables you to select which project custom fields will be showed at the projects overview (index).

What version of Redmine do you use?

I've tested this (for this thread specifically) with a clean 0.7.3 (the latest stable). Though it also still works on recent trunk ( =< r1745).

Recap:

Here's a clear stipped-down step-by-step configuration-description of the plugin on a fresh 0.7.3:

  1. Install the plugin according to the generic plugin installation wikipage (don't skip the engines part blindly :-0)
  2. Create two project custom fields ("Administration" -> "Custom fields" -> "Tab: Projects");
    1. one which you intend to use as a 'storage-space' for the iframe-link
    2. one which you intend to use as a 'storage-space' for the tab's name (this is currently not working, see posts above).
      • The project custom field which is intended to be used as the iframe-link placeholder should be of the format "Long text".
        For all other options: nothing special has to be configured in a special way (eg. name of the project custom field is not important since it will be configured in (4)).
  3. Now configure the plugin through "Administration" -> "Information" -> "Tab Plugin" -> "Configure"
    1. Setting: "iFrame Text", value: name of project custom field which is setup in (2) intended to be used as a storage-space for the iframe-link
    2. Setting: "Tab Name", value: name of project custom field which is setup in (2) intended to be used as a storage-space for the tab's name (though not working atm)
  4. Goto the project where you want to use the tab ("Projects" -> "<yourproject>" -> "Settings" -> "Tab Information")
    1. Now fill-in the the two newly created project custom fields for the project with the appropriate values. Make sure to use the appropriate syntax for the iframe-link. Here's a clean stripped-down example:
      <IFRAME SRC="http://www.google.com" WIDTH=450 HEIGHT=450></IFRAME>
      The project custom field which you've setup for the tab's name isn't special in any way. Just pick a name, though this isn't working atm/yet as described in the posts before this one.
  5. Enable the new tab "module" for the project by ticking it at: "Projects" -> "<yourproject>" -> "Settings" -> "Tab Modules" -> "Tab"
  6. Finally, set the desired permission ("View tab") for all your (desired) roles at: "Administration" -> "Roles and permissions" -> "Permissions report"

RE: Custom Tabs - Added by Adrian Tarau about 16 years ago

Thanks Mischa, I will try again :)

    (1-21/21)