Skip to content

Commit 42acc65

Browse files
author
VuXfi
committed
refactor: add city field to AboutProjectStep and update related settings; implement step completion check
1 parent 9a7e1a9 commit 42acc65

File tree

4 files changed

+44
-1
lines changed

4 files changed

+44
-1
lines changed

installSteps/about_project.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class AboutProjectStep {
2020
"PROJECT_NAME",
2121
"RESTOCORE_URL",
2222
"COUNTRY_ISO",
23+
"CITY",
2324
"DEFAULT_CURRENCY_ISO",
2425
"DEFAULT_LOCALE",
2526
"FRONTEND_CHECKOUT_PAGE",
@@ -43,11 +44,20 @@ class AboutProjectStep {
4344

4445
async check() {
4546
console.log('Check AboutProjectStep');
47+
48+
// Check if step was already completed
49+
const initSteps = await Settings.get("PROJECT_INIT_STEPS");
50+
if (initSteps && initSteps >= 1) {
51+
this.isProcessed = true;
52+
return true;
53+
}
54+
4655
// Check if all required settings are filled
4756
const requiredSettings = [
4857
"PROJECT_NAME",
4958
"RESTOCORE_URL",
5059
"COUNTRY_ISO",
60+
"CITY",
5161
"DEFAULT_CURRENCY_ISO",
5262
"DEFAULT_LOCALE",
5363
"FRONTEND_CHECKOUT_PAGE",
@@ -70,6 +80,7 @@ class AboutProjectStep {
7080
"PROJECT_NAME",
7181
"RESTOCORE_URL",
7282
"COUNTRY_ISO",
83+
"CITY",
7384
"DEFAULT_CURRENCY_ISO",
7485
"DEFAULT_LOCALE",
7586
"FRONTEND_CHECKOUT_PAGE",
@@ -82,6 +93,9 @@ class AboutProjectStep {
8293
}
8394
}
8495

96+
// Mark this step as completed
97+
await Settings.set("PROJECT_INIT_STEPS", { value: 1 });
98+
8599
// save data in context to process it on last step
86100
Object.assign(context, data);
87101
this.isProcessed = true;

settings/city.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
"key": "CITY",
33
"type": "string",
44
"name": "City",
5-
"description": "",
5+
"description": "City where your project is located",
6+
"jsonSchema": {
7+
"type": "string",
8+
"minLength": 2,
9+
"maxLength": 100
10+
},
611
"isRequired": true
712
}

settings/project_init_steps.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"key": "PROJECT_INIT_STEPS",
3+
"type": "number",
4+
"name": "Project Initialization Steps",
5+
"description": "Counter for completed initialization steps",
6+
"jsonSchema": {
7+
"type": "integer",
8+
"minimum": 0
9+
},
10+
"isRequired": false
11+
}

views/about_project.ejs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@
3131
<small class="form-text">Country for your application - auto-detected from your timezone</small>
3232
</div>
3333

34+
<div class="form-group">
35+
<label for="project-city">City: <span class="required">*</span></label>
36+
<input
37+
type="text"
38+
id="project-city"
39+
name="CITY"
40+
class="form-control"
41+
placeholder="Enter your city"
42+
required
43+
/>
44+
<small class="form-text">City where your project is located</small>
45+
</div>
46+
3447
<!-- Advanced Settings Spoiler -->
3548
<div class="advanced-settings">
3649
<button type="button" class="spoiler-toggle" id="advanced-toggle">

0 commit comments

Comments
 (0)