修复创建pagetype前后端模板文件路径错误
This commit is contained in:
parent
7cfc1693d6
commit
c8aefd3953
@ -59,12 +59,12 @@ const slug = computed(() => toSnake(form.value.pagetype || ''))
|
||||
function dotToSlash(s: string): string { return s ? s.split('.').join('/').toLowerCase() : '' }
|
||||
const frontendPath = computed(() =>
|
||||
appName.value && slug.value !== ''
|
||||
? `frontend/src/apps/${appName.value}/${appName.value}/${dotToSlash(moduleName.value)}/pagetype/${slug.value}/${slug.value}_toolbar.vue`
|
||||
? `apps/${appName.value}/frontend/src/views/pagetype/${slug.value}/${slug.value}_toolbar.vue`
|
||||
: ''
|
||||
)
|
||||
const backendPath = computed(() =>
|
||||
appName.value && slug.value !== ''
|
||||
? `${appName.value}/apps/${appName.value}/${appName.value}/${dotToSlash(moduleName.value)}/pagetype/${slug.value}/${slug.value}.py`
|
||||
? `apps/${appName.value}/${appName.value}/${dotToSlash(moduleName.value)}/pagetype/${slug.value}/${slug.value}.py`
|
||||
: ''
|
||||
)
|
||||
|
||||
|
||||
@ -21,8 +21,7 @@ async def create_pagetypes(payload: Dict[str, Any]):
|
||||
slug = to_snake(name)
|
||||
|
||||
current = Path(__file__).resolve()
|
||||
# project root (apps/jingrow/jingrow/api/dev.py) -> go up 5 to reach /home/dev/
|
||||
root = current.parents[5]
|
||||
root = current.parents[4]
|
||||
|
||||
frontend_path = None
|
||||
backend_path = None
|
||||
@ -30,7 +29,7 @@ async def create_pagetypes(payload: Dict[str, Any]):
|
||||
backend_exists = False
|
||||
|
||||
if create_frontend:
|
||||
fp = root / "apps" / app / "frontend" / module / "pagetype" / slug / f"{slug}_toolbar.vue"
|
||||
fp = root / "apps" / app / "frontend" / "src" / "views" / "pagetype" / slug / f"{slug}_toolbar.vue"
|
||||
fp.parent.mkdir(parents=True, exist_ok=True)
|
||||
if fp.exists():
|
||||
frontend_exists = True
|
||||
@ -39,7 +38,7 @@ async def create_pagetypes(payload: Dict[str, Any]):
|
||||
frontend_path = str(fp)
|
||||
|
||||
if create_backend:
|
||||
bp = root / "apps" / app / app / app / module / "pagetype" / slug / f"{slug}.py"
|
||||
bp = root / "apps" / app / app / module / "pagetype" / slug / f"{slug}.py"
|
||||
bp.parent.mkdir(parents=True, exist_ok=True)
|
||||
if bp.exists():
|
||||
backend_exists = True
|
||||
|
||||
19
apps/myapp/README.md
Normal file
19
apps/myapp/README.md
Normal file
@ -0,0 +1,19 @@
|
||||
# Myapp
|
||||
|
||||
Myapp
|
||||
|
||||
## 安装
|
||||
|
||||
```bash
|
||||
pip install -e .
|
||||
```
|
||||
|
||||
## 开发
|
||||
|
||||
```bash
|
||||
pip install -e ".[dev]"
|
||||
```
|
||||
|
||||
## 许可证
|
||||
|
||||
MIT License
|
||||
@ -0,0 +1,5 @@
|
||||
<template>
|
||||
<div></div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
</script>
|
||||
1
apps/myapp/myapp/__init__.py
Normal file
1
apps/myapp/myapp/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
__version__ = "0.0.1"
|
||||
0
apps/myapp/myapp/config/__init__.py
Normal file
0
apps/myapp/myapp/config/__init__.py
Normal file
6
apps/myapp/myapp/hooks.py
Normal file
6
apps/myapp/myapp/hooks.py
Normal file
@ -0,0 +1,6 @@
|
||||
app_name = "myapp"
|
||||
app_title = "Myapp"
|
||||
app_publisher = "Your Company"
|
||||
app_description = "Myapp"
|
||||
app_email = "support@yourcompany.com"
|
||||
app_license = "mit"
|
||||
1
apps/myapp/myapp/modules.txt
Normal file
1
apps/myapp/myapp/modules.txt
Normal file
@ -0,0 +1 @@
|
||||
Myapp
|
||||
0
apps/myapp/myapp/myapp/__init__.py
Normal file
0
apps/myapp/myapp/myapp/__init__.py
Normal file
3
apps/myapp/myapp/myapp/pagetype/test_page/test_page.py
Normal file
3
apps/myapp/myapp/myapp/pagetype/test_page/test_page.py
Normal file
@ -0,0 +1,3 @@
|
||||
# coding: utf-8
|
||||
|
||||
# Blank template for PageType backend hooks
|
||||
0
apps/myapp/myapp/public/.gitkeep
Normal file
0
apps/myapp/myapp/public/.gitkeep
Normal file
23
apps/myapp/pyproject.toml
Normal file
23
apps/myapp/pyproject.toml
Normal file
@ -0,0 +1,23 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=61.0", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "myapp"
|
||||
version = "0.0.1"
|
||||
description = "Myapp"
|
||||
authors = [
|
||||
{name = "Your Company", email = "support@yourcompany.com"}
|
||||
]
|
||||
license = {text = "MIT"}
|
||||
requires-python = ">=3.8"
|
||||
|
||||
dependencies = [
|
||||
# Add your app-specific dependencies here
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = [
|
||||
"pytest>=7.0.0",
|
||||
"black>=23.0.0",
|
||||
]
|
||||
Loading…
x
Reference in New Issue
Block a user