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