New config to hide referring motions in slide and detail view

Rework motion slide:
- move referring motions to h2 subtitle
- move identifier to h1 main title
- reduce subtitle line
This commit is contained in:
Emanuel Schütze 2019-08-19 15:10:59 +02:00
parent d3c56efdc5
commit 862d8cdee9
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 meta information box on projector');
_('Hide recommendation on projector');
_('Hide referring motions');
_('Show the sequential number for a motion');
_('In motion list, motion detail and PDF.');
_('Stop submitting new motions by non-staff users');
@ -388,3 +389,4 @@ _('Motion change recommendation deleted');
// core misc strings
_('items per page');
_('Tag');

View File

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

View File

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

View File

@ -11,22 +11,24 @@
<h3>{{ data.data.recommender }}</h3>
{{ getRecommendationLabel() }}
</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 [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">
<h1>{{ getTitleWithChanges() }}</h1>
<h2><span translate>Motion</span> {{ data.data.identifier }}</h2>
<h1>
<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>

View File

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

View File

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

View File

@ -125,13 +125,23 @@ def get_config_variables():
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(
name="motions_show_sequential_numbers",
default_value=True,
input_type="boolean",
label="Show the sequential number for a motion",
help_text="In motion list, motion detail and PDF.",
weight=328,
weight=329,
group="Motions",
subgroup="General",
)

View File

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

View File

@ -293,6 +293,7 @@ async def test_motion_slide(all_data):
"base_statute": None,
"is_child": False,
"show_meta_box": True,
"show_referring_motions": True,
"reason": "",
"submitter": ["Administrator"],
"line_length": 85,
@ -319,6 +320,7 @@ async def test_amendment_slide(all_data):
"base_statute": None,
"is_child": True,
"show_meta_box": True,
"show_referring_motions": True,
"reason": "",
"submitter": ["Administrator"],
"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>"},
"is_child": False,
"show_meta_box": True,
"show_referring_motions": True,
"reason": "",
"submitter": ["Administrator"],
"line_length": 85,