make modalName a component prop, rather than passing it into methods
This commit is contained in:
parent
456c5307c7
commit
aba2eb28ed
@ -16,7 +16,8 @@ export default {
|
||||
initialData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
modalName: String
|
||||
},
|
||||
|
||||
data: function () {
|
||||
@ -86,10 +87,10 @@ export default {
|
||||
return names.every((n, index) => names.indexOf(n) === index)
|
||||
},
|
||||
|
||||
handleSubmit: function (modalName, event) {
|
||||
handleSubmit: function (event) {
|
||||
if (!this.readyToSubmit) {
|
||||
event.preventDefault()
|
||||
this.validateAndOpenModal(modalName)
|
||||
this.validateAndOpenModal(this.modalName)
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -3,13 +3,13 @@
|
||||
{% from "components/text_input.html" import TextInput %}
|
||||
{% from "components/alert.html" import Alert %}
|
||||
|
||||
<new-project inline-template v-bind:initial-data='{{ form.data|tojson }}'>
|
||||
<new-project inline-template v-bind:initial-data='{{ form.data|tojson }}' modal-name='{{ modalName }}'>
|
||||
{% set new_project = project is not defined %}
|
||||
{% set form_action = url_for('workspaces.create_project', workspace_id=workspace.id) if new_project else url_for('workspaces.edit_project', workspace_id=workspace.id, project_id=project.id) %}
|
||||
{% set action_text = 'Create' if new_project else 'Update' %}
|
||||
{% set title_text = 'Add a new project' if new_project else 'Edit {} project'.format(project.name) %}
|
||||
|
||||
<form method="POST" action="{{ form_action }}" v-on:submit="handleSubmit('{{ modalName }}', $event)">
|
||||
<form method="POST" action="{{ form_action }}" v-on:submit="handleSubmit">
|
||||
{% call Modal(name=modalName, dismissable=False) %}
|
||||
<h1>{{ action_text }} project !{ name }</h1>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user