本文整理汇总了TypeScript中app/core/ui-services/config.service.ConfigService.instant方法的典型用法代码示例。如果您正苦于以下问题:TypeScript service.ConfigService.instant方法的具体用法?TypeScript service.ConfigService.instant怎么用?TypeScript service.ConfigService.instant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app/core/ui-services/config.service.ConfigService
的用法示例。
在下文中一共展示了service.ConfigService.instant方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: motionToDocDef
/**
* Converts a motion to PdfMake doc definition
*
* @param motion the motion to convert to pdf
* @param lnMode determine the used line mode
* @param crMode determine the used change Recommendation mode
* @param contentToExport determine which content is to export. If left out, everything will be exported
* @param infoToExport determine which metaInfo to export. If left out, everything will be exported.
* @param commentsToExport comments to chose for export. If 'allcomments' is set in infoToExport, this selection will be ignored and all comments exported
* @returns doc def for the motion
*/
public motionToDocDef(
motion: ViewMotion,
lnMode?: LineNumberingMode,
crMode?: ChangeRecoMode,
contentToExport?: string[],
infoToExport?: InfoToExport[],
commentsToExport?: number[]
): object {
let motionPdfContent = [];
// Enforces that statutes should always have Diff Mode and no line numbers
if (motion.isStatuteAmendment()) {
lnMode = LineNumberingMode.None;
crMode = ChangeRecoMode.Diff;
}
// determine the default lnMode if not explicitly given
if (!lnMode) {
lnMode = this.configService.instant('motions_default_line_numbering');
}
// determine the default crMode if not explicitly given
if (!crMode) {
crMode = this.configService.instant('motions_recommendation_text_mode');
}
const title = this.createTitle(motion);
const sequential = !infoToExport || infoToExport.includes('id');
const subtitle = this.createSubtitle(motion, sequential);
motionPdfContent = [title, subtitle];
if ((infoToExport && infoToExport.length > 0) || !infoToExport) {
const metaInfo = this.createMetaInfoTable(motion, crMode, infoToExport);
motionPdfContent.push(metaInfo);
}
if (!contentToExport || contentToExport.includes('text')) {
const preamble = this.createPreamble(motion);
motionPdfContent.push(preamble);
const text = this.createText(motion, lnMode, crMode);
motionPdfContent.push(text);
}
if (!contentToExport || contentToExport.includes('reason')) {
const reason = this.createReason(motion, lnMode);
motionPdfContent.push(reason);
}
if (infoToExport && infoToExport.includes('allcomments')) {
commentsToExport = this.commentRepo.getSortedViewModelList().map(vm => vm.id);
}
if (commentsToExport) {
motionPdfContent.push(this.createComments(motion, commentsToExport));
}
return motionPdfContent;
}
示例2: createWelcomeText
/**
* Generates a welcone text according to the events' configuration
*
* @returns pdfMake definitions
*/
private createWelcomeText(): object {
return [
{
text: this.translate.instant(this.configService.instant<string>('users_pdf_welcometitle')),
style: 'userDataHeading'
},
{
text: this.translate.instant(this.configService.instant<string>('users_pdf_welcometext')),
style: 'userDataTopic'
}
];
}
示例3: createUserAccessContent
/**
* Creates access information (login name, initial password) for the given user,
* additionally encoded in a qr code
*
* @param user
* @returns pdfMake definitions
*/
private createUserAccessContent(user: ViewUser): object {
const columnOpenSlides: object[] = [
{
text: this.translate.instant('OpenSlides access data'),
style: 'userDataHeading'
},
{
text: this.translate.instant('Username') + ':',
style: 'userDataTopic'
},
{
text: user.username,
style: 'userDataValue'
},
{
text: this.translate.instant('Initial password') + ':',
style: 'userDataTopic'
},
{
text: user.default_password,
style: 'userDataValue'
},
{
text: 'URL:',
style: 'userDataTopic'
},
{
text: this.configService.instant<string>('users_pdf_url') || '-',
link: this.configService.instant<string>('users_pdf_url'),
style: 'userDataValue'
},
{
text: '\n'
}
];
// url qr code
if (this.configService.instant<string>('users_pdf_url')) {
columnOpenSlides.push(
{
qr: this.configService.instant<string>('users_pdf_url'),
fit: 120,
margin: [0, 0, 0, 8]
},
{
text: this.translate.instant('Scan this QR code to open URL.'),
style: 'small'
}
);
}
return columnOpenSlides;
}
示例4: createWifiAccessContent
/**
* Creates the wifi access data, including qr code, for the configured event wlan parameters
*
* @returns pdfMake definitions
*/
private createWifiAccessContent(): object {
const wifiColumn: object[] = [
{
text: this.translate.instant('WLAN access data'),
style: 'userDataHeading'
},
{
text: this.translate.instant('WLAN name (SSID)') + ':',
style: 'userDataTopic'
},
{
text: this.configService.instant<string>('users_pdf_wlan_ssid') || '-',
style: 'userDataValue'
},
{
text: this.translate.instant('WLAN password') + ':',
style: 'userDataTopic'
},
{
text: this.configService.instant<string>('users_pdf_wlan_password') || '-',
style: 'userDataValue'
},
{
text: this.translate.instant('WLAN encryption') + ':',
style: 'userDataTopic'
},
{
text: this.configService.instant<string>('users_pdf_wlan_encryption') || '-',
style: 'userDataValue'
},
{
text: '\n'
}
];
if (
this.configService.instant<string>('users_pdf_wlan_ssid') &&
this.configService.instant<string>('users_pdf_wlan_encryption')
) {
const wifiQrCode =
'WIFI:S:' +
this.configService.instant<string>('users_pdf_wlan_ssid') +
';T:' +
this.configService.instant<string>('users_pdf_wlan_encryption') +
';P:' +
this.configService.instant<string>('users_pdf_wlan_password') +
';;';
wifiColumn.push(
{
qr: wifiQrCode,
fit: 120,
margin: [0, 0, 0, 8]
},
{
text: this.translate.instant('Scan this QR code to connect to WLAN.'),
style: 'small'
}
);
}
return wifiColumn;
}
示例5: if
this.operator.getViewUserObservable().subscribe(user => {
if (user) {
this.username = user.short_name;
} else if (!user && configService.instant<boolean>('general_system_enable_anonymous')) {
this.username = translate.instant('Guest');
}
this.isLoggedIn = !!user;
});
示例6: createText
/**
* Creates the motion text - uses HTML to PDF
*
* @param motion the motion to convert to pdf
* @param lnMode determine the used line mode
* @param crMode determine the used change Recommendation mode
* @returns doc def for the "the assembly may decide" preamble
*/
private createText(motion: ViewMotion, lnMode: LineNumberingMode, crMode: ChangeRecoMode): object {
let motionText: string;
// get the line length from the config
const lineLength = this.configService.instant<number>('motions_line_length');
if (motion.isParagraphBasedAmendment()) {
motionText = '';
// this is logically redundant with the formation of amendments in the motion-detail html.
// Should be refactored in a way that a service returns the correct html for both cases
for (const paragraph of this.motionRepo.getAmendedParagraphs(motion, lineLength)) {
if (paragraph.diffLineTo === paragraph.diffLineFrom + 1) {
motionText += `<h3>
${this.translate.instant('Line')} ${paragraph.diffLineFrom}:
</h3>`;
} else {
motionText += `<h3>
${this.translate.instant('Line')} ${paragraph.diffLineFrom} - ${paragraph.diffLineTo - 1}:
</h3>`;
}
motionText += `<div class="paragraphcontext">${paragraph.textPre}</div>`;
motionText += paragraph.text;
motionText += `<div class="paragraphcontext">${paragraph.textPost}</div>`;
}
} else if (motion.isStatuteAmendment()) {
// statute amendments
const statutes = this.statuteRepo.getViewModelList();
motionText = this.motionRepo.formatStatuteAmendment(statutes, motion, lineLength);
} else {
// lead motion or normal amendments
// TODO: Consider tile change recommendation
const changes: ViewUnifiedChange[] = Object.assign(
[],
this.changeRecoRepo.getChangeRecoOfMotion(motion.id)
);
// TODO: Cleanup, everything change reco and amendment based needs a unified structure.
const amendments = this.motionRepo.getAmendmentsInstantly(motion.id);
if (amendments) {
for (const amendment of amendments) {
const changedParagraphs = this.motionRepo.getAmendmentAmendedParagraphs(amendment, lineLength);
for (const change of changedParagraphs) {
changes.push(change as ViewUnifiedChange);
}
}
}
// changes need to be sorted, by "line from".
// otherwise, formatMotion will make unexpected results by messing up the
// order of changes applied to the motion
changes.sort((a, b) => a.getLineFrom() - b.getLineFrom());
motionText = this.motionRepo.formatMotion(motion.id, crMode, changes, lineLength);
// reformat motion text to split long HTML elements to easier convert into PDF
motionText = this.linenumberingService.splitInlineElementsAtLineBreaks(motionText);
}
return this.htmlToPdfService.convertHtml(motionText, lnMode);
}
示例7: textToDocDef
/**
* Creates pdfmake definitions for basic information about the motion and
* comments or notes
*
* @param note string optionally containing html layout
* @param motion the ViewMotion this note refers to
* @param noteTitle additional heading to be used (will be translated)
* @returns pdfMake definitions
*/
public textToDocDef(note: string, motion: ViewMotion, noteTitle: string): object {
const title = this.createTitle(motion);
const subtitle = this.createSubtitle(motion);
const metaInfo = this.createMetaInfoTable(
motion,
this.configService.instant('motions_recommendation_text_mode'),
['submitters', 'state', 'category']
);
const noteContent = this.htmlToPdfService.convertHtml(note);
const subHeading = {
text: this.translate.instant(noteTitle),
style: 'heading2'
};
return [title, subtitle, metaInfo, subHeading, noteContent];
}
示例8: exportMotionCatalog
/**
* Exports multiple motions to a collection of PDFs
*
* @param motions the motions to export
* @param lnMode lineNumbering Mode
* @param crMode Change Recommendation Mode
* @param contentToExport Determine to determine with text and/or reason
* @param infoToExport Determine the meta info to export
* @param commentsToExport Comments (by id) to export
*/
public exportMotionCatalog(
motions: ViewMotion[],
lnMode?: LineNumberingMode,
crMode?: ChangeRecoMode,
contentToExport?: string[],
infoToExport?: InfoToExport[],
commentsToExport?: number[]
): void {
const doc = this.pdfCatalogService.motionListToDocDef(
motions,
lnMode,
crMode,
contentToExport,
infoToExport,
commentsToExport
);
const filename = this.translate.instant(this.configService.instant<string>('motions_export_title'));
const metadata = {
title: filename
};
this.pdfDocumentService.download(doc, filename, metadata);
}
示例9: createPreamble
/**
* Creates the motion preamble
*
* @param motion the target motion
* @returns doc def for the motion text
*/
private createPreamble(motion: ViewMotion): object {
return {
text: `${this.translate.instant(this.configService.instant('motions_preamble'))}`,
margin: [0, 10, 0, 10]
};
}
示例10: 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([
{
//.........这里部分代码省略.........