BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
cd1d045f
Commit
cd1d045f
authored
Mar 09, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issue with timeago not firing
parent
12506abf
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
7 deletions
+24
-7
application_helper.rb
app/helpers/application_helper.rb
+8
-2
_last_commit.html.haml
app/views/projects/_last_commit.html.haml
+1
-1
show.html.haml
app/views/projects/blame/show.html.haml
+1
-1
_commit.html.haml
app/views/projects/commits/_commit.html.haml
+1
-1
application_helper_spec.rb
spec/helpers/application_helper_spec.rb
+13
-2
No files found.
app/helpers/application_helper.rb
View file @
cd1d045f
...
...
@@ -179,13 +179,19 @@ module ApplicationHelper
# `html_class` argument is provided.
#
# Returns an HTML-safe String
def
time_ago_with_tooltip
(
time
,
placement:
'top'
,
html_class:
'time_ago'
)
def
time_ago_with_tooltip
(
time
,
placement:
'top'
,
html_class:
'time_ago'
,
skip_js:
false
)
element
=
content_tag
:time
,
time
.
to_s
,
class:
"
#{
html_class
}
js-timeago"
,
class:
"
#{
html_class
}
js-timeago
#{
"js-timeago-pending"
unless
skip_js
}
"
,
datetime:
time
.
to_time
.
getutc
.
iso8601
,
title:
time
.
in_time_zone
.
to_s
(
:medium
),
data:
{
toggle:
'tooltip'
,
placement:
placement
,
container:
'body'
}
unless
skip_js
element
<<
javascript_tag
(
"$('.js-timeago-pending').removeClass('js-timeago-pending').timeago()"
)
end
element
end
...
...
app/views/projects/_last_commit.html.haml
View file @
cd1d045f
...
...
@@ -8,5 +8,5 @@
=
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"
·
#{
time_ago_with_tooltip
(
commit
.
committed_date
)
}
by
#{
time_ago_with_tooltip
(
commit
.
committed_date
,
skip_js:
true
)
}
by
=
commit_author_link
(
commit
,
avatar:
true
,
size:
24
)
app/views/projects/blame/show.html.haml
View file @
cd1d045f
...
...
@@ -29,7 +29,7 @@
.light
=
commit_author_link
(
commit
,
avatar:
false
)
authored
#{
time_ago_with_tooltip
(
commit
.
committed_date
)
}
#{
time_ago_with_tooltip
(
commit
.
committed_date
,
skip_js:
true
)
}
%td
.line-numbers
-
line_count
=
blame_group
[
:lines
].
count
-
(
current_line
...
(
current_line
+
line_count
)).
each
do
|
i
|
...
...
app/views/projects/commits/_commit.html.haml
View file @
cd1d045f
...
...
@@ -38,5 +38,5 @@
=
commit_author_link
(
commit
,
avatar:
true
,
size:
24
)
authored
.committed_ago
#{
time_ago_with_tooltip
(
commit
.
committed_date
)
}
#{
time_ago_with_tooltip
(
commit
.
committed_date
,
skip_js:
true
)
}
=
link_to_browse_code
(
project
,
commit
)
spec/helpers/application_helper_spec.rb
View file @
cd1d045f
...
...
@@ -263,18 +263,29 @@ describe ApplicationHelper do
end
it
'includes a default js-timeago class'
do
expect
(
element
.
attr
(
'class'
)).
to
eq
'time_ago js-timeago'
expect
(
element
.
attr
(
'class'
)).
to
eq
'time_ago js-timeago
js-timeago-pending
'
end
it
'accepts a custom html_class'
do
expect
(
element
(
html_class:
'custom_class'
).
attr
(
'class'
)).
to
eq
'custom_class js-timeago'
to
eq
'custom_class js-timeago
js-timeago-pending
'
end
it
'accepts a custom tooltip placement'
do
expect
(
element
(
placement:
'bottom'
).
attr
(
'data-placement'
)).
to
eq
'bottom'
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
expect
{
helper
.
time_ago_with_tooltip
(
Date
.
today
)
}.
not_to
raise_error
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