Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 456
- Log:
Reduce code duplicat - "htmlize" was always wrapped by a call
to "make_links", so just include that call inside "htmlize".
- Author:
- rool
- Date:
- Fri Sep 06 07:23:16 +0100 2013
- Size:
- 944 Bytes
1 | # The methods added to this helper will be available to all templates in the application. |
2 | |
3 | class Object::Array |
4 | def cycle() |
5 | self.each_with_index {|o, i| yield(o, %w(odd even)[i % 2])} |
6 | end |
7 | end |
8 | |
9 | module ApplicationHelper |
10 | def make_links(text) |
11 | text.gsub!(/changeset\s#?([0-9]+)/i){|s| link_to("Changeset ##{$1}", :controller => 'repository', :action => 'show_changeset', :revision => $1)} |
12 | text.gsub!(/ticket\s#?([0-9]+)/i){|s| link_to("Ticket ##{$1}", :controller => 'tickets', :action => 'show', :id => $1)} |
13 | return text |
14 | end |
15 | |
16 | def format_and_make_links(text) |
17 | text = make_links(text) |
18 | text = simple_format(text) |
19 | return text |
20 | end |
21 | |
22 | def htmlize(text) |
23 | return if text.nil? |
24 | text.gsub!("<", "<") |
25 | text.gsub!(">", ">") |
26 | text = auto_link( text ) { |visible| truncate(visible, 50) } |
27 | text = RedCloth.new(text).to_html |
28 | make_links(text) |
29 | return text |
30 | end |
31 | |
32 | def request |
33 | @request |
34 | end |
35 | end |