Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odevzdávací Systém MO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Commits
c1792eda
Commit
c1792eda
authored
3 years ago
by
Jiří Setnička
Browse files
Options
Downloads
Patches
Plain Diff
Table: Přidání CellInput
parent
a6f98c57
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mo/web/table.py
+21
-8
21 additions, 8 deletions
mo/web/table.py
with
21 additions
and
8 deletions
mo/web/table.py
+
21
−
8
View file @
c1792eda
...
...
@@ -71,22 +71,35 @@ class CellLink(Cell):
return
a
+
'
>
'
+
escape
(
self
.
text
)
+
'
</a>
'
+
str
(
self
.
html_suffix
)
class
Cell
Checkbox
(
Cell
):
class
Cell
Input
(
Cell
):
name
:
str
value
:
str
checked
:
bool
type
:
str
attrs
:
Dict
[
str
,
Optional
[
str
]]
def
__init__
(
self
,
name
:
str
,
value
:
str
,
checked
:
bool
=
False
):
def
__init__
(
self
,
name
:
str
,
value
:
str
,
type
:
str
=
"
text
"
,
attrs
:
Dict
[
str
,
Optional
[
str
]]
=
{}
):
Cell
.
__init__
(
self
,
""
)
self
.
name
=
name
self
.
value
=
value
self
.
checked
=
checked
self
.
type
=
type
self
.
attrs
=
attrs
def
to_html
(
self
)
->
str
:
ch
=
f
'
<td><input type=
"
checkbox
"
name=
"
{
self
.
name
}
"
value=
"
{
self
.
value
}
"'
if
self
.
checked
:
ch
+=
'
checked
'
return
ch
+
'
>
'
out
=
f
'
<td><input type=
"
{
self
.
type
}
"
name=
"
{
self
.
name
}
"
value=
"
{
self
.
value
}
"'
for
(
attr
,
value
)
in
self
.
attrs
.
items
():
out
+=
f
'
{
attr
}
'
if
value
is
not
None
:
out
+=
'
=
'
+
escape
(
value
)
return
out
+
'
>
'
class
CellCheckbox
(
CellInput
):
def
__init__
(
self
,
name
:
str
,
value
:
str
,
checked
:
bool
=
False
):
attrs
=
{}
if
checked
:
attrs
[
'
checked
'
]
=
None
CellInput
.
__init__
(
self
,
name
,
value
,
"
checkbox
"
,
attrs
)
class
CellMarkup
(
Cell
):
text
:
str
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment