Improved Redmine links:
* issue and changeset links generated only if the object exists * issue subject and status appear in the link title * strike issue link if issue is closed * red wiki page link if page doesn't exist * new icon for external links Wiki page cache had to be disabled. git-svn-id: http://redmine.rubyforge.org/svn/trunk@714 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -157,7 +157,16 @@ module ApplicationHelper
|
||||
page = title || $2
|
||||
title = $1 if page.blank?
|
||||
end
|
||||
link_to((title || page), format_wiki_link.call(link_project, Wiki.titleize(page)), :class => 'wiki-page')
|
||||
|
||||
if link_project && link_project.wiki
|
||||
# check if page exists
|
||||
wiki_page = link_project.wiki.find_page(page)
|
||||
link_to((title || page), format_wiki_link.call(link_project, Wiki.titleize(page)),
|
||||
:class => ('wiki-page' + (wiki_page ? '' : ' new')))
|
||||
else
|
||||
# project or wiki doesn't exist
|
||||
title || page
|
||||
end
|
||||
end
|
||||
|
||||
# turn issue and revision ids into links
|
||||
@@ -168,9 +177,16 @@ module ApplicationHelper
|
||||
leading, otype, oid = $1, $2, $3
|
||||
link = nil
|
||||
if otype == 'r'
|
||||
link = link_to("r#{oid}", {:controller => 'repositories', :action => 'revision', :id => project.id, :rev => oid}, :class => 'changeset') if project
|
||||
if project && (changeset = project.changesets.find_by_revision(oid))
|
||||
link = link_to("r#{oid}", {:controller => 'repositories', :action => 'revision', :id => project.id, :rev => oid}, :class => 'changeset',
|
||||
:title => truncate(changeset.comments, 100))
|
||||
end
|
||||
else
|
||||
link = link_to("##{oid}", {:controller => 'issues', :action => 'show', :id => oid}, :class => 'issue')
|
||||
if issue = Issue.find_by_id(oid.to_i, :include => [:project, :status], :conditions => Project.visible_by(User.current))
|
||||
link = link_to("##{oid}", {:controller => 'issues', :action => 'show', :id => oid}, :class => 'issue',
|
||||
:title => "#{truncate(issue.subject, 100)} (#{issue.status.name})")
|
||||
link = content_tag('del', link) if issue.closed?
|
||||
end
|
||||
end
|
||||
leading + (link || "#{otype}#{oid}")
|
||||
end
|
||||
|
||||
@@ -33,6 +33,7 @@ class Project < ActiveRecord::Base
|
||||
has_many :issue_categories, :dependent => :delete_all, :order => "#{IssueCategory.table_name}.name"
|
||||
has_many :boards, :order => "position ASC"
|
||||
has_one :repository, :dependent => :destroy
|
||||
has_many :changesets, :through => :repository
|
||||
has_one :wiki, :dependent => :destroy
|
||||
has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}", :association_foreign_key => 'custom_field_id'
|
||||
acts_as_tree :order => "name", :counter_cache => true
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<%= hidden_field_tag "wiki_enabled", 0 %>
|
||||
<div id="wiki">
|
||||
<% fields_for :wiki, @project.wiki, { :builder => TabularFormBuilder, :lang => current_language} do |wiki| %>
|
||||
<p><%= wiki.text_field :start_page, :size => 60, :required => true %><br /><em><%= l(:text_unallowed_characters) %>: , . / ? ; |</em></p>
|
||||
<p><%= wiki.text_field :start_page, :size => 60, :required => true %><br /><em><%= l(:text_unallowed_characters) %>: , . / ? ; : |</em></p>
|
||||
<% # content_tag("div", "", :id => "wiki_start_page_auto_complete", :class => "auto_complete") +
|
||||
# auto_complete_field("wiki_start_page", { :url => { :controller => 'wiki', :action => 'auto_complete_for_wiki_page', :id => @project } })
|
||||
%>
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
<div class="wiki">
|
||||
<% cache "wiki/show/#{content.page.id}/#{content.version}" do %>
|
||||
<%= textilizable content.text, :attachments => content.page.attachments %>
|
||||
<% end %>
|
||||
<%= textilizable content.text, :attachments => content.page.attachments %>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user