diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -75,7 +75,7 @@ module ApplicationHelper subject = truncate(subject, :length => options[:truncate]) end end - s = link_to "#{issue.tracker} ##{issue.id}", {:controller => "issues", :action => "show", :id => issue}, + s = link_to "#{issue.tracker} ##{issue.id}", {:controller => "issues", :action => "show", :id => issue.id_titled}, :class => issue.css_classes, :title => title s << ": #{h subject}" if subject @@ -586,7 +600,7 @@ module ApplicationHelper :controller => 'messages', :action => 'show', :board_id => message.board, - :id => message.root, + :id => message.id_titled, :anchor => (message.parent ? "message-#{message.id}" : nil)}, :class => 'message' end diff --git a/app/helpers/messages_helper.rb b/app/helpers/messages_helper.rb --- a/app/helpers/messages_helper.rb +++ b/app/helpers/messages_helper.rb @@ -22,7 +22,7 @@ module MessagesHelper link_to h(truncate(message.subject, :length => 60)), :controller => 'messages', :action => 'show', :board_id => message.board_id, - :id => message.root, + :id => message.id_titled, :r => (message.parent_id && message.id), :anchor => (message.parent_id ? "message-#{message.id}" : nil) end diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb --- a/app/helpers/queries_helper.rb +++ b/app/helpers/queries_helper.rb @@ -33,7 +33,7 @@ module QueriesHelper case value.class.name when 'String' if column.name == :subject - link_to(h(value), :controller => 'issues', :action => 'show', :id => issue) + link_to(h(value), :controller => 'issues', :action => 'show', :id => issue.id_titled) else h(value) end diff --git a/app/models/issue.rb b/app/models/issue.rb --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -41,7 +41,7 @@ class Issue < ActiveRecord::Base # sort by id so that limited eager loading doesn't break with postgresql :order_column => "#{table_name}.id" acts_as_event :title => Proc.new {|o| "#{o.tracker.name} ##{o.id} (#{o.status}): #{o.subject}"}, - :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.id}}, + :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.id_titled }}, :type => Proc.new {|o| 'issue' + (o.closed? ? ' closed' : '') } acts_as_activity_provider :find_options => {:include => [:project, :author, :tracker]}, @@ -541,6 +541,11 @@ class Issue < ActiveRecord::Base end end + def id_titled + out = self.id.to_s+"-"+ self.project.name.to_s+"-" +self.subject.gsub(%r{[^0-9a-zA-Z_]+},'-') + out + end + def parent_issue_id if instance_variable_defined? :@parent_issue @parent_issue.nil? ? nil : @parent_issue.id diff --git a/app/models/journal.rb b/app/models/journal.rb --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -29,7 +29,7 @@ class Journal < ActiveRecord::Base :description => :notes, :author => :user, :type => Proc.new {|o| (s = o.new_status) ? (s.is_closed? ? 'issue-closed' : 'issue-edit') : 'issue-note' }, - :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.issue.id, :anchor => "change-#{o.id}"}} + :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.issue.id_titled, :anchor => "change-#{o.id}"}} acts_as_activity_provider :type => 'issues', :permission => :view_issues, diff --git a/app/models/message.rb b/app/models/message.rb --- a/app/models/message.rb +++ b/app/models/message.rb @@ -29,7 +29,7 @@ class Message < ActiveRecord::Base acts_as_event :title => Proc.new {|o| "#{o.board.name}: #{o.subject}"}, :description => :content, :type => Proc.new {|o| o.parent_id.nil? ? 'message' : 'reply'}, - :url => Proc.new {|o| {:controller => 'messages', :action => 'show', :board_id => o.board_id}.merge(o.parent_id.nil? ? {:id => o.id} : + :url => Proc.new {|o| {:controller => 'messages', :action => 'show', :board_id => o.board_id}.merge(o.parent_id.nil? ? {:id => o.id_titled} : {:id => o.parent_id, :r => o.id, :anchor => "message-#{o.id}"})} acts_as_activity_provider :find_options => {:include => [{:board => :project}, :author]}, @@ -90,6 +90,11 @@ class Message < ActiveRecord::Base usr && usr.logged? && (usr.allowed_to?(:delete_messages, project) || (self.author == usr && usr.allowed_to?(:delete_own_messages, project))) end + def id_titled + out = self.id.to_s+"-"+ self.project.name.to_s+"-" +self.subject.gsub(%r{[^0-9a-zA-Z_]+},'-') + out + end + private def add_author_as_watcher diff --git a/app/models/news.rb b/app/models/news.rb --- a/app/models/news.rb +++ b/app/models/news.rb @@ -25,7 +25,7 @@ class News < ActiveRecord::Base validates_length_of :summary, :maximum => 255 acts_as_searchable :columns => ['title', 'summary', "#{table_name}.description"], :include => :project - acts_as_event :url => Proc.new {|o| {:controller => 'news', :action => 'show', :id => o.id}} + acts_as_event :url => Proc.new {|o| {:controller => 'news', :action => 'show', :id => o.id_titled}} acts_as_activity_provider :find_options => {:include => [:project, :author]}, :author_key => :author_id @@ -37,4 +37,9 @@ class News < ActiveRecord::Base def self.latest(user = User.current, count = 5) find(:all, :limit => count, :conditions => Project.allowed_to_condition(user, :view_news), :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") end + + def id_titled + out = self.id.to_s+"-"+ self.project.name.to_s+"-" +self.title.gsub(%r{[^0-9a-zA-Z_]+},'-') + out + end end diff --git a/app/views/boards/show.rhtml b/app/views/boards/show.rhtml --- a/app/views/boards/show.rhtml +++ b/app/views/boards/show.rhtml @@ -42,7 +42,7 @@ <% @topics.each do |topic| %> - <%= link_to h(topic.subject), { :controller => 'messages', :action => 'show', :board_id => @board, :id => topic } %> + <%= link_to h(topic.subject), { :controller => 'messages', :action => 'show', :board_id => @board, :id => topic.id_titled } %> <%= topic.author %> <%= format_time(topic.created_on) %> <%= topic.replies_count %> diff --git a/app/views/issues/_list.rhtml b/app/views/issues/_list.rhtml --- a/app/views/issues/_list.rhtml +++ b/app/views/issues/_list.rhtml @@ -26,7 +26,7 @@ <% end %> "> <%= check_box_tag("ids[]", issue.id, false, :id => nil) %> - <%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %> + <%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue.id_titled %> <% query.columns.each do |column| %><%= content_tag 'td', column_content(column, issue), :class => column.name %><% end %> <% end -%> diff --git a/app/views/issues/_list_simple.rhtml b/app/views/issues/_list_simple.rhtml --- a/app/views/issues/_list_simple.rhtml +++ b/app/views/issues/_list_simple.rhtml @@ -12,12 +12,12 @@ <%= check_box_tag("ids[]", issue.id, false, :style => 'display:none;') %> - <%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %> + <%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue.id_titled %> <%= link_to(h(issue.project), :controller => 'projects', :action => 'show', :id => issue.project) %> <%=h issue.tracker %> - <%= link_to h(truncate(issue.subject, :length => 60)), :controller => 'issues', :action => 'show', :id => issue %> (<%=h issue.status %>) + <%= link_to h(truncate(issue.subject, :length => 60)), :controller => 'issues', :action => 'show', :id => issue.id_titled %> (<%=h issue.status %>) <% end %> diff --git a/app/views/issues/changes.rxml b/app/views/issues/changes.rxml --- a/app/views/issues/changes.rxml +++ b/app/views/issues/changes.rxml @@ -10,7 +10,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do issue = change.issue xml.entry do xml.title "#{issue.project.name} - #{issue.tracker.name} ##{issue.id}: #{issue.subject}" - xml.link "rel" => "alternate", "href" => url_for(:controller => 'issues' , :action => 'show', :id => issue, :only_path => false) + xml.link "rel" => "alternate", "href" => url_for(:controller => 'issues' , :action => 'show', :id => issue.id_titled, :only_path => false) xml.id url_for(:controller => 'issues' , :action => 'show', :id => issue, :journal_id => change, :only_path => false) xml.updated change.created_on.xmlschema xml.author do diff --git a/app/views/messages/show.rhtml b/app/views/messages/show.rhtml --- a/app/views/messages/show.rhtml +++ b/app/views/messages/show.rhtml @@ -30,7 +30,7 @@

<%= avatar(message.author, :size => "24") %> - <%= link_to h(message.subject), { :controller => 'messages', :action => 'show', :board_id => @board, :id => @topic, :anchor => "message-#{message.id}" } %> + <%= link_to h(message.subject), { :controller => 'messages', :action => 'show', :board_id => @board, :id => @topic.id_titled, :anchor => "message-#{message.id}" } %> - <%= authoring message.created_on, message.author %>

@@ -44,7 +44,7 @@ <% if !@topic.locked? && authorize_for('messages', 'reply') %>

<%= toggle_link l(:button_reply), "reply", :focus => 'message_content' %>