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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
protokollsystem
proto3
Commits
e078fab7
Commit
e078fab7
authored
7 years ago
by
Robin Sonnabend
Browse files
Options
Downloads
Patches
Plain Diff
Refactor protocol table code
parent
97282105
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
views/tables.py
+20
-30
20 additions, 30 deletions
views/tables.py
with
20 additions
and
30 deletions
views/tables.py
+
20
−
30
View file @
e078fab7
from
flask
import
Markup
,
url_for
,
request
from
flask
import
Markup
,
url_for
from
shared
import
date_filter
,
datetime_filter
,
time_filter
,
current_user
from
shared
import
date_filter
,
datetime_filter
,
time_filter
,
current_user
from
utils
import
get_csrf_token
from
utils
import
get_csrf_token
...
@@ -102,46 +102,36 @@ class ProtocolsTable(Table):
...
@@ -102,46 +102,36 @@ class ProtocolsTable(Table):
return
result
return
result
def
classes
(
self
):
def
classes
(
self
):
_MOBILE
=
[
"
hidden-sm hidden-md hidden-lg
"
]
_STANDARD
=
[
"
hidden-xs
"
]
_ALL
=
[
""
]
if
self
.
search_results
is
None
:
if
self
.
search_results
is
None
:
result
=
[
return
_MOBILE
+
3
*
_STANDARD
+
_MOBILE
+
_STANDARD
+
_ALL
"
hidden-sm hidden-md hidden-lg
"
,
# "Sitzung" 2 lines mobile view
"
hidden-xs
"
,
# "Sitzung" 1 line standard view
"
hidden-xs
"
,
# "Datum" standard view
"
hidden-xs
"
,
# "Uhrzeit" standard view
"
hidden-sm hidden-md hidden-lg
"
,
# "Status" only icon mobile view
"
hidden-xs
"
,
# "Status" icon + text standard view
""
# column for buttons all vievs
]
else
:
else
:
result
=
[
return
_MOBILE
+
2
*
_STANDARD
+
_ALL
+
2
*
_STANDARD
"
hidden-sm hidden-md hidden-lg
"
,
# "Sitzung" 2 lines mobile view
"
hidden-xs
"
,
# "Sitzung" 1 line standard view
"
hidden-xs
"
,
# "Datum" standard view
""
,
# "Suchergebnis" all vievs
"
hidden-xs
"
,
# Status without header standard view
"
hidden-xs
"
# column for buttons standard view
]
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
.
concat_lines
([
# "Sitzung" 2 lines
# Protocol (mobile)
Table
.
concat_lines
([
Table
.
link
(
protocol_link
,
protocol
.
protocoltype
.
name
),
Table
.
link
(
protocol_link
,
protocol
.
protocoltype
.
name
),
date_filter
(
protocol
.
date
)]),
date_filter
(
protocol
.
date
)]),
Table
.
link
(
protocol_link
,
protocol
.
protocoltype
.
name
),
# "Sitzung" 1 line
# Protocol (standard)
date_filter
(
protocol
.
date
)
# "Datum"
Table
.
link
(
protocol_link
,
protocol
.
protocoltype
.
name
),
date_filter
(
protocol
.
date
)
]
]
if
self
.
search_results
is
None
:
if
self
.
search_results
is
None
:
result
.
append
(
Markup
(
time_filter
(
protocol
.
start_time
)))
# "Uhrzeit"
result
.
append
(
Markup
(
time_filter
(
protocol
.
start_time
)))
result
.
append
(
Table
.
glyphicon
(
protocol
.
get_state_glyph
()))
# "Status" only icon
# State (mobile)
result
.
append
(
Table
.
glyphicon
(
# "Status" icon + text
result
.
append
(
Table
.
glyphicon
(
protocol
.
get_state_glyph
()))
# State (standard)
result
.
append
(
Table
.
glyphicon
(
protocol
.
get_state_glyph
(),
protocol
.
get_state_name
()))
protocol
.
get_state_glyph
(),
protocol
.
get_state_name
()))
elif
protocol
in
self
.
search_results
:
elif
protocol
in
self
.
search_results
:
result
.
append
(
Markup
(
self
.
search_results
[
protocol
]))
# "Suchergebnis"
result
.
append
(
Markup
(
self
.
search_results
[
protocol
]))
result
.
append
(
Table
.
glyphicon
(
protocol
.
get_state_glyph
()))
# "Status" only icon
result
.
append
(
Table
.
glyphicon
(
protocol
.
get_state_glyph
()))
buttons
=
[]
buttons
=
[]
if
protocol
.
has_public_view_right
(
user
):
if
protocol
.
has_public_view_right
(
user
):
...
@@ -160,7 +150,7 @@ class ProtocolsTable(Table):
...
@@ -160,7 +150,7 @@ class ProtocolsTable(Table):
confirm
=
"
Bist du dir sicher, dass du das Protokoll {}
"
confirm
=
"
Bist du dir sicher, dass du das Protokoll {}
"
"
löschen möchtest?
"
))
"
löschen möchtest?
"
))
result
.
append
(
Table
.
button_group
(
buttons
))
# column for buttons
result
.
append
(
Table
.
button_group
(
buttons
))
return
result
return
result
...
...
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