sumba 1.0.7 → 1.0.9

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.
@@ -0,0 +1,16 @@
1
+ const doboBeforeRecordCreate = {
2
+ level: 1000,
3
+ handler: async function (body, options = {}) {
4
+ const { get, isEmpty } = this.app.bajo.lib._
5
+ const user = get(options, 'req.user')
6
+ if (user) {
7
+ if (isEmpty(body.firstName)) body.firstName = user.firstName
8
+ if (isEmpty(body.lastName)) body.lastName = user.firstName
9
+ if (isEmpty(body.email)) body.email = user.email
10
+ }
11
+ if (isEmpty(body.category)) body.category = 'MISC'
12
+ options.checksumId = true
13
+ }
14
+ }
15
+
16
+ export default doboBeforeRecordCreate
@@ -1,9 +1,11 @@
1
1
  {
2
- "signoutWarning": "You're about to sign out. This means your session will be cleared and you'll be asked for your credential again in case you want to access any protected pages and resources.<br /><br />Are your sure?",
2
+ "signoutWarning": "You\\'re about to sign out. This means your session will be cleared and you\\'ll be asked for your credential again in case you want to access any protected pages and resources.<br /><br />Are your sure?",
3
3
  "field": {
4
4
  "currentPassword": "Current Password",
5
5
  "newPassword": "New Password",
6
6
  "verifyNewPassword": "Verify New Password",
7
- "usernameEmail": "Username/Email"
7
+ "usernameEmail": "Username/Email",
8
+ "subject": "Subject",
9
+ "message": "Message"
8
10
  }
9
11
  }
@@ -47,6 +47,7 @@
47
47
  "User account successfully created": "Akun pengguna sukses dibuat",
48
48
  "Reset API Key": "Reset Kunci API",
49
49
  "Person In Charge": "Penanggung Jawab",
50
+ "Contact Form": "Form Kontak",
50
51
  "field": {
51
52
  "currentPassword": "Kata Sandi Saat Ini",
52
53
  "newPassword": "Kata Sandi Baru",
@@ -55,7 +56,9 @@
55
56
  "usernameEmail": "Nama Pengguna/Surel",
56
57
  "apiKey": "Kunci API",
57
58
  "hostname": "Nama Host",
58
- "iconset": "Iconset"
59
+ "iconset": "Iconset",
60
+ "subject": "Judul",
61
+ "message": "Pesan"
59
62
  },
60
63
  "validation": {
61
64
  "password.minOfUppercase": "Mengandung setidaknya {{min}} huruf besar",
@@ -6,7 +6,7 @@ async function status (opts = {}) {
6
6
  type: 'string',
7
7
  maxLength: 50,
8
8
  index: true,
9
- values: ['UNVERIFIED', 'ACTIVE', 'INACTIVE']
9
+ values: opts.values ?? ['UNVERIFIED', 'ACTIVE', 'INACTIVE']
10
10
  }],
11
11
  hook: {
12
12
  beforeCreate: async function ({ body }) {
@@ -0,0 +1,21 @@
1
+ {
2
+ "properties": [
3
+ "id::50:primary:true",
4
+ "firstName::50:true:true",
5
+ "lastName::50:true:true",
6
+ "email::50:true:true",
7
+ "category::50:true",
8
+ "subject::255::true",
9
+ "message:text"
10
+ ],
11
+ "feature": {
12
+ "sumba.status": {
13
+ "default": "NEW",
14
+ "values": ["NEW", "ACK"]
15
+ },
16
+ "sumba.userId": true,
17
+ "sumba.siteId": true,
18
+ "createdAt": true,
19
+ "updatedAt": true
20
+ }
21
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sumba",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Bajo Framework's Biz Suite",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,9 @@
1
+ <% if (_meta.user) { %>
2
+ <c:list-item href="sumba:/my-stuff/profile" t:content="Your Profile" />
3
+ <c:list-item href="sumba:/my-stuff/change-password" t:content="Change Password" />
4
+ <c:list-item href="sumba:/signout" t:content="Signout" />
5
+ <% } else { %>
6
+ <c:list-item href="sumba:/signin" t:content="Signin" />
7
+ <c:list-item href="sumba:/user/signup" t:content="New User Signup" />
8
+ <c:list-item href="sumba:/user/forgot-password" t:content="Forgot Password" />
9
+ <% } %>
@@ -0,0 +1,24 @@
1
+ const contactForm = {
2
+ method: ['GET', 'POST'],
3
+ handler: async function (req, reply) {
4
+ const { defaultsDeep } = this.app.bajo
5
+ const { pick } = this.app.bajo.lib._
6
+ const { recordCreate } = this.app.waibuDb
7
+
8
+ const def = req.user ? pick(req.user, ['firstName', 'lastName', 'email']) : {}
9
+ const form = defaultsDeep(req.body, def)
10
+ let error
11
+ if (req.method === 'POST') {
12
+ try {
13
+ const { data } = await recordCreate({ model: 'SumbaContactForm', req, reply, options: { noFlash: true } })
14
+ req.flash('notify', 'Contact form successfully submitted')
15
+ return reply.view('sumba.template:/contact-form/success.html', { form: req.body, data })
16
+ } catch (err) {
17
+ error = err
18
+ }
19
+ }
20
+ return reply.view('sumba.template:/contact-form/form.html', { form, error })
21
+ }
22
+ }
23
+
24
+ export default contactForm
@@ -0,0 +1,17 @@
1
+ ---
2
+ t:title: Contact Form
3
+ ---
4
+ <c:form button reset-validation referer grid-gutter="2">
5
+ <c:form-input name="firstName" col="6-lg" label-floating <%= _meta.user ? 'readonly' : '' %> />
6
+ <c:form-input name="lastName" col="6-lg" label-floating <%= _meta.user ? 'readonly' : '' %> />
7
+ <c:form-input type="email" col="6-lg" name="email" label-floating <%= _meta.user ? 'readonly' : '' %> />
8
+ <c:form-select name="category" col="6-lg" label-floating>
9
+ <c:option value="QUESTION" t:content="Question" />
10
+ <c:option value="INQUIRY" t:content="Inquiry" />
11
+ <c:option value="BILLING" t:content="Billing" />
12
+ <c:option value="API" t:content="API Integration" />
13
+ <c:option value="MISC" t:content="Misc" />
14
+ </c:form-select>
15
+ <c:form-input name="subject" label-floating />
16
+ <c:form-textarea name="message" label-floating style="height:10em"/>
17
+ </c:form>
@@ -0,0 +1,7 @@
1
+ ---
2
+ t:title: Contact Form
3
+ ---
4
+ <p><c:t>Congratulation!</c:t></p>
5
+ <c:list type="unstyled" margin="start-3">
6
+ <c:list-item t:content="Goto Home" href="/" icon="house"/>
7
+ </c:list>
@@ -29,7 +29,7 @@ scripts:
29
29
  </c:fieldset>
30
30
  </c:grid-col>
31
31
  <c:grid-col col="4-md">
32
- <c:heading type="6-display" t:content="Image" />
32
+ <c:heading type="5" t:content="Image" />
33
33
  <c:img holder="400x200" responsive rounded />
34
34
  <c:form-file name="image" no-label wrapper-margin="top-2"/>
35
35
  <c:btn-group margin="top-3" flex="full">
@@ -42,7 +42,7 @@ scripts:
42
42
  </c:btn>
43
43
  <% } %>
44
44
  <hr />
45
- <c:heading type="6-display" t:content="More" margin="top-3" />
45
+ <c:heading type="5" t:content="More" margin="top-3" />
46
46
  <c:list type="group" hover>
47
47
  <c:list-item href="sumba:/my-stuff/change-password" t:content="Change Password" />
48
48
  <c:list-item t:content="Display API Key" target="api-key-modal"/>
@@ -28,9 +28,9 @@ scripts:
28
28
  </c:fieldset>
29
29
  </c:grid-col>
30
30
  <c:grid-col col="4-md">
31
- <c:heading type="6-display" t:content="Image" />
31
+ <c:heading type="5" t:content="Image" />
32
32
  <c:img holder="400x200" responsive rounded />
33
- <c:heading type="6-display" t:content="More" margin="top-3" />
33
+ <c:heading type="5" t:content="More" margin="top-3" />
34
34
  <c:list type="group" hover>
35
35
  <c:list-item href="sumba:/my-stuff/profile/edit" t:content="Update Profile" />
36
36
  <c:list-item t:content="Display API Key" target="api-key-modal"/>
@@ -6,9 +6,11 @@ layout: sumba.layout:/wide.html
6
6
  <c:form-plaintext name="apiKey" label-floating wrapper-margin="bottom-2" />
7
7
  <c:form-password name="password" label-floating wrapper-margin="bottom-3" />
8
8
  </c:form>
9
+ <% if (!page.noLinks) { %>
9
10
  <c:list type="unstyled" margin="start-3">
10
11
  <c:include resource="sumba.partial:/list-item/your-profile.html" />
11
12
  <c:include resource="sumba.partial:/list-item/change-password.html" />
12
13
  <c:include resource="sumba.partial:/list-item/signout.html" />
13
14
  <c:include resource="sumba.partial:/list-item/goto-home.html" />
14
15
  </c:list>
16
+ <% } %>
@@ -5,8 +5,10 @@ t:title: Signin
5
5
  <c:form-input name="username" label-floating wrapper-margin="bottom-2" />
6
6
  <c:form-password name="password" label-floating wrapper-margin="bottom-3" />
7
7
  </c:form>
8
+ <% if (!page.noLinks) { %>
8
9
  <c:list type="unstyled" margin="start-3">
9
10
  <c:include resource="sumba.partial:/list-item/forgot-password.html" />
10
11
  <c:include resource="sumba.partial:/list-item/user-signup.html" />
11
12
  <c:include resource="sumba.partial:/list-item/goto-home.html" />
12
13
  </c:list>
14
+ <% } %>
@@ -4,5 +4,7 @@ t:title: Signout
4
4
  <c:p t:content="signoutWarning" />
5
5
  <c:form method="POST" action="sumba:/signout" referer>
6
6
  <c:btn color="primary" t:content="Yes, sign me out now!" type="submit" />
7
+ <% if (!page.noLinks) { %>
7
8
  <c:btn color="link" icon="house" t:content="Goto Home" href="/" />
9
+ <% } %>
8
10
  </c:form>
@@ -4,8 +4,10 @@ t:title: User Activation
4
4
  <c:form button reset-validation referer>
5
5
  <c:form-input name="key" label-floating />
6
6
  </c:form>
7
+ <% if (!page.noLinks) { %>
7
8
  <c:list type="unstyled" margin="start-3">
8
9
  <c:include resource="sumba.partial:/list-item/signin.html" />
9
10
  <c:include resource="sumba.partial:/list-item/forgot-password.html" />
10
11
  <c:include resource="sumba.partial:/list-item/goto-home.html" />
11
12
  </c:list>
13
+ <% } %>
@@ -4,8 +4,10 @@ t:title: Forgot Password
4
4
  <c:form button reset-validation>
5
5
  <c:form-input name="usernameEmail" label-floating wrapper-margin="bottom-2" t:hint="Link to reset password wil be sent to your email"/>
6
6
  </c:form>
7
+ <% if (!page.noLinks) { %>
7
8
  <c:list type="unstyled" margin="start-3">
8
9
  <c:include resource="sumba.partial:/list-item/signin.html" />
9
10
  <c:include resource="sumba.partial:/list-item/user-signup.html" />
10
11
  <c:include resource="sumba.partial:/list-item/goto-home.html" />
11
12
  </c:list>
13
+ <% } %>
@@ -10,8 +10,10 @@ t:title: New User Signup
10
10
  <c:form-input name="lastName" col="6-lg" label-floating />
11
11
  <c:form-check name="agree" col="12" value="true" t:label="I agree to the <a href='../info/terms-conditions'>Terms and Conditions</a>" />
12
12
  </c:form>
13
+ <% if (!page.noLinks) { %>
13
14
  <c:list type="unstyled" margin="start-3">
14
15
  <c:include resource="sumba.partial:/list-item/forgot-password.html" />
15
16
  <c:include resource="sumba.partial:/list-item/signin.html" />
16
17
  <c:include resource="sumba.partial:/list-item/goto-home.html" />
17
18
  </c:list>
19
+ <% } %>