Project

General

Profile

Patch #5897 ยป id-titled.patch

W Snyder, 2010-07-18 14:09

View differences:

app/helpers/application_helper.rb
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
......
: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
app/helpers/messages_helper.rb
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
app/helpers/queries_helper.rb
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
app/models/issue.rb
# 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]},
......
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
app/models/journal.rb
: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,
app/models/message.rb
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]},
......
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
app/models/news.rb
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
......
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
app/views/boards/show.rhtml
<tbody>
<% @topics.each do |topic| %>
<tr class="message <%= cycle 'odd', 'even' %> <%= topic.sticky? ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>">
<td class="subject"><%= link_to h(topic.subject), { :controller => 'messages', :action => 'show', :board_id => @board, :id => topic } %></td>
<td class="subject"><%= link_to h(topic.subject), { :controller => 'messages', :action => 'show', :board_id => @board, :id => topic.id_titled } %></td>
<td class="author" align="center"><%= topic.author %></td>
<td class="created_on" align="center"><%= format_time(topic.created_on) %></td>
<td class="replies" align="center"><%= topic.replies_count %></td>
app/views/issues/_list.rhtml
<% end %>
<tr id="issue-<%= issue.id %>" class="hascontextmenu <%= cycle('odd', 'even') %> <%= issue.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
<td class="checkbox"><%= check_box_tag("ids[]", issue.id, false, :id => nil) %></td>
<td class="id"><%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %></td>
<td class="id"><%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue.id_titled %></td>
<% query.columns.each do |column| %><%= content_tag 'td', column_content(column, issue), :class => column.name %><% end %>
</tr>
<% end -%>
app/views/issues/_list_simple.rhtml
<tr id="issue-<%= issue.id %>" class="hascontextmenu <%= cycle('odd', 'even') %> <%= issue.css_classes %>">
<td class="id">
<%= 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 %>
</td>
<td class="project"><%= link_to(h(issue.project), :controller => 'projects', :action => 'show', :id => issue.project) %></td>
<td class="tracker"><%=h issue.tracker %></td>
<td class="subject">
<%= 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 %>)
</td>
</tr>
<% end %>
app/views/issues/changes.rxml
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
app/views/messages/show.rhtml
</div>
<h4>
<%= 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 %>
</h4>
......
<% if !@topic.locked? && authorize_for('messages', 'reply') %>
<p><%= toggle_link l(:button_reply), "reply", :focus => 'message_content' %></p>
<div id="reply" style="display:none;">
<% form_for :reply, @reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
<% form_for :reply, @reply, :url => {:action => 'reply', :id => @topic.id_titled}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f, :replying => true} %>
<%= submit_tag l(:button_submit) %>
<%= link_to_remote l(:label_preview),
app/views/news/_news.rhtml
<p><%= link_to(h(news.project.name), :controller => 'projects', :action => 'show', :id => news.project) + ': ' unless @project %>
<%= link_to h(news.title), :controller => 'news', :action => 'show', :id => news %>
<%= link_to h(news.title), :controller => 'news', :action => 'show', :id => news.id_titled %>
<%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count > 0 %>
<br />
<% unless news.summary.blank? %><span class="summary"><%=h news.summary %></span><br /><% end %>
app/views/news/index.rhtml
<% else %>
<% @newss.each do |news| %>
<h3><%= link_to(h(news.project.name), :controller => 'projects', :action => 'show', :id => news.project) + ': ' unless news.project == @project %>
<%= link_to h(news.title), :controller => 'news', :action => 'show', :id => news %>
<%= link_to h(news.title), :controller => 'news', :action => 'show', :id => news.id_titled %>
<%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count > 0 %></h3>
<p class="author"><%= authoring news.created_on, news.author %></p>
<div class="wiki">
config/routes.rb
map.connect 'time_entries/:id/edit', :action => 'edit', :controller => 'timelog'
map.connect 'projects/:project_id/time_entries/new', :action => 'edit', :controller => 'timelog'
map.connect 'projects/:project_id/issues/:issue_id/time_entries/new', :action => 'edit', :controller => 'timelog'
map.connect 'projects/:project_id/issues/:issue_id:ignore/time_entries/new', :action => 'edit', :controller => 'timelog', :issue_id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/
map.with_options :controller => 'timelog' do |timelog|
timelog.connect 'projects/:project_id/time_entries', :action => 'details'
......
timelog.with_options :action => 'details', :conditions => {:method => :get} do |time_details|
time_details.connect 'time_entries'
time_details.connect 'time_entries.:format'
time_details.connect 'issues/:issue_id/time_entries'
time_details.connect 'issues/:issue_id/time_entries.:format'
time_details.connect 'issues/:issue_id:ignore/time_entries', :issue_id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/
time_details.connect 'issues/:issue_id:ignore/time_entries.:format', :issue_id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/
time_details.connect 'projects/:project_id/time_entries.:format'
time_details.connect 'projects/:project_id/issues/:issue_id/time_entries'
time_details.connect 'projects/:project_id/issues/:issue_id/time_entries.:format'
......
end
timelog.with_options :action => 'edit', :conditions => {:method => :get} do |time_edit|
time_edit.connect 'issues/:issue_id/time_entries/new'
time_edit.connect 'issues/:issue_id:ignore/time_entries/new', :issue_id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/
end
timelog.connect 'time_entries/:id/destroy', :action => 'destroy', :conditions => {:method => :post}
......
map.with_options :controller => 'messages' do |messages_routes|
messages_routes.with_options :conditions => {:method => :get} do |messages_views|
messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
messages_views.connect 'boards/:board_id/topics/:id:ignore', :action => 'show', :id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/
messages_views.connect 'boards/:board_id/topics/:id:ignore/edit', :action => 'edit', :id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/
end
messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply'
messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/
messages_actions.connect 'boards/:board_id/topics/:id:ignore/replies', :action => 'reply', :id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/
messages_actions.connect 'boards/:board_id/topics/:id:ignore/:action', :action => /edit|destroy/, :id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/
end
end
......
board_routes.with_options :conditions => {:method => :get} do |board_views|
board_views.connect 'projects/:project_id/boards', :action => 'index'
board_views.connect 'projects/:project_id/boards/new', :action => 'new'
board_views.connect 'projects/:project_id/boards/:id', :action => 'show'
board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show'
board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit'
board_views.connect 'projects/:project_id/boards/:id:ignore', :action => 'show', :id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/
board_views.connect 'projects/:project_id/boards/:id:ignore.:format', :action => 'show', :id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/
board_views.connect 'projects/:project_id/boards/:id:ignore/edit', :action => 'edit', :id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/
end
board_routes.with_options :conditions => {:method => :post} do |board_actions|
board_actions.connect 'projects/:project_id/boards', :action => 'new'
board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/
board_actions.connect 'projects/:project_id/boards/:id:ignore/:action', :action => /edit|destroy/, :id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/
end
end
......
issues_views.connect 'projects/:project_id/issues/gantt', :controller => 'gantts', :action => 'show'
issues_views.connect 'projects/:project_id/issues/calendar', :controller => 'calendars', :action => 'show'
issues_views.connect 'projects/:project_id/issues/:copy_from/copy', :action => 'new'
issues_views.connect 'issues/:id', :action => 'show', :id => /\d+/
issues_views.connect 'issues/:id.:format', :action => 'show', :id => /\d+/
issues_views.connect 'issues/:id/edit', :action => 'edit', :id => /\d+/
issues_views.connect 'issues/:id/move', :action => 'move', :id => /\d+/
issues_views.connect 'issues/:id:ignore', :action => 'show', :id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/
issues_views.connect 'issues/:id:ignore.:format', :action => 'show', :id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/
issues_views.connect 'issues/:id:ignore/edit', :action => 'edit', :id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/
issues_views.connect 'issues/:id:ignore/move', :action => 'move', :id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/
end
issues_routes.with_options :conditions => {:method => :post} do |issues_actions|
issues_actions.connect 'issues', :action => 'index'
issues_actions.connect 'projects/:project_id/issues', :action => 'create'
issues_actions.connect 'projects/:project_id/issues/gantt', :controller => 'gantts', :action => 'show'
issues_actions.connect 'projects/:project_id/issues/calendar', :controller => 'calendars', :action => 'show'
issues_actions.connect 'issues/:id/quoted', :action => 'reply', :id => /\d+/
issues_actions.connect 'issues/:id/:action', :action => /edit|move|destroy/, :id => /\d+/
issues_actions.connect 'issues/:id/quoted', :action => 'reply', :id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/
issues_actions.connect 'issues/:id/:action', :action => /edit|move|destroy/, :id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/
issues_actions.connect 'issues.:format', :action => 'create', :format => /xml/
end
issues_routes.with_options :conditions => {:method => :put} do |issues_actions|
......
end
map.with_options :controller => 'issue_relations', :conditions => {:method => :post} do |relations|
relations.connect 'issues/:issue_id/relations/:id', :action => 'new'
relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy'
relations.connect 'issues/:issue_id:ignore/relations/:id:ignore2', :action => 'new', :id => /\d+/, :issue_id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/, :ignore2 => /(-[a-zA-Z0-9_]+)?/
relations.connect 'issues/:issue_id:ignore/relations/:id:ignore2/destroy', :action => 'destroy', :id => /\d+/, :issue_id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/, :ignore2 => /(-[a-zA-Z0-9_]+)?/
end
map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports|
......
news_views.connect 'projects/:project_id/news.:format', :action => 'index'
news_views.connect 'news.:format', :action => 'index'
news_views.connect 'projects/:project_id/news/new', :action => 'new'
news_views.connect 'news/:id', :action => 'show'
news_views.connect 'news/:id/edit', :action => 'edit'
news_views.connect 'news/:id:ignore', :action => 'show', :id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/
news_views.connect 'news/:id:ignore/edit', :action => 'edit', :id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/
end
news_routes.with_options do |news_actions|
news_actions.connect 'projects/:project_id/news', :action => 'new'
news_actions.connect 'news/:id/edit', :action => 'edit'
news_actions.connect 'news/:id/destroy', :action => 'destroy'
news_actions.connect 'news/:id:ignore/edit', :action => 'edit', :id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/
news_actions.connect 'news/:id:ignore/destroy', :action => 'destroy', :id => /\d+/, :ignore => /(-[a-zA-Z0-9_]+)?/
end
end
    (1-1/1)