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
iv
gitlab-ce
Commits
a9d19fa8
Commit
a9d19fa8
authored
Dec 16, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
parents
259a7d7b
8e9f740d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+6
-2
spec/helpers/application_helper_spec.rb
spec/helpers/application_helper_spec.rb
+4
-3
No files found.
app/helpers/application_helper.rb
View file @
a9d19fa8
...
@@ -204,12 +204,16 @@ module ApplicationHelper
...
@@ -204,12 +204,16 @@ module ApplicationHelper
# 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'
,
skip_js:
false
)
element
=
content_tag
:time
,
time
.
to_s
,
element
=
content_tag
:time
,
time
.
to_s
,
class:
"
#{
html_class
}
js-timeago"
,
class:
"
#{
html_class
}
js-timeago
js-timeago-pending
"
,
datetime:
time
.
getutc
.
iso8601
,
datetime:
time
.
getutc
.
iso8601
,
title:
time
.
in_time_zone
.
stamp
(
'Aug 21, 2011 9:23pm'
),
title:
time
.
in_time_zone
.
stamp
(
'Aug 21, 2011 9:23pm'
),
data:
{
toggle:
'tooltip'
,
placement:
placement
,
container:
'body'
}
data:
{
toggle:
'tooltip'
,
placement:
placement
,
container:
'body'
}
element
+=
javascript_tag
"$('.js-timeago').last().timeago()"
unless
skip_js
unless
skip_js
element
<<
javascript_tag
(
"$('.js-timeago-pending').removeClass('js-timeago-pending').timeago()"
)
end
element
element
end
end
...
...
spec/helpers/application_helper_spec.rb
View file @
a9d19fa8
...
@@ -263,11 +263,12 @@ describe ApplicationHelper do
...
@@ -263,11 +263,12 @@ 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'
expect
(
element
.
attr
(
'class'
)).
to
eq
'time_ago js-timeago
js-timeago-pending
'
end
end
it
'accepts a custom html_class'
do
it
'accepts a custom html_class'
do
expect
(
element
(
html_class:
'custom_class'
).
attr
(
'class'
)).
to
eq
'custom_class js-timeago'
expect
(
element
(
html_class:
'custom_class'
).
attr
(
'class'
)).
to
eq
'custom_class js-timeago js-timeago-pending'
end
end
it
'accepts a custom tooltip placement'
do
it
'accepts a custom tooltip placement'
do
...
@@ -278,7 +279,7 @@ describe ApplicationHelper do
...
@@ -278,7 +279,7 @@ describe ApplicationHelper do
el
=
element
.
next_element
el
=
element
.
next_element
expect
(
el
.
name
).
to
eq
'script'
expect
(
el
.
name
).
to
eq
'script'
expect
(
el
.
text
).
to
include
"$('.js-timeago
').last(
).timeago()"
expect
(
el
.
text
).
to
include
"$('.js-timeago
-pending').removeClass('js-timeago-pending'
).timeago()"
end
end
it
'allows the script tag to be excluded'
do
it
'allows the script tag to be excluded'
do
...
...
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