Use horizontal meta box ('pdf style table') for motion slide

This commit is contained in:
Emanuel Schütze 2019-10-28 11:06:39 +01:00 committed by Sean Engelhardt
parent 98a7d4dcdf
commit 5305b52dba
5 changed files with 91 additions and 41 deletions

View File

@ -6,7 +6,7 @@
width: calc(100% - 100px);
position: absolute;
left: 50px;
top: 50px;
top: 40px;
line-height: 1.5;
}
}

View File

@ -6,7 +6,7 @@
>
<!-- Submitters -->
<h3 translate>Submitters</h3>
<span *ngFor="let submitter of data.data.submitter; let last = last">
<span *ngFor="let submitter of data.data.submitters; let last = last">
{{ submitter }}<span *ngIf="!last">, </span>
</span>
@ -20,19 +20,54 @@
<div [ngStyle]="{ width: data.data.show_meta_box ? 'calc(100% - 250px)' : '100%' }">
<!-- Title -->
<div class="spacer" [ngStyle]="{ height: projector.show_header_footer ? '50px' : '0' }"></div>
<div class="slidetitle">
<div [ngClass]="{ 'slidetitle': data.data.show_meta_box }">
<h1>
<span *ngIf="data.data.identifier">{{ data.data.identifier }}:</span>
{{ getTitleWithChanges() }}
</h1>
<!-- recommendation referencing motions -->
<h2 *ngIf="data.data.recommendation_referencing_motions">
<h2 *ngIf="data.data.show_meta_box && data.data.recommendation_referencing_motions">
<span translate>Referring motions</span>:
<span *ngFor="let titleInformation of referencingMotions; let last = last">
{{ getIdentifierOrTitle(titleInformation) }}<span *ngIf="!last">,</span>
</span>
</h2>
<div *ngIf="!data.data.show_meta_box">
<table class="metatable spacer-top-20" cellpadding="0" cellspacing="0">
<!-- Submitters -->
<tr>
<td class="min">
<b>{{ 'Submitters' | translate }}:</b>
</td>
<td>
<span *ngFor="let submitter of data.data.submitters; let last = last">
{{ submitter }}<span *ngIf="!last">, </span>
</span>
</td>
</tr>
<!-- Recommendation -->
<tr *ngIf="data.data.recommendation && data.data.recommender">
<td class="min">
<b>{{ data.data.recommender }}:</b>
</td>
<td>
{{ getRecommendationLabel() }}
</td>
</tr>
<!-- recommendation referencing motions -->
<tr *ngIf="data.data.recommendation_referencing_motions">
<td class="min">
<b>{{ 'Referring motions' | translate }}:</b>
</td>
<td>
<span *ngFor="let titleInformation of referencingMotions; let last = last">
{{ getIdentifierOrTitle(titleInformation) }}<span *ngIf="!last">,</span>
</span>
</td>
</tr>
</table>
</div>
</div>
</div>

View File

@ -33,6 +33,23 @@
}
}
.metatable {
background-color: #ddd;
width: 100%;
font-size: 120%;
td {
border-bottom: 2px solid white;
}
td.min {
width: 1%;
white-space: nowrap;
font-weight: 500;
padding: 0 10px 0 7px;
vertical-align: top;
}
}
.spacer {
min-width: 1px;
}
@ -50,8 +67,8 @@
&.line-numbers-outside {
.os-line-number {
&:after {
top: 19px;
font-size: 15px;
top: 17px;
font-size: 16px;
}
}
}

View File

@ -151,6 +151,7 @@ async def motion_slide(
* identifier
* title
* text
* submitters
* amendment_paragraphs
* is_child
* show_meta_box
@ -161,7 +162,6 @@ async def motion_slide(
* recommendation_extension
* recommender
* change_recommendations
* submitter
"""
# Get motion
mode = element.get(
@ -177,6 +177,14 @@ async def motion_slide(
except KeyError:
raise ProjectorElementException(f"motion with id {motion_id} does not exist")
# Add submitters
submitters = [
await get_user_name(all_data, submitter["user_id"])
for submitter in sorted(
motion["submitters"], key=lambda submitter: submitter["weight"]
)
]
# Get some needed config values
show_meta_box = not await get_config(
all_data, "motions_disable_sidebox_on_projector"
@ -210,6 +218,7 @@ async def motion_slide(
return_value = {
"identifier": motion["identifier"],
"title": motion["title"],
"submitters": submitters,
"preamble": motions_preamble,
"amendment_paragraphs": motion["amendment_paragraphs"],
"base_motion": base_motion,
@ -232,42 +241,31 @@ async def motion_slide(
if mode == "final":
return_value["modified_final_version"] = motion["modified_final_version"]
if show_meta_box:
# Add recommendation, if enabled in config (and the motion has one)
if (
not await get_config(
all_data, "motions_disable_recommendation_on_projector"
# Add recommendation, if enabled in config (and the motion has one)
if (
not await get_config(all_data, "motions_disable_recommendation_on_projector")
and motion["recommendation_id"]
):
recommendation_state = await get_state(all_data, motion, "recommendation_id")
return_value["recommendation"] = recommendation_state["recommendation_label"]
if recommendation_state["show_recommendation_extension_field"]:
recommendation_extension = motion["recommendation_extension"]
# All title information for referenced motions in the recommendation
referenced_motions: Dict[int, Dict[str, str]] = {}
await extend_reference_motion_dict(
all_data, recommendation_extension, referenced_motions
)
and motion["recommendation_id"]
):
recommendation_state = await get_state(
all_data, motion, "recommendation_id"
return_value["recommendation_extension"] = recommendation_extension
return_value["referenced_motions"] = referenced_motions
if motion["statute_paragraph_id"]:
return_value["recommender"] = await get_config(
all_data, "motions_statute_recommendations_by"
)
return_value["recommendation"] = recommendation_state[
"recommendation_label"
]
if recommendation_state["show_recommendation_extension_field"]:
recommendation_extension = motion["recommendation_extension"]
# All title information for referenced motions in the recommendation
referenced_motions: Dict[int, Dict[str, str]] = {}
await extend_reference_motion_dict(
all_data, recommendation_extension, referenced_motions
)
return_value["recommendation_extension"] = recommendation_extension
return_value["referenced_motions"] = referenced_motions
else:
return_value["recommender"] = await get_config(
all_data, "motions_recommendations_by"
)
# Add submitters
return_value["submitter"] = [
await get_user_name(all_data, submitter["user_id"])
for submitter in sorted(
motion["submitters"], key=lambda submitter: submitter["weight"]
)
]
if show_referring_motions:
# Add recommendation-referencing motions
return_value[

View File

@ -295,7 +295,7 @@ async def test_motion_slide(all_data):
"show_meta_box": True,
"show_referring_motions": True,
"reason": "",
"submitter": ["Administrator"],
"submitters": ["Administrator"],
"line_length": 85,
"line_numbering_mode": "outside",
"preamble": "The assembly may decide:",
@ -322,7 +322,7 @@ async def test_amendment_slide(all_data):
"show_meta_box": True,
"show_referring_motions": True,
"reason": "",
"submitter": ["Administrator"],
"submitters": ["Administrator"],
"line_length": 85,
"line_numbering_mode": "outside",
"preamble": "The assembly may decide:",
@ -349,7 +349,7 @@ async def test_statute_amendment_slide(all_data):
"show_meta_box": True,
"show_referring_motions": True,
"reason": "",
"submitter": ["Administrator"],
"submitters": ["Administrator"],
"line_length": 85,
"line_numbering_mode": "outside",
"preamble": "The assembly may decide:",