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); width: calc(100% - 100px);
position: absolute; position: absolute;
left: 50px; left: 50px;
top: 50px; top: 40px;
line-height: 1.5; line-height: 1.5;
} }
} }

View File

@ -6,7 +6,7 @@
> >
<!-- Submitters --> <!-- Submitters -->
<h3 translate>Submitters</h3> <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> {{ submitter }}<span *ngIf="!last">, </span>
</span> </span>
@ -20,19 +20,54 @@
<div [ngStyle]="{ width: data.data.show_meta_box ? 'calc(100% - 250px)' : '100%' }"> <div [ngStyle]="{ width: data.data.show_meta_box ? 'calc(100% - 250px)' : '100%' }">
<!-- Title --> <!-- Title -->
<div class="spacer" [ngStyle]="{ height: projector.show_header_footer ? '50px' : '0' }"></div> <div class="spacer" [ngStyle]="{ height: projector.show_header_footer ? '50px' : '0' }"></div>
<div class="slidetitle"> <div [ngClass]="{ 'slidetitle': data.data.show_meta_box }">
<h1> <h1>
<span *ngIf="data.data.identifier">{{ data.data.identifier }}:</span> <span *ngIf="data.data.identifier">{{ data.data.identifier }}:</span>
{{ getTitleWithChanges() }} {{ getTitleWithChanges() }}
</h1> </h1>
<!-- recommendation referencing motions --> <!-- 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 translate>Referring motions</span>:
<span *ngFor="let titleInformation of referencingMotions; let last = last"> <span *ngFor="let titleInformation of referencingMotions; let last = last">
{{ getIdentifierOrTitle(titleInformation) }}<span *ngIf="!last">,</span> {{ getIdentifierOrTitle(titleInformation) }}<span *ngIf="!last">,</span>
</span> </span>
</h2> </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>
</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 { .spacer {
min-width: 1px; min-width: 1px;
} }
@ -50,8 +67,8 @@
&.line-numbers-outside { &.line-numbers-outside {
.os-line-number { .os-line-number {
&:after { &:after {
top: 19px; top: 17px;
font-size: 15px; font-size: 16px;
} }
} }
} }

View File

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

View File

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