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
Boxiang Sun
gitlab-ce
Commits
fa36749b
Commit
fa36749b
authored
Jan 06, 2016
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add two custom Date/Time conversion formats
parent
59305715
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
27 additions
and
18 deletions
+27
-18
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+1
-1
app/models/global_milestone.rb
app/models/global_milestone.rb
+2
-2
app/models/milestone.rb
app/models/milestone.rb
+2
-2
app/views/admin/groups/show.html.haml
app/views/admin/groups/show.html.haml
+1
-1
app/views/admin/projects/show.html.haml
app/views/admin/projects/show.html.haml
+1
-1
app/views/admin/users/_profile.html.haml
app/views/admin/users/_profile.html.haml
+1
-1
app/views/admin/users/show.html.haml
app/views/admin/users/show.html.haml
+4
-4
app/views/profiles/keys/_key_details.html.haml
app/views/profiles/keys/_key_details.html.haml
+1
-1
app/views/users/show.html.haml
app/views/users/show.html.haml
+1
-1
config/initializers/date_time_formats.rb
config/initializers/date_time_formats.rb
+9
-0
spec/helpers/application_helper_spec.rb
spec/helpers/application_helper_spec.rb
+4
-4
No files found.
app/helpers/application_helper.rb
View file @
fa36749b
...
...
@@ -206,7 +206,7 @@ module ApplicationHelper
element
=
content_tag
:time
,
time
.
to_s
,
class:
"
#{
html_class
}
js-timeago js-timeago-pending"
,
datetime:
time
.
getutc
.
iso8601
,
title:
time
.
in_time_zone
.
strftime
(
'%b %-d, %Y %-I:%m%P'
),
# Aug 1, 2011 9:23pm
title:
time
.
in_time_zone
.
to_s
(
:medium
),
data:
{
toggle:
'tooltip'
,
placement:
placement
,
container:
'body'
}
unless
skip_js
...
...
app/models/global_milestone.rb
View file @
fa36749b
...
...
@@ -121,9 +121,9 @@ class GlobalMilestone
def
expires_at
if
due_date
if
due_date
.
past?
"expired
at
#{
due_date
.
strftime
(
'%b %-d, %Y'
)
}
"
"expired
on
#{
due_date
.
to_s
(
:medium
)
}
"
else
"expires
at
#{
due_date
.
strftime
(
'%b %-d, %Y'
)
}
"
"expires
on
#{
due_date
.
to_s
(
:medium
)
}
"
end
end
end
...
...
app/models/milestone.rb
View file @
fa36749b
...
...
@@ -112,9 +112,9 @@ class Milestone < ActiveRecord::Base
def
expires_at
if
due_date
if
due_date
.
past?
"expired
at
#{
due_date
.
strftime
(
'%b %-d, %Y'
)
}
"
"expired
on
#{
due_date
.
to_s
(
:medium
)
}
"
else
"expires
at
#{
due_date
.
strftime
(
'%b %-d, %Y'
)
}
"
"expires
on
#{
due_date
.
to_s
(
:medium
)
}
"
end
end
end
...
...
app/views/admin/groups/show.html.haml
View file @
fa36749b
...
...
@@ -30,7 +30,7 @@
%li
%span
.light
Created on:
%strong
=
@group
.
created_at
.
strftime
(
'%B %-d, %Y'
)
=
@group
.
created_at
.
to_s
(
:medium
)
.panel.panel-default
.panel-heading
...
...
app/views/admin/projects/show.html.haml
View file @
fa36749b
...
...
@@ -38,7 +38,7 @@
%li
%span
.light
Created on:
%strong
=
@project
.
created_at
.
strftime
(
'%B %-d, %Y'
)
=
@project
.
created_at
.
to_s
(
:medium
)
%li
%span
.light
http:
...
...
app/views/admin/users/_profile.html.haml
View file @
fa36749b
...
...
@@ -4,7 +4,7 @@
%ul
.well-list
%li
%span
.light
Member since
%strong
=
user
.
created_at
.
strftime
(
'%b %-d, %Y'
)
%strong
=
user
.
created_at
.
to_s
(
:medium
)
-
unless
user
.
public_email
.
blank?
%li
%span
.light
E-mail:
...
...
app/views/admin/users/show.html.haml
View file @
fa36749b
...
...
@@ -58,12 +58,12 @@
%li
%span
.light
Member since:
%strong
=
@user
.
created_at
.
strftime
(
'%b %-d, %Y'
)
=
@user
.
created_at
.
to_s
(
:medium
)
-
if
@user
.
confirmed_at
%li
%span
.light
Confirmed at:
%strong
=
@user
.
confirmed_at
.
strftime
(
'%b %-d, %Y'
)
=
@user
.
confirmed_at
.
to_s
(
:medium
)
-
else
%li
%span
.light
Confirmed:
...
...
@@ -74,7 +74,7 @@
%span
.light
Current sign-in at:
%strong
-
if
@user
.
current_sign_in_at
=
@user
.
current_sign_in_at
.
strftime
(
'%b %-d, %Y'
)
=
@user
.
current_sign_in_at
.
to_s
(
:medium
)
-
else
never
...
...
@@ -82,7 +82,7 @@
%span
.light
Last sign-in at:
%strong
-
if
@user
.
last_sign_in_at
=
@user
.
last_sign_in_at
.
strftime
(
'%b %-d, %Y'
)
=
@user
.
last_sign_in_at
.
to_s
(
:medium
)
-
else
never
...
...
app/views/profiles/keys/_key_details.html.haml
View file @
fa36749b
...
...
@@ -10,7 +10,7 @@
%strong
=
@key
.
title
%li
%span
.light
Created on:
%strong
=
@key
.
created_at
.
strftime
(
'%b %-d, %Y'
)
%strong
=
@key
.
created_at
.
to_s
(
:medium
)
.col-md-8
%p
...
...
app/views/users/show.html.haml
View file @
fa36749b
...
...
@@ -21,7 +21,7 @@
%span
#{
@user
.
bio
}
.
%span
Member since
#{
@user
.
created_at
.
strftime
(
'%b %d, %Y'
)
}
Member since
#{
@user
.
created_at
.
to_s
(
:medium
)
}
.cover-desc
-
unless
@user
.
public_email
.
blank?
...
...
config/initializers/date_time_formats.rb
0 → 100644
View file @
fa36749b
# :short - 10 Nov
# :medium - Nov 10, 2007
# :long - November 10, 2007
Date
::
DATE_FORMATS
[
:medium
]
=
'%b %-d, %Y'
# :short - 18 Jan 06:10
# :medium - Jan 18, 2007 6:10am
# :long - January 18, 2007 06:10
Time
::
DATE_FORMATS
[
:medium
]
=
'%b %-d, %Y %-I:%M%P'
spec/helpers/application_helper_spec.rb
View file @
fa36749b
...
...
@@ -240,7 +240,7 @@ describe ApplicationHelper do
describe
'time_ago_with_tooltip'
do
def
element
(
*
arguments
)
Time
.
zone
=
'UTC'
time
=
Time
.
zone
.
parse
(
'2015-07-02 08:
00
'
)
time
=
Time
.
zone
.
parse
(
'2015-07-02 08:
23
'
)
element
=
helper
.
time_ago_with_tooltip
(
time
,
*
arguments
)
Nokogiri
::
HTML
::
DocumentFragment
.
parse
(
element
).
first_element_child
...
...
@@ -251,15 +251,15 @@ describe ApplicationHelper do
end
it
'includes the date string'
do
expect
(
element
.
text
).
to
eq
'2015-07-02 08:
00
:00 UTC'
expect
(
element
.
text
).
to
eq
'2015-07-02 08:
23
:00 UTC'
end
it
'has a datetime attribute'
do
expect
(
element
.
attr
(
'datetime'
)).
to
eq
'2015-07-02T08:
00
:00Z'
expect
(
element
.
attr
(
'datetime'
)).
to
eq
'2015-07-02T08:
23
:00Z'
end
it
'has a formatted title attribute'
do
expect
(
element
.
attr
(
'title'
)).
to
eq
'Jul
02, 2015 8:00
am'
expect
(
element
.
attr
(
'title'
)).
to
eq
'Jul
2, 2015 8:23
am'
end
it
'includes a default js-timeago class'
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