-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add timeStamp field * ID-4705 [FEAT] Create TimeStamp form instance
- Loading branch information
1 parent
b03b454
commit 0b7821e
Showing
12 changed files
with
123 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Fliplet.FormBuilder.field('timeStamp', { | ||
name: 'Time Stamp', | ||
category: 'Date & time', | ||
submit: false, | ||
props: { | ||
placeholder: { | ||
type: String | ||
}, | ||
description: { | ||
type: String | ||
}, | ||
createdAt: { | ||
type: Boolean, | ||
default: true | ||
}, | ||
updatedAt: { | ||
type: Boolean, | ||
default: true | ||
}, | ||
showLabel: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
label: undefined | ||
}, | ||
created: function() { | ||
Fliplet.Hooks.on('afterFormSubmit', this.afterFormSubmit); | ||
}, | ||
destroyed: function() { | ||
Fliplet.Hooks.off('afterFormSubmit', this.afterFormSubmit); | ||
}, | ||
methods: { | ||
afterFormSubmit: async function(data) { | ||
let dataSourceId = data.result.dataSourceId; | ||
|
||
const connection = await Fliplet.DataSources.connect(dataSourceId); | ||
|
||
if (data.result.createdAt !== data.result.updatedAt && this.updatedAt) { | ||
connection.update(data.result.id, { | ||
'Last updated': data.result.updatedAt | ||
}); | ||
} else if (this.createdAt) { | ||
connection.update(data.result.id, { | ||
'Created at': data.result.createdAt | ||
}); | ||
} | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fliplet.FormBuilder.configuration('timeStamp'); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div> | ||
<div class="timeStamp">timestamp will be recorded upon submission</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<div class="form-group clearfix"> | ||
<label>Created at:</label> | ||
<div class="checkbox checkbox-icon"> | ||
<input type="checkbox" name="created-at" v-model="createdAt" id="created-at"> | ||
<label for="created-at"> | ||
<span class="check"><i class="fa fa-check"></i></span> | ||
<span class="hide-field">Save timestamp when form is first submitted</span> | ||
</label> | ||
</div> | ||
</div> | ||
|
||
<div class="form-group clearfix"> | ||
<label>Updated at:</label> | ||
<div class="checkbox checkbox-icon"> | ||
<input type="checkbox" name="updated-at" v-model="updatedAt" id="updated-at"> | ||
<label for="updated-at"> | ||
<span class="check"><i class="fa fa-check"></i></span> | ||
<span class="hide-field">Save timestamp every time form is updated</span> | ||
</label> | ||
</div> | ||
</div> | ||
|
||
<div class="text-danger" v-if="errors.timeStampOption"> \{{ errors.timeStampOption }} </div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters