focomy 0.1.109__py3-none-any.whl → 0.1.111__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
core/api/forms.py CHANGED
@@ -9,10 +9,10 @@ from pydantic import BaseModel
9
9
  from sqlalchemy.ext.asyncio import AsyncSession
10
10
 
11
11
  from ..database import get_db
12
+ from ..engine.routes import render_template
12
13
  from ..rate_limit import limiter
13
14
  from ..services.entity import EntityService
14
15
  from ..services.mail import mail_service
15
- from ..services.theme import theme_service
16
16
  from ..utils import require_feature_async
17
17
 
18
18
  router = APIRouter(prefix="/forms", tags=["forms"])
@@ -63,8 +63,9 @@ async def view_form(
63
63
  except json.JSONDecodeError:
64
64
  steps = []
65
65
 
66
- # Render form template
67
- html = theme_service.render(
66
+ # Render form template (with admin bar context)
67
+ html = await render_template(
68
+ db,
68
69
  "form.html",
69
70
  {
70
71
  "form": form_data,
@@ -72,6 +73,9 @@ async def view_form(
72
73
  "steps": steps,
73
74
  "csrf_token": getattr(request.state, "csrf_token", ""),
74
75
  },
76
+ request=request,
77
+ entity=form,
78
+ content_type="form",
75
79
  )
76
80
 
77
81
  return HTMLResponse(content=html)
@@ -162,13 +166,15 @@ async def submit_form(
162
166
  if "application/json" in content_type:
163
167
  return {"success": True, "message": success_message}
164
168
 
165
- # Render success page
166
- html = theme_service.render(
169
+ # Render success page (with admin bar context)
170
+ html = await render_template(
171
+ db,
167
172
  "form_success.html",
168
173
  {
169
174
  "form": form_data,
170
175
  "message": success_message,
171
176
  },
177
+ request=request,
172
178
  )
173
179
 
174
180
  return HTMLResponse(content=html)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: focomy
3
- Version: 0.1.109
3
+ Version: 0.1.111
4
4
  Summary: The Most Beautiful CMS - A metadata-driven, zero-duplicate-code content management system
5
5
  Project-URL: Homepage, https://github.com/focomy/focomy
6
6
  Project-URL: Documentation, https://focomy.dev/docs
@@ -13,7 +13,7 @@ core/api/__init__.py,sha256=H1StbYGDVRS6g-Jk3UUf17ibAz1K8IUa27NfPMkaNrA,19
13
13
  core/api/auth.py,sha256=Zb37IHcUSjf8_hXiVzhoZPQw6WAiOOS_AoMqE96yat8,11565
14
14
  core/api/comments.py,sha256=Eu_0a_JqgiOP1GPsPoslxDztkCv_M324x9qAuBOWPOE,8397
15
15
  core/api/entities.py,sha256=sAS12hgjt0Zgudrq2BzfXdCU25myh-8whUxsU_z_jt8,11766
16
- core/api/forms.py,sha256=pJc0f72-F1QOTSI7aNDMaqScCmJnHUWbigvmSN4Or7k,4832
16
+ core/api/forms.py,sha256=YnGPq0SyQ_O7paJ7kV2EdCUYyq0YUJyYsOX0rkBWFos,5009
17
17
  core/api/media.py,sha256=iCsgRBS_-raYK99sksudyAINnTWFl1GhTMBaXJGWkek,6767
18
18
  core/api/relations.py,sha256=sErG5lNLBjmWZ5qSXyhGkU7F8iVZAYpFc-_5mY3ZkzU,4874
19
19
  core/api/revisions.py,sha256=8BJXtCsq8OJV1R5s33bl369lQrRDNkztWoS0tX70uAA,6960
@@ -189,7 +189,7 @@ themes/default/templates/archive.html,sha256=ZHBxPYewvc2TbrsB745LYO2uM5SJbTFQQR6
189
189
  themes/default/templates/base.html,sha256=06hSyyeAHqfG2thvMMMUQnxgRTdRD4DCGKieThSzEGM,11901
190
190
  themes/default/templates/category.html,sha256=k-yN0vFoOpgxgg6DlGin5X4IzVDBG9xRZ0FOD7OJtU8,3061
191
191
  themes/default/templates/channel.html,sha256=1i1zkAWmvpcqyoEfaeQNDc2zrMao2xSXCkjRuwzxOUU,3213
192
- themes/default/templates/form.html,sha256=OvS2yXVu3sruDOYvEjQCEQNohLf94SMQGR1V9Ky1_Sw,8685
192
+ themes/default/templates/form.html,sha256=KFrFS6qxHELPrpRB0B_BNU-uqM3k11oMYwd6oY3qoPQ,8685
193
193
  themes/default/templates/form_success.html,sha256=DTBFkWcbcTLKi-CrT3aK1PjIG5ShIpzQDVBF_fNaP0s,1210
194
194
  themes/default/templates/home.html,sha256=c_deA25C7XQz-DgmLbwDzZNPKKZUNNAc9YKILRX6tq4,495
195
195
  themes/default/templates/page.html,sha256=7Xcoq-ryaxlp913H2S1ishrAro2wsqqGmvsm1osXxd4,389
@@ -201,8 +201,8 @@ themes/minimal/templates/base.html,sha256=LFkx-XLDMGH7oFHHa0e6KPB0DJITOBvr6GtPkD
201
201
  themes/minimal/templates/home.html,sha256=ygYQgYj1OGCiKwmfsxwkPselVKT8vDH3jLLbfphpqKI,1577
202
202
  themes/minimal/templates/page.html,sha256=7Xcoq-ryaxlp913H2S1ishrAro2wsqqGmvsm1osXxd4,389
203
203
  themes/minimal/templates/post.html,sha256=FkTRHci8HNIIi3DU6Mb3oL0aDisGyDcsT_IUDwHmrvo,1387
204
- focomy-0.1.109.dist-info/METADATA,sha256=KdDxlADdFCsXNDgMH4WcLM49cMPyVwmw-oKKVQGbziE,7042
205
- focomy-0.1.109.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
206
- focomy-0.1.109.dist-info/entry_points.txt,sha256=_rF-wxGI1axY7gox3DBsTLHq-JrFKkMCjA65a6b_oqE,41
207
- focomy-0.1.109.dist-info/licenses/LICENSE,sha256=z9Z7gN7NNV7zYCaY-Knh3bv8RBCu89VueYtAlN_-lro,1063
208
- focomy-0.1.109.dist-info/RECORD,,
204
+ focomy-0.1.111.dist-info/METADATA,sha256=6a3EmVsy6IOOVUM1wDtGebUVQqnn8Q1K3hVso97veoc,7042
205
+ focomy-0.1.111.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
206
+ focomy-0.1.111.dist-info/entry_points.txt,sha256=_rF-wxGI1axY7gox3DBsTLHq-JrFKkMCjA65a6b_oqE,41
207
+ focomy-0.1.111.dist-info/licenses/LICENSE,sha256=z9Z7gN7NNV7zYCaY-Knh3bv8RBCu89VueYtAlN_-lro,1063
208
+ focomy-0.1.111.dist-info/RECORD,,
@@ -1,68 +1,5 @@
1
1
  {% extends "base.html" %}
2
2
 
3
- {% block title %}{{ form.title }} - {{ site_name }}{% endblock %}
4
-
5
- {% block content %}
6
- <div class="form-page">
7
- <header class="form-header">
8
- <h1>{{ form.title }}</h1>
9
- {% if form.description %}
10
- <p class="form-description">{{ form.description }}</p>
11
- {% endif %}
12
- </header>
13
-
14
- <form id="dynamic-form" method="POST" action="/forms/{{ form.slug }}" class="dynamic-form">
15
- <input type="hidden" name="csrf_token" value="{{ csrf_token }}">
16
-
17
- {% if steps and steps|length > 1 %}
18
- <!-- ウィザード形式 -->
19
- <div class="wizard">
20
- <div class="wizard-progress">
21
- {% for step in steps %}
22
- <div class="wizard-step {% if loop.first %}active{% endif %}" data-step="{{ loop.index }}">
23
- <span class="step-number">{{ loop.index }}</span>
24
- <span class="step-title">{{ step.title }}</span>
25
- </div>
26
- {% endfor %}
27
- </div>
28
-
29
- {% for step in steps %}
30
- <div class="wizard-panel {% if loop.first %}active{% endif %}" data-step="{{ loop.index }}">
31
- <h2 class="step-heading">{{ step.title }}</h2>
32
- {% for field in fields %}
33
- {% if field.name in step.fields %}
34
- {{ render_field(field) }}
35
- {% endif %}
36
- {% endfor %}
37
-
38
- <div class="wizard-nav">
39
- {% if not loop.first %}
40
- <button type="button" class="btn btn-secondary prev-step">戻る</button>
41
- {% endif %}
42
- {% if loop.last %}
43
- <button type="submit" class="btn btn-primary">{{ form.submit_label or '送信する' }}</button>
44
- {% else %}
45
- <button type="button" class="btn btn-primary next-step">次へ</button>
46
- {% endif %}
47
- </div>
48
- </div>
49
- {% endfor %}
50
- </div>
51
- {% else %}
52
- <!-- 通常フォーム -->
53
- <div class="form-fields">
54
- {% for field in fields %}
55
- {{ render_field(field) }}
56
- {% endfor %}
57
- </div>
58
-
59
- <div class="form-actions">
60
- <button type="submit" class="btn btn-primary">{{ form.submit_label or '送信する' }}</button>
61
- </div>
62
- {% endif %}
63
- </form>
64
- </div>
65
-
66
3
  {% macro render_field(field) %}
67
4
  <div class="form-group">
68
5
  <label for="{{ field.name }}">
@@ -134,6 +71,69 @@
134
71
  </div>
135
72
  {% endmacro %}
136
73
 
74
+ {% block title %}{{ form.title }} - {{ site_name }}{% endblock %}
75
+
76
+ {% block content %}
77
+ <div class="form-page">
78
+ <header class="form-header">
79
+ <h1>{{ form.title }}</h1>
80
+ {% if form.description %}
81
+ <p class="form-description">{{ form.description }}</p>
82
+ {% endif %}
83
+ </header>
84
+
85
+ <form id="dynamic-form" method="POST" action="/forms/{{ form.slug }}" class="dynamic-form">
86
+ <input type="hidden" name="csrf_token" value="{{ csrf_token }}">
87
+
88
+ {% if steps and steps|length > 1 %}
89
+ <!-- ウィザード形式 -->
90
+ <div class="wizard">
91
+ <div class="wizard-progress">
92
+ {% for step in steps %}
93
+ <div class="wizard-step {% if loop.first %}active{% endif %}" data-step="{{ loop.index }}">
94
+ <span class="step-number">{{ loop.index }}</span>
95
+ <span class="step-title">{{ step.title }}</span>
96
+ </div>
97
+ {% endfor %}
98
+ </div>
99
+
100
+ {% for step in steps %}
101
+ <div class="wizard-panel {% if loop.first %}active{% endif %}" data-step="{{ loop.index }}">
102
+ <h2 class="step-heading">{{ step.title }}</h2>
103
+ {% for field in fields %}
104
+ {% if field.name in step.fields %}
105
+ {{ render_field(field) }}
106
+ {% endif %}
107
+ {% endfor %}
108
+
109
+ <div class="wizard-nav">
110
+ {% if not loop.first %}
111
+ <button type="button" class="btn btn-secondary prev-step">戻る</button>
112
+ {% endif %}
113
+ {% if loop.last %}
114
+ <button type="submit" class="btn btn-primary">{{ form.submit_label or '送信する' }}</button>
115
+ {% else %}
116
+ <button type="button" class="btn btn-primary next-step">次へ</button>
117
+ {% endif %}
118
+ </div>
119
+ </div>
120
+ {% endfor %}
121
+ </div>
122
+ {% else %}
123
+ <!-- 通常フォーム -->
124
+ <div class="form-fields">
125
+ {% for field in fields %}
126
+ {{ render_field(field) }}
127
+ {% endfor %}
128
+ </div>
129
+
130
+ <div class="form-actions">
131
+ <button type="submit" class="btn btn-primary">{{ form.submit_label or '送信する' }}</button>
132
+ </div>
133
+ {% endif %}
134
+ </form>
135
+ </div>
136
+
137
137
  <style>
138
138
  .form-page {
139
139
  max-width: 600px;