-
Notifications
You must be signed in to change notification settings - Fork 22
/
post.coffee
180 lines (175 loc) · 4.18 KB
/
post.coffee
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
Creator.Objects.post =
name: "post"
label: "动态"
icon: "contract"
enable_files:true
fields:
name:
label:'标题'
type:'text'
required:true
is_wide:true
summary:
label:'简介'
type:'textarea'
omit:true
description:
label:'正文'
is_wide:true
type:'markdown'
rows: 8
star_count:
label:'点赞数'
type:'number'
omit:true
read_count:
label:'阅读数'
type:'number'
omit:true
forward_count:
label:'转发数'
type:'number'
omit:true
enable_comment:
label:'是否允许评论'
type:'boolean'
defaultValue:true
omit:true
start_time:
label:'开始时间'
type:'datetime'
omit:true
end_time:
label:'结束时间'
type:'datetime'
omit:true
# store:
# label:'门店'
# type:'master_detail'
# reference_to:'vip_store'
cover:
label: '封面'
type: 'image'
group:"-"
images:
label: '图片'
type: 'image'
multiple : true
video:
label: '视频'
type: 'video'
# omit:true
video_url:
label: '视频地址'
type: 'text'
omit:true
# audio:
# label: '音频'
# type: 'audio'
# omit:true
categories:
label:'栏目'
type:'lookup'
reference_to:'post_category'
multiple:true
index:true
type:
label:'信息分类'
type:'select'
options:[
{label:'公告通知',value:'announcements'},
{label:'关于我们',value:'about'},
{label:'新闻动态',value:'news'},
{label:'会员指南',value:'help'},
{label:'招兵买马',value:'jobs'},
{label:'线上课程',value:'course'},
# {label:'优惠券',value:'coupon'},
# {label:'社区',value:'community'},
# {label:'红包',value:'red_packet'}
]
omit:true
mini_type:
label:'内容样式'
type:'select'
options:[
{label:'文章',value:'article'},
{label:'照片',value:'photo'},
{label:'视频',value:'video'},
{label:'音乐',value:'music'}
]
omit:true
visible_type:
label:'可见范围'
type:'select'
omit:true
options:[
{label:'公开',value:'public'},
{label:'秘密',value:'private'},
{label:'会员可见',value:'member'},
{label:'员工可见',value:'user'}
]
omit:true
featured:
label:'推荐'
type:'boolean'
index:true
group:'-'
list_views:
all:
label: "所有"
columns: ["name", "comment_count", "star_count","forward_count"]
filter_scope: "space"
triggers:
"before.insert.server.post":
on: "server"
when: "before.insert"
todo: (userId, doc)->
# if doc.description
# doc.summary = doc.description.substring(0,100)
if doc.video
if Meteor.settings.public.cfs?.store is 'OSS'
video = cfs.videos.findOne(doc.video)
if video
doc.video_url = 'https://' + Meteor.settings.cfs.aliyun.bucket + '.' + Meteor.settings.cfs.aliyun.region.split('-internal')[0] + '.aliyuncs.com/videos/videos-' + video._id + '-' + encodeURIComponent(video.original.name)
"before.update.server.post":
on: "server"
when: "before.update"
todo: (userId, doc, fieldNames, modifier, options)->
# if modifier.$set.description
# modifier.$set.summary = modifier.$set.description.substring(0,100)
# if modifier.$unset and modifier.$unset.hasOwnProperty('description')
# modifier.$unset.summary = 1
if modifier.$set.video
if Meteor.settings.public.cfs?.store is 'OSS'
video = cfs.videos.findOne(modifier.$set.video)
if video
modifier.$set.video_url = 'https://' + Meteor.settings.cfs.aliyun.bucket + '.' + Meteor.settings.cfs.aliyun.region.split('-internal')[0] + '.aliyuncs.com/videos/videos-' + video._id + '-' + encodeURIComponent(video.original.name)
permission_set:
user:
allowCreate: true
allowDelete: true
allowEdit: true
allowRead: true
modifyAllRecords: false
viewAllRecords: true
admin:
allowCreate: true
allowDelete: true
allowEdit: true
allowRead: true
modifyAllRecords: true
viewAllRecords: true
guest:
allowCreate: true
allowDelete: true
allowEdit: true
allowRead: true
modifyAllRecords: false
viewAllRecords: true
member:
allowCreate: true
allowDelete: true
allowEdit: true
allowRead: true
modifyAllRecords: false
viewAllRecords: true