@@ -157,7 +157,16 module ApplicationHelper | |||||
157 | page = title || $2 |
|
157 | page = title || $2 | |
158 | title = $1 if page.blank? |
|
158 | title = $1 if page.blank? | |
159 | end |
|
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 | end |
|
170 | end | |
162 |
|
171 | |||
163 | # turn issue and revision ids into links |
|
172 | # turn issue and revision ids into links | |
@@ -168,9 +177,16 module ApplicationHelper | |||||
168 | leading, otype, oid = $1, $2, $3 |
|
177 | leading, otype, oid = $1, $2, $3 | |
169 | link = nil |
|
178 | link = nil | |
170 | if otype == 'r' |
|
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 | else |
|
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 | end |
|
190 | end | |
175 | leading + (link || "#{otype}#{oid}") |
|
191 | leading + (link || "#{otype}#{oid}") | |
176 | end |
|
192 | end |
@@ -33,6 +33,7 class Project < ActiveRecord::Base | |||||
33 | has_many :issue_categories, :dependent => :delete_all, :order => "#{IssueCategory.table_name}.name" |
|
33 | has_many :issue_categories, :dependent => :delete_all, :order => "#{IssueCategory.table_name}.name" | |
34 | has_many :boards, :order => "position ASC" |
|
34 | has_many :boards, :order => "position ASC" | |
35 | has_one :repository, :dependent => :destroy |
|
35 | has_one :repository, :dependent => :destroy | |
|
36 | has_many :changesets, :through => :repository | |||
36 | has_one :wiki, :dependent => :destroy |
|
37 | has_one :wiki, :dependent => :destroy | |
37 | 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 | 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 | acts_as_tree :order => "name", :counter_cache => true |
|
39 | acts_as_tree :order => "name", :counter_cache => true |
@@ -45,7 +45,7 | |||||
45 | <%= hidden_field_tag "wiki_enabled", 0 %> |
|
45 | <%= hidden_field_tag "wiki_enabled", 0 %> | |
46 | <div id="wiki"> |
|
46 | <div id="wiki"> | |
47 | <% fields_for :wiki, @project.wiki, { :builder => TabularFormBuilder, :lang => current_language} do |wiki| %> |
|
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 | <% # content_tag("div", "", :id => "wiki_start_page_auto_complete", :class => "auto_complete") + |
|
49 | <% # content_tag("div", "", :id => "wiki_start_page_auto_complete", :class => "auto_complete") + | |
50 | # auto_complete_field("wiki_start_page", { :url => { :controller => 'wiki', :action => 'auto_complete_for_wiki_page', :id => @project } }) |
|
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 | <div class="wiki"> |
|
1 | <div class="wiki"> | |
2 | <% cache "wiki/show/#{content.page.id}/#{content.version}" do %> |
|
2 | <%= textilizable content.text, :attachments => content.page.attachments %> | |
3 | <%= textilizable content.text, :attachments => content.page.attachments %> |
|
|||
4 | <% end %> |
|
|||
5 | </div> |
|
3 | </div> |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -615,7 +615,7 div.wiki table, div.wiki td, div.wiki th { | |||||
615 | div.wiki a { |
|
615 | div.wiki a { | |
616 | background-position: 0% 60%; |
|
616 | background-position: 0% 60%; | |
617 | background-repeat: no-repeat; |
|
617 | background-repeat: no-repeat; | |
618 |
padding-left: 1 |
|
618 | padding-left: 12px; | |
619 | background-image: url(../images/external.png); |
|
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 | background-image: none; |
|
624 | background-image: none; | |
625 | } |
|
625 | } | |
626 |
|
626 | |||
|
627 | div.wiki a.new { | |||
|
628 | color: #b73535; | |||
|
629 | } | |||
|
630 | ||||
627 | div.wiki code { |
|
631 | div.wiki code { | |
628 | font-size: 1.2em; |
|
632 | font-size: 1.2em; | |
629 | } |
|
633 | } |
@@ -19,7 +19,8 require File.dirname(__FILE__) + '/../../test_helper' | |||||
19 |
|
19 | |||
20 | class ApplicationHelperTest < HelperTestCase |
|
20 | class ApplicationHelperTest < HelperTestCase | |
21 | include ApplicationHelper |
|
21 | include ApplicationHelper | |
22 | fixtures :projects |
|
22 | include ActionView::Helpers::TextHelper | |
|
23 | fixtures :projects, :repositories, :changesets, :trackers, :issue_statuses, :issues | |||
23 |
|
24 | |||
24 | def setup |
|
25 | def setup | |
25 | super |
|
26 | super | |
@@ -53,12 +54,14 class ApplicationHelperTest < HelperTestCase | |||||
53 | end |
|
54 | end | |
54 |
|
55 | |||
55 | def test_redmine_links |
|
56 | def test_redmine_links | |
56 |
issue_link = link_to('# |
|
57 | issue_link = link_to('#3', {:controller => 'issues', :action => 'show', :id => 3}, | |
57 | changeset_link = link_to('r19', {:controller => 'repositories', :action => 'revision', :id => 1, :rev => 19}, :class => 'changeset') |
|
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 | to_test = { |
|
62 | to_test = { | |
60 |
'# |
|
63 | '#3, #3 and #3.' => "#{issue_link}, #{issue_link} and #{issue_link}.", | |
61 |
'r1 |
|
64 | 'r1' => changeset_link | |
62 | } |
|
65 | } | |
63 | @project = Project.find(1) |
|
66 | @project = Project.find(1) | |
64 | to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } |
|
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