Add new Vue.js component to handle submit and cancel buttons
This commit is contained in:
@@ -3,7 +3,7 @@ Version 1.0.33 (unreleased)
|
|||||||
|
|
||||||
New features:
|
New features:
|
||||||
|
|
||||||
* Move a task without drag and drop (mobiles)
|
* Move a task without drag and drop (smartphones and tablets)
|
||||||
* Add the possibility to unlock users from the user interface
|
* Add the possibility to unlock users from the user interface
|
||||||
* New API calls for task metadata
|
* New API calls for task metadata
|
||||||
* New automatic actions:
|
* New automatic actions:
|
||||||
|
|||||||
@@ -30,11 +30,12 @@
|
|||||||
<label><input type="radio" value="after" v-model="positionChoice"><?= t('Insert after this task') ?></label>
|
<label><input type="radio" value="after" v-model="positionChoice"><?= t('Insert after this task') ?></label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions">
|
<submit-cancel
|
||||||
<input type="button" value="<?= t('Save') ?>" class="btn btn-blue" @click="onSubmit">
|
label-button="<?= t('Save') ?>"
|
||||||
<?= t('or') ?>
|
label-or="<?= t('or') ?>"
|
||||||
<?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
|
label-cancel="<?= t('cancel') ?>"
|
||||||
</div>
|
:callback="onSubmit">
|
||||||
|
</submit-cancel>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<task-move-position
|
<task-move-position
|
||||||
|
|||||||
4
assets/js/app.min.js
vendored
4
assets/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
30
assets/js/components/submit-cancel.js
Normal file
30
assets/js/components/submit-cancel.js
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
Vue.component('submit-cancel', {
|
||||||
|
props: ['labelButton', 'labelOr', 'labelCancel', 'callback'],
|
||||||
|
template: '<div class="form-actions">' +
|
||||||
|
'<button type="button" class="btn btn-blue" @click="onSubmit" :disabled="isLoading">' +
|
||||||
|
'<span v-show="isLoading"><i class="fa fa-spinner fa-pulse"></i> </span>' +
|
||||||
|
'{{ labelButton }}' +
|
||||||
|
'</button> ' +
|
||||||
|
'{{ labelOr }} <a href="#" v-on:click.prevent="onCancel">{{ labelCancel }}</a>' +
|
||||||
|
'</div>'
|
||||||
|
,
|
||||||
|
data: function () {
|
||||||
|
return {
|
||||||
|
loading: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isLoading: function () {
|
||||||
|
return this.loading;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onSubmit: function () {
|
||||||
|
this.loading = true;
|
||||||
|
this.callback();
|
||||||
|
},
|
||||||
|
onCancel: function () {
|
||||||
|
_KB.get('Popover').close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
|
var _KB = null;
|
||||||
|
|
||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
var app = new Kanboard.App();
|
_KB = new Kanboard.App();
|
||||||
app.execute();
|
_KB.execute();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user