Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
14023c4e
Commit
14023c4e
authored
Dec 30, 2011
by
Saito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove charencode.
parent
7279e8c1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
9 additions
and
26 deletions
+9
-26
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+0
-1
app/models/commit.rb
app/models/commit.rb
+3
-4
app/views/commits/_text_file.html.haml
app/views/commits/_text_file.html.haml
+1
-1
app/views/refs/_tree.html.haml
app/views/refs/_tree.html.haml
+2
-2
lib/graph_commit.rb
lib/graph_commit.rb
+2
-3
lib/utils.rb
lib/utils.rb
+1
-15
No files found.
app/helpers/application_helper.rb
View file @
14023c4e
require
'digest/md5'
require
'digest/md5'
module
ApplicationHelper
module
ApplicationHelper
include
Utils
::
CharEncode
def
gravatar_icon
(
user_email
,
size
=
40
)
def
gravatar_icon
(
user_email
,
size
=
40
)
gravatar_host
=
request
.
ssl?
?
"https://secure.gravatar.com"
:
"http://www.gravatar.com"
gravatar_host
=
request
.
ssl?
?
"https://secure.gravatar.com"
:
"http://www.gravatar.com"
...
...
app/models/commit.rb
View file @
14023c4e
class
Commit
class
Commit
include
Utils
::
CharEncode
attr_accessor
:commit
attr_accessor
:commit
attr_accessor
:head
attr_accessor
:head
...
@@ -22,7 +21,7 @@ class Commit
...
@@ -22,7 +21,7 @@ class Commit
end
end
def
safe_message
def
safe_message
encode
(
message
)
message
end
end
def
created_at
def
created_at
...
@@ -30,11 +29,11 @@ class Commit
...
@@ -30,11 +29,11 @@ class Commit
end
end
def
author_email
def
author_email
encode
(
author
.
email
)
author
.
email
end
end
def
author_name
def
author_name
encode
(
author
.
name
)
author
.
name
end
end
def
prev_commit
def
prev_commit
...
...
app/views/commits/_text_file.html.haml
View file @
14023c4e
%table
%table
-
line_old
=
0
-
line_old
=
0
-
line_new
=
0
-
line_new
=
0
-
diff_str
=
encode
(
diff
.
diff
)
-
diff_str
=
diff
.
diff
-
lines_arr
=
diff_str
.
lines
.
to_a
-
lines_arr
=
diff_str
.
lines
.
to_a
-
lines_arr
.
each
do
|
line
|
-
lines_arr
.
each
do
|
line
|
-
next
if
line
.
match
(
/^--- \/dev\/null/
)
-
next
if
line
.
match
(
/^--- \/dev\/null/
)
...
...
app/views/refs/_tree.html.haml
View file @
14023c4e
...
@@ -40,9 +40,9 @@
...
@@ -40,9 +40,9 @@
%h3
=
content
.
name
%h3
=
content
.
name
.readme
.readme
-
if
content
.
name
=~
/\.(md|markdown)$/i
-
if
content
.
name
=~
/\.(md|markdown)$/i
=
markdown
(
encode
content
.
data
)
=
markdown
(
content
.
data
)
-
else
-
else
=
simple_format
(
encode
content
.
data
)
=
simple_format
(
content
.
data
)
:javascript
:javascript
$
(
function
(){
$
(
function
(){
...
...
lib/graph_commit.rb
View file @
14023c4e
require
"grit"
require
"grit"
class
GraphCommit
class
GraphCommit
include
Utils
::
CharEncode
attr_accessor
:time
,
:space
attr_accessor
:time
,
:space
attr_accessor
:refs
attr_accessor
:refs
...
@@ -97,13 +96,13 @@ class GraphCommit
...
@@ -97,13 +96,13 @@ class GraphCommit
h
[
:parents
]
=
self
.
parents
.
collect
do
|
p
|
h
[
:parents
]
=
self
.
parents
.
collect
do
|
p
|
[
p
.
id
,
0
,
0
]
[
p
.
id
,
0
,
0
]
end
end
h
[
:author
]
=
encode
(
author
.
name
)
h
[
:author
]
=
author
.
name
h
[
:time
]
=
time
h
[
:time
]
=
time
h
[
:space
]
=
space
h
[
:space
]
=
space
h
[
:refs
]
=
refs
.
collect
{
|
r
|
r
.
name
}.
join
(
" "
)
unless
refs
.
nil?
h
[
:refs
]
=
refs
.
collect
{
|
r
|
r
.
name
}.
join
(
" "
)
unless
refs
.
nil?
h
[
:id
]
=
sha
h
[
:id
]
=
sha
h
[
:date
]
=
date
h
[
:date
]
=
date
h
[
:message
]
=
encode
(
message
)
h
[
:message
]
=
message
h
[
:login
]
=
author
.
email
h
[
:login
]
=
author
.
email
h
h
end
end
...
...
lib/utils.rb
View file @
14023c4e
...
@@ -16,28 +16,14 @@ module Utils
...
@@ -16,28 +16,14 @@ module Utils
end
end
end
end
module
CharEncode
def
encode
(
string
)
return
''
unless
string
cd
=
CharDet
.
detect
(
string
)
if
cd
.
confidence
>
0.6
string
.
force_encoding
(
cd
.
encoding
)
end
string
.
encode
(
"utf-8"
,
:undef
=>
:replace
,
:replace
=>
"?"
,
:invalid
=>
:replace
)
rescue
"Invalid Encoding"
end
end
module
Colorize
module
Colorize
include
CharEncode
def
colorize
def
colorize
system_colorize
(
data
,
name
)
system_colorize
(
data
,
name
)
end
end
def
system_colorize
(
data
,
file_name
)
def
system_colorize
(
data
,
file_name
)
ft
=
handle_file_type
(
file_name
)
ft
=
handle_file_type
(
file_name
)
Pygments
.
highlight
(
encode
(
data
)
,
:lexer
=>
ft
,
:options
=>
{
:encoding
=>
'utf-8'
,
:linenos
=>
'True'
})
Pygments
.
highlight
(
data
,
:lexer
=>
ft
,
:options
=>
{
:encoding
=>
'utf-8'
,
:linenos
=>
'True'
})
end
end
def
handle_file_type
(
file_name
,
mime_type
=
nil
)
def
handle_file_type
(
file_name
,
mime_type
=
nil
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment