diff --git a/client/src/app/site/motions/components/motion-change-recommendation/motion-change-recommendation.component.scss b/client/src/app/site/motions/components/motion-change-recommendation/motion-change-recommendation.component.scss
index e2963273e..bdd7f2572 100644
--- a/client/src/app/site/motions/components/motion-change-recommendation/motion-change-recommendation.component.scss
+++ b/client/src/app/site/motions/components/motion-change-recommendation/motion-change-recommendation.component.scss
@@ -1,3 +1,11 @@
+::ng-deep h3 {
+ margin-top: 0.3em;
+ margin-bottom: 0.3em;
+ font-size: 1em;
+}
+::ng-deep .mat-dialog-content {
+ overflow: visible;
+}
.wide-form {
textarea {
height: 100px;
diff --git a/client/src/app/site/motions/components/motion-change-recommendation/motion-change-recommendation.component.ts b/client/src/app/site/motions/components/motion-change-recommendation/motion-change-recommendation.component.ts
index 7ac1c54e5..369a25d62 100644
--- a/client/src/app/site/motions/components/motion-change-recommendation/motion-change-recommendation.component.ts
+++ b/client/src/app/site/motions/components/motion-change-recommendation/motion-change-recommendation.component.ts
@@ -103,6 +103,10 @@ export class MotionChangeRecommendationComponent extends BaseViewComponent {
this.changeReco = data.changeRecommendation;
this.lineRange = data.lineRange;
+ this.tinyMceSettings.height = 50;
+ this.tinyMceSettings.toolbar = `undo redo | bold italic underline strikethrough
+ | removeformat | bullist numlist | outdent indent | link charmap code`;
+
this.createForm();
}
diff --git a/client/src/app/site/motions/components/motion-detail-diff/motion-detail-diff.component.html b/client/src/app/site/motions/components/motion-detail-diff/motion-detail-diff.component.html
index f409942c8..78065dd73 100644
--- a/client/src/app/site/motions/components/motion-detail-diff/motion-detail-diff.component.html
+++ b/client/src/app/site/motions/components/motion-detail-diff/motion-detail-diff.component.html
@@ -50,7 +50,11 @@
-
-
+
-
@@ -613,8 +616,12 @@
- Original version
- Changed version
- Diff version
- Final version
+ Original version
+ Changed version
+ Diff version
+ Final version
diff --git a/client/src/app/site/motions/components/motion-detail/motion-detail.component.ts b/client/src/app/site/motions/components/motion-detail/motion-detail.component.ts
index 8e8a3556b..eadd323d5 100644
--- a/client/src/app/site/motions/components/motion-detail/motion-detail.component.ts
+++ b/client/src/app/site/motions/components/motion-detail/motion-detail.component.ts
@@ -229,6 +229,16 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit {
*/
public itemVisibility = itemVisibilityChoices;
+ /**
+ * For using the enum constants from the template
+ */
+ public ChangeRecoMode = ChangeRecoMode;
+
+ /**
+ * For using the enum constants from the template
+ */
+ public LineNumberingMode = LineNumberingMode;
+
/**
* Constuct the detail view.
*
@@ -651,7 +661,7 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit {
* Sets the motions change reco mode
* @param mode Needs to fot to the enum defined in ViewMotion
*/
- public setChangeRecoMode(mode: number): void {
+ public setChangeRecoMode(mode: ChangeRecoMode): void {
this.motion.crMode = mode;
}
@@ -659,14 +669,14 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit {
* Returns true if the original version (including change recommendation annotation) is to be shown
*/
public isRecoModeOriginal(): boolean {
- return this.motion.crMode === ChangeRecoMode.Original;
+ return this.motion.crMode === ChangeRecoMode.Original || this.allChangingObjects.length === 0;
}
/**
* Returns true if the diff version is to be shown
*/
public isRecoModeDiff(): boolean {
- return this.motion.crMode === ChangeRecoMode.Diff;
+ return this.motion.crMode === ChangeRecoMode.Diff && this.allChangingObjects.length > 0;
}
/**
diff --git a/client/src/app/site/motions/models/view-create-motion.ts b/client/src/app/site/motions/models/view-create-motion.ts
index ff81bbb66..d6fab6033 100644
--- a/client/src/app/site/motions/models/view-create-motion.ts
+++ b/client/src/app/site/motions/models/view-create-motion.ts
@@ -4,7 +4,7 @@ import { Workflow } from '../../../shared/models/motions/workflow';
import { WorkflowState } from '../../../shared/models/motions/workflow-state';
import { Item } from 'app/shared/models/agenda/item';
import { MotionBlock } from 'app/shared/models/motions/motion-block';
-import { ViewMotion } from './view-motion';
+import { LineNumberingMode, ViewMotion } from './view-motion';
import { CreateMotion } from './create-motion';
/**
@@ -43,7 +43,7 @@ export class ViewCreateMotion extends ViewMotion {
item?: Item,
block?: MotionBlock
) {
- super(motion, category, submitters, supporters, workflow, state, item, block);
+ super(motion, category, submitters, supporters, workflow, state, item, block, null, 80, LineNumberingMode.None);
}
/**
diff --git a/client/src/app/site/motions/models/view-motion.ts b/client/src/app/site/motions/models/view-motion.ts
index e234b9036..9ce480bac 100644
--- a/client/src/app/site/motions/models/view-motion.ts
+++ b/client/src/app/site/motions/models/view-motion.ts
@@ -11,17 +11,24 @@ import { Item } from 'app/shared/models/agenda/item';
import { MotionBlock } from 'app/shared/models/motions/motion-block';
import { Mediafile } from 'app/shared/models/mediafiles/mediafile';
+/**
+ * The line numbering mode for the motion detail view.
+ * The constants need to be in sync with the values saved in the config store.
+ */
export enum LineNumberingMode {
- None,
- Inside,
- Outside
+ None = 'none',
+ Inside = 'inline',
+ Outside = 'outside'
}
+/**
+ * The change recommendation mode for the motion detail view.
+ */
export enum ChangeRecoMode {
- Original,
- Changed,
- Diff,
- Final
+ Original = 'original',
+ Changed = 'changed',
+ Diff = 'diff',
+ Final = 'agreed'
}
/**
@@ -236,6 +243,9 @@ export class ViewMotion extends BaseViewModel {
item?: Item,
block?: MotionBlock,
attachments?: Mediafile[],
+ lineLength: number = 80,
+ lineNumberingMode?: LineNumberingMode,
+ crMode?: ChangeRecoMode
) {
super();
this._motion = motion;
@@ -248,15 +258,9 @@ export class ViewMotion extends BaseViewModel {
this._block = block;
this._attachments = attachments;
- // TODO: Should be set using a a config variable
- /*this._configService.get('motions_default_line_numbering').subscribe(
- (mode: string): void => {
- this.lnMode = LineNumberingMode.Outside;
- }
- );*/
- this.lnMode = LineNumberingMode.Outside;
- this.crMode = ChangeRecoMode.Original;
- this.lineLength = 80;
+ this.lnMode = lineNumberingMode;
+ this.crMode = crMode;
+ this.lineLength = lineLength;
this.highlightedLine = null;
}
@@ -417,7 +421,10 @@ export class ViewMotion extends BaseViewModel {
this._state,
this._item,
this._block,
- this._attachments
+ this._attachments,
+ this.lineLength,
+ this.lnMode,
+ this.crMode
);
}
}
diff --git a/client/src/app/site/motions/services/motion-repository.service.ts b/client/src/app/site/motions/services/motion-repository.service.ts
index d9221736b..24c21b9f0 100644
--- a/client/src/app/site/motions/services/motion-repository.service.ts
+++ b/client/src/app/site/motions/services/motion-repository.service.ts
@@ -9,7 +9,7 @@ import { User } from '../../../shared/models/users/user';
import { Category } from '../../../shared/models/motions/category';
import { Workflow } from '../../../shared/models/motions/workflow';
import { WorkflowState } from '../../../shared/models/motions/workflow-state';
-import { ChangeRecoMode, ViewMotion } from '../models/view-motion';
+import { ChangeRecoMode, LineNumberingMode, ViewMotion } from '../models/view-motion';
import { BaseRepository } from '../../base/base-repository';
import { DataStoreService } from '../../../core/services/data-store.service';
import { LinenumberingService } from './linenumbering.service';
@@ -28,6 +28,7 @@ import { ViewMotionAmendedParagraph } from '../models/view-motion-amended-paragr
import { CreateMotion } from '../models/create-motion';
import { MotionBlock } from 'app/shared/models/motions/motion-block';
import { Mediafile } from 'app/shared/models/mediafiles/mediafile';
+import { ConfigService } from "../../../core/services/config.service";
/**
* Repository Services for motions (and potentially categories)
@@ -43,6 +44,16 @@ import { Mediafile } from 'app/shared/models/mediafiles/mediafile';
providedIn: 'root'
})
export class MotionRepositoryService extends BaseRepository {
+
+ // The line length; comes from the config variable motions_line_length
+ private lineLength = 90;
+
+ // The default line numbering mode; comes from the config variable motions_default_line_numbering
+ private defaultLineNumbering = LineNumberingMode.Outside;
+
+ // The default line numbering mode; comes from the config variable motions_recommendation_text_mode
+ private defaultCrMode = ChangeRecoMode.Original;
+
/**
* Creates a MotionRepository
*
@@ -55,6 +66,7 @@ export class MotionRepositoryService extends BaseRepository
* @param httpService OpenSlides own Http service
* @param lineNumbering Line numbering for motion text
* @param diff Display changes in motion text as diff.
+ * @param configService The configuration provider
*/
public constructor(
DS: DataStoreService,
@@ -63,9 +75,15 @@ export class MotionRepositoryService extends BaseRepository
private httpService: HttpService,
private readonly lineNumbering: LinenumberingService,
private readonly diff: DiffService,
+ private readonly configService: ConfigService,
private treeService: TreeService
) {
super(DS, mapperService, Motion, [Category, User, Workflow, Item, MotionBlock, Mediafile]);
+
+ // load config variables
+ this.configService.get('motions_line_length').subscribe(lineLength => this.lineLength = lineLength);
+ this.configService.get('motions_default_line_numbering').subscribe(mode => this.defaultLineNumbering = mode);
+ this.configService.get('motions_recommendation_text_mode').subscribe(mode => this.defaultCrMode = mode);
}
/**
@@ -88,7 +106,7 @@ export class MotionRepositoryService extends BaseRepository
if (workflow) {
state = workflow.getStateById(motion.state_id);
}
- return new ViewMotion(motion, category, submitters, supporters, workflow, state, item, block, attachments);
+ return new ViewMotion(motion, category, submitters, supporters, workflow, state, item, block, attachments, this.lineLength, this.defaultLineNumbering, this.defaultCrMode);
}
/**
@@ -315,7 +333,7 @@ export class MotionRepositoryService extends BaseRepository
const appliedChanges: ViewUnifiedChange[] = changes.filter(change => change.isAccepted());
return this.diff.getTextWithChanges(targetMotion, appliedChanges, lineLength, highlightLine);
default:
- console.error('unrecognized ChangeRecoMode option');
+ console.error('unrecognized ChangeRecoMode option (' + crMode + ')');
return null;
}
} else {
@@ -342,8 +360,7 @@ export class MotionRepositoryService extends BaseRepository
* @param {boolean} lineNumbers - weather to add line numbers to the returned HTML string
*/
public extractMotionLineRange(id: number, lineRange: LineRange, lineNumbers: boolean): string {
- // @TODO flexible line numbers
- const origHtml = this.formatMotion(id, ChangeRecoMode.Original, [], 80);
+ const origHtml = this.formatMotion(id, ChangeRecoMode.Original, [], this.lineLength);
const extracted = this.diff.extractRangeByLineNumbers(origHtml, lineRange.from, lineRange.to);
let html =
extracted.outerContextStart +
@@ -370,7 +387,7 @@ export class MotionRepositoryService extends BaseRepository
changes: ViewUnifiedChange[],
highlight?: number
): string {
- let maxLine = 0;
+ let maxLine = 1;
changes.forEach((change: ViewUnifiedChange) => {
if (change.getLineTo() > maxLine) {
maxLine = change.getLineTo();
@@ -378,6 +395,10 @@ export class MotionRepositoryService extends BaseRepository
}, 0);
const numberedHtml = this.lineNumbering.insertLineNumbers(motion.text, motion.lineLength);
+ if (changes.length === 0) {
+ return numberedHtml;
+ }
+
let data;
try {