Merge pull request #4932 from emanuelschuetze/motionSlideRework

New config to hide referring motions in slide and detail view
This commit is contained in:
Emanuel Schütze 2019-08-21 14:41:11 +02:00 committed by GitHub
commit 7447052a1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 53 additions and 17 deletions

View File

@ -110,6 +110,7 @@ _('Reason required for creating new motion');
_('Hide reason on projector'); _('Hide reason on projector');
_('Hide meta information box on projector'); _('Hide meta information box on projector');
_('Hide recommendation on projector'); _('Hide recommendation on projector');
_('Hide referring motions');
_('Show the sequential number for a motion'); _('Show the sequential number for a motion');
_('In motion list, motion detail and PDF.'); _('In motion list, motion detail and PDF.');
_('Stop submitting new motions by non-staff users'); _('Stop submitting new motions by non-staff users');
@ -388,3 +389,4 @@ _('Motion change recommendation deleted');
// core misc strings // core misc strings
_('items per page'); _('items per page');
_('Tag');

View File

@ -312,11 +312,12 @@
</div> </div>
<!-- recommendation referencing motions --> <!-- recommendation referencing motions -->
<div *ngIf="!editMotion && recommendationReferencingMotions.length > 0"> <div *ngIf="!editMotion && recommendationReferencingMotions.length > 0 && showReferringMotions">
<h4 translate>Referring motions</h4> <h4 translate>Referring motions</h4>
<div *ngFor="let motion of recommendationReferencingMotions"> <span *ngFor="let motion of recommendationReferencingMotions; let last = last">
<a [routerLink]="motion.getDetailStateURL()">{{ motion.identifierOrTitle }}</a> <a [routerLink]="motion.getDetailStateURL()" class="nowrap">{{ motion.identifierOrTitle }}</a>
</div> <span *ngIf="!last"> · </span>
</span>
</div> </div>
<!-- Category --> <!-- Category -->

View File

@ -170,6 +170,11 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit,
*/ */
public reasonRequired: boolean; public reasonRequired: boolean;
/**
* Value of the config variable `motions_hide_referring_motions`
*/
public showReferringMotions: boolean;
/** /**
* Value of the config variable `motions_min_supporters` * Value of the config variable `motions_min_supporters`
*/ */
@ -470,6 +475,9 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit,
this.configService this.configService
.get<boolean>('motions_reason_required') .get<boolean>('motions_reason_required')
.subscribe(required => (this.reasonRequired = required)); .subscribe(required => (this.reasonRequired = required));
this.configService
.get<boolean>('motions_hide_referring_motions')
.subscribe(show => (this.showReferringMotions = !show));
this.configService this.configService
.get<number>('motions_min_supporters') .get<number>('motions_min_supporters')
.subscribe(supporters => (this.minSupporters = supporters)); .subscribe(supporters => (this.minSupporters = supporters));

View File

@ -11,22 +11,24 @@
<h3>{{ data.data.recommender }}</h3> <h3>{{ data.data.recommender }}</h3>
{{ getRecommendationLabel() }} {{ getRecommendationLabel() }}
</div> </div>
<!-- recommendation referencing motions -->
<div *ngIf="data.data.recommendation_referencing_motions">
<h3 translate>Referring motions</h3>
<div *ngFor="let titleInformation of data.data.recommendation_referencing_motions">
{{ getIdentifierOrTitle(titleInformation) }}
</div>
</div>
</div> </div>
<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 class="slidetitle">
<h1>{{ getTitleWithChanges() }}</h1> <h1>
<h2><span translate>Motion</span> {{ data.data.identifier }}</h2> <span *ngIf="data.data.identifier">{{ data.data.identifier }}:</span>
{{ getTitleWithChanges() }}
</h1>
<!-- recommendation referencing motions -->
<h2 *ngIf="data.data.recommendation_referencing_motions">
<span translate>Referring motions</span>:
<span *ngFor="let titleInformation of data.data.recommendation_referencing_motions; let last = last">
{{ getIdentifierOrTitle(titleInformation) }}<span *ngIf="!last">,</span>
</span>
</h2>
</div> </div>
</div> </div>

View File

@ -22,8 +22,8 @@
} }
.slidetitle { .slidetitle {
border-bottom: 4px solid #d3d3d3; border-bottom: 2px solid #d3d3d3;
margin-bottom: 40px; padding-bottom: 20px;
h1 { h1 {
margin-bottom: 0; margin-bottom: 0;

View File

@ -834,6 +834,10 @@ button.mat-menu-item.selected {
margin-right: 3px; margin-right: 3px;
} }
.nowrap {
white-space: nowrap;
}
.white { .white {
color: white; color: white;
} }

View File

@ -125,13 +125,23 @@ def get_config_variables():
subgroup="General", subgroup="General",
) )
yield ConfigVariable(
name="motions_hide_referring_motions",
default_value=False,
input_type="boolean",
label="Hide referring motions",
weight=328,
group="Motions",
subgroup="General",
)
yield ConfigVariable( yield ConfigVariable(
name="motions_show_sequential_numbers", name="motions_show_sequential_numbers",
default_value=True, default_value=True,
input_type="boolean", input_type="boolean",
label="Show the sequential number for a motion", label="Show the sequential number for a motion",
help_text="In motion list, motion detail and PDF.", help_text="In motion list, motion detail and PDF.",
weight=328, weight=329,
group="Motions", group="Motions",
subgroup="General", subgroup="General",
) )

View File

@ -154,6 +154,7 @@ async def motion_slide(
* amendment_paragraphs * amendment_paragraphs
* is_child * is_child
* show_meta_box * show_meta_box
* show_referring_motions
* reason * reason
* modified_final_version * modified_final_version
* recommendation * recommendation
@ -180,6 +181,9 @@ async def motion_slide(
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"
) )
show_referring_motions = not await get_config(
all_data, "motions_hide_referring_motions"
)
line_length = await get_config(all_data, "motions_line_length") line_length = await get_config(all_data, "motions_line_length")
line_numbering_mode = await get_config(all_data, "motions_default_line_numbering") line_numbering_mode = await get_config(all_data, "motions_default_line_numbering")
motions_preamble = await get_config(all_data, "motions_preamble") motions_preamble = await get_config(all_data, "motions_preamble")
@ -213,6 +217,7 @@ async def motion_slide(
"base_statute": base_statute, "base_statute": base_statute,
"is_child": bool(motion["parent_id"]), "is_child": bool(motion["parent_id"]),
"show_meta_box": show_meta_box, "show_meta_box": show_meta_box,
"show_referring_motions": show_referring_motions,
"change_recommendations": change_recommendations, "change_recommendations": change_recommendations,
"amendments": amendments, "amendments": amendments,
"line_length": line_length, "line_length": line_length,
@ -261,6 +266,7 @@ async def motion_slide(
) )
] ]
if show_referring_motions:
# Add recommendation-referencing motions # Add recommendation-referencing motions
return_value[ return_value[
"recommendation_referencing_motions" "recommendation_referencing_motions"

View File

@ -293,6 +293,7 @@ async def test_motion_slide(all_data):
"base_statute": None, "base_statute": None,
"is_child": False, "is_child": False,
"show_meta_box": True, "show_meta_box": True,
"show_referring_motions": True,
"reason": "", "reason": "",
"submitter": ["Administrator"], "submitter": ["Administrator"],
"line_length": 85, "line_length": 85,
@ -319,6 +320,7 @@ async def test_amendment_slide(all_data):
"base_statute": None, "base_statute": None,
"is_child": True, "is_child": True,
"show_meta_box": True, "show_meta_box": True,
"show_referring_motions": True,
"reason": "", "reason": "",
"submitter": ["Administrator"], "submitter": ["Administrator"],
"line_length": 85, "line_length": 85,
@ -345,6 +347,7 @@ async def test_statute_amendment_slide(all_data):
"base_statute": {"title": "§1 Preamble", "text": "<p>Some preamble text</p>"}, "base_statute": {"title": "§1 Preamble", "text": "<p>Some preamble text</p>"},
"is_child": False, "is_child": False,
"show_meta_box": True, "show_meta_box": True,
"show_referring_motions": True,
"reason": "", "reason": "",
"submitter": ["Administrator"], "submitter": ["Administrator"],
"line_length": 85, "line_length": 85,