-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
76 lines (74 loc) · 1.35 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const dayjs = require('dayjs');
const queries = require('./queries');
module.exports = {
extend: '@apostrophecms/piece-type',
bundle: {
directory: 'modules',
modules: [ '@apostrophecms/blog-page' ]
},
options: {
label: 'aposBlog:label',
pluralLabel: 'aposBlog:pluralLabel',
sort: {
publishedAt: -1,
createdAt: -1
},
i18n: {
ns: 'aposBlog',
browser: true
}
},
columns: {
add: {
publishedAt: {
label: 'aposBlog:publishedAt'
}
}
},
fields: {
add: {
publishedAt: {
label: 'aposBlog:publishedAt',
type: 'date',
required: true
}
},
group: {
basics: {
fields: [ 'publishedAt' ]
}
}
},
filters: {
add: {
future: {
label: 'aposBlog:futureArticles',
def: null
},
year: {
label: 'aposBlog:filterYear',
def: null
},
month: {
label: 'aposBlog:filterMonth',
def: null
},
day: {
label: 'aposBlog:filterDay',
def: null
}
}
},
queries,
extendMethods(self) {
return {
newInstance(_super) {
const instance = _super();
if (!instance.publishedAt) {
instance.publishedAt = dayjs().format('YYYY-MM-DD');
}
return instance;
}
};
}
};