Skip to content

Commit 5d821af

Browse files
rueckstiesskangas
authored andcommitted
INT-399 fixes several doc viewer issues
- slightly less increased line-height - added colon back between key and value - spacing for type labels correct - general indentation improvements - added back double quotes around string values - type coloring - numbers for array elements (zero based, with colon sep) Also fixes INT-395, INT-396, INT-397.
1 parent 7940860 commit 5d821af

File tree

2 files changed

+53
-26
lines changed

2 files changed

+53
-26
lines changed

src/document-list/document-list-item.jade

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,23 @@ mixin jsvalue(value, _type)
1212

1313
mixin jsarray(items)
1414
ol.document-property-body
15-
each item in items
16-
+jsproperty(null, item)
15+
each item,index in items
16+
+jsproperty(index, item)
1717

18+
mixin keyvalue(key, value)
19+
.document-property-key= key
20+
|:
21+
+jsvalue(value, _type)
22+
1823
mixin jsproperty(key, value)
1924
- _type = getType(value)
2025
li(class='document-property #{_type.toLowerCase()}')
2126
if _type === 'Array' || _type === 'Object'
2227
.document-property-header
2328
.caret
24-
if key
25-
.document-property-key= key
26-
|:
27-
+jsvalue(value, _type)
29+
+keyvalue(key, value)
2830
else
29-
if key
30-
.document-property-key= key
31-
|:
32-
+jsvalue(value, _type)
31+
+keyvalue(key, value)
3332
if _type === 'Array'
3433
+jsarray(value)
3534
if _type === 'Object'

src/document-list/index.less

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,16 @@ ol.document-list {
1111
li.document-list-item {
1212
font-family: @font-family-monospace;
1313
font-size: 11px;
14-
margin-left: 5px;
1514
padding-bottom: 10px;
1615
margin-bottom: 10px;
1716
border-bottom: 1px solid @gray7;
1817

19-
// unstyled for top-level object
20-
> ol.document-property-body {
21-
.list-unstyled;
22-
}
23-
2418
ol.document-property-body {
2519
display: block;
20+
.list-unstyled;
2621
.truncate-text-mixin();
22+
padding-left: 25px;
23+
2724
// - Strings, Numbers, ObjectID's, Date's, etc
2825
li.document-property {
2926
width: 100%;
@@ -32,19 +29,54 @@ ol.document-list {
3229
.document-property-key {
3330
font-weight: bold;
3431
display: inline-block;
35-
padding-left: 12px;
3632
}
3733

3834
.document-property-value {
39-
padding-left: 5px;
40-
padding-top: 4px;
4135
display: inline-block;
4236
}
4337
}
4438

39+
// add quotes for strings before and after, and some basic type coloring
40+
.document-property.string > .document-property-value {
41+
color: steelblue;
42+
&::before {
43+
content: "\"";
44+
}
45+
&::after {
46+
content: "\"";
47+
}
48+
}
49+
50+
.document-property.number > .document-property-value {
51+
color: green;
52+
}
53+
54+
.document-property.boolean > .document-property-value {
55+
color: purple;
56+
}
57+
58+
.document-property.date > .document-property-value {
59+
color: firebrick;
60+
}
61+
62+
// ObjectIDs serialize to just the hash, wrap in "ObjectId( ... )"
63+
.document-property.objectid > .document-property-value {
64+
color: orangered;
65+
&::before {
66+
content: "ObjectID('";
67+
}
68+
&::after {
69+
content: "')";
70+
}
71+
}
72+
4573
li.document-property.array, li.document-property.object {
4674
display: block;
47-
padding-top: 4px;
75+
margin-left: -16px;
76+
77+
&.expanded {
78+
margin-left: -20px;
79+
}
4880

4981
.document-property-header {
5082
cursor: pointer;
@@ -55,7 +87,8 @@ ol.document-list {
5587
display: inline-block;
5688
width: 12px;
5789
height: 1em;
58-
margin-right: 5px;
90+
margin-left: 2px;
91+
margin-right: 10px;
5992
.caret-right;
6093
}
6194

@@ -71,14 +104,9 @@ ol.document-list {
71104

72105
ol.document-property-body {
73106
margin-left: 5px;
74-
padding-left: -5px;
75107
border-left: 1px dotted @gray5;
76108
display: none;
77109
}
78-
// ol.document-property-body > a ~ ol {
79-
// padding-left: 12px;
80-
// display: none;
81-
// }
82110
&.expanded {
83111
> .document-property-header {
84112
> .caret {

0 commit comments

Comments
 (0)