Add motion to motion change observation

Also fixes an some navigation for motion and amendments
This commit is contained in:
Sean Engelhardt 2019-03-21 11:31:02 +01:00
parent 63a2c6b05b
commit b472a3851b
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.