Skip to content

Commit 7db5cba

Browse files
committedSep 17, 2024·
assign ActionSkel
1 parent 2c3b377 commit 7db5cba

File tree

4 files changed

+42
-6
lines changed

4 files changed

+42
-6
lines changed
 

‎deploy/html/todo_add.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% extends "template.html" %}
22

33
{% block content %}
4-
<h1 id="headlinetest">Eine neue ToDo anlegen<sl-icon name="emoji-smile-fill"></sl-icon></h1>
4+
<h1 id="headlinetest">Eine neue ToDo anlegen <sl-icon name="emoji-smile-fill"></sl-icon></h1>
55

66
<todo-add-form>
77
</todo-add-form>

‎deploy/modules/file.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from viur.core import i18n, db, current
1+
from viur.core import i18n, current
22
from viur.core.modules.file import File
33

44

‎deploy/modules/todo.py

+39
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
from viur.core.prototypes import List
2+
from viur.core import exposed, skey, access
3+
from viur.core.skeleton import RelSkel as ActionSkel # TODO: ActionSkel
4+
from viur.core.bones import *
25

36

47
class Todo(List):
@@ -23,6 +26,42 @@ class Todo(List):
2326
def canAdd(self):
2427
return True # everyone can add entries!
2528

29+
def addSkel(self):
30+
# TODO: new skel.sub_skel() feature!
31+
skel = self.addSkel().clone()
32+
skel.status = None
33+
return skel
34+
35+
@exposed
36+
@skey(allow_empty=True)
37+
@access("root", "todo-edit")
38+
def assign(self, **kwargs):
39+
40+
# ActionSkel for assigning multiple todos to one user
41+
class TodoAssignSkel(ActionSkel):
42+
todo = RelationalBone(
43+
kind="todo",
44+
descr="Todos",
45+
multiple=True,
46+
required=True,
47+
)
48+
49+
user = UserBone(
50+
descr="Zuweisen an",
51+
required=True,
52+
)
53+
54+
action_skel = TodoAssignSkel()
55+
56+
if not kwargs or not action_skel.fromClient(kwargs):
57+
# TODO: Provide generic render action skel
58+
return self.render.edit(action_skel, "assign")
59+
60+
# TODO: Add program logic here
61+
62+
# TODO: Provide generic render action success
63+
return self.render.editSuccess(action_skel, "assignSuccess")
64+
2665

2766
Todo.html = True
2867
Todo.json = True

‎deploy/skeletons/todo.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class TodoSkel(skeleton.Skeleton):
99

1010
lastname = StringBone(
1111
descr="Nachname",
12-
required=True
12+
required=True,
1313
)
1414

1515
subject = StringBone(
@@ -21,11 +21,8 @@ class TodoSkel(skeleton.Skeleton):
2121
descr="Nachricht",
2222
required=True,
2323
validHtml=None,
24-
params={"visibleIf":"""lastname!='Brose'"""}
2524
)
2625

27-
file = FileBone(descr="Datei")
28-
2926
status = SelectBone(
3027
descr="Status",
3128
required=True,

0 commit comments

Comments
 (0)
Please sign in to comment.