本文整理汇总了TypeScript中app/core/repositories/motions/motion-repository.service.MotionRepositoryService类的典型用法代码示例。如果您正苦于以下问题:TypeScript service.MotionRepositoryService类的具体用法?TypeScript service.MotionRepositoryService怎么用?TypeScript service.MotionRepositoryService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了service.MotionRepositoryService类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: setStateOfMultiple
/**
* Opens a dialog and then sets the status for all motions.
*
* @param motions The motions to change
*/
public async setStateOfMultiple(motions: ViewMotion[]): Promise<void> {
const title = this.translate.instant('This will set the following state for all selected motions:');
const choices = this.workflowRepo.getWorkflowStatesForMotions(motions).map(workflowState => ({
id: workflowState.id,
label: workflowState.name
}));
const selectedChoice = await this.choiceService.open(title, choices);
if (selectedChoice) {
await this.repo.setMultiState(motions, selectedChoice.items as number);
}
}
开发者ID:tsiegleauq,项目名称:OpenSlides,代码行数:16,代码来源:motion-multiselect.service.ts
示例2:
this.repo.getViewModelObservable(params.id).subscribe(newViewMotion => {
this.motion = newViewMotion;
this.paragraphs = this.repo
.getTextParagraphs(this.motion, true, this.lineLength)
.map((paragraph: string, index: number) => {
return {
paragraphNo: index,
safeHtml: this.sanitizer.bypassSecurityTrustHtml(paragraph),
rawHtml: this.lineNumbering.stripLineNumbers(paragraph)
};
});
});
开发者ID:emanuelschuetze,项目名称:OpenSlides,代码行数:13,代码来源:amendment-create-wizard.component.ts
示例3: createCallListRow
/**
* Creates the pdfMake definitions for a row of the call List table
*
* @param motion
* @returns pdfmakre definitions
*/
private createCallListRow(motion: ViewMotion): object {
return [
{
text: motion.sort_parent_id ? '' : motion.identifierOrTitle
},
{ text: motion.sort_parent_id ? motion.identifierOrTitle : '' },
{ text: motion.submitters.length ? motion.submitters.map(s => s.short_name).join(', ') : '' },
{ text: motion.title },
{
text: motion.recommendation ? this.motionRepo.getExtendedRecommendationLabel(motion) : ''
},
{ text: '' }
];
}
开发者ID:tsiegleauq,项目名称:OpenSlides,代码行数:20,代码来源:motion-pdf.service.ts
示例4: setMotionBlock
/**
* Opens a dialog and changes the motionBlock for all given motions.
*
* @param motions The motions for which to change the motionBlock
*/
public async setMotionBlock(motions: ViewMotion[]): Promise<void> {
const title = this.translate.instant('This will set the following motion block for all selected motions:');
const clearChoice = 'Clear motion block';
const selectedChoice = await this.choiceService.open(
title,
this.motionBlockRepo.getViewModelList(),
false,
null,
clearChoice
);
if (selectedChoice) {
for (const motion of motions) {
const blockId = selectedChoice.action ? null : (selectedChoice.items as number);
await this.repo.update({ motion_block_id: blockId }, motion);
}
}
}
开发者ID:jwinzer,项目名称:OpenSlides,代码行数:22,代码来源:motion-multiselect.service.ts
示例5: motionsInCategory
/**
* Returns the motions corresponding to a category
*
* @param category target
* @returns all motions in the category
*/
public motionsInCategory(category: Category): ViewMotion[] {
const coll = new Intl.Collator(this.translate.currentLang);
return this.motionRepo
.getViewModelList()
.filter(m => m.category_id === category.id)
.sort((motion1, motion2) => {
if (motion1.identifier && motion2.identifier) {
return coll.compare(motion1.identifier, motion2.identifier);
} else if (motion1.identifier) {
return 1;
} else if (motion2.identifier) {
return -1;
} else {
return coll.compare(motion1.getTitle(), motion2.getTitle());
}
});
}
开发者ID:jwinzer,项目名称:OpenSlides,代码行数:23,代码来源:category-list.component.ts
示例6: printBallots
/**
* Triggers a pdf creation for this poll's ballots.
* There will be 8 ballots per page.
* Each ballot will contain:
* - the event name and logo
* - a first, bold line with a title. Defaults to the label Motion, the identifier,
* and the current number of polls for this motion (if more than one)
* - a subtitle. A second, short (two lines, 90 characters) clarification for
* the ballot. Defaults to the beginning of the motion's title
* - the options 'yes', 'no', 'abstain' translated to the client's language.
*
* @param motionPoll: The poll this ballot refers to
* @param title (optional) a different title
* @param subtitle (optional) a different subtitle
*/
public printBallots(motionPoll: MotionPoll, title?: string, subtitle?: string): void {
const motion = this.motionRepo.getViewModel(motionPoll.motion_id);
const fileName = `${this.translate.instant('Motion')} - ${motion.identifier} - ${this.translate.instant(
'ballot-paper'
)}`;
if (!title) {
title = `${this.translate.instant('Motion')} - ${motion.identifier}`;
if (motion.motion.polls.length > 1) {
title += ` (${this.translate.instant('Vote')} ${motion.motion.polls.length})`;
}
}
if (!subtitle) {
subtitle = motion.title;
}
if (subtitle.length > 90) {
subtitle = subtitle.substring(0, 90) + '...';
}
this.pdfService.downloadWithBallotPaper(this.getContent(title, subtitle), fileName, this.logo);
}
开发者ID:CatoTH,项目名称:OpenSlides,代码行数:34,代码来源:motion-poll-pdf.service.ts
示例7: setCategory
/**
* Opens a dialog and sets the category for all given motions.
*
* @param motions The motions to change
*/
public async setCategory(motions: ViewMotion[]): Promise<void> {
const title = this.translate.instant('This will set the following category for all selected motions:');
const clearChoice = this.translate.instant('No category');
const selectedChoice = await this.choiceService.open(
title,
this.categoryRepo.sortViewCategoriesByConfig(this.categoryRepo.getViewModelList()),
false,
null,
clearChoice
);
if (selectedChoice) {
for (const motion of motions) {
await this.repo.update(
{ category_id: selectedChoice.action ? null : (selectedChoice.items as number) },
motion
);
}
}
}
开发者ID:jwinzer,项目名称:OpenSlides,代码行数:24,代码来源:motion-multiselect.service.ts
示例8: saveAmendment
/**
* Saves the amendment and navigates to detail view of this amendment
*
* @returns {Promise<void>}
*/
public async saveAmendment(): Promise<void> {
const amendedParagraphs = this.paragraphs.map(
(paragraph: ParagraphToChoose, index: number): string => {
if (index === this.contentForm.value.selectedParagraph) {
return this.contentForm.value.text;
} else {
return null;
}
}
);
const newMotionValues = {
...this.metaInfoForm.value,
...this.contentForm.value,
title: this.translate.instant('Amendment to') + ' ' + this.motion.identifier,
parent_id: this.motion.id,
amendment_paragraphs: amendedParagraphs
};
const motion = new CreateMotion();
motion.deserialize(newMotionValues);
const response = await this.repo.create(motion);
this.router.navigate(['./motions/' + response.id]);
}
开发者ID:jwinzer,项目名称:OpenSlides,代码行数:29,代码来源:amendment-create-wizard.component.ts
示例9: createMetaInfoTable
/**
* Creates the MetaInfoTable
*
* @param motion the target motion
* @returns doc def for the meta infos
*/
private createMetaInfoTable(motion: ViewMotion, crMode: ChangeRecoMode, infoToExport?: InfoToExport[]): object {
const metaTableBody = [];
// submitters
if (!infoToExport || infoToExport.includes('submitters')) {
const submitters = motion.submitters
.map(submitter => {
return submitter.full_name;
})
.join(', ');
metaTableBody.push([
{
text: `${this.translate.instant('Submitters')}:`,
style: 'boldText'
},
{
text: submitters
}
]);
}
// state
if (!infoToExport || infoToExport.includes('state')) {
metaTableBody.push([
{
text: `${this.translate.instant('State')}:`,
style: 'boldText'
},
{
text: this.motionRepo.getExtendedStateLabel(motion)
}
]);
}
// recommendation
if (motion.recommendation && (!infoToExport || infoToExport.includes('recommendation'))) {
let recommendationByText: string;
if (motion.isStatuteAmendment()) {
recommendationByText = this.configService.instant('motions_statute_recommendations_by');
} else {
recommendationByText = this.configService.instant('motions_recommendations_by');
}
metaTableBody.push([
{
text: `${recommendationByText}:`,
style: 'boldText'
},
{
text: this.motionRepo.getExtendedRecommendationLabel(motion)
}
]);
}
// category
if (motion.category && (!infoToExport || infoToExport.includes('category'))) {
metaTableBody.push([
{
text: `${this.translate.instant('Category')}:`,
style: 'boldText'
},
{
text: motion.category.prefix
? `${motion.category.prefix} - ${motion.category.name}`
: `${motion.category.name}`
}
]);
}
// tags
if (motion.tags.length && (!infoToExport || infoToExport.includes('tags'))) {
const tags = motion.tags
.map(tag => {
return tag;
})
.join(', ');
metaTableBody.push([
{
text: `${this.translate.instant('Tags')}:`,
style: 'boldText'
},
{
text: tags
}
]);
}
// motion block
if (motion.motion_block && (!infoToExport || infoToExport.includes('block'))) {
metaTableBody.push([
{
//.........这里部分代码省略.........
开发者ID:jwinzer,项目名称:OpenSlides,代码行数:101,代码来源:motion-pdf.service.ts
示例10: getMotionTitle
public getMotionTitle(motion: MotionTitleInformation): string {
return this.motionRepo.getTitle(motion);
}
开发者ID:jwinzer,项目名称:OpenSlides,代码行数:3,代码来源:motion-block-slide.component.ts
注:本文中的app/core/repositories/motions/motion-repository.service.MotionRepositoryService类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论