playbook_ui 7.4.0 → 7.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/images/clark.jpg +0 -0
- data/app/assets/images/giant.jpg +0 -0
- data/app/assets/images/pb.logo.svg +28 -0
- data/app/assets/images/sample_screenshot.svg +7 -0
- data/app/pb_kits/playbook/_playbook.scss +1 -0
- data/app/pb_kits/playbook/data/menu.yml +1 -6
- data/app/pb_kits/playbook/index.js +2 -0
- data/app/pb_kits/playbook/pb_background/_background.html.erb +18 -12
- data/app/pb_kits/playbook/pb_background/_background.jsx +14 -10
- data/app/pb_kits/playbook/pb_background/docs/_background_dark.jsx +4 -6
- data/app/pb_kits/playbook/pb_background/docs/_background_gradient.jsx +4 -6
- data/app/pb_kits/playbook/pb_background/docs/_background_image.jsx +20 -22
- data/app/pb_kits/playbook/pb_background/docs/_background_light.jsx +4 -6
- data/app/pb_kits/playbook/pb_background/docs/_background_white.jsx +1 -1
- data/app/pb_kits/playbook/pb_checkbox/_checkbox.html.erb +1 -1
- data/app/pb_kits/playbook/pb_image/_image.html.erb +2 -1
- data/app/pb_kits/playbook/pb_image/_image.jsx +7 -1
- data/app/pb_kits/playbook/pb_image/_image.scss +41 -14
- data/app/pb_kits/playbook/pb_image/docs/_default_image.html.erb +12 -0
- data/app/pb_kits/playbook/pb_image/docs/_default_image.jsx +25 -3
- data/app/pb_kits/playbook/pb_image/docs/_rounded_image.html.erb +17 -0
- data/app/pb_kits/playbook/pb_image/docs/_rounded_image.jsx +36 -0
- data/app/pb_kits/playbook/pb_image/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_image/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_image/image.rb +16 -1
- data/app/pb_kits/playbook/pb_list/_list.jsx +9 -2
- data/app/pb_kits/playbook/pb_selectable_card/docs/_selectable_card_image.html.erb +27 -0
- data/app/pb_kits/playbook/pb_selectable_card/docs/_selectable_card_image.jsx +61 -0
- data/app/pb_kits/playbook/pb_selectable_card/docs/_selectable_card_image.md +1 -0
- data/app/pb_kits/playbook/pb_selectable_card/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_selectable_card/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_selectable_list/_item.jsx +90 -0
- data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.html.erb +11 -0
- data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.jsx +47 -0
- data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.scss +17 -0
- data/app/pb_kits/playbook/pb_selectable_list/_selectable_list_item.html.erb +18 -0
- data/app/pb_kits/playbook/pb_selectable_list/docs/_selectable_list_checkbox.html.erb +27 -0
- data/app/pb_kits/playbook/pb_selectable_list/docs/_selectable_list_checkbox.jsx +29 -0
- data/app/pb_kits/playbook/pb_selectable_list/docs/_selectable_list_radio.html.erb +27 -0
- data/app/pb_kits/playbook/pb_selectable_list/docs/_selectable_list_radio.jsx +29 -0
- data/app/pb_kits/playbook/pb_selectable_list/docs/example.yml +12 -0
- data/app/pb_kits/playbook/pb_selectable_list/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list.rb +24 -0
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.rb +28 -0
- data/app/pb_kits/playbook/pb_timestamp/_timestamp.html.erb +1 -13
- data/app/pb_kits/playbook/pb_timestamp/_timestamp.jsx +20 -96
- data/app/pb_kits/playbook/pb_timestamp/_timestamp.scss +1 -12
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_default.html.erb +1 -21
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_default.jsx +4 -31
- data/app/pb_kits/playbook/pb_timestamp/docs/example.yml +0 -14
- data/app/pb_kits/playbook/pb_timestamp/docs/index.js +0 -7
- data/app/pb_kits/playbook/pb_timestamp/timestamp.rb +1 -67
- data/lib/playbook/version.rb +1 -1
- metadata +29 -6
@@ -0,0 +1,29 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { SelectableList } from '../..'
|
3
|
+
|
4
|
+
const SelectableListDefault = () => {
|
5
|
+
return (
|
6
|
+
<div>
|
7
|
+
<SelectableList variant="checkbox">
|
8
|
+
<SelectableList.Item
|
9
|
+
label="Mild"
|
10
|
+
name="checkbox-name-1"
|
11
|
+
value="1"
|
12
|
+
/>
|
13
|
+
<SelectableList.Item
|
14
|
+
checked
|
15
|
+
label="Medium"
|
16
|
+
name="checkbox-name-2"
|
17
|
+
value="2"
|
18
|
+
/>
|
19
|
+
<SelectableList.Item
|
20
|
+
label="Hot"
|
21
|
+
name="checkbox-name-3"
|
22
|
+
value="3"
|
23
|
+
/>
|
24
|
+
</SelectableList>
|
25
|
+
</div>
|
26
|
+
)
|
27
|
+
}
|
28
|
+
|
29
|
+
export default SelectableListDefault
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%= pb_rails("selectable_list",
|
2
|
+
props: {
|
3
|
+
variant: "radio",
|
4
|
+
items: [
|
5
|
+
{ text: "Small",
|
6
|
+
input_options: {
|
7
|
+
value: "1",
|
8
|
+
name: "radio-name",
|
9
|
+
}
|
10
|
+
},
|
11
|
+
{ text: "Medium",
|
12
|
+
checked: true,
|
13
|
+
input_options: {
|
14
|
+
value: "2",
|
15
|
+
name: "radio-name",
|
16
|
+
}
|
17
|
+
},
|
18
|
+
{ text: "Large",
|
19
|
+
input_options: {
|
20
|
+
value: "3",
|
21
|
+
name: "radio-name",
|
22
|
+
}
|
23
|
+
}
|
24
|
+
]
|
25
|
+
}
|
26
|
+
)
|
27
|
+
%>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { SelectableList } from '../..'
|
3
|
+
|
4
|
+
const SelectableListDefault = () => {
|
5
|
+
return (
|
6
|
+
<div>
|
7
|
+
<SelectableList variant="radio">
|
8
|
+
<SelectableList.Item
|
9
|
+
label="Small"
|
10
|
+
name="radio"
|
11
|
+
value="1"
|
12
|
+
/>
|
13
|
+
<SelectableList.Item
|
14
|
+
defaultChecked
|
15
|
+
label="Medium"
|
16
|
+
name="radio"
|
17
|
+
value="2"
|
18
|
+
/>
|
19
|
+
<SelectableList.Item
|
20
|
+
label="Large"
|
21
|
+
name="radio"
|
22
|
+
value="3"
|
23
|
+
/>
|
24
|
+
</SelectableList>
|
25
|
+
</div>
|
26
|
+
)
|
27
|
+
}
|
28
|
+
|
29
|
+
export default SelectableListDefault
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module PbSelectableList
|
5
|
+
class SelectableList
|
6
|
+
include Playbook::Props
|
7
|
+
|
8
|
+
partial "pb_selectable_list/selectable_list"
|
9
|
+
|
10
|
+
prop :variant, type: Playbook::Props::Enum,
|
11
|
+
values: %w[radio checkbox],
|
12
|
+
default: "checkbox"
|
13
|
+
|
14
|
+
prop :text, type: Playbook::Props::String
|
15
|
+
|
16
|
+
prop :items, type: Playbook::Props::Array,
|
17
|
+
default: []
|
18
|
+
|
19
|
+
def classname
|
20
|
+
generate_classname("pb_selectable_list_kit")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module PbSelectableList
|
5
|
+
class SelectableListItem
|
6
|
+
include Playbook::Props
|
7
|
+
|
8
|
+
prop :tabindex
|
9
|
+
|
10
|
+
prop :checked, type: Playbook::Props::Boolean,
|
11
|
+
default: false
|
12
|
+
prop :name, type: Playbook::Props::String
|
13
|
+
prop :text, type: Playbook::Props::String
|
14
|
+
prop :value, type: Playbook::Props::String
|
15
|
+
prop :variant, type: Playbook::Props::Enum,
|
16
|
+
values: %w[radio checkbox],
|
17
|
+
default: "radio"
|
18
|
+
prop :input_options, type: Playbook::Props::Hash,
|
19
|
+
default: {}
|
20
|
+
|
21
|
+
partial "pb_selectable_list/selectable_list_item"
|
22
|
+
|
23
|
+
def classname
|
24
|
+
generate_classname("pb_selectable_list_item_kit")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -2,17 +2,5 @@
|
|
2
2
|
id: object.id,
|
3
3
|
data: object.data,
|
4
4
|
class: object.classname) do %>
|
5
|
-
|
6
|
-
<% case object.variant
|
7
|
-
when "updated" %>
|
8
|
-
<%= pb_rails("caption", props: { text: object.format_updated_string, size: 'xs', dark: object.dark }) %>
|
9
|
-
<% when "elapsed" %>
|
10
|
-
<%= pb_rails("caption", props: { text: object.format_updated_string, size: 'xs', dark: object.dark }) %>
|
11
|
-
<% else %>
|
12
|
-
<% if object.show_date %>
|
13
|
-
<%= pb_rails("caption", props: { text: object.format_datetime_string, size: 'xs', dark: object.dark }) %>
|
14
|
-
<% else %>
|
15
|
-
<%= pb_rails("caption", props: { text: object.format_time_string, size: 'xs', dark: object.dark }) %>
|
16
|
-
<% end %>
|
17
|
-
<% end %>
|
5
|
+
<%= pb_rails("caption", props: { text: object.text, tag: 'span', size: 'xs' }) %>
|
18
6
|
<% end %>
|
@@ -2,112 +2,36 @@
|
|
2
2
|
|
3
3
|
import React from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
|
-
|
6
|
-
import { buildCss } from '../utilities/props'
|
5
|
+
|
7
6
|
import { Caption } from '../'
|
7
|
+
|
8
|
+
import { buildCss, buildDataProps } from '../utilities/props'
|
9
|
+
|
8
10
|
import { globalProps } from '../utilities/globalProps.js'
|
9
11
|
|
10
12
|
type TimestampProps = {
|
11
|
-
align?: "left" | "center" | "right",
|
12
|
-
className?: string | array<string>,
|
13
|
-
dark?: boolean,
|
14
|
-
data?: string,
|
15
|
-
text: string,
|
16
|
-
timestamp: string,
|
17
|
-
timezone: string,
|
18
13
|
id?: string,
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
variant?: "default" | "elapsed" | "updated"
|
14
|
+
data?: object,
|
15
|
+
className?: string,
|
16
|
+
text?: string,
|
23
17
|
}
|
24
18
|
|
25
19
|
const Timestamp = (props: TimestampProps) => {
|
26
|
-
const {
|
27
|
-
|
28
|
-
|
29
|
-
dark = false,
|
30
|
-
text,
|
31
|
-
timestamp,
|
32
|
-
timezone,
|
33
|
-
showDate = true,
|
34
|
-
showUser = false,
|
35
|
-
showTimezone = false,
|
36
|
-
variant = 'default',
|
37
|
-
} = props
|
38
|
-
const classes = classnames(
|
39
|
-
buildCss('pb_timestamp_kit', align, {
|
40
|
-
dark: dark,
|
41
|
-
variant: variant,
|
42
|
-
}),
|
43
|
-
globalProps(props),
|
44
|
-
className
|
45
|
-
)
|
46
|
-
|
47
|
-
const currentYear = new Date().getFullYear().toString()
|
48
|
-
const dateTimestamp = new DateTime({ value: timestamp, zone: timezone })
|
49
|
-
const dateDisplay = dateTimestamp.toMonth() + ' ' + dateTimestamp.toDay()
|
50
|
-
const timeDisplay = dateTimestamp.toHour() + ':' + dateTimestamp.toMinute() + dateTimestamp.toMeridian()
|
51
|
-
|
52
|
-
var fullTimeDisplay = function fullTimeDisplay(dateTimestamp, timeDisplay, timezone, showTimezone) {
|
53
|
-
if (showTimezone == 'true' && timezone.length > 0) {
|
54
|
-
timeDisplay = timeDisplay + ' ' + dateTimestamp.toTimezone()
|
55
|
-
}
|
56
|
-
return timeDisplay
|
57
|
-
}
|
58
|
-
|
59
|
-
var fullDateDisplay = function fullDateDisplay(dateTimestamp, currentYear, dateDisplay, timezone, showTimezone) {
|
60
|
-
var fullDisplay = dateTimestamp.toMonth() + ' ' + dateTimestamp.toDay()
|
61
|
-
if (dateTimestamp.toYear() > currentYear) {
|
62
|
-
fullDisplay = fullDisplay + ', ' + dateTimestamp.toYear().toString()
|
63
|
-
}
|
64
|
-
return fullDisplay + ' \u00b7 ' + fullTimeDisplay(dateTimestamp, timeDisplay, timezone, showTimezone)
|
65
|
-
}
|
66
|
-
|
67
|
-
var fullElapsedDisplay = function fullElapsedDisplay(showUser, text, dateTimestamp){
|
68
|
-
var userDisplay = (showUser == 'true' && text.length > 0) ? ' by ' + text : ''
|
69
|
-
return 'Last updated' + userDisplay + ' ' + dateTimestamp.value.fromNow()
|
70
|
-
}
|
71
|
-
|
72
|
-
var fullUpdatedDisplay = function fullUpdatedDisplay(showUser, text, timeDisplay, timezone, showTimezone){
|
73
|
-
var userDisplay = (showUser == 'true' && text.length > 0) ? ' by ' + text : ''
|
74
|
-
return 'Last updated' + userDisplay + ' at ' + fullTimeDisplay(dateTimestamp, timeDisplay, timezone, showTimezone)
|
75
|
-
}
|
20
|
+
const { id, className, data = {}, text } = props
|
21
|
+
const dataProps = buildDataProps(data)
|
22
|
+
const pbCss = buildCss('pb_timestamp_kit')
|
76
23
|
|
77
24
|
return (
|
78
|
-
<div
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
<Caption
|
89
|
-
dark={dark}
|
90
|
-
size="xs"
|
91
|
-
text={fullElapsedDisplay(showUser, text, dateTimestamp)}
|
92
|
-
/>
|
93
|
-
</If>
|
94
|
-
<If condition={variant == 'default'}>
|
95
|
-
<If condition={showDate == 'true'}>
|
96
|
-
<Caption
|
97
|
-
dark={dark}
|
98
|
-
size="xs"
|
99
|
-
text={fullDateDisplay(dateTimestamp, currentYear, dateDisplay, timezone, showTimezone)}
|
100
|
-
/>
|
101
|
-
</If>
|
102
|
-
<If condition={showDate == 'false'}>
|
103
|
-
<Caption
|
104
|
-
dark={dark}
|
105
|
-
size="xs"
|
106
|
-
text={timeDisplay}
|
107
|
-
/>
|
108
|
-
</If>
|
109
|
-
</If>
|
110
|
-
</div>
|
25
|
+
<div
|
26
|
+
{...dataProps}
|
27
|
+
className={classnames(pbCss, globalProps(props), className)}
|
28
|
+
id={id}
|
29
|
+
>
|
30
|
+
<Caption
|
31
|
+
size="xs"
|
32
|
+
tag="span"
|
33
|
+
text={text}
|
34
|
+
/>
|
111
35
|
</div>
|
112
36
|
)
|
113
37
|
}
|
@@ -1,16 +1,5 @@
|
|
1
1
|
@import "timestamp-mixins";
|
2
|
-
@import "../tokens/colors";
|
3
2
|
|
4
|
-
[class^=pb_timestamp_kit]{
|
3
|
+
[class^=pb_timestamp_kit] {
|
5
4
|
@include pb_timestamp;
|
6
|
-
|
7
|
-
&[class*=_center] {
|
8
|
-
text-align: center;
|
9
|
-
}
|
10
|
-
&[class*=_right] {
|
11
|
-
text-align: right;
|
12
|
-
}
|
13
|
-
&[class*=_dark] {
|
14
|
-
color: $text_dk_default;
|
15
|
-
}
|
16
5
|
}
|
@@ -1,21 +1 @@
|
|
1
|
-
<%= pb_rails("timestamp", props: {
|
2
|
-
timestamp: DateTime.now,
|
3
|
-
show_date: false,
|
4
|
-
align: "left"
|
5
|
-
}) %>
|
6
|
-
|
7
|
-
<br>
|
8
|
-
|
9
|
-
<%= pb_rails("timestamp", props: {
|
10
|
-
timestamp: DateTime.now,
|
11
|
-
show_date: true,
|
12
|
-
align: "left"
|
13
|
-
}) %>
|
14
|
-
|
15
|
-
<br>
|
16
|
-
|
17
|
-
<%= pb_rails("timestamp", props: {
|
18
|
-
timestamp: DateTime.now + 4.years,
|
19
|
-
show_date: true,
|
20
|
-
align: "left"
|
21
|
-
}) %>
|
1
|
+
<%= pb_rails("timestamp", props: { text: "20 seconds ago" }) %>
|
@@ -1,35 +1,8 @@
|
|
1
1
|
import React from 'react'
|
2
|
-
import Timestamp from '
|
2
|
+
import { Timestamp } from '../../'
|
3
3
|
|
4
|
-
const TimestampDefault = (
|
5
|
-
|
6
|
-
|
7
|
-
<Timestamp
|
8
|
-
align="left"
|
9
|
-
showDate="false"
|
10
|
-
timestamp={new Date().getTime()}
|
11
|
-
{...props}
|
12
|
-
/>
|
13
|
-
|
14
|
-
<br />
|
15
|
-
|
16
|
-
<Timestamp
|
17
|
-
align="left"
|
18
|
-
showDate="true"
|
19
|
-
timestamp={new Date().getTime()}
|
20
|
-
{...props}
|
21
|
-
/>
|
22
|
-
|
23
|
-
<br />
|
24
|
-
|
25
|
-
<Timestamp
|
26
|
-
align="left"
|
27
|
-
showDate="true"
|
28
|
-
timestamp={new Date((new Date()).getFullYear() + 4, (new Date().getMonth()), (new Date().getDate() + 1)).getTime()}
|
29
|
-
{...props}
|
30
|
-
/>
|
31
|
-
</div>
|
32
|
-
)
|
33
|
-
}
|
4
|
+
const TimestampDefault = () => (
|
5
|
+
<Timestamp text="20 seconds ago" />
|
6
|
+
)
|
34
7
|
|
35
8
|
export default TimestampDefault
|
@@ -2,20 +2,6 @@ examples:
|
|
2
2
|
|
3
3
|
rails:
|
4
4
|
- timestamp_default: Default
|
5
|
-
- timestamp_align: Alignments
|
6
|
-
- timestamp_timezones: Timezones
|
7
|
-
- timestamp_timezones_align: Timezones - Alignments
|
8
|
-
- timestamp_updated: Last Updated by
|
9
|
-
- timestamp_updated_align: Last Updated by - Alignments
|
10
|
-
- timestamp_elapsed: Time Ago
|
11
|
-
- timestamp_elapsed_align: Time Ago - Alignments
|
12
5
|
|
13
6
|
react:
|
14
7
|
- timestamp_default: Default
|
15
|
-
- timestamp_align: Alignments
|
16
|
-
- timestamp_timezones: Timezones
|
17
|
-
- timestamp_timezones_align: Timezones - Alignments
|
18
|
-
- timestamp_updated: Last Updated by
|
19
|
-
- timestamp_updated_align: Last Updated by - Alignments
|
20
|
-
- timestamp_elapsed: Time Ago
|
21
|
-
- timestamp_elapsed_align: Time Ago - Alignments
|
@@ -1,8 +1 @@
|
|
1
1
|
export { default as TimestampDefault } from './_timestamp_default.jsx'
|
2
|
-
export { default as TimestampAlign } from './_timestamp_align.jsx'
|
3
|
-
export { default as TimestampTimezones } from './_timestamp_timezones.jsx'
|
4
|
-
export { default as TimestampTimezonesAlign } from './_timestamp_timezones_align.jsx'
|
5
|
-
export { default as TimestampUpdated } from './_timestamp_updated.jsx'
|
6
|
-
export { default as TimestampUpdatedAlign } from './_timestamp_updated_align.jsx'
|
7
|
-
export { default as TimestampElapsed } from './_timestamp_elapsed.jsx'
|
8
|
-
export { default as TimestampElapsedAlign } from './_timestamp_elapsed_align.jsx'
|
@@ -3,80 +3,14 @@
|
|
3
3
|
module Playbook
|
4
4
|
module PbTimestamp
|
5
5
|
class Timestamp
|
6
|
-
include ActionView::Helpers::DateHelper
|
7
6
|
include Playbook::Props
|
8
7
|
|
9
8
|
partial "pb_timestamp/timestamp"
|
10
9
|
|
11
10
|
prop :text
|
12
|
-
prop :timestamp, required: true
|
13
|
-
|
14
|
-
prop :dark, type: Playbook::Props::Boolean,
|
15
|
-
default: false
|
16
|
-
prop :align, type: Playbook::Props::Enum,
|
17
|
-
values: %w[left center right],
|
18
|
-
default: "left"
|
19
|
-
prop :show_date, type: Playbook::Props::Boolean,
|
20
|
-
default: true
|
21
|
-
prop :show_timezone, type: Playbook::Props::Boolean,
|
22
|
-
default: false
|
23
|
-
prop :show_user, type: Playbook::Props::Boolean,
|
24
|
-
default: false
|
25
|
-
prop :timezone, default: "America/New_York"
|
26
|
-
prop :variant, type: Playbook::Props::Enum,
|
27
|
-
values: %w[default elapsed updated],
|
28
|
-
default: "default"
|
29
11
|
|
30
12
|
def classname
|
31
|
-
generate_classname("pb_timestamp_kit"
|
32
|
-
end
|
33
|
-
|
34
|
-
def format_year_string
|
35
|
-
pb_date_time.to_year != DateTime.now.year.to_s ? ", #{pb_date_time.to_year}" : ""
|
36
|
-
end
|
37
|
-
|
38
|
-
def format_time_string
|
39
|
-
"#{pb_date_time.to_hour}:#{pb_date_time.to_minutes}#{pb_date_time.to_meridian} #{format_timezone_string}".strip
|
40
|
-
end
|
41
|
-
|
42
|
-
def format_timezone_string
|
43
|
-
timezone && show_timezone ? pb_date_time.to_timezone.to_s : ""
|
44
|
-
end
|
45
|
-
|
46
|
-
def format_date_string
|
47
|
-
"#{pb_date_time.to_month_downcase} #{pb_date_time.to_unpadded_day}#{format_year_string}"
|
48
|
-
end
|
49
|
-
|
50
|
-
def format_datetime_string
|
51
|
-
"#{format_date_string} · #{format_time_string}".html_safe
|
52
|
-
end
|
53
|
-
|
54
|
-
def format_updated_string
|
55
|
-
user_string = show_user ? " by #{text}" : ""
|
56
|
-
|
57
|
-
case variant
|
58
|
-
when "updated"
|
59
|
-
datetime_string = " on #{format_date_string} at #{format_time_string}"
|
60
|
-
when "elapsed"
|
61
|
-
datetime_string = " #{time_ago_in_words(pb_date_time.convert_to_timestamp)} ago"
|
62
|
-
end
|
63
|
-
|
64
|
-
"Last updated#{user_string}#{datetime_string}"
|
65
|
-
end
|
66
|
-
|
67
|
-
private
|
68
|
-
|
69
|
-
def pb_date_time
|
70
|
-
Playbook::PbKit::PbDateTime.new(timestamp, timezone)
|
71
|
-
end
|
72
|
-
|
73
|
-
def variant_class
|
74
|
-
case variant
|
75
|
-
when "updated"
|
76
|
-
"updated"
|
77
|
-
when "elapsed"
|
78
|
-
"elapsed"
|
79
|
-
end
|
13
|
+
generate_classname("pb_timestamp_kit")
|
80
14
|
end
|
81
15
|
end
|
82
16
|
end
|