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
Léo-Paul Géneau
gitlab-ce
Commits
538f3e0d
Commit
538f3e0d
authored
Mar 03, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed ruby issues from feedback
Fixed failing tests
parent
3d99ffc8
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
28 deletions
+12
-28
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+7
-12
app/views/projects/_last_commit.html.haml
app/views/projects/_last_commit.html.haml
+1
-1
app/views/projects/blame/show.html.haml
app/views/projects/blame/show.html.haml
+1
-1
app/views/projects/commits/_commit.html.haml
app/views/projects/commits/_commit.html.haml
+1
-1
spec/helpers/application_helper_spec.rb
spec/helpers/application_helper_spec.rb
+2
-13
No files found.
app/helpers/application_helper.rb
View file @
538f3e0d
...
@@ -168,7 +168,6 @@ module ApplicationHelper
...
@@ -168,7 +168,6 @@ module ApplicationHelper
# time - Time object
# time - Time object
# placement - Tooltip placement String (default: "top")
# placement - Tooltip placement String (default: "top")
# html_class - Custom class for `time` element (default: "time_ago")
# html_class - Custom class for `time` element (default: "time_ago")
# skip_js - When true, exclude the `script` tag (default: false)
#
#
# By default also includes a `script` element with Javascript necessary to
# By default also includes a `script` element with Javascript necessary to
# initialize the `timeago` jQuery extension. If this method is called many
# initialize the `timeago` jQuery extension. If this method is called many
...
@@ -180,7 +179,7 @@ module ApplicationHelper
...
@@ -180,7 +179,7 @@ module ApplicationHelper
# `html_class` argument is provided.
# `html_class` argument is provided.
#
#
# Returns an HTML-safe String
# Returns an HTML-safe String
def
time_ago_with_tooltip
(
time
,
placement:
'top'
,
html_class:
'time_ago'
,
skip_js:
false
)
def
time_ago_with_tooltip
(
time
,
placement:
'top'
,
html_class:
'time_ago'
)
element
=
content_tag
:time
,
time
.
to_s
,
element
=
content_tag
:time
,
time
.
to_s
,
class:
"
#{
html_class
}
js-timeago"
,
class:
"
#{
html_class
}
js-timeago"
,
datetime:
time
.
to_time
.
getutc
.
iso8601
,
datetime:
time
.
to_time
.
getutc
.
iso8601
,
...
@@ -190,21 +189,17 @@ module ApplicationHelper
...
@@ -190,21 +189,17 @@ module ApplicationHelper
element
element
end
end
def
edited_time_ago_with_tooltip
(
object
,
placement:
'top'
,
html_class:
'time_ago'
,
skip_js:
false
,
include_author:
false
)
def
edited_time_ago_with_tooltip
(
object
,
placement:
'top'
,
html_class:
'time_ago'
,
include_author:
false
)
return
nil
if
object
.
updated_at
==
object
.
created_at
return
if
object
.
updated_at
==
object
.
created_at
content_tag
:small
,
class:
"edited-text"
do
content_tag
:small
,
class:
"edited-text"
do
output
=
content_tag
:span
do
output
=
content_tag
(
:span
,
"Edited "
)
"Edited "
output
<<
time_ago_with_tooltip
(
object
.
updated_at
,
placement:
placement
,
html_class:
html_class
)
end
output
+=
time_ago_with_tooltip
(
object
.
updated_at
)
if
include_author
if
include_author
if
object
.
updated_by
&&
object
.
updated_by
!=
object
.
author
if
object
.
updated_by
&&
object
.
updated_by
!=
object
.
author
output
+=
content_tag
:span
do
output
<<
content_tag
(
:span
,
" by "
)
" by "
output
<<
link_to_member
(
object
.
project
,
object
.
updated_by
,
avatar:
false
,
author_class:
nil
)
end
output
+=
link_to_member
(
object
.
project
,
object
.
updated_by
,
avatar:
false
,
author_class:
nil
)
end
end
end
end
...
...
app/views/projects/_last_commit.html.haml
View file @
538f3e0d
...
@@ -8,5 +8,5 @@
...
@@ -8,5 +8,5 @@
=
link_to
commit
.
short_id
,
namespace_project_commit_path
(
project
.
namespace
,
project
,
commit
),
class:
"commit_short_id"
=
link_to
commit
.
short_id
,
namespace_project_commit_path
(
project
.
namespace
,
project
,
commit
),
class:
"commit_short_id"
=
link_to_gfm
commit
.
title
,
namespace_project_commit_path
(
project
.
namespace
,
project
,
commit
),
class:
"commit-row-message"
=
link_to_gfm
commit
.
title
,
namespace_project_commit_path
(
project
.
namespace
,
project
,
commit
),
class:
"commit-row-message"
·
·
#{
time_ago_with_tooltip
(
commit
.
committed_date
,
skip_js:
true
)
}
by
#{
time_ago_with_tooltip
(
commit
.
committed_date
)
}
by
=
commit_author_link
(
commit
,
avatar:
true
,
size:
24
)
=
commit_author_link
(
commit
,
avatar:
true
,
size:
24
)
app/views/projects/blame/show.html.haml
View file @
538f3e0d
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
.light
.light
=
commit_author_link
(
commit
,
avatar:
false
)
=
commit_author_link
(
commit
,
avatar:
false
)
authored
authored
#{
time_ago_with_tooltip
(
commit
.
committed_date
,
skip_js:
true
)
}
#{
time_ago_with_tooltip
(
commit
.
committed_date
)
}
%td
.line-numbers
%td
.line-numbers
-
line_count
=
blame_group
[
:lines
].
count
-
line_count
=
blame_group
[
:lines
].
count
-
(
current_line
...
(
current_line
+
line_count
)).
each
do
|
i
|
-
(
current_line
...
(
current_line
+
line_count
)).
each
do
|
i
|
...
...
app/views/projects/commits/_commit.html.haml
View file @
538f3e0d
...
@@ -38,5 +38,5 @@
...
@@ -38,5 +38,5 @@
=
commit_author_link
(
commit
,
avatar:
true
,
size:
24
)
=
commit_author_link
(
commit
,
avatar:
true
,
size:
24
)
authored
authored
.committed_ago
.committed_ago
#{
time_ago_with_tooltip
(
commit
.
committed_date
,
skip_js:
true
)
}
#{
time_ago_with_tooltip
(
commit
.
committed_date
)
}
=
link_to_browse_code
(
project
,
commit
)
=
link_to_browse_code
(
project
,
commit
)
spec/helpers/application_helper_spec.rb
View file @
538f3e0d
...
@@ -263,29 +263,18 @@ describe ApplicationHelper do
...
@@ -263,29 +263,18 @@ describe ApplicationHelper do
end
end
it
'includes a default js-timeago class'
do
it
'includes a default js-timeago class'
do
expect
(
element
.
attr
(
'class'
)).
to
eq
'time_ago js-timeago
js-timeago-pending
'
expect
(
element
.
attr
(
'class'
)).
to
eq
'time_ago js-timeago'
end
end
it
'accepts a custom html_class'
do
it
'accepts a custom html_class'
do
expect
(
element
(
html_class:
'custom_class'
).
attr
(
'class'
)).
expect
(
element
(
html_class:
'custom_class'
).
attr
(
'class'
)).
to
eq
'custom_class js-timeago
js-timeago-pending
'
to
eq
'custom_class js-timeago'
end
end
it
'accepts a custom tooltip placement'
do
it
'accepts a custom tooltip placement'
do
expect
(
element
(
placement:
'bottom'
).
attr
(
'data-placement'
)).
to
eq
'bottom'
expect
(
element
(
placement:
'bottom'
).
attr
(
'data-placement'
)).
to
eq
'bottom'
end
end
it
're-initializes timeago Javascript'
do
el
=
element
.
next_element
expect
(
el
.
name
).
to
eq
'script'
expect
(
el
.
text
).
to
include
"$('.js-timeago-pending').removeClass('js-timeago-pending').timeago()"
end
it
'allows the script tag to be excluded'
do
expect
(
element
(
skip_js:
true
)).
not_to
include
'script'
end
it
'converts to Time'
do
it
'converts to Time'
do
expect
{
helper
.
time_ago_with_tooltip
(
Date
.
today
)
}.
not_to
raise_error
expect
{
helper
.
time_ago_with_tooltip
(
Date
.
today
)
}.
not_to
raise_error
end
end
...
...
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