Project

General

Profile

home page automatic redirect to the wiki page of a project

Added by Stéphane Escaich almost 16 years ago

As the redmine site does, i would like to configure my redmine in order that the home page automaticaly redirect to the wiki page of the (only) projet.

Is this possible ? and how do that ?

Stéphane.


Replies (17)

RE: home page automatic redirect to the wiki page of a project - Added by Carl Nygard almost 16 years ago

look in routes.rb it should be clear enough what you need to do.

RE: home page automatic redirect to the wiki page of a project - Added by Audrey Gilbert almost 16 years ago

Thank you
I found the answer.
If it could help :

In redmine repository :

cp config/routes.rb config/routes.rb.sav
sudo nano config/routes.rb

Modify the line : map.home '', :controller => 'welcome'
by : map.home '', :controller => 'wiki', :id => 'project_name'
Save

cp lib/redmine.rb lib/redmine.rb.sav
sudo nano lib/redmine.rb

Modify the line : menu.push :home, :home_path, :html => { :class => 'home' }
By : menu.push :home, :home_path, :html => { :controller => 'wiki', :id => 'project_name' }
Save

Restart ruby

RE: home page automatic redirect to the wiki page of a project - Added by Kevin Skidmore over 14 years ago

On a related note if you have multiple projects and you want the main projects index page to have a link to the wiki for the project instead of a link to the overview you can modify app/views/projects/index.rhtml by making the following change:

link_to h(project.name), {:action => 'show', :id => project}, :class => (User.current.member_of?(project) ? "icon icon-fav" : "")

becomes:

link_to h(project.name), {:controller => 'wiki', :id => project}, :class => (User.current.member_of?(project) ? "icon icon-fav" : "")

If you want the same behavior for sub projects then just make a similar change to the sub projects block. Obviously this assumes that all your projects have an active wiki and will give a page not found error if the project doesn't have a wiki.

RE: home page automatic redirect to the wiki page of a project - Added by Marko Stanojevic over 14 years ago

Kevin, thanks a lot for the above post. It should perform exactly what I am looking for.

The bad part is that I did not manage to get your solution to work. Would you please review my setup and comment on it.

I am running Redmine 0.8.5 and forcing authentication (users must log in). The modification was made to the aforementioned file (app/views/projects/index.rhtml), mongrel was restarted as well as client-side web browser. Am I using different version from the one for which your solution was stated or is it possible that the forced authentication can affect it? Please try to adjust the communication level for the person with extensive programming experience but who has not so far had any contacts with Ruby.

RE: home page automatic redirect to the wiki page of a project - Added by Kevin Skidmore over 14 years ago

Not too sure why it doesn't work for you. I am using forced authentication as well but am running Redmine 0.8.4 so maybe there is a difference? If you want to post your index.rhtml I'd be happy to have a look and compare it to mine.

RE: home page automatic redirect to the wiki page of a project - Added by Marko Stanojevic over 14 years ago

Thanks a lot. I am attaching my index.rhtml, edited as per your post, as well as its original version (prior to editing), for your kind review.

RE: home page automatic redirect to the wiki page of a project - Added by Tiberiu C. Turbureanu about 14 years ago

This worked for me:

$ cat app/views/welcome/index.rhtml
<!-- 20100206-tct: intrare direct în wiki: 
<%= link_to h(project.name), :controller => 'projects', :action => 'show', :id => project %> (<%= format_time(project.created_on) %>) -->
                        <%= link_to h(project.name), :controller => 'wiki', :id => project %> (<%= format_time(project.created_on) %>)

$ cat app/helpers/projects_helper.rb
# 20100206-tct: intrare direct în wiki: 
# link_to(h(project), {:controller => 'projects', :action => 'show', :id => project}, :class => "project #{User.current.member_of?(project) ? 'my-project' : nil}")
               link_to(h(project), {:controller => 'wiki', :id => project}, :class => "project #{User.current.member_of?(project) ? 'my-project' : nil}")

$ cat config/routes.rb
    wiki_routes.with_options :conditions => {:method => :get} do |wiki_views|
      wiki_views.connect 'proiecte', :controller => 'projects'
      wiki_views.connect 'proiecte/:id', :controller => 'wiki'
[...]
  map.with_options :controller => 'projects' do |projects|
    projects.with_options :conditions => {:method => :get} do |project_views|
[...]
      # project_views.connect 'proiecte/:id', :controller => 'wiki'
      project_views.connect 'proiecte/:id/despre', :action => 'show'

Note: The routes are translated in Romanian.

RE: home page automatic redirect to the wiki page of a project - Added by Txinto Vaz over 12 years ago

Hi, I have developed a plugin to this problem.

Maybe it can be helpful for you: http://www.redmine.org/plugins/redmine_startpage

See you!

Tx

RE: home page automatic redirect to the wiki page of a project - Added by joe yeg over 12 years ago

I used the redmine_startpage plugin to redirect my entry-page to a specific project wiki successfully; Works great man, thanks!

In order to make the entry-page of a project, go to a wiki page instead of the "overview", add this line to your config/routes.rb file.

map.connect 'projects/:project_id', :controller => 'wiki', :action => 'show'

I added it near line 36.

I did a lot of research on this and this is the only way to do it. Other solutions do not work in >1.0 releases.

RE: home page automatic redirect to the wiki page of a project - Added by joe yeg over 12 years ago

Whoops. It's actually this code:

map.connect 'projects/:project_id', :controller => 'wiki', :action => 'show', :conditions => {:method => :get}

If you don't specific get only in the conditions, all settings changes, etc, will just send you to the Wiki page. I haven't found a way to bring the Overview page back up, which is OK by me because I hate it.

RE: home page automatic redirect to the wiki page of a project - Added by Tobias Bornakke Jørgensen about 12 years ago

For anybody looking for a way to redirect specefic projects to wiki (but not all projects!) it can be done with:

map.connect 'projects/YOUR_PROJECT_IDENTIFIER', :controller => 'wiki', :action => 'show', :project_id => 'YOUR_PROJECT_IDENTIFIER', :conditions => {:method => :get}

A problem i however haven't been able to solve is to redirect fx. the startpage to a specefic query. Basicly I want the startpage to hold informations of all tickets assigned to the logged in users which can be done by custom queries. But how to reroute redmine home to this page on load?

Hope somebody has some brilliant ideas! :)

RE: home page automatic redirect to the wiki page of a project - Added by Brian Mowrey about 12 years ago

This works for us to show all tickets assigned to the user (but without a custom query) I'm sure you coudl add more params to make that work:

map.home '', :controller => 'issues', :assigned_to_id => 'me'

It is also weird if someone isn't logged in and goes to the homepage (just displays a no data query) but since we require login for ours it isn't a big deal to us, so hopefully this at least points you in the right direction.

RE: home page automatic redirect to the wiki page of a project - Added by Richard Boyd almost 12 years ago

Anyone know how to make a projects start page it's wiki in Redmine 2.0.2? I was looking at the routes.rb but I have to say it is not entirely clear to me what to change. I am new to both Redmine and Ruby so please be kind. :)

RE: home page automatic redirect to the wiki page of a project - Added by Sunny Jaiwal over 11 years ago

I was able to successfully change the home page in Redmine 2.1.0 by changing the following statement in /config/routes.rb from

root :to => 'welcome#index', :as => 'home'

to

root :to => 'reports#issue_report', :id => 'myproject', :as => 'home'

where "myproject" is the project identifier.

RE: home page automatic redirect to the wiki page of a project - Added by Julien Mellerin about 11 years ago

To redirect from the normal homepage to a specific project wiki page, replace the same rule as above by:

root :to => 'wiki#show', :project_id => 'general', :as => 'home'

Note the difference between the project identifier parameters.

RE: home page automatic redirect to the wiki page of a project - Added by Andrey Trubchanin almost 11 years ago

Richard Boyd wrote:

Anyone know how to make a projects start page it's wiki in Redmine 2.0.2? I was looking at the routes.rb but I have to say it is not entirely clear to me what to change. I am new to both Redmine and Ruby so please be kind. :)

+1
Redmine 2.3.1

app\views\projects\index.html.erb

<div id="projects-index">
<%= render_project_hierarchy(@projects)%>
</div>

app\helpers\projects_helper.rb

  # Renders the projects index
  def render_project_hierarchy(projects)
    render_project_nested_lists(projects) do |project|
      s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")
      if project.description.present?
        s << content_tag('div', textilizable(project.short_description, :project => project), :class => 'wiki description')
      end
      s
    end
  end

app\helpers\application_helper.rb

# Generates a link to a project if active
  # Examples:
  #
  #   link_to_project(project)                          # => link to the specified project overview
  #   link_to_project(project, {:only_path => false}, :class => "project") # => 3rd arg adds html options
  #   link_to_project(project, {}, :class => "project") # => html options with default url (project overview)
  #
  def link_to_project(project, options={}, html_options = nil)
    if project.archived?
      h(project.name)
    elsif options.key?(:action)
      ActiveSupport::Deprecation.warn "#link_to_project with :action option is deprecated and will be removed in Redmine 3.0." 
      url = {:controller => 'projects', :action => 'show', :id => project}.merge(options)
      link_to project.name, url, html_options
    else
      link_to project.name, project_path(project, options), html_options
    end
  end

I can't find project_path() method in Redmine sources and don't know how to change path "projects/project_name" to "projects/project_name/wiki".
("link_to project.name, project_path(project, options)<<"/wiki", html_options" solves the problem but I don't like it)

BTW code

      ActiveSupport::Deprecation.warn "#link_to_project with :action option is deprecated and will be removed in Redmine 3.0." 
      url = {:controller => 'projects', :action => 'show', :id => project}.merge(options)
      link_to project.name, url, html_options

does`t work (Ruby 1.8.7 Rails 3.2.13) when
      s = link_to_project(project, {:action => 'show'}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")

RE: home page automatic redirect to the wiki page of a project - Added by danilo t over 8 years ago

I have the same problem with redmine 3.0, anyone else can help us?

    (1-17/17)