Split "new project" forms into multiple sections

This commit is contained in:
Lance Edgar 2020-09-06 14:47:14 -05:00
parent cebe2f8adc
commit cf613ab34a
2 changed files with 164 additions and 111 deletions

View file

@ -13,15 +13,17 @@
</b-select> </b-select>
</b-field> </b-field>
<div class="card" v-if="projectType == 'rattail'"> <div v-if="projectType == 'rattail'">
<header class="card-header">
<p class="card-header-title">New 'rattail' Project</p>
</header>
<div class="card-content">
<div class="content">
${h.form(request.current_route_url(), ref='rattailForm')} ${h.form(request.current_route_url(), ref='rattailForm')}
${h.csrf_token(request)} ${h.csrf_token(request)}
${h.hidden('project_type', value='rattail')} ${h.hidden('project_type', value='rattail')}
<br />
<div class="card">
<header class="card-header">
<p class="card-header-title">Naming</p>
</header>
<div class="card-content">
<div class="content">
<b-field horizontal label="Name"> <b-field horizontal label="Name">
<b-input name="name" v-model="rattail.name"></b-input> <b-input name="name" v-model="rattail.name"></b-input>
@ -43,61 +45,139 @@
<b-input name="python_name" v-model="rattail.python_package_name"></b-input> <b-input name="python_name" v-model="rattail.python_package_name"></b-input>
</b-field> </b-field>
<b-field horizontal label="Has Rattail DB">
<b-checkbox name="has_db" v-model="rattail.has_rattail_db"></b-checkbox>
</b-field>
<b-field horizontal label="Extends Rattail DB Schema">
<b-checkbox name="extends_db" v-model="rattail.extends_rattail_db_schema"></b-checkbox>
</b-field>
<b-field horizontal label="Uses Rattail Batch Schema">
<b-checkbox name="has_batch_schema" v-model="rattail.uses_rattail_batch_schema"></b-checkbox>
</b-field>
<b-field horizontal label="Has Tailbone Web App">
<b-checkbox name="has_web" v-model="rattail.has_tailbone_web_app"></b-checkbox>
</b-field>
<b-field horizontal label="Has Tailbone Web API">
<b-checkbox name="has_web_api" v-model="rattail.has_tailbone_web_api"></b-checkbox>
</b-field>
<b-field horizontal label="Has DataSync Service">
<b-checkbox name="has_datasync" v-model="rattail.has_datasync_service"></b-checkbox>
</b-field>
<b-field horizontal label="Integrates w/ Catapult">
<b-checkbox name="integrates_catapult" v-model="rattail.integrates_with_catapult"></b-checkbox>
</b-field>
<b-field horizontal label="Integrates w/ CORE-POS">
<b-checkbox name="integrates_corepos" v-model="rattail.integrates_with_corepos"></b-checkbox>
</b-field>
<b-field horizontal label="Integrates w/ LOC SMS">
<b-checkbox name="integrates_corepos" v-model="rattail.integrates_with_locsms"></b-checkbox>
</b-field>
<b-field horizontal label="Uses Fabric">
<b-checkbox name="uses_fabric" v-model="rattail.uses_fabric"></b-checkbox>
</b-field>
${h.end_form()}
</div> </div>
</div> </div>
</div> </div>
<br />
<div class="card" v-if="projectType == 'byjove'"> <div class="card">
<header class="card-header"> <header class="card-header">
<p class="card-header-title">New 'byjove' Project</p> <p class="card-header-title">Database</p>
</header> </header>
<div class="card-content"> <div class="card-content">
<div class="content"> <div class="content">
<b-field horizontal label="Has Rattail DB">
<b-checkbox name="has_db"
v-model="rattail.has_rattail_db"
native-value="true">
</b-checkbox>
</b-field>
<b-field horizontal label="Extends Rattail DB Schema">
<b-checkbox name="extends_db"
v-model="rattail.extends_rattail_db_schema"
native-value="true">
</b-checkbox>
</b-field>
<b-field horizontal label="Uses Rattail Batch Schema">
<b-checkbox name="has_batch_schema"
v-model="rattail.uses_rattail_batch_schema"
native-value="true">
</b-checkbox>
</b-field>
</div>
</div>
</div>
<br />
<div class="card">
<header class="card-header">
<p class="card-header-title">Web App</p>
</header>
<div class="card-content">
<div class="content">
<b-field horizontal label="Has Tailbone Web App">
<b-checkbox name="has_web"
v-model="rattail.has_tailbone_web_app"
native-value="true">
</b-checkbox>
</b-field>
<b-field horizontal label="Has Tailbone Web API">
<b-checkbox name="has_web_api"
v-model="rattail.has_tailbone_web_api"
native-value="true">
</b-checkbox>
</b-field>
</div>
</div>
</div>
<br />
<div class="card">
<header class="card-header">
<p class="card-header-title">Integrations</p>
</header>
<div class="card-content">
<div class="content">
<b-field horizontal label="Integrates w/ Catapult">
<b-checkbox name="integrates_catapult"
v-model="rattail.integrates_with_catapult"
native-value="true">
</b-checkbox>
</b-field>
<b-field horizontal label="Integrates w/ CORE-POS">
<b-checkbox name="integrates_corepos"
v-model="rattail.integrates_with_corepos"
native-value="true">
</b-checkbox>
</b-field>
<b-field horizontal label="Integrates w/ LOC SMS">
<b-checkbox name="integrates_corepos"
v-model="rattail.integrates_with_locsms"
native-value="true">
</b-checkbox>
</b-field>
<b-field horizontal label="Has DataSync Service">
<b-checkbox name="has_datasync"
v-model="rattail.has_datasync_service"
native-value="true">
</b-checkbox>
</b-field>
</div>
</div>
</div>
<br />
<div class="card">
<header class="card-header">
<p class="card-header-title">Deployment</p>
</header>
<div class="card-content">
<div class="content">
<b-field horizontal label="Uses Fabric">
<b-checkbox name="uses_fabric"
v-model="rattail.uses_fabric"
native-value="true">
</b-checkbox>
</b-field>
</div>
</div>
</div>
${h.end_form()}
</div>
<div v-if="projectType == 'byjove'">
${h.form(request.current_route_url(), ref='byjoveForm')} ${h.form(request.current_route_url(), ref='byjoveForm')}
${h.csrf_token(request)} ${h.csrf_token(request)}
${h.hidden('project_type', value='byjove')} ${h.hidden('project_type', value='byjove')}
<br />
<div class="card">
<header class="card-header">
<p class="card-header-title">Naming</p>
</header>
<div class="card-content">
<div class="content">
<b-field horizontal label="Name"> <b-field horizontal label="Name">
<b-input name="name" v-model="byjove.name"></b-input> <b-input name="name" v-model="byjove.name"></b-input>
</b-field> </b-field>
@ -106,10 +186,12 @@
<b-input name="slug" v-model="byjove.slug"></b-input> <b-input name="slug" v-model="byjove.slug"></b-input>
</b-field> </b-field>
</div>
</div>
</div>
${h.end_form()} ${h.end_form()}
</div> </div>
</div>
</div>
<br /> <br />
<div class="buttons" style="padding-left: 8rem;"> <div class="buttons" style="padding-left: 8rem;">
@ -134,7 +216,7 @@
python_project_name: "Acme-Okay-Then", python_project_name: "Acme-Okay-Then",
python_package_name: "okay_then", python_package_name: "okay_then",
has_rattail_db: true, has_rattail_db: true,
extends_rattail_db_schema: false, extends_rattail_db_schema: true,
uses_rattail_batch_schema: false, uses_rattail_batch_schema: false,
has_tailbone_web_app: true, has_tailbone_web_app: true,
has_tailbone_web_api: false, has_tailbone_web_api: false,

View file

@ -120,45 +120,16 @@ class GenerateProjectView(View):
schema = GenerateByjoveProject if project_type == 'byjove' else GenerateProject schema = GenerateByjoveProject if project_type == 'byjove' else GenerateProject
form = forms.Form(schema=schema(), request=self.request, form = forms.Form(schema=schema(), request=self.request,
use_buefy=use_buefy) use_buefy=use_buefy)
form.submit_label = "Generate Project"
form.auto_disable = False
form.auto_disable_save = False
if form.validate(newstyle=True): if form.validate(newstyle=True):
zipped = self.generate_project(project_type, form) zipped = self.generate_project(project_type, form)
return self.file_response(zipped) return self.file_response(zipped)
# self.request.session.flash("New project was generated: {}".format(form.validated['name'])) # self.request.session.flash("New project was generated: {}".format(form.validated['name']))
# return self.redirect(self.request.current_route_url()) # return self.redirect(self.request.current_route_url())
form.set_label('python_name', "Python Package Name")
form.set_label('has_db', "Has Rattail DB")
form.set_label('extends_db', "Extends Rattail DB Schema")
form.set_label('has_batch_schema', "Uses Rattail Batch Schema")
form.set_label('has_web', "Has Tailbone Web App")
form.set_label('has_web_api', "Has Tailbone Web API")
form.set_label('has_datasync', "Has DataSync Service")
# form.set_label('has_filemon', "Has FileMon Service")
# form.set_label('has_tempmon', "Has TempMon Service")
# form.set_label('has_bouncer', "Has Bouncer Service")
form.set_label('integrates_catapult', "Integrates w/ Catapult")
form.set_label('integrates_corepos', "Integrates w/ CORE-POS")
# form.set_label('integrates_instacart', "Integrates w/ Instacart")
form.set_label('integrates_locsms', "Integrates w/ LOC SMS")
# form.set_label('integrates_mailchimp', "Integrates w/ Mailchimp")
# TODO!
form.set_default('name', 'Okay-Then')
form.set_default('slug', 'okay-then')
form.set_default('organization', 'Acme')
form.set_default('python_project_name', 'Acme-Okay-Then')
form.set_default('python_name', 'okay_then')
form.set_default('has_db', True)
form.set_default('has_web', True)
return { return {
'index_title': "Generate Project", 'index_title': "Generate Project",
'handler': self.handler, 'handler': self.handler,
# 'choices': choices, # 'choices': choices,
'form': form,
'use_buefy': use_buefy, 'use_buefy': use_buefy,
} }