@@ -25,13 +25,13 module RepositoriesHelper | |||||
25 | revision.to_s |
|
25 | revision.to_s | |
26 | end |
|
26 | end | |
27 | end |
|
27 | end | |
28 |
|
28 | |||
29 | def truncate_at_line_break(text, length = 255) |
|
29 | def truncate_at_line_break(text, length = 255) | |
30 | if text |
|
30 | if text | |
31 | text.gsub(%r{^(.{#{length}}[^\n]*)\n.+$}m, '\\1...') |
|
31 | text.gsub(%r{^(.{#{length}}[^\n]*)\n.+$}m, '\\1...') | |
32 | end |
|
32 | end | |
33 | end |
|
33 | end | |
34 |
|
34 | |||
35 | def render_properties(properties) |
|
35 | def render_properties(properties) | |
36 | unless properties.nil? || properties.empty? |
|
36 | unless properties.nil? || properties.empty? | |
37 | content = '' |
|
37 | content = '' | |
@@ -41,7 +41,7 module RepositoriesHelper | |||||
41 | content_tag('ul', content, :class => 'properties') |
|
41 | content_tag('ul', content, :class => 'properties') | |
42 | end |
|
42 | end | |
43 | end |
|
43 | end | |
44 |
|
44 | |||
45 | def render_changeset_changes |
|
45 | def render_changeset_changes | |
46 | changes = @changeset.changes.find(:all, :limit => 1000, :order => 'path').collect do |change| |
|
46 | changes = @changeset.changes.find(:all, :limit => 1000, :order => 'path').collect do |change| | |
47 | case change.action |
|
47 | case change.action | |
@@ -75,10 +75,10 module RepositoriesHelper | |||||
75 |
|
75 | |||
76 | render_changes_tree(tree[:s]) |
|
76 | render_changes_tree(tree[:s]) | |
77 | end |
|
77 | end | |
78 |
|
78 | |||
79 | def render_changes_tree(tree) |
|
79 | def render_changes_tree(tree) | |
80 | return '' if tree.nil? |
|
80 | return '' if tree.nil? | |
81 |
|
81 | |||
82 | output = '' |
|
82 | output = '' | |
83 | output << '<ul>' |
|
83 | output << '<ul>' | |
84 | tree.keys.sort.each do |file| |
|
84 | tree.keys.sort.each do |file| | |
@@ -115,14 +115,14 module RepositoriesHelper | |||||
115 | output << '</ul>' |
|
115 | output << '</ul>' | |
116 | output |
|
116 | output | |
117 | end |
|
117 | end | |
118 |
|
118 | |||
119 | def to_utf8(str) |
|
119 | def to_utf8(str) | |
120 | return str if str.blank? |
|
120 | return str if str.blank? | |
121 | if str.respond_to?(:force_encoding) |
|
121 | if str.respond_to?(:force_encoding) | |
122 | str.force_encoding('UTF-8') |
|
122 | str.force_encoding('UTF-8') | |
123 | else |
|
123 | else | |
124 | # TODO: |
|
124 | # TODO: | |
125 |
# Japanese Shift_JIS(CP932) is not compatible with ASCII. |
|
125 | # Japanese Shift_JIS(CP932) is not compatible with ASCII. | |
126 | # UTF-7 and Japanese ISO-2022-JP are 7bits clean. |
|
126 | # UTF-7 and Japanese ISO-2022-JP are 7bits clean. | |
127 | return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii |
|
127 | return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii | |
128 | end |
|
128 | end | |
@@ -192,10 +192,11 module RepositoriesHelper | |||||
192 | :disabled => (repository && !repository.root_url.blank?)) + |
|
192 | :disabled => (repository && !repository.root_url.blank?)) + | |
193 | '<br />(file:///, http://, https://, svn://, svn+[tunnelscheme]://)') + |
|
193 | '<br />(file:///, http://, https://, svn://, svn+[tunnelscheme]://)') + | |
194 | content_tag('p', form.text_field(:login, :size => 30)) + |
|
194 | content_tag('p', form.text_field(:login, :size => 30)) + | |
195 |
content_tag('p', form.password_field( |
|
195 | content_tag('p', form.password_field( | |
196 | :value => ((repository.new_record? || repository.password.blank?) ? '' : ('x'*15)), |
|
196 | :password, :size => 30, :name => 'ignore', | |
197 | :onfocus => "this.value=''; this.name='repository[password]';", |
|
197 | :value => ((repository.new_record? || repository.password.blank?) ? '' : ('x'*15)), | |
198 |
|
|
198 | :onfocus => "this.value=''; this.name='repository[password]';", | |
|
199 | :onchange => "this.name='repository[password]';")) | |||
199 | end |
|
200 | end | |
200 |
|
201 | |||
201 | def darcs_field_tags(form, repository) |
|
202 | def darcs_field_tags(form, repository) |
General Comments 0
You need to be logged in to leave comments.
Login now