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
...
@@ -206,7 +206,7 @@ module ApplicationHelper
element
=
content_tag
:time
,
time
.
to_s
,
element
=
content_tag
:time
,
time
.
to_s
,
class:
"
#{
html_class
}
js-timeago js-timeago-pending"
,
class:
"
#{
html_class
}
js-timeago js-timeago-pending"
,
datetime:
time
.
getutc
.
iso8601
,
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'
}
data:
{
toggle:
'tooltip'
,
placement:
placement
,
container:
'body'
}
unless
skip_js
unless
skip_js
...
...
app/models/global_milestone.rb
View file @
fa36749b
...
@@ -121,9 +121,9 @@ class GlobalMilestone
...
@@ -121,9 +121,9 @@ class GlobalMilestone
def
expires_at
def
expires_at
if
due_date
if
due_date
if
due_date
.
past?
if
due_date
.
past?
"expired
at
#{
due_date
.
strftime
(
'%b %-d, %Y'
)
}
"
"expired
on
#{
due_date
.
to_s
(
:medium
)
}
"
else
else
"expires
at
#{
due_date
.
strftime
(
'%b %-d, %Y'
)
}
"
"expires
on
#{
due_date
.
to_s
(
:medium
)
}
"
end
end
end
end
end
end
...
...
app/models/milestone.rb
View file @
fa36749b
...
@@ -112,9 +112,9 @@ class Milestone < ActiveRecord::Base
...
@@ -112,9 +112,9 @@ class Milestone < ActiveRecord::Base
def
expires_at
def
expires_at
if
due_date
if
due_date
if
due_date
.
past?
if
due_date
.
past?
"expired
at
#{
due_date
.
strftime
(
'%b %-d, %Y'
)
}
"
"expired
on
#{
due_date
.
to_s
(
:medium
)
}
"
else
else
"expires
at
#{
due_date
.
strftime
(
'%b %-d, %Y'
)
}
"
"expires
on
#{
due_date
.
to_s
(
:medium
)
}
"
end
end
end
end
end
end
...
...
app/views/admin/groups/show.html.haml
View file @
fa36749b
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
%li
%li
%span
.light
Created on:
%span
.light
Created on:
%strong
%strong
=
@group
.
created_at
.
strftime
(
'%B %-d, %Y'
)
=
@group
.
created_at
.
to_s
(
:medium
)
.panel.panel-default
.panel.panel-default
.panel-heading
.panel-heading
...
...
app/views/admin/projects/show.html.haml
View file @
fa36749b
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
%li
%li
%span
.light
Created on:
%span
.light
Created on:
%strong
%strong
=
@project
.
created_at
.
strftime
(
'%B %-d, %Y'
)
=
@project
.
created_at
.
to_s
(
:medium
)
%li
%li
%span
.light
http:
%span
.light
http:
...
...
app/views/admin/users/_profile.html.haml
View file @
fa36749b
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
%ul
.well-list
%ul
.well-list
%li
%li
%span
.light
Member since
%span
.light
Member since
%strong
=
user
.
created_at
.
strftime
(
'%b %-d, %Y'
)
%strong
=
user
.
created_at
.
to_s
(
:medium
)
-
unless
user
.
public_email
.
blank?
-
unless
user
.
public_email
.
blank?
%li
%li
%span
.light
E-mail:
%span
.light
E-mail:
...
...
app/views/admin/users/show.html.haml
View file @
fa36749b
...
@@ -58,12 +58,12 @@
...
@@ -58,12 +58,12 @@
%li
%li
%span
.light
Member since:
%span
.light
Member since:
%strong
%strong
=
@user
.
created_at
.
strftime
(
'%b %-d, %Y'
)
=
@user
.
created_at
.
to_s
(
:medium
)
-
if
@user
.
confirmed_at
-
if
@user
.
confirmed_at
%li
%li
%span
.light
Confirmed at:
%span
.light
Confirmed at:
%strong
%strong
=
@user
.
confirmed_at
.
strftime
(
'%b %-d, %Y'
)
=
@user
.
confirmed_at
.
to_s
(
:medium
)
-
else
-
else
%li
%li
%span
.light
Confirmed:
%span
.light
Confirmed:
...
@@ -74,7 +74,7 @@
...
@@ -74,7 +74,7 @@
%span
.light
Current sign-in at:
%span
.light
Current sign-in at:
%strong
%strong
-
if
@user
.
current_sign_in_at
-
if
@user
.
current_sign_in_at
=
@user
.
current_sign_in_at
.
strftime
(
'%b %-d, %Y'
)
=
@user
.
current_sign_in_at
.
to_s
(
:medium
)
-
else
-
else
never
never
...
@@ -82,7 +82,7 @@
...
@@ -82,7 +82,7 @@
%span
.light
Last sign-in at:
%span
.light
Last sign-in at:
%strong
%strong
-
if
@user
.
last_sign_in_at
-
if
@user
.
last_sign_in_at
=
@user
.
last_sign_in_at
.
strftime
(
'%b %-d, %Y'
)
=
@user
.
last_sign_in_at
.
to_s
(
:medium
)
-
else
-
else
never
never
...
...
app/views/profiles/keys/_key_details.html.haml
View file @
fa36749b
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
%strong
=
@key
.
title
%strong
=
@key
.
title
%li
%li
%span
.light
Created on:
%span
.light
Created on:
%strong
=
@key
.
created_at
.
strftime
(
'%b %-d, %Y'
)
%strong
=
@key
.
created_at
.
to_s
(
:medium
)
.col-md-8
.col-md-8
%p
%p
...
...
app/views/users/show.html.haml
View file @
fa36749b
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
%span
%span
#{
@user
.
bio
}
.
#{
@user
.
bio
}
.
%span
%span
Member since
#{
@user
.
created_at
.
strftime
(
'%b %d, %Y'
)
}
Member since
#{
@user
.
created_at
.
to_s
(
:medium
)
}
.cover-desc
.cover-desc
-
unless
@user
.
public_email
.
blank?
-
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
...
@@ -240,7 +240,7 @@ describe ApplicationHelper do
describe
'time_ago_with_tooltip'
do
describe
'time_ago_with_tooltip'
do
def
element
(
*
arguments
)
def
element
(
*
arguments
)
Time
.
zone
=
'UTC'
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
)
element
=
helper
.
time_ago_with_tooltip
(
time
,
*
arguments
)
Nokogiri
::
HTML
::
DocumentFragment
.
parse
(
element
).
first_element_child
Nokogiri
::
HTML
::
DocumentFragment
.
parse
(
element
).
first_element_child
...
@@ -251,15 +251,15 @@ describe ApplicationHelper do
...
@@ -251,15 +251,15 @@ describe ApplicationHelper do
end
end
it
'includes the date string'
do
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
end
it
'has a datetime attribute'
do
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
end
it
'has a formatted title attribute'
do
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
end
it
'includes a default js-timeago class'
do
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