Merge pull request #4523 from tsiegleauq/motion-amendment-fixes

Add motion to motion change observation
This commit is contained in:
Emanuel Schütze 2019-03-21 15:38:31 +01:00 committed by GitHub
commit b9a3308b60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 10 deletions

View File

@ -101,7 +101,8 @@ export class MotionRepositoryService extends BaseAgendaContentObjectRepository<V
Mediafile,
Tag,
MotionChangeRecommendation,
PersonalNote
PersonalNote,
Motion
]);
config.get<SortProperty>('motions_motions_sorting').subscribe(conf => {
this.sortProperty = conf;

View File

@ -628,7 +628,10 @@ export class ViewMotion extends BaseAgendaViewModel implements Searchable {
public getSlide(configService: ConfigService): ProjectorElementBuildDeskriptor {
const slideOptions = [];
if ((this.changeRecommendations && this.changeRecommendations.length) || this.amendments) {
if (
(this.changeRecommendations && this.changeRecommendations.length) ||
(this.amendments && this.amendments.length)
) {
slideOptions.push({
key: 'mode',
displayName: _('Which version?'),

View File

@ -1,7 +1,7 @@
<os-head-bar
[mainButton]="perms.isAllowed('update', motion)"
mainButtonIcon="edit"
[prevUrl]="backTarget"
[prevUrl]="getPrevUrl()"
[nav]="false"
[editMode]="editMotion"
(mainEvent)="setEditMode(!editMotion)"

View File

@ -336,13 +336,6 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit,
*/
private editNotificationSubscription: Subscription;
/**
* Determine what to "return" to.
* Handles the target for clicking the back button
* Several angular peculiarities prevent dynamic changing from working right now
*/
public backTarget = '../..';
/**
* Hold the subscription to the navigation.
* This cannot go into the subscription-list, since it should
@ -1479,6 +1472,20 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit,
this.raiseError(error);
}
/**
* Tries to "logically" navigate back. If the motion has a parent, it will
* try to navigate to the parent
* rather than just into the list view.
*
* @returns the target to navigate to
*/
public getPrevUrl(): string {
if (this.motion.parent_id) {
return `../../${this.motion.parent_id}`;
}
return '../..';
}
/**
* Function to prevent automatically closing the window/tab,
* if the user is editing a motion.