當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript config.service.ConfigService類代碼示例

本文整理匯總了TypeScript中app/core/ui-services/config.service.ConfigService的典型用法代碼示例。如果您正苦於以下問題:TypeScript service.ConfigService類的具體用法?TypeScript service.ConfigService怎麽用?TypeScript service.ConfigService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了service.ConfigService類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

    /**
     * Constructs this component.
     *
     * @param {Title} titleService set the browser title
     * @param {TranslateService} translate the translation service
     * @param {ConfigService} configService The configuration provider
     * @param {FormBuilder} formBuilder Form builder
     * @param {MotionRepositoryService} repo Motion Repository
     * @param {ActivatedRoute} route The activated route
     * @param {Router} router The router
     * @param {MatSnackBar} matSnackBar Material Design SnackBar
     */
    public constructor(
        titleService: Title,
        protected translate: TranslateService, // protected required for ng-translate-extract
        private configService: ConfigService,
        private formBuilder: FormBuilder,
        private repo: MotionRepositoryService,
        private route: ActivatedRoute,
        private router: Router,
        matSnackBar: MatSnackBar
    ) {
        super(titleService, translate, matSnackBar);
        this.createForm();

        this.configService.get<number>('motions_line_length').subscribe(lineLength => {
            this.lineLength = lineLength;
            this.getMotionByUrl();
        });

        this.configService.get<boolean>('motions_reason_required').subscribe(required => {
            this.reasonRequired = required;
        });

        this.configService.get<boolean>('motions_amendments_multiple_paragraphs').subscribe(allowed => {
            this.multipleParagraphsAllowed = allowed;
        });
    }
開發者ID:CatoTH,項目名稱:OpenSlides,代碼行數:38,代碼來源:amendment-create-wizard.component.ts

示例2: constructor

 public constructor(
     private operator: OperatorService,
     private configService: ConfigService,
     private constants: ConstantsService
 ) {
     // load config variables
     this.configService
         .get<number>('motions_min_supporters')
         .subscribe(supporters => (this.configMinSupporters = supporters));
     this.configService
         .get<boolean>('motions_amendments_enabled')
         .subscribe(enabled => (this.amendmentEnabled = enabled));
     this.constants
         .get<OpenSlidesSettings>('OpenSlidesSettings')
         .subscribe(settings => (this.amendmentOfAmendment = settings.MOTIONS_ALLOW_AMENDMENTS_OF_AMENDMENTS));
 }
開發者ID:jwinzer,項目名稱:OpenSlides,代碼行數:16,代碼來源:local-permissions.service.ts

示例3: constructor

    public constructor(
        titleService: Title,
        translate: TranslateService,
        matSnackBar: MatSnackBar,
        private repo: CountdownRepositoryService,
        private configService: ConfigService
    ) {
        super(titleService, translate, matSnackBar);

        this.configService.get<number>('agenda_countdown_warning_time').subscribe(time => (this.warningTime = time));
    }
開發者ID:emanuelschuetze,項目名稱:OpenSlides,代碼行數:11,代碼來源:countdown-controls.component.ts

示例4: 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;
    }
開發者ID:CatoTH,項目名稱:OpenSlides,代碼行數:69,代碼來源:motion-pdf.service.ts

示例5: 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'
         }
     ];
 }
開發者ID:emanuelschuetze,項目名稱:OpenSlides,代碼行數:17,代碼來源:user-pdf.service.ts

示例6: ngOnInit

    /**
     * Init the component.
     *
     * Sets the welcomeTitle and welcomeText.
     */
    public ngOnInit(): void {
        super.setTitle('Home');

        // set the welcome title
        this.configService
            .get<string>('general_event_welcome_title')
            .subscribe(welcomeTitle => (this.welcomeTitle = welcomeTitle));

        // set the welcome text
        this.configService
            .get<string>('general_event_welcome_text')
            .subscribe(welcomeText => (this.welcomeText = welcomeText as string));
    }
開發者ID:CatoTH,項目名稱:OpenSlides,代碼行數:18,代碼來源:start.component.ts

示例7: 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;
 }
開發者ID:emanuelschuetze,項目名稱:OpenSlides,代碼行數:58,代碼來源:user-pdf.service.ts

示例8: 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;
 }
開發者ID:emanuelschuetze,項目名稱:OpenSlides,代碼行數:65,代碼來源:user-pdf.service.ts

示例9: 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;
 });
開發者ID:CatoTH,項目名稱:OpenSlides,代碼行數:8,代碼來源:site.component.ts

示例10: 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);
    }
開發者ID:tsiegleauq,項目名稱:OpenSlides,代碼行數:66,代碼來源:motion-pdf.service.ts


注:本文中的app/core/ui-services/config.service.ConfigService類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。