Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
proto3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
protokollsystem
proto3
Commits
8d605064
Commit
8d605064
authored
7 years ago
by
Robin Sonnabend
Browse files
Options
Downloads
Plain Diff
Merge branch '156-protokolle-ubersichtseite-umbauen'
parents
b5c3fc77
29f9b254
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
models/database.py
+18
-0
18 additions, 0 deletions
models/database.py
templates/macros.html
+1
-1
1 addition, 1 deletion
templates/macros.html
templates/protocols-list.html
+6
-0
6 additions, 0 deletions
templates/protocols-list.html
views/tables.py
+42
-28
42 additions, 28 deletions
views/tables.py
with
67 additions
and
29 deletions
models/database.py
+
18
−
0
View file @
8d605064
...
@@ -237,6 +237,24 @@ class Protocol(DatabaseModel):
...
@@ -237,6 +237,24 @@ class Protocol(DatabaseModel):
def
is_done
(
self
):
def
is_done
(
self
):
return
self
.
done
return
self
.
done
def
get_state_glyph
(
self
):
if
self
.
is_done
():
state
=
"
unchecked
"
#"Fertig"
if
self
.
public
:
state
=
"
check
"
#"Veröffentlicht"
else
:
state
=
"
pencil
"
#"Geplant"
return
state
def
get_state_name
(
self
):
if
self
.
is_done
():
state
=
"
Fertig
"
if
self
.
public
:
state
=
"
Veröffentlicht
"
else
:
state
=
"
Geplant
"
return
state
def
get_identifier
(
self
):
def
get_identifier
(
self
):
if
self
.
pad_identifier
is
not
None
:
if
self
.
pad_identifier
is
not
None
:
return
self
.
pad_identifier
return
self
.
pad_identifier
...
...
This diff is collapsed.
Click to expand it.
templates/macros.html
+
1
−
1
View file @
8d605064
...
@@ -126,7 +126,7 @@ to not render a label for the CRSFTokenField -->
...
@@ -126,7 +126,7 @@ to not render a label for the CRSFTokenField -->
<a
href=
"{{table.newlink}}"
>
{{table.newtext}}
</a>
<a
href=
"{{table.newlink}}"
>
{{table.newtext}}
</a>
{% endif %}
{% endif %}
</h3>
</h3>
<table
class=
"table table-striped"
>
<table
class=
"table table-striped
table-hover
"
>
<thead>
<thead>
<tr>
<tr>
{% for (header, class) in zip(table.headers(), classes) %}
{% for (header, class) in zip(table.headers(), classes) %}
...
...
This diff is collapsed.
Click to expand it.
templates/protocols-list.html
+
6
−
0
View file @
8d605064
...
@@ -12,10 +12,16 @@
...
@@ -12,10 +12,16 @@
<a
href=
"{{url_for(request.endpoint, page=_page, protocoltype_id=protocoltype_id, search=search_term, state_open=state_open, page_length=_page_length)}}"
>
{{text}}
</a>
<a
href=
"{{url_for(request.endpoint, page=_page, protocoltype_id=protocoltype_id, search=search_term, state_open=state_open, page_length=_page_length)}}"
>
{{text}}
</a>
{% endmacro %}
{% endmacro %}
{% block content %}
{% block content %}
<div
class=
"container"
>
<div
class=
"container"
>
{{render_form(search_form, class_="form-inline", action_url=url_for("list_protocols"), action_text="Suchen", labels_visible=False, method="GET")}}
{{render_form(search_form, class_="form-inline", action_url=url_for("list_protocols"), action_text="Suchen", labels_visible=False, method="GET")}}
{{render_table(protocols_table)}}
{{render_table(protocols_table)}}
<div
align=
"center"
>
<span
class=
"glyphicon glyphicon-pencil"
></span>
Geplant,
<span
class=
"glyphicon glyphicon-unchecked"
></span>
Fertig,
<span
class=
"glyphicon glyphicon-check"
></span>
Veröffentlicht
</div>
{% include "pagination-footer.html" %}
{% include "pagination-footer.html" %}
</div>
</div>
{% endblock %}
{% endblock %}
This diff is collapsed.
Click to expand it.
views/tables.py
+
42
−
28
View file @
8d605064
...
@@ -25,6 +25,16 @@ class Table:
...
@@ -25,6 +25,16 @@ class Table:
confirmation
=
"
onclick=
\"
return confirm(
'
{}
'
);
\"
"
.
format
(
confirm
)
confirmation
=
"
onclick=
\"
return confirm(
'
{}
'
);
\"
"
.
format
(
confirm
)
return
Markup
(
"
<a href=
\"
{}
\"
{}>{}</a>
"
.
format
(
target
,
confirmation
,
text
))
return
Markup
(
"
<a href=
\"
{}
\"
{}>{}</a>
"
.
format
(
target
,
confirmation
,
text
))
@staticmethod
def
button
(
target
,
icon
,
style
,
confirm
=
None
):
confirmation
=
""
if
confirm
:
confirmation
=
"
onclick=
\"
return confirm(
'
{}
'
);
\"
"
.
format
(
confirm
)
return
Markup
(
'''
<a href=
"
{target}
"
class=
"
btn btn-{style}
"
{confirmation}>
<span class=
"
glyphicon glyphicon-{icon}
"
></span>
</a>
'''
.
format
(
target
=
target
,
style
=
style
,
confirmation
=
confirmation
,
icon
=
icon
))
@staticmethod
@staticmethod
def
mail
(
target
):
def
mail
(
target
):
return
Markup
(
"
<a href=
\"
mailto:{}
\"
>{}</a>
"
.
format
(
target
,
target
))
return
Markup
(
"
<a href=
\"
mailto:{}
\"
>{}</a>
"
.
format
(
target
,
target
))
...
@@ -59,54 +69,58 @@ class ProtocolsTable(Table):
...
@@ -59,54 +69,58 @@ class ProtocolsTable(Table):
def
headers
(
self
):
def
headers
(
self
):
user
=
current_user
()
user
=
current_user
()
result
=
[
"
ID
"
,
"
Sitzung
"
,
"
Sitzung
"
,
"
Datum
"
]
result
=
[
"
Sitzung
"
,
"
Sitzung
"
,
"
Datum
"
]
state_part
=
[
"
Status
"
]
state_part
=
[
"
Status
"
,
"
Status
"
,
""
]
search_part
=
[
"
Suchergebnis
"
]
search_part
=
[
"
Suchergebnis
"
,
""
]
login_part
=
[
"
Typ
"
,
""
]
if
self
.
search_results
is
None
:
if
self
.
search_results
is
None
:
result
.
extend
(
state_part
)
result
.
extend
(
state_part
)
else
:
else
:
result
.
extend
(
search_part
)
result
.
extend
(
search_part
)
if
check_login
():
result
.
extend
(
login_part
)
return
result
return
result
def
classes
(
self
):
def
classes
(
self
):
state_or_search_class
=
"
hidden-xs
"
if
self
.
search_results
is
None
else
None
if
self
.
search_results
is
None
:
result
=
[
"
hidden-xs
"
,
"
hidden-sm hidden-md hidden-lg
"
,
"
hidden-xs
"
,
"
hidden-xs
"
,
None
]
result
=
[
"
hidden-sm hidden-md hidden-lg
"
,
"
hidden-xs
"
,
"
hidden-xs
"
,
"
hidden-sm hidden-md hidden-lg
"
,
"
hidden-xs
"
,
""
]
#result.append(state_or_search_class)
else
:
login_part
=
[
"
hidden-xs
"
,
"
hidden-xs
"
]
result
=
[
"
hidden-sm hidden-md hidden-lg
"
,
"
hidden-xs
"
,
"
hidden-xs
"
,
""
,
"
hidden-xs
"
,
"
hidden-xs
"
]
if
check_login
():
result
.
extend
(
login_part
)
return
result
return
result
def
row
(
self
,
protocol
):
def
row
(
self
,
protocol
):
user
=
current_user
()
user
=
current_user
()
protocol_link
=
url_for
(
"
show_protocol
"
,
protocol_id
=
protocol
.
id
)
protocol_link
=
url_for
(
"
show_protocol
"
,
protocol_id
=
protocol
.
id
)
result
=
[
result
=
[
Table
.
link
(
protocol_link
,
str
(
protocol
.
id
)),
Markup
(
"
<br>
"
).
join
([
Table
.
link
(
protocol_link
,
protocol
.
protocoltype
.
name
),
date_filter
(
protocol
.
date
)]),
Markup
(
"
<br>
"
).
join
([
Table
.
link
(
protocol_link
,
protocol
.
protocoltype
.
name
),
date_filter
(
protocol
.
date
)]),
Table
.
link
(
protocol_link
,
protocol
.
protocoltype
.
name
),
Table
.
link
(
protocol_link
,
protocol
.
protocoltype
.
name
),
date_filter
(
protocol
.
date
),
date_filter
(
protocol
.
date
),
]
]
if
self
.
search_results
is
None
:
if
self
.
search_results
is
None
:
state
=
"
Geplant
"
result
.
append
(
Markup
(
'
<span class=
"
glyphicon glyphicon-{state}
"
></span>
'
.
format
(
state
=
protocol
.
get_state_glyph
())))
if
protocol
.
is_done
():
result
.
append
(
Markup
(
'
<span class=
"
glyphicon glyphicon-{glyph}
"
></span> {state}
'
.
format
(
state
=
protocol
.
get_state_name
(),
glyph
=
protocol
.
get_state_glyph
())))
state
=
"
Fertig
"
if
protocol
.
public
:
state
=
"
Veröffentlicht
"
result
.
append
(
state
)
elif
protocol
in
self
.
search_results
:
elif
protocol
in
self
.
search_results
:
result
.
append
(
Markup
(
self
.
search_results
[
protocol
]))
result
.
append
(
Markup
(
self
.
search_results
[
protocol
]))
if
check_login
():
result
.
append
(
Markup
(
'
<span class=
"
glyphicon glyphicon-{state}
"
></span>
'
.
format
(
state
=
protocol
.
get_state_glyph
())))
if
user
is
not
None
and
protocol
.
protocoltype
.
has_private_view_right
(
user
):
result
.
append
(
Table
.
link
(
url_for
(
"
show_type
"
,
protocoltype_id
=
protocol
.
protocoltype
.
id
),
protocol
.
protocoltype
.
short_name
))
login_part1
=
""
login_part2
=
""
if
protocol
.
has_public_view_right
(
user
):
user_right
=
protocol
.
has_private_view_right
(
user
)
document
=
protocol
.
get_compiled_document
(
user_right
)
if
document
is
not
None
:
login_part1
=
Table
.
button
(
url_for
(
"
download_document
"
,
document_id
=
document
.
id
),
icon
=
"
download
"
,
style
=
"
success
"
)
if
protocol
.
protocoltype
.
has_admin_right
(
user
):
if
protocol
.
protocoltype
.
has_admin_right
(
user
):
result
.
append
(
Table
.
link
(
url_for
(
"
delete_protocol
"
,
protocol_id
=
protocol
.
id
),
"
Löschen
"
,
confirm
=
"
Bist du dir sicher, dass du das Protokoll {} löschen möchtest?
"
.
format
(
protocol
.
get_short_identifier
())))
login_part2
=
Table
.
button
(
else
:
url_for
(
"
delete_protocol
"
,
protocol_id
=
protocol
.
id
),
result
.
append
(
""
)
icon
=
"
trash
"
,
else
:
style
=
"
danger
"
,
result
.
extend
([
""
,
""
])
confirm
=
"
Bist du dir sicher, dass du das Protokoll {} löschen möchtest?
"
)
result
.
append
(
Markup
(
'
<div class=
"
btn-group btn-group-xs
"
> {} </div>
'
.
format
(
""
.
join
((
login_part1
,
login_part2
)))))
return
result
return
result
class
ProtocolTypesTable
(
Table
):
class
ProtocolTypesTable
(
Table
):
...
...
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