-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.gs
161 lines (159 loc) · 5.66 KB
/
config.gs
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
var APPS_NAME = 'Ladon Sample App'
var SPREADSHEET_ID = '13IhhLyvUSdw18mXkwYHt1MdTaflqxXQ7CgDP3zdY0hc'
var FAVICON_URL = 'https://images.vexels.com/media/users/3/142408/isolated/preview/910ae724dc878524d143cf91fff7fddf-sans-serif-l-font-by-vexels.png'
var COLOR_PRIMARY = '#ffe0e2'
var COLOR_PRIMARY_DARK = '#f5c2c5'
var COLOR_ACCENT = '#9c5b95'
var PRIMARY_COLUMN = ['Name', 'City', 'Email']
/**
* Define the schema below
* Schema Object
* "sheetName" : sheet name correspond to spreadsheet
* "sections" : array of Section object
* Section Object
* "sectionName" : name of the section
* "fields" : array of Field object
* Field Object
* "id" : unique id for every field
* "name" : equivalence with column header in spreadsheet
* "type" : type of field, depend on the type, you may have (optional) additional properties:
* - createTimestamp : automatic set to time when user is registered
* - text : simple text
* - validate : regex for validation
* - error : error message if validation fails
* - autocomplete : simple autocomplete field
* - validate : regex for validation
* - error : error message if validation fails
* - number : simple number
* - minimum : lower bound input
* - maximum : upper bound input
* - validate : regex for validation, if interpreted as string
* - error : error message if validation fails
* - email : simple email
* - validate : regex for validation, if interpreted as string. recomended using /.+@.+\..+/
* - error : error message if validation fails
* - date : date, month, and year
* - validate : regex for validation
* - error : error message if validation fails
* - radio : radio button
* - options : options of radio
* - validate : regex for validation
* - error : error message if validation fails
* - checkbox : checkbox
* - options : options of checkbox
* - minimum : minimum chosen
* - maximum : maximum chosen
* - error : error message if validation fails
* - paragraph : not an input, just a text to be shown
* - text : text to show as paragraph
* - title : header of the paragraph
* "scope" : one of these:
* - hidden : never shown to any user (wont't accept input)
* - private : shown only to corresponding user
* - public : shown to all registered user
* "helper" : helper text, disabled on createTimestamp, updateTimestamp, and activeEmail
*/
var SCHEMA = {
sheetName : 'Basic Fields',
sections : [
{
sectionName : 'Introduction',
fields: [
{
id: 'intro1',
type: 'paragraph',
title: '',
text: 'This is sample form made for Ladon'
}, {
id: 'intro2',
type: 'paragraph',
title: 'Usage',
text: 'You can customize config.gs in your project file'
}, {
id: 'intro3',
type: 'paragraph',
text: 'You can add text too. Feel free to add <strong> html element </strong> to <em> decorate </em> your text'
}
]
},{
sectionName : 'Basic Info',
fields: [
{
id: 'desc1',
type: 'paragraph',
title: 'Example',
text: 'You can fill these form below. You don\'t have to use your actual credential, just explore all form fields available'
}, {
id: 'createdAt',
name: 'Created At',
type: 'createTimestamp',
scope: 'hidden'
}, {
id: 'name',
name: 'Name',
type: 'text',
helper: 'try left it 1 character only',
validate: /^.{2,40}$/,
error: 'Name should have 2 to 40 characters',
placeholder: 'Your full name',
scope: 'public'
}, {
id: 'email',
name: 'Email',
type: 'email',
scope: 'public',
validate: /.+@.+\..+/,
error: 'Your email is not valid'
}, {
id: 'gender',
name: 'Gender',
type: 'radio',
scope: 'public',
validate: /Male|Female/,
error: 'Please choose your gender',
options: [ 'Male', 'Female' ]
}, {
id: 'birthDate',
name: 'Birth Date',
type: 'date',
validate: /^.+$/, /* this is default regex for "cant be empty" field */
error: 'This field is required',
scope: 'private',
minimum: [1995,0,1],
maximum: [2002,12,31]
}, {
id: 'phoneNumber',
name: 'Phone Number',
type: 'number',
helper: 'Your phone number won\'t be shared to others',
validate: /^.{10,14}$/,
error: '10 to 14 digit',
scope: 'private'
}, {
id: 'city',
name: 'City',
type: 'autocomplete',
helper: 'Try type \'c\' and autocomplete will help you',
validate: /^.+$/,
scope: 'private',
placeholder: 'Born city',
options: [ 'California', 'Los Angeles', 'Cichago' ]
}
]
},{
sectionName : 'Feedback',
fields: [
{
id: 'feature',
name: 'What feature do you need?',
type: 'checkbox',
helper: 'Try left it blank',
scope: 'public',
options: [ 'Slider', 'Text Area', 'Select' ],
minimum: 1,
error: 'Minimum selection is 1'
}
]
}
]
}