link_to(text, {:controller => 'repositories', :action => 'revision', :id => project, :rev => rev},
:title => l(:label_revision_id, format_revision(revision)))
end
+
+ # Generates a link to a message
+ def link_to_message(message, options={}, html_options = nil)
+ link_to(
+ h(truncate(message.subject, :length => 60)),
+ { :controller => 'messages', :action => 'show',
+ :board_id => message.board_id,
+ :id => message.root,
+ :r => (message.parent_id && message.id),
+ :anchor => (message.parent_id ? "message-#{message.id}" : nil)
+ }.merge(options),
+ html_options
+ )
+ end
# Generates a link to a project if active
# Examples:
end
when 'message'
if message = Message.visible.find_by_id(oid, :include => :parent)
- link = link_to h(truncate(message.subject, :length => 60)), {:only_path => only_path,
- :controller => 'messages',
- :action => 'show',
- :board_id => message.board,
- :id => message.root,
- :anchor => (message.parent ? "message-#{message.id}" : nil)},
- :class => 'message'
+ link = link_to_message(message, {:only_path => only_path}, :class => 'message')
end
when 'project'
if p = Project.visible.find_by_id(oid)
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module MessagesHelper
-
- def link_to_message(message)
- return '' unless message
- link_to h(truncate(message.subject, :length => 60)), :controller => 'messages',
- :action => 'show',
- :board_id => message.board_id,
- :id => message.root,
- :r => (message.parent_id && message.id),
- :anchor => (message.parent_id ? "message-#{message.id}" : nil)
- end
end
'export:/some/file' => link_to('export:/some/file', source_url.merge(:format => 'raw'), :class => 'source download'),
# message
'message#4' => link_to('Post 2', message_url, :class => 'message'),
- 'message#5' => link_to('RE: post 2', message_url.merge(:anchor => 'message-5'), :class => 'message'),
+ 'message#5' => link_to('RE: post 2', message_url.merge(:anchor => 'message-5', :r => 5), :class => 'message'),
# project
'project#3' => link_to('eCookbook Subproject 1', project_url, :class => 'project'),
'project:subproject1' => link_to('eCookbook Subproject 1', project_url, :class => 'project'),