From 1bd93f0e985a221f542d12258f0aeff3f9cec73f Mon Sep 17 00:00:00 2001 From: jsangmeister Date: Wed, 31 Jul 2019 12:04:15 +0200 Subject: [PATCH 1/5] added dialogs for creating and editing tags, statute paragraphs, motion comments and motion blocks --- client/package.json | 2 +- .../motion-block-list.component.html | 66 ++++---- .../motion-block-list.component.ts | 32 ++-- ...motion-comment-section-list.component.html | 153 +++++++----------- .../motion-comment-section-list.component.ts | 125 ++++++-------- .../statute-paragraph-list.component.html | 117 +++++--------- .../statute-paragraph-list.component.ts | 135 ++++++---------- .../tag-list/tag-list.component.html | 68 ++++---- .../components/tag-list/tag-list.component.ts | 137 +++++++--------- openslides/core/views.py | 1 + 10 files changed, 348 insertions(+), 488 deletions(-) diff --git a/client/package.json b/client/package.json index 65a66e9c9..2ced716f8 100644 --- a/client/package.json +++ b/client/package.json @@ -90,7 +90,7 @@ "karma-jasmine-html-reporter": "^1.4.0", "npm-license-crawler": "^0.2.1", "npm-run-all": "^4.1.5", - "prettier": "^1.18.0", + "prettier": "^1.18.2", "protractor": "^5.4.2", "resize-observer-polyfill": "^1.5.1", "source-map-explorer": "^2.0.1", diff --git a/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.html b/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.html index be4934842..7d11da074 100644 --- a/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.html +++ b/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.html @@ -3,39 +3,6 @@

Motion blocks

- - - New motion block - -
- -

- - - - A title is required - - -

- - -

- Internal -

- - -
-
- - - - - - -
- + + + +

+ {{ "New motion block" | translate }} +

+
+
+ +

+ + + + A title is required + + +

+ + +

+ Internal +

+ + +
+
+
+ + +
+
diff --git a/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.ts b/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.ts index 2d33f766a..40c66b82e 100644 --- a/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.ts +++ b/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.ts @@ -1,5 +1,6 @@ -import { Component, OnInit, ViewEncapsulation } from '@angular/core'; +import { Component, OnInit, TemplateRef, ViewChild, ViewEncapsulation } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { MatDialog, MatDialogRef } from '@angular/material'; import { MatSnackBar } from '@angular/material/snack-bar'; import { Title } from '@angular/platform-browser'; @@ -27,6 +28,11 @@ import { MotionBlockSortService } from 'app/site/motions/services/motion-block-s encapsulation: ViewEncapsulation.None }) export class MotionBlockListComponent extends BaseListViewComponent implements OnInit { + @ViewChild('newMotionBlockDialog', { static: true }) + private newMotionBlockDialog: TemplateRef; + + private dialogRef: MatDialogRef; + /** * Holds the create form */ @@ -95,6 +101,7 @@ export class MotionBlockListComponent extends BaseListViewComponent +

Comment fields

@@ -13,52 +13,11 @@
- - New comment field - -
-

- - - - Required - - -

-

- -

-

- -

-
-
- - - - -
@@ -87,59 +46,22 @@
-
- Edit comment field: -

- - - - Required - - -

-

- -

-

- -

-
- -

Name

-
{{ section.name }}
-

Groups with read permissions

-
    -
  • {{ group.getTitle() }}
  • -
-
No groups selected
-

Groups with write permissions

-
    -
  • {{ group.getTitle() }}
  • -
-
No groups selected
-
+

Name

+
{{ section.name }}
+

Groups with read permissions

+
    +
  • {{ group.getTitle() }}
  • +
+
No groups selected
+

Groups with write permissions

+
    +
  • {{ group.getTitle() }}
  • +
+
No groups selected
- - - @@ -153,3 +75,48 @@ Sort + + + +

+ {{ (currentComment ? "Edit comment field" : "New comment field") | translate }} +

+
+
+

+ + + + Required + + +

+

+ +

+

+ +

+
+
+
+ + +
+
diff --git a/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.ts b/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.ts index 9be7b7a3c..0234c3e10 100644 --- a/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.ts +++ b/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.ts @@ -1,5 +1,6 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { MatDialog, MatDialogRef } from '@angular/material'; import { MatSnackBar } from '@angular/material/snack-bar'; import { Title } from '@angular/platform-browser'; @@ -23,7 +24,12 @@ import { ViewGroup } from 'app/site/users/models/view-group'; styleUrls: ['./motion-comment-section-list.component.scss'] }) export class MotionCommentSectionListComponent extends BaseViewComponent implements OnInit { - public commentSectionToCreate: MotionCommentSection | null; + @ViewChild('motionCommentDialog', { static: true }) + private motionCommentDialog: TemplateRef; + + public currentComment: ViewMotionCommentSection | null; + + public dialogRef: MatDialogRef; /** * Source of the Data @@ -31,14 +37,11 @@ export class MotionCommentSectionListComponent extends BaseViewComponent impleme public commentSections: ViewMotionCommentSection[] = []; /** - * The current focussed formgroup + * formgroup for editing and creating of comments */ - public updateForm: FormGroup; - - public createForm: FormGroup; + public commentFieldForm: FormGroup; public openId: number | null; - public editId: number | null; public groups: BehaviorSubject; @@ -59,6 +62,7 @@ export class MotionCommentSectionListComponent extends BaseViewComponent impleme private repo: MotionCommentSectionRepositoryService, private formBuilder: FormBuilder, private promptService: PromptService, + private dialog: MatDialog, private groupRepo: GroupRepositoryService ) { super(titleService, translate, matSnackBar); @@ -68,8 +72,7 @@ export class MotionCommentSectionListComponent extends BaseViewComponent impleme read_groups_id: [[]], write_groups_id: [[]] }; - this.createForm = this.formBuilder.group(form); - this.updateForm = this.formBuilder.group(form); + this.commentFieldForm = this.formBuilder.group(form); } /** @@ -82,81 +85,62 @@ export class MotionCommentSectionListComponent extends BaseViewComponent impleme } /** - * Event on Key Down in update or create form. + * Event on Key Down in form. * * @param event the keyboard event * @param the current view in scope */ - public keyDownFunction(event: KeyboardEvent, viewSection?: ViewMotionCommentSection): void { + public onKeyDown(event: KeyboardEvent, viewSection?: ViewMotionCommentSection): void { if (event.key === 'Enter' && event.shiftKey) { - if (viewSection) { - this.onSaveButton(viewSection); - } else { - this.create(); - } + this.save(); } if (event.key === 'Escape') { - if (viewSection) { - this.editId = null; - } else { - this.commentSectionToCreate = null; - } + this.cancel(); } } /** - * Opens the create form. + * Opens the create dialog. */ - public onPlusButton(): void { - if (!this.commentSectionToCreate) { - this.commentSectionToCreate = new MotionCommentSection(); - this.createForm.setValue({ - name: '', - read_groups_id: [], - write_groups_id: [] - }); - } - } - - /** - * Creates the comment section from the create form. - */ - public create(): void { - if (this.createForm.valid) { - this.commentSectionToCreate.patchValues(this.createForm.value as MotionCommentSection); - this.repo - .create(this.commentSectionToCreate) - .then(() => (this.commentSectionToCreate = null), this.raiseError); - } - } - - /** - * Executed on edit button - * @param viewSection - */ - public onEditButton(viewSection: ViewMotionCommentSection): void { - this.editId = viewSection.id; - - this.updateForm.setValue({ - name: viewSection.name, - read_groups_id: viewSection.read_groups_id, - write_groups_id: viewSection.write_groups_id + public openDialog(c?: ViewMotionCommentSection): void { + this.currentComment = c; + this.commentFieldForm.reset({ + name: c ? c.name : '', + read_groups_id: c ? c.read_groups_id : [], + write_groups_id: c ? c.write_groups_id : [] + }); + this.dialogRef = this.dialog.open(this.motionCommentDialog, { + width: '500px', + maxWidth: '90vw', + maxHeight: '90vh', + disableClose: true }); } /** - * Saves the comment section - * - * @param viewSection The section to save + * saves the current data, either updating an existing comment or creating a new one. */ - public onSaveButton(viewSection: ViewMotionCommentSection): void { - if (this.updateForm.valid) { - this.repo.update(this.updateForm.value as Partial, viewSection).then(() => { - this.openId = this.editId = null; - }, this.raiseError); + public save(): void { + if (this.commentFieldForm.valid) { + // eiher update or create + if (this.currentComment) { + this.repo + .update(this.commentFieldForm.value as Partial, this.currentComment) + .then(() => this.dialogRef.close(), this.raiseError); + } else { + const c = new MotionCommentSection(this.commentFieldForm.value); + this.repo.create(c).then(() => this.dialogRef.close(), this.raiseError); + } } } + /** + * close the dialog + */ + public cancel(): void { + this.dialogRef.close(); + } + /** * is executed, when the delete button is pressed * @param viewSection The section to delete @@ -165,18 +149,7 @@ export class MotionCommentSectionListComponent extends BaseViewComponent impleme const title = this.translate.instant('Are you sure you want to delete this comment field?'); const content = viewSection.name; if (await this.promptService.open(title, content)) { - this.repo.delete(viewSection).then(() => (this.openId = this.editId = null), this.raiseError); - } - } - - /** - * Is executed when a mat-extension-panel is closed - * @param viewSection the section in the panel - */ - public panelClosed(viewSection: ViewMotionCommentSection): void { - this.openId = null; - if (this.editId) { - this.onSaveButton(viewSection); + this.repo.delete(viewSection).catch(this.raiseError); } } } diff --git a/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.html b/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.html index bdbbcf1e1..40eb854e2 100644 --- a/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.html +++ b/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.html @@ -1,4 +1,4 @@ - +

Statute

@@ -12,41 +12,12 @@
- - New statute paragraph - -
-

- - - - Required - - -

- - -

Statute paragraph

- -
-
-
- - - - -
- - + @@ -55,51 +26,17 @@ {{ statuteParagraph.title }} -
- Edit statute paragraph: -

- - - - Required - - -

- - -

Statute paragraph

- -
-
- - - {{ statuteParagraph.title }} - -
-
-
-
+ + {{ statuteParagraph.title }} + +
+
+
- - - - @@ -123,3 +60,35 @@ Import ... + + + +

+ {{ (currentStatuteParagraph ? "Edit statute paragraph" : "New statute paragraph") | translate }} +

+
+
+

+ + + + Required + + +

+ + +

Statute paragraph

+ +
+
+
+
+ + +
+
diff --git a/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.ts b/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.ts index 8463f4d40..235023c8c 100644 --- a/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.ts +++ b/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.ts @@ -1,5 +1,6 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { MatDialog, MatDialogRef } from '@angular/material'; import { MatSnackBar } from '@angular/material/snack-bar'; import { Title } from '@angular/platform-browser'; @@ -21,7 +22,12 @@ import { StatuteCsvExportService } from 'app/site/motions/services/statute-csv-e styleUrls: ['./statute-paragraph-list.component.scss'] }) export class StatuteParagraphListComponent extends BaseViewComponent implements OnInit { - public statuteParagraphToCreate: StatuteParagraph | null; + @ViewChild('statuteParagraphDialog', { static: true }) + private statuteParagraphDialog: TemplateRef; + + private dialogRef: MatDialogRef; + + private currentStatuteParagraph: ViewStatuteParagraph | null; /** * Source of the Data @@ -29,14 +35,11 @@ export class StatuteParagraphListComponent extends BaseViewComponent implements public statuteParagraphs: ViewStatuteParagraph[] = []; /** - * The current focussed formgroup + * Formgroup for creating and updating of statute paragraphs */ - public updateForm: FormGroup; + public statuteParagraphForm: FormGroup; - public createForm: FormGroup; - - public openId: number | null; - public editId: number | null; + public openId: Number | null; /** * The usual component constructor. Initializes the forms @@ -56,6 +59,7 @@ export class StatuteParagraphListComponent extends BaseViewComponent implements private repo: StatuteParagraphRepositoryService, private formBuilder: FormBuilder, private promptService: PromptService, + private dialog: MatDialog, private csvExportService: StatuteCsvExportService ) { super(titleService, translate, matSnackBar); @@ -64,8 +68,7 @@ export class StatuteParagraphListComponent extends BaseViewComponent implements title: ['', Validators.required], text: ['', Validators.required] }; - this.createForm = this.formBuilder.group(form); - this.updateForm = this.formBuilder.group(form); + this.statuteParagraphForm = this.formBuilder.group(form); } /** @@ -81,53 +84,39 @@ export class StatuteParagraphListComponent extends BaseViewComponent implements } /** - * Add a new Section. + * Open the modal dialog */ - public onPlusButton(): void { - if (!this.statuteParagraphToCreate) { - this.createForm.reset(); - this.createForm.setValue({ - title: '', - text: '' + public openDialog(p?: ViewStatuteParagraph): void { + this.currentStatuteParagraph = p; + this.statuteParagraphForm.reset(); + if (p) { + this.statuteParagraphForm.setValue({ + title: p.title, + text: p.text }); - this.statuteParagraphToCreate = new StatuteParagraph(); } - } - - /** - * Handler when clicking on create to create a new statute paragraph - */ - public create(): void { - if (this.createForm.valid) { - this.statuteParagraphToCreate.patchValues(this.createForm.value as StatuteParagraph); - this.repo.create(this.statuteParagraphToCreate).then(() => { - this.statuteParagraphToCreate = null; - }, this.raiseError); - } - } - - /** - * Executed on edit button - * @param viewStatuteParagraph - */ - public onEditButton(viewStatuteParagraph: ViewStatuteParagraph): void { - this.editId = viewStatuteParagraph.id; - - this.updateForm.setValue({ - title: viewStatuteParagraph.title, - text: viewStatuteParagraph.text + this.dialogRef = this.dialog.open(this.statuteParagraphDialog, { + width: '1000px', + maxWidth: '95vw', + maxHeight: '90vh', + disableClose: true }); } /** - * Saves the statute paragraph - * @param viewStatuteParagraph The statute paragraph to save + * creates a new statute paragraph or updates the current one */ - public onSaveButton(viewStatuteParagraph: ViewStatuteParagraph): void { - if (this.updateForm.valid) { - this.repo.update(this.updateForm.value as Partial, viewStatuteParagraph).then(() => { - this.openId = this.editId = null; - }, this.raiseError); + public save(): void { + if (this.statuteParagraphForm.valid) { + // eiher update or create + if (this.currentStatuteParagraph) { + this.repo + .update(this.statuteParagraphForm.value as Partial, this.currentStatuteParagraph) + .then(() => this.dialogRef.close(), this.raiseError); + } else { + const p = new StatuteParagraph(this.statuteParagraphForm.value); + this.repo.create(p).then(() => this.dialogRef.close(), this.raiseError); + } } } @@ -139,18 +128,7 @@ export class StatuteParagraphListComponent extends BaseViewComponent implements const title = this.translate.instant('Are you sure you want to delete this statute paragraph?'); const content = viewStatuteParagraph.title; if (await this.promptService.open(title, content)) { - this.repo.delete(viewStatuteParagraph).then(() => (this.openId = this.editId = null), this.raiseError); - } - } - - /** - * Is executed when a mat-extension-panel is closed - * @param viewStatuteParagraph the statute paragraph in the panel - */ - public panelClosed(viewStatuteParagraph: ViewStatuteParagraph): void { - this.openId = null; - if (this.editId) { - this.onSaveButton(viewStatuteParagraph); + this.repo.delete(viewStatuteParagraph).catch(this.raiseError); } } @@ -167,43 +145,20 @@ export class StatuteParagraphListComponent extends BaseViewComponent implements * * @param event has the code */ - public onKeyDownCreate(event: KeyboardEvent): void { + public onKeyDown(event: KeyboardEvent): void { if (event.key === 'Enter' && event.shiftKey) { - this.create(); + this.save(); } if (event.key === 'Escape') { - this.onCancelCreate(); + this.cancel(); } } /** - * Cancels the current form action + * Closes the dialog */ - public onCancelCreate(): void { - this.statuteParagraphToCreate = null; - } - - /** - * clicking Shift and Enter will save automatically - * clicking Escape will cancel the process - * - * @param event has the code - */ - public onKeyDownUpdate(event: KeyboardEvent): void { - if (event.key === 'Enter' && event.shiftKey) { - const myParagraph = this.statuteParagraphs.find(x => x.id === this.editId); - this.onSaveButton(myParagraph); - } - if (event.key === 'Escape') { - this.onCancelUpdate(); - } - } - - /** - * Cancels the current form action - */ - public onCancelUpdate(): void { - this.editId = null; + public cancel(): void { + this.dialogRef.close(); } /** diff --git a/client/src/app/site/tags/components/tag-list/tag-list.component.html b/client/src/app/site/tags/components/tag-list/tag-list.component.html index 8154989d7..1c93d2056 100644 --- a/client/src/app/site/tags/components/tag-list/tag-list.component.html +++ b/client/src/app/site/tags/components/tag-list/tag-list.component.html @@ -1,37 +1,10 @@ - -
-

Tags

-
- - - Required - -
-
- - -
- -
+

Tags

-
+
{{ name }}
+ +
+ +
+ +
+ +
+ + + +

+ {{ (currentTag ? 'Edit tag' : 'New tag') | translate }} +

+
+
+ + + +
+ +
+ + +
+
+
diff --git a/client/src/app/site/tags/components/tag-list/tag-list.component.ts b/client/src/app/site/tags/components/tag-list/tag-list.component.ts index ae424b516..8150d68d1 100644 --- a/client/src/app/site/tags/components/tag-list/tag-list.component.ts +++ b/client/src/app/site/tags/components/tag-list/tag-list.component.ts @@ -1,5 +1,6 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; -import { FormControl, FormGroup, Validators } from '@angular/forms'; +import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { MatDialog, MatDialogRef } from '@angular/material'; import { MatSnackBar } from '@angular/material/snack-bar'; import { Title } from '@angular/platform-browser'; @@ -13,7 +14,7 @@ import { BaseListViewComponent } from 'app/site/base/base-list-view'; import { ViewTag } from '../../models/view-tag'; /** - * Listview for the complete lsit of available Tags + * Listview for the complete list of available Tags * ### Usage: * ```html * @@ -25,12 +26,19 @@ import { ViewTag } from '../../models/view-tag'; styleUrls: ['./tag-list.component.scss'] }) export class TagListComponent extends BaseListViewComponent implements OnInit { - public editTag = false; - public newTag = false; - public selectedTag: ViewTag; + @ViewChild('tagDialog', { static: true }) + private tagDialog: TemplateRef; - @ViewChild('tagForm', { static: true }) - public tagForm: FormGroup; + private tagForm: FormGroup = this.formBuilder.group({ + name: ['', [Validators.required]] + }); + + private dialogRef: MatDialogRef; + + /** + * Holds the tag that's currently being edited, or null. + */ + public currentTag: ViewTag; /** * Define the columns to show @@ -39,6 +47,14 @@ export class TagListComponent extends BaseListViewComponent implements { prop: 'name', width: 'auto' + }, + { + prop: 'edit', + width: this.singleButtonWidth + }, + { + prop: 'delete', + width: this.singleButtonWidth } ]; @@ -55,7 +71,9 @@ export class TagListComponent extends BaseListViewComponent implements matSnackBar: MatSnackBar, public repo: TagRepositoryService, protected translate: TranslateService, // protected required for ng-translate-extract - private promptService: PromptService + private promptService: PromptService, + private dialog: MatDialog, + private formBuilder: FormBuilder ) { super(titleService, translate, matSnackBar); } @@ -66,93 +84,48 @@ export class TagListComponent extends BaseListViewComponent implements */ public ngOnInit(): void { super.setTitle('Tags'); - this.tagForm = new FormGroup({ name: new FormControl('', Validators.required) }); } /** - * Sends a new or updates tag to the dataStore + * sets the given tag as the current and opens the tag dialog. + * @param tag the current tag, or null if a new tag is to be created */ - public saveTag(): void { - if (this.editTag && this.newTag) { - this.submitNewTag(); - } else if (this.editTag && !this.newTag) { - this.submitEditedTag(); - } - } - - /** - * Saves a newly created tag. - */ - public submitNewTag(): void { - if (!this.tagForm.value || !this.tagForm.valid) { - return; - } - this.repo.create(this.tagForm.value).then(() => { - this.tagForm.reset(); - this.cancelEditing(); - }, this.raiseError); - } - - /** - * Saves an edited tag. - */ - public submitEditedTag(): void { - if (!this.tagForm.value || !this.tagForm.valid) { - return; - } - const updateData = new Tag({ name: this.tagForm.value.name }); - - this.repo.update(updateData, this.selectedTag).then(() => this.cancelEditing(), this.raiseError); - } - - /** - * Deletes the selected Tag after a successful confirmation. - */ - public async deleteSelectedTag(): Promise { - const title = this.translate.instant('Are you sure you want to delete this tag?'); - const content = this.selectedTag.name; - if (await this.promptService.open(title, content)) { - this.repo.delete(this.selectedTag).then(() => this.cancelEditing(), this.raiseError); - } - } - - /** - * Cancels the editing - */ - public cancelEditing(): void { - this.newTag = false; - this.editTag = false; + public openTagDialog(tag?: ViewTag): void { + this.currentTag = tag; this.tagForm.reset(); + this.tagForm.get('name').setValue(this.currentTag ? this.currentTag.name : ''); + this.dialogRef = this.dialog.open(this.tagDialog, { + width: '400px', + maxWidth: '90vw', + maxHeight: '90vh', + disableClose: true + }); } /** - * Handler for a click on a row in the table - * @param viewTag + * Submit the form and create or update a tag. */ - public selectTag(viewTag: ViewTag): void { - this.selectedTag = viewTag; - this.setEditMode(true, false); - this.tagForm.setValue({ name: this.selectedTag.name }); - } - - public setEditMode(mode: boolean, newTag: boolean = true): void { - this.editTag = mode; - this.newTag = newTag; - if (!mode) { - this.cancelEditing(); + public onSubmit(): void { + if (!this.tagForm.value || !this.tagForm.valid) { + return; + } + if (this.currentTag) { + this.repo + .update(new Tag(this.tagForm.value), this.currentTag) + .then(() => this.dialogRef.close(), this.raiseError); + } else { + this.repo.create(this.tagForm.value).then(() => this.dialogRef.close(), this.raiseError); } } /** - * Handles keyboard events. On enter, the editing is canceled. - * @param event + * Deletes the given Tag after a successful confirmation. */ - public keyDownFunction(event: KeyboardEvent): void { - if (event.key === 'Enter' && event.shiftKey) { - this.submitNewTag(); - } - if (event.key === 'Escape') { - this.cancelEditing(); + public async onDeleteButton(tag: ViewTag): Promise { + const title = this.translate.instant('Are you sure you want to delete this tag?'); + const content = tag.name; + if (await this.promptService.open(title, content)) { + this.repo.delete(tag).catch(this.raiseError); } } } diff --git a/openslides/core/views.py b/openslides/core/views.py index 11f71b968..71ef04fc8 100644 --- a/openslides/core/views.py +++ b/openslides/core/views.py @@ -186,6 +186,7 @@ class ProjectorViewSet(ModelViewSet): If `reset_scroll` is True, the scoll of the projector will reset. """ projector = self.get_object() + projector.scroll = 0 elements = request.data.get("elements") preview = request.data.get("preview") history_element = request.data.get("append_to_history") From 30c93f399065b5167fb85b9e30908814e49a1463 Mon Sep 17 00:00:00 2001 From: Joshua Sangmeister Date: Tue, 6 Aug 2019 09:26:11 +0200 Subject: [PATCH 2/5] w --- AUTHORS | 1 + .../agenda-content-object-form.component.html | 8 ++-- .../motion-block-list.component.html | 20 ++++----- .../motion-block-list.component.scss | 10 ++++- .../motion-block-list.component.ts | 43 +++++++----------- ...motion-comment-section-list.component.html | 4 +- .../motion-comment-section-list.component.ts | 44 ++++++++----------- .../statute-paragraph-list.component.html | 6 +-- .../statute-paragraph-list.component.ts | 44 ++++++++----------- .../tag-list/tag-list.component.html | 24 +++++----- .../components/tag-list/tag-list.component.ts | 42 ++++++++++++------ 11 files changed, 119 insertions(+), 127 deletions(-) diff --git a/AUTHORS b/AUTHORS index e438973a9..6147d3e87 100644 --- a/AUTHORS +++ b/AUTHORS @@ -30,3 +30,4 @@ Authors of OpenSlides in chronological order of first contribution: Jochen Saalfeld Fadi Abbud Gabriel Meyer + Joshua Sangmeister diff --git a/client/src/app/shared/components/agenda-content-object-form/agenda-content-object-form.component.html b/client/src/app/shared/components/agenda-content-object-form/agenda-content-object-form.component.html index 3cd2a2f02..bd59f1a30 100644 --- a/client/src/app/shared/components/agenda-content-object-form/agenda-content-object-form.component.html +++ b/client/src/app/shared/components/agenda-content-object-form/agenda-content-object-form.component.html @@ -1,9 +1,11 @@
- - Add to agenda - +

+ + Add to agenda + +

diff --git a/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.html b/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.html index 7d11da074..af403280c 100644 --- a/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.html +++ b/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.html @@ -41,16 +41,14 @@ {{ "New motion block" | translate }}
-
+
-

- - - - A title is required - - -

+ + + + A title is required + +

@@ -61,9 +59,9 @@

- - +
diff --git a/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.scss b/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.scss index 7a60d3212..83f48c826 100644 --- a/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.scss +++ b/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.scss @@ -8,6 +8,12 @@ } } -.mat-form-field { - width: 50%; +.mat-dialog-container { + .mat-dialog-title { + margin: 0; + } + + .mat-form-field { + width: 100%; + } } diff --git a/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.ts b/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.ts index 40c66b82e..478a093ad 100644 --- a/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.ts +++ b/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, TemplateRef, ViewChild, ViewEncapsulation } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { MatDialog, MatDialogRef } from '@angular/material'; +import { MatDialog } from '@angular/material'; import { MatSnackBar } from '@angular/material/snack-bar'; import { Title } from '@angular/platform-browser'; @@ -17,6 +17,7 @@ import { ViewItem } from 'app/site/agenda/models/view-item'; import { BaseListViewComponent } from 'app/site/base/base-list-view'; import { ViewMotionBlock } from 'app/site/motions/models/view-motion-block'; import { MotionBlockSortService } from 'app/site/motions/services/motion-block-sort.service'; +import { infoDialogSettings } from 'app/shared/utils/dialog-settings'; /** * Table for the motion blocks @@ -31,8 +32,6 @@ export class MotionBlockListComponent extends BaseListViewComponent; - private dialogRef: MatDialogRef; - /** * Holds the create form */ @@ -136,13 +135,9 @@ export class MotionBlockListComponent extends BaseListViewComponent { + if (res) { + this.save(); + } + }) } /** - * Click handler for the save button. * Sends the block to create to the repository and resets the form. */ - public async onSaveNewButton(): Promise { + private save(): void { if (this.createBlockForm.valid) { const block = this.createBlockForm.value; if (!block.agenda_parent_id) { @@ -171,14 +165,12 @@ export class MotionBlockListComponent extends BaseListViewComponent
- -
diff --git a/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.ts b/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.ts index 0234c3e10..6a72f1c15 100644 --- a/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.ts +++ b/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { MatDialog, MatDialogRef } from '@angular/material'; +import { MatDialog } from '@angular/material'; import { MatSnackBar } from '@angular/material/snack-bar'; import { Title } from '@angular/platform-browser'; @@ -14,6 +14,7 @@ import { MotionCommentSection } from 'app/shared/models/motions/motion-comment-s import { BaseViewComponent } from 'app/site/base/base-view'; import { ViewMotionCommentSection } from 'app/site/motions/models/view-motion-comment-section'; import { ViewGroup } from 'app/site/users/models/view-group'; +import { infoDialogSettings } from 'app/shared/utils/dialog-settings'; /** * List view for the comment sections. @@ -29,8 +30,6 @@ export class MotionCommentSectionListComponent extends BaseViewComponent impleme public currentComment: ViewMotionCommentSection | null; - public dialogRef: MatDialogRef; - /** * Source of the Data */ @@ -93,54 +92,47 @@ export class MotionCommentSectionListComponent extends BaseViewComponent impleme public onKeyDown(event: KeyboardEvent, viewSection?: ViewMotionCommentSection): void { if (event.key === 'Enter' && event.shiftKey) { this.save(); + this.dialog.closeAll(); } if (event.key === 'Escape') { - this.cancel(); + this.dialog.closeAll(); } } /** * Opens the create dialog. */ - public openDialog(c?: ViewMotionCommentSection): void { - this.currentComment = c; + public openDialog(commentSection?: ViewMotionCommentSection): void { + this.currentComment = commentSection; this.commentFieldForm.reset({ - name: c ? c.name : '', - read_groups_id: c ? c.read_groups_id : [], - write_groups_id: c ? c.write_groups_id : [] + name: commentSection ? commentSection.name : '', + read_groups_id: commentSection ? commentSection.read_groups_id : [], + write_groups_id: commentSection ? commentSection.write_groups_id : [] }); - this.dialogRef = this.dialog.open(this.motionCommentDialog, { - width: '500px', - maxWidth: '90vw', - maxHeight: '90vh', - disableClose: true + const dialogRef = this.dialog.open(this.motionCommentDialog, infoDialogSettings); + dialogRef.afterClosed().subscribe((res) => { + if (res) { + this.save(); + } }); } /** * saves the current data, either updating an existing comment or creating a new one. */ - public save(): void { + private save(): void { if (this.commentFieldForm.valid) { // eiher update or create if (this.currentComment) { - this.repo - .update(this.commentFieldForm.value as Partial, this.currentComment) - .then(() => this.dialogRef.close(), this.raiseError); + this.repo.update(this.commentFieldForm.value as Partial, this.currentComment).catch(this.raiseError); } else { const c = new MotionCommentSection(this.commentFieldForm.value); - this.repo.create(c).then(() => this.dialogRef.close(), this.raiseError); + this.repo.create(c).catch(this.raiseError); } + this.commentFieldForm.reset(); } } - /** - * close the dialog - */ - public cancel(): void { - this.dialogRef.close(); - } - /** * is executed, when the delete button is pressed * @param viewSection The section to delete diff --git a/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.html b/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.html index 40eb854e2..8d4baf4a7 100644 --- a/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.html +++ b/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.html @@ -64,7 +64,7 @@

- {{ (currentStatuteParagraph ? "Edit statute paragraph" : "New statute paragraph") | translate }} + {{ ((currentStatuteParagraph ? "Edit" : "New") + "statute paragraph") | translate }}

@@ -84,10 +84,10 @@
- -
diff --git a/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.ts b/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.ts index 235023c8c..ae7e9dca5 100644 --- a/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.ts +++ b/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { MatDialog, MatDialogRef } from '@angular/material'; +import { MatDialog } from '@angular/material'; import { MatSnackBar } from '@angular/material/snack-bar'; import { Title } from '@angular/platform-browser'; @@ -12,6 +12,7 @@ import { StatuteParagraph } from 'app/shared/models/motions/statute-paragraph'; import { BaseViewComponent } from 'app/site/base/base-view'; import { ViewStatuteParagraph } from 'app/site/motions/models/view-statute-paragraph'; import { StatuteCsvExportService } from 'app/site/motions/services/statute-csv-export.service'; +import { largeDialogSettings } from 'app/shared/utils/dialog-settings'; /** * List view for the statute paragraphs. @@ -25,8 +26,6 @@ export class StatuteParagraphListComponent extends BaseViewComponent implements @ViewChild('statuteParagraphDialog', { static: true }) private statuteParagraphDialog: TemplateRef; - private dialogRef: MatDialogRef; - private currentStatuteParagraph: ViewStatuteParagraph | null; /** @@ -86,37 +85,36 @@ export class StatuteParagraphListComponent extends BaseViewComponent implements /** * Open the modal dialog */ - public openDialog(p?: ViewStatuteParagraph): void { - this.currentStatuteParagraph = p; + public openDialog(paragraph?: ViewStatuteParagraph): void { + this.currentStatuteParagraph = paragraph; this.statuteParagraphForm.reset(); - if (p) { + if (paragraph) { this.statuteParagraphForm.setValue({ - title: p.title, - text: p.text + title: paragraph.title, + text: paragraph.text }); } - this.dialogRef = this.dialog.open(this.statuteParagraphDialog, { - width: '1000px', - maxWidth: '95vw', - maxHeight: '90vh', - disableClose: true + const dialogRef = this.dialog.open(this.statuteParagraphDialog, largeDialogSettings); + dialogRef.afterClosed().subscribe((res) => { + if (res) { + this.save(); + } }); } /** * creates a new statute paragraph or updates the current one */ - public save(): void { + private save(): void { if (this.statuteParagraphForm.valid) { // eiher update or create if (this.currentStatuteParagraph) { - this.repo - .update(this.statuteParagraphForm.value as Partial, this.currentStatuteParagraph) - .then(() => this.dialogRef.close(), this.raiseError); + this.repo.update(this.statuteParagraphForm.value as Partial, this.currentStatuteParagraph).catch(this.raiseError); } else { const p = new StatuteParagraph(this.statuteParagraphForm.value); - this.repo.create(p).then(() => this.dialogRef.close(), this.raiseError); + this.repo.create(p).catch(this.raiseError); } + this.statuteParagraphForm.reset(); } } @@ -148,19 +146,13 @@ export class StatuteParagraphListComponent extends BaseViewComponent implements public onKeyDown(event: KeyboardEvent): void { if (event.key === 'Enter' && event.shiftKey) { this.save(); + this.dialog.closeAll(); } if (event.key === 'Escape') { - this.cancel(); + this.dialog.closeAll(); } } - /** - * Closes the dialog - */ - public cancel(): void { - this.dialogRef.close(); - } - /** * Triggers a csv export of the statute paragraphs */ diff --git a/client/src/app/site/tags/components/tag-list/tag-list.component.html b/client/src/app/site/tags/components/tag-list/tag-list.component.html index 1c93d2056..651d0be7c 100644 --- a/client/src/app/site/tags/components/tag-list/tag-list.component.html +++ b/client/src/app/site/tags/components/tag-list/tag-list.component.html @@ -39,20 +39,20 @@

{{ (currentTag ? 'Edit tag' : 'New tag') | translate }}

-
-
+
+ -
+ +
-
- - -
- +
+ + +
diff --git a/client/src/app/site/tags/components/tag-list/tag-list.component.ts b/client/src/app/site/tags/components/tag-list/tag-list.component.ts index 8150d68d1..4b2200f20 100644 --- a/client/src/app/site/tags/components/tag-list/tag-list.component.ts +++ b/client/src/app/site/tags/components/tag-list/tag-list.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { MatDialog, MatDialogRef } from '@angular/material'; +import { MatDialog } from '@angular/material'; import { MatSnackBar } from '@angular/material/snack-bar'; import { Title } from '@angular/platform-browser'; @@ -12,6 +12,7 @@ import { PromptService } from 'app/core/ui-services/prompt.service'; import { Tag } from 'app/shared/models/core/tag'; import { BaseListViewComponent } from 'app/site/base/base-list-view'; import { ViewTag } from '../../models/view-tag'; +import { infoDialogSettings } from 'app/shared/utils/dialog-settings'; /** * Listview for the complete list of available Tags @@ -33,8 +34,6 @@ export class TagListComponent extends BaseListViewComponent implements name: ['', [Validators.required]] }); - private dialogRef: MatDialogRef; - /** * Holds the tag that's currently being edited, or null. */ @@ -94,28 +93,27 @@ export class TagListComponent extends BaseListViewComponent implements this.currentTag = tag; this.tagForm.reset(); this.tagForm.get('name').setValue(this.currentTag ? this.currentTag.name : ''); - this.dialogRef = this.dialog.open(this.tagDialog, { - width: '400px', - maxWidth: '90vw', - maxHeight: '90vh', - disableClose: true - }); + const dialogRef = this.dialog.open(this.tagDialog, infoDialogSettings); + dialogRef.afterClosed().subscribe((res) => { + if (res) { + this.save(); + } + }) } /** * Submit the form and create or update a tag. */ - public onSubmit(): void { + private save(): void { if (!this.tagForm.value || !this.tagForm.valid) { return; } if (this.currentTag) { - this.repo - .update(new Tag(this.tagForm.value), this.currentTag) - .then(() => this.dialogRef.close(), this.raiseError); + this.repo.update(new Tag(this.tagForm.value), this.currentTag).catch(this.raiseError); } else { - this.repo.create(this.tagForm.value).then(() => this.dialogRef.close(), this.raiseError); + this.repo.create(this.tagForm.value).catch(this.raiseError); } + this.tagForm.reset(); // reset here so pressing shift+enter wont save when dialog isnt open } /** @@ -128,4 +126,20 @@ export class TagListComponent extends BaseListViewComponent implements this.repo.delete(tag).catch(this.raiseError); } } + + /** + * clicking Shift and Enter will save automatically + * clicking Escape will cancel the process + * + * @param event has the code + */ + public onKeyDown(event: KeyboardEvent): void { + if (event.key === 'Enter' && event.shiftKey) { + this.save(); + this.dialog.closeAll(); + } + if (event.key === 'Escape') { + this.dialog.closeAll(); + } + } } From b7c9b3f2aee06bc871a32de261446c43b4cd8a06 Mon Sep 17 00:00:00 2001 From: Joshua Sangmeister Date: Tue, 6 Aug 2019 09:56:38 +0200 Subject: [PATCH 3/5] w --- client/package.json | 3 +- .../motion-block-list.component.html | 2 +- .../motion-block-list.component.ts | 15 ++-- ...motion-comment-section-list.component.html | 3 +- .../motion-comment-section-list.component.ts | 12 +-- .../statute-paragraph-list.component.html | 3 +- .../statute-paragraph-list.component.ts | 12 +-- .../tag-list/tag-list.component.html | 3 +- .../components/tag-list/tag-list.component.ts | 8 +- client/src/assets/i18n/template-en.pot | 77 ++++++++++++------- openslides/core/views.py | 1 - 11 files changed, 82 insertions(+), 57 deletions(-) diff --git a/client/package.json b/client/package.json index 2ced716f8..81a104ac2 100644 --- a/client/package.json +++ b/client/package.json @@ -24,7 +24,8 @@ "po2json-tempfix": "./node_modules/.bin/po2json -f mf src/assets/i18n/de.po /dev/stdout | sed -f sed_replacements > src/assets/i18n/de.json && ./node_modules/.bin/po2json -f mf src/assets/i18n/cs.po /dev/stdout | sed -f sed_replacements > src/assets/i18n/cs.json", "prettify-check": "prettier --config ./.prettierrc --list-different \"src/{app,environments}/**/*{.ts,.js,.json,.css,.scss}\"", "prettify-write": "prettier --config ./.prettierrc --write \"src/{app,environments}/**/*{.ts,.js,.json,.css,.scss}\"", - "cleanup": "npm run lint-write; npm run prettify-write" + "cleanup": "npm run lint-write; npm run prettify-write", + "cleanup-win": "npm run lint-write & npm run prettify-write" }, "dependencies": { "@angular/animations": "^8.0.3", diff --git a/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.html b/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.html index af403280c..1b9dddd0c 100644 --- a/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.html +++ b/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.html @@ -38,7 +38,7 @@

- {{ "New motion block" | translate }} + New motion block

diff --git a/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.ts b/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.ts index 478a093ad..ae1afea8d 100644 --- a/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.ts +++ b/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.ts @@ -13,11 +13,11 @@ import { StorageService } from 'app/core/core-services/storage.service'; import { ItemRepositoryService } from 'app/core/repositories/agenda/item-repository.service'; import { MotionBlockRepositoryService } from 'app/core/repositories/motions/motion-block-repository.service'; import { MotionBlock } from 'app/shared/models/motions/motion-block'; +import { infoDialogSettings } from 'app/shared/utils/dialog-settings'; import { ViewItem } from 'app/site/agenda/models/view-item'; import { BaseListViewComponent } from 'app/site/base/base-list-view'; import { ViewMotionBlock } from 'app/site/motions/models/view-motion-block'; import { MotionBlockSortService } from 'app/site/motions/services/motion-block-sort.service'; -import { infoDialogSettings } from 'app/shared/utils/dialog-settings'; /** * Table for the motion blocks @@ -147,11 +147,11 @@ export class MotionBlockListComponent extends BaseListViewComponent { + dialogRef.afterClosed().subscribe(res => { if (res) { this.save(); } - }) + }); } /** @@ -163,13 +163,8 @@ export class MotionBlockListComponent extends BaseListViewComponent

- {{ (currentComment ? "Edit comment field" : "New comment field") | translate }} + Edit comment field + New comment field

diff --git a/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.ts b/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.ts index 6a72f1c15..b2eb97269 100644 --- a/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.ts +++ b/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.ts @@ -11,10 +11,10 @@ import { MotionCommentSectionRepositoryService } from 'app/core/repositories/mot import { GroupRepositoryService } from 'app/core/repositories/users/group-repository.service'; import { PromptService } from 'app/core/ui-services/prompt.service'; import { MotionCommentSection } from 'app/shared/models/motions/motion-comment-section'; +import { infoDialogSettings } from 'app/shared/utils/dialog-settings'; import { BaseViewComponent } from 'app/site/base/base-view'; import { ViewMotionCommentSection } from 'app/site/motions/models/view-motion-comment-section'; import { ViewGroup } from 'app/site/users/models/view-group'; -import { infoDialogSettings } from 'app/shared/utils/dialog-settings'; /** * List view for the comment sections. @@ -110,7 +110,7 @@ export class MotionCommentSectionListComponent extends BaseViewComponent impleme write_groups_id: commentSection ? commentSection.write_groups_id : [] }); const dialogRef = this.dialog.open(this.motionCommentDialog, infoDialogSettings); - dialogRef.afterClosed().subscribe((res) => { + dialogRef.afterClosed().subscribe(res => { if (res) { this.save(); } @@ -124,10 +124,12 @@ export class MotionCommentSectionListComponent extends BaseViewComponent impleme if (this.commentFieldForm.valid) { // eiher update or create if (this.currentComment) { - this.repo.update(this.commentFieldForm.value as Partial, this.currentComment).catch(this.raiseError); + this.repo + .update(this.commentFieldForm.value as Partial, this.currentComment) + .catch(this.raiseError); } else { - const c = new MotionCommentSection(this.commentFieldForm.value); - this.repo.create(c).catch(this.raiseError); + const comment = new MotionCommentSection(this.commentFieldForm.value); + this.repo.create(comment).catch(this.raiseError); } this.commentFieldForm.reset(); } diff --git a/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.html b/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.html index 8d4baf4a7..fcccfbbcd 100644 --- a/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.html +++ b/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.html @@ -64,7 +64,8 @@

- {{ ((currentStatuteParagraph ? "Edit" : "New") + "statute paragraph") | translate }} + Edit statute paragraph + New statute paragraph

diff --git a/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.ts b/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.ts index ae7e9dca5..eee59d970 100644 --- a/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.ts +++ b/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.ts @@ -9,10 +9,10 @@ import { TranslateService } from '@ngx-translate/core'; import { StatuteParagraphRepositoryService } from 'app/core/repositories/motions/statute-paragraph-repository.service'; import { PromptService } from 'app/core/ui-services/prompt.service'; import { StatuteParagraph } from 'app/shared/models/motions/statute-paragraph'; +import { largeDialogSettings } from 'app/shared/utils/dialog-settings'; import { BaseViewComponent } from 'app/site/base/base-view'; import { ViewStatuteParagraph } from 'app/site/motions/models/view-statute-paragraph'; import { StatuteCsvExportService } from 'app/site/motions/services/statute-csv-export.service'; -import { largeDialogSettings } from 'app/shared/utils/dialog-settings'; /** * List view for the statute paragraphs. @@ -95,7 +95,7 @@ export class StatuteParagraphListComponent extends BaseViewComponent implements }); } const dialogRef = this.dialog.open(this.statuteParagraphDialog, largeDialogSettings); - dialogRef.afterClosed().subscribe((res) => { + dialogRef.afterClosed().subscribe(res => { if (res) { this.save(); } @@ -109,10 +109,12 @@ export class StatuteParagraphListComponent extends BaseViewComponent implements if (this.statuteParagraphForm.valid) { // eiher update or create if (this.currentStatuteParagraph) { - this.repo.update(this.statuteParagraphForm.value as Partial, this.currentStatuteParagraph).catch(this.raiseError); + this.repo + .update(this.statuteParagraphForm.value as Partial, this.currentStatuteParagraph) + .catch(this.raiseError); } else { - const p = new StatuteParagraph(this.statuteParagraphForm.value); - this.repo.create(p).catch(this.raiseError); + const paragraph = new StatuteParagraph(this.statuteParagraphForm.value); + this.repo.create(paragraph).catch(this.raiseError); } this.statuteParagraphForm.reset(); } diff --git a/client/src/app/site/tags/components/tag-list/tag-list.component.html b/client/src/app/site/tags/components/tag-list/tag-list.component.html index 651d0be7c..740d706ed 100644 --- a/client/src/app/site/tags/components/tag-list/tag-list.component.html +++ b/client/src/app/site/tags/components/tag-list/tag-list.component.html @@ -37,7 +37,8 @@

- {{ (currentTag ? 'Edit tag' : 'New tag') | translate }} + Edit tag + New tag

diff --git a/client/src/app/site/tags/components/tag-list/tag-list.component.ts b/client/src/app/site/tags/components/tag-list/tag-list.component.ts index 4b2200f20..38da6f29a 100644 --- a/client/src/app/site/tags/components/tag-list/tag-list.component.ts +++ b/client/src/app/site/tags/components/tag-list/tag-list.component.ts @@ -10,9 +10,9 @@ import { PblColumnDefinition } from '@pebula/ngrid'; import { TagRepositoryService } from 'app/core/repositories/tags/tag-repository.service'; import { PromptService } from 'app/core/ui-services/prompt.service'; import { Tag } from 'app/shared/models/core/tag'; +import { infoDialogSettings } from 'app/shared/utils/dialog-settings'; import { BaseListViewComponent } from 'app/site/base/base-list-view'; import { ViewTag } from '../../models/view-tag'; -import { infoDialogSettings } from 'app/shared/utils/dialog-settings'; /** * Listview for the complete list of available Tags @@ -94,11 +94,11 @@ export class TagListComponent extends BaseListViewComponent implements this.tagForm.reset(); this.tagForm.get('name').setValue(this.currentTag ? this.currentTag.name : ''); const dialogRef = this.dialog.open(this.tagDialog, infoDialogSettings); - dialogRef.afterClosed().subscribe((res) => { + dialogRef.afterClosed().subscribe(res => { if (res) { this.save(); } - }) + }); } /** @@ -113,7 +113,7 @@ export class TagListComponent extends BaseListViewComponent implements } else { this.repo.create(this.tagForm.value).catch(this.raiseError); } - this.tagForm.reset(); // reset here so pressing shift+enter wont save when dialog isnt open + this.tagForm.reset(); // reset here so pressing shift+enter wont save when dialog isnt open } /** diff --git a/client/src/assets/i18n/template-en.pot b/client/src/assets/i18n/template-en.pot index 6f9671ca0..c6e930f80 100644 --- a/client/src/assets/i18n/template-en.pot +++ b/client/src/assets/i18n/template-en.pot @@ -174,9 +174,6 @@ msgstr "" msgid "Amendments can change multiple paragraphs" msgstr "" -msgid "An email with a password reset link was send!" -msgstr "" - msgid "An unknown error occurred." msgstr "" @@ -252,6 +249,11 @@ msgstr "" msgid "Are you sure you want to delete this workflow?" msgstr "" +msgid "" +"Are you sure you want to generate new passwords for all selected " +"participants?" +msgstr "" + msgid "Are you sure you want to number all agenda items?" msgstr "" @@ -272,6 +274,9 @@ msgstr "" msgid "Are you sure you want to renumber all motions of this category?" msgstr "" +msgid "Are you sure you want to reset all passwords to the default ones?" +msgstr "" + msgid "Are you sure you want to send an invitation email to the user?" msgstr "" @@ -737,18 +742,12 @@ msgstr "" msgid "Edit" msgstr "" -msgid "Edit comment field:" -msgstr "" - msgid "Edit details" msgstr "" msgid "Edit details for" msgstr "" -msgid "Edit statute paragraph:" -msgstr "" - msgid "Edit the whole motion text" msgstr "" @@ -927,6 +926,9 @@ msgid "" "candidate the sum of all votes is 100 %." msgstr "" +msgid "Foreground color" +msgstr "" + msgid "Forgot Password?" msgstr "" @@ -1043,6 +1045,9 @@ msgstr "" msgid "Import topics" msgstr "" +msgid "Inactive" +msgstr "" + msgid "Initial password" msgstr "" @@ -1301,9 +1306,6 @@ msgstr "" msgid "New change recommendation" msgstr "" -msgid "New comment field" -msgstr "" - msgid "New directory" msgstr "" @@ -1331,12 +1333,6 @@ msgstr "" msgid "New state" msgstr "" -msgid "New statute paragraph" -msgstr "" - -msgid "New tag name" -msgstr "" - msgid "New topic" msgstr "" @@ -1421,6 +1417,12 @@ msgstr "" msgid "None" msgstr "" +msgid "Noone" +msgstr "" + +msgid "Note, that the default password will be changed to the new generated one." +msgstr "" + msgid "" "Note: Your own password was not changed. Please use the password change " "dialog instead." @@ -1823,6 +1825,9 @@ msgstr "" msgid "Reset password" msgstr "" +msgid "Reset passwords to the default ones" +msgstr "" + msgid "Reset recommendation" msgstr "" @@ -1910,9 +1915,6 @@ msgstr "" msgid "Serially numbered" msgstr "" -msgid "Set active status for selected participants:" -msgstr "" - msgid "Set as favorite" msgstr "" @@ -1928,9 +1930,6 @@ msgstr "" msgid "Set committee ..." msgstr "" -msgid "Set committee status for selected participants:" -msgstr "" - msgid "Set favorite" msgstr "" @@ -1952,9 +1951,6 @@ msgstr "" msgid "Set presence ..." msgstr "" -msgid "Set presence status for selected participants:" -msgstr "" - msgid "Set public" msgstr "" @@ -2042,6 +2038,9 @@ msgstr "" msgid "Sort" msgstr "" +msgid "Sort Comments" +msgstr "" + msgid "Sort agenda" msgstr "" @@ -2108,6 +2107,9 @@ msgstr "" msgid "Structure level" msgstr "" +msgid "Subcategory" +msgstr "" + msgid "Submitters" msgstr "" @@ -2162,6 +2164,9 @@ msgstr "" msgid "The assembly may decide:" msgstr "" +msgid "The event manager hasn't set up a legal notice yet." +msgstr "" + msgid "The event manager hasn't set up a privacy policy yet." msgstr "" @@ -2177,11 +2182,17 @@ msgstr "" msgid "The link is broken. Please contact your system administrator." msgstr "" +msgid "The list of speakers is closed" +msgstr "" + msgid "" "The maximum number of characters per line. Relevant when line numbering is " "enabled. Min: 40" msgstr "" +msgid "The number has to be greater than \"0\" " +msgstr "" + msgid "The reason field may not be blank." msgstr "" @@ -2204,6 +2215,9 @@ msgstr "" msgid "The text field may not be blank." msgstr "" +msgid "The title is required" +msgstr "" + msgid "The title of the motion is always applied." msgstr "" @@ -2222,6 +2236,9 @@ msgstr "" msgid "This element does not exist at this time." msgstr "" +msgid "This field is required" +msgstr "" + msgid "This field is required." msgstr "" @@ -2408,6 +2425,9 @@ msgstr "" msgid "Web interface header logo" msgstr "" +msgid "Web workers are not supported on your browser." +msgstr "" + msgid "Welcome to OpenSlides" msgstr "" @@ -2692,4 +2712,7 @@ msgid "with local storage" msgstr "" msgid "withdrawed" +msgstr "" + +msgid "{{ option.label }}" msgstr "" \ No newline at end of file diff --git a/openslides/core/views.py b/openslides/core/views.py index 71ef04fc8..11f71b968 100644 --- a/openslides/core/views.py +++ b/openslides/core/views.py @@ -186,7 +186,6 @@ class ProjectorViewSet(ModelViewSet): If `reset_scroll` is True, the scoll of the projector will reset. """ projector = self.get_object() - projector.scroll = 0 elements = request.data.get("elements") preview = request.data.get("preview") history_element = request.data.get("append_to_history") From ce50ce2eb9221d1b2c118d096f16211a0bbd61de Mon Sep 17 00:00:00 2001 From: Joshua Sangmeister Date: Tue, 6 Aug 2019 10:56:37 +0200 Subject: [PATCH 4/5] w --- .../motion-block-list.component.ts | 7 +- client/src/assets/i18n/template-en.pot | 77 +++++++------------ 2 files changed, 28 insertions(+), 56 deletions(-) diff --git a/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.ts b/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.ts index ae1afea8d..f8a6d48e7 100644 --- a/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.ts +++ b/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.ts @@ -37,11 +37,6 @@ export class MotionBlockListComponent extends BaseListViewComponent Date: Tue, 6 Aug 2019 11:57:23 +0200 Subject: [PATCH 5/5] w --- .../motion-comment-section-list.component.html | 3 --- .../motion-comment-section-list.component.ts | 2 -- .../statute-paragraph-list.component.html | 3 --- .../statute-paragraph-list/statute-paragraph-list.component.ts | 2 -- 4 files changed, 10 deletions(-) diff --git a/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.html b/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.html index e0e610ee8..0367f3fca 100644 --- a/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.html +++ b/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.html @@ -16,9 +16,6 @@ diff --git a/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.ts b/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.ts index b2eb97269..410569703 100644 --- a/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.ts +++ b/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.ts @@ -40,8 +40,6 @@ export class MotionCommentSectionListComponent extends BaseViewComponent impleme */ public commentFieldForm: FormGroup; - public openId: number | null; - public groups: BehaviorSubject; /** diff --git a/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.html b/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.html index fcccfbbcd..14fa29e07 100644 --- a/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.html +++ b/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.html @@ -16,9 +16,6 @@ diff --git a/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.ts b/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.ts index eee59d970..f9af28da3 100644 --- a/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.ts +++ b/client/src/app/site/motions/modules/statute-paragraph/components/statute-paragraph-list/statute-paragraph-list.component.ts @@ -38,8 +38,6 @@ export class StatuteParagraphListComponent extends BaseViewComponent implements */ public statuteParagraphForm: FormGroup; - public openId: Number | null; - /** * The usual component constructor. Initializes the forms *