@@ -157,7 +157,16 module ApplicationHelper | |||
|
157 | 157 | page = title || $2 |
|
158 | 158 | title = $1 if page.blank? |
|
159 | 159 | end |
|
160 | link_to((title || page), format_wiki_link.call(link_project, Wiki.titleize(page)), :class => 'wiki-page') | |
|
160 | ||
|
161 | if link_project && link_project.wiki | |
|
162 | # check if page exists | |
|
163 | wiki_page = link_project.wiki.find_page(page) | |
|
164 | link_to((title || page), format_wiki_link.call(link_project, Wiki.titleize(page)), | |
|
165 | :class => ('wiki-page' + (wiki_page ? '' : ' new'))) | |
|
166 | else | |
|
167 | # project or wiki doesn't exist | |
|
168 | title || page | |
|
169 | end | |
|
161 | 170 | end |
|
162 | 171 | |
|
163 | 172 | # turn issue and revision ids into links |
@@ -168,9 +177,16 module ApplicationHelper | |||
|
168 | 177 | leading, otype, oid = $1, $2, $3 |
|
169 | 178 | link = nil |
|
170 | 179 | if otype == 'r' |
|
171 | link = link_to("r#{oid}", {:controller => 'repositories', :action => 'revision', :id => project.id, :rev => oid}, :class => 'changeset') if project | |
|
180 | if project && (changeset = project.changesets.find_by_revision(oid)) | |
|
181 | link = link_to("r#{oid}", {:controller => 'repositories', :action => 'revision', :id => project.id, :rev => oid}, :class => 'changeset', | |
|
182 | :title => truncate(changeset.comments, 100)) | |
|
183 | end | |
|
172 | 184 | else |
|
173 | link = link_to("##{oid}", {:controller => 'issues', :action => 'show', :id => oid}, :class => 'issue') | |
|
185 | if issue = Issue.find_by_id(oid.to_i, :include => [:project, :status], :conditions => Project.visible_by(User.current)) | |
|
186 | link = link_to("##{oid}", {:controller => 'issues', :action => 'show', :id => oid}, :class => 'issue', | |
|
187 | :title => "#{truncate(issue.subject, 100)} (#{issue.status.name})") | |
|
188 | link = content_tag('del', link) if issue.closed? | |
|
189 | end | |
|
174 | 190 | end |
|
175 | 191 | leading + (link || "#{otype}#{oid}") |
|
176 | 192 | end |
@@ -33,6 +33,7 class Project < ActiveRecord::Base | |||
|
33 | 33 | has_many :issue_categories, :dependent => :delete_all, :order => "#{IssueCategory.table_name}.name" |
|
34 | 34 | has_many :boards, :order => "position ASC" |
|
35 | 35 | has_one :repository, :dependent => :destroy |
|
36 | has_many :changesets, :through => :repository | |
|
36 | 37 | has_one :wiki, :dependent => :destroy |
|
37 | 38 | 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' |
|
38 | 39 | acts_as_tree :order => "name", :counter_cache => true |
@@ -45,7 +45,7 | |||
|
45 | 45 | <%= hidden_field_tag "wiki_enabled", 0 %> |
|
46 | 46 | <div id="wiki"> |
|
47 | 47 | <% fields_for :wiki, @project.wiki, { :builder => TabularFormBuilder, :lang => current_language} do |wiki| %> |
|
48 | <p><%= wiki.text_field :start_page, :size => 60, :required => true %><br /><em><%= l(:text_unallowed_characters) %>: , . / ? ; |</em></p> | |
|
48 | <p><%= wiki.text_field :start_page, :size => 60, :required => true %><br /><em><%= l(:text_unallowed_characters) %>: , . / ? ; : |</em></p> | |
|
49 | 49 | <% # content_tag("div", "", :id => "wiki_start_page_auto_complete", :class => "auto_complete") + |
|
50 | 50 | # auto_complete_field("wiki_start_page", { :url => { :controller => 'wiki', :action => 'auto_complete_for_wiki_page', :id => @project } }) |
|
51 | 51 | %> |
@@ -1,5 +1,3 | |||
|
1 | 1 | <div class="wiki"> |
|
2 | <% cache "wiki/show/#{content.page.id}/#{content.version}" do %> | |
|
3 | <%= textilizable content.text, :attachments => content.page.attachments %> | |
|
4 | <% end %> | |
|
2 | <%= textilizable content.text, :attachments => content.page.attachments %> | |
|
5 | 3 | </div> |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -615,7 +615,7 div.wiki table, div.wiki td, div.wiki th { | |||
|
615 | 615 | div.wiki a { |
|
616 | 616 | background-position: 0% 60%; |
|
617 | 617 | background-repeat: no-repeat; |
|
618 |
padding-left: 1 |
|
|
618 | padding-left: 12px; | |
|
619 | 619 | background-image: url(../images/external.png); |
|
620 | 620 | } |
|
621 | 621 | |
@@ -624,6 +624,10 div.wiki a.wiki-page, div.wiki a.issue, div.wiki a.changeset, div.wiki a.email { | |||
|
624 | 624 | background-image: none; |
|
625 | 625 | } |
|
626 | 626 | |
|
627 | div.wiki a.new { | |
|
628 | color: #b73535; | |
|
629 | } | |
|
630 | ||
|
627 | 631 | div.wiki code { |
|
628 | 632 | font-size: 1.2em; |
|
629 | 633 | } |
@@ -19,7 +19,8 require File.dirname(__FILE__) + '/../../test_helper' | |||
|
19 | 19 | |
|
20 | 20 | class ApplicationHelperTest < HelperTestCase |
|
21 | 21 | include ApplicationHelper |
|
22 | fixtures :projects | |
|
22 | include ActionView::Helpers::TextHelper | |
|
23 | fixtures :projects, :repositories, :changesets, :trackers, :issue_statuses, :issues | |
|
23 | 24 | |
|
24 | 25 | def setup |
|
25 | 26 | super |
@@ -53,12 +54,14 class ApplicationHelperTest < HelperTestCase | |||
|
53 | 54 | end |
|
54 | 55 | |
|
55 | 56 | def test_redmine_links |
|
56 |
issue_link = link_to('# |
|
|
57 | changeset_link = link_to('r19', {:controller => 'repositories', :action => 'revision', :id => 1, :rev => 19}, :class => 'changeset') | |
|
57 | issue_link = link_to('#3', {:controller => 'issues', :action => 'show', :id => 3}, | |
|
58 | :class => 'issue', :title => 'Error 281 when updating a recipe (New)') | |
|
59 | changeset_link = link_to('r1', {:controller => 'repositories', :action => 'revision', :id => 1, :rev => 1}, | |
|
60 | :class => 'changeset', :title => 'My very first commit') | |
|
58 | 61 | |
|
59 | 62 | to_test = { |
|
60 |
'# |
|
|
61 |
'r1 |
|
|
63 | '#3, #3 and #3.' => "#{issue_link}, #{issue_link} and #{issue_link}.", | |
|
64 | 'r1' => changeset_link | |
|
62 | 65 | } |
|
63 | 66 | @project = Project.find(1) |
|
64 | 67 | to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } |
General Comments 0
You need to be logged in to leave comments.
Login now