How to use the dojo/string.substitute function in dojo

To help you get started, we’ve selected a few dojo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Saleslogix / argos-saleslogix / src / Format.js View on Github external
const numParse = crm.Format.fixedLocale(val, 2);
    switch (type) { // eslint-disable-line
      case 'days':
        return string.substitute(resource.daysText, {
          val: numParse,
        });
      case 'weeks':
        return string.substitute(resource.weeksText, {
          val: numParse,
        });
      case 'months':
        return string.substitute(resource.monthsText, {
          val: numParse,
        });
      case 'years':
        return string.substitute(resource.yearsText, {
          val: numParse,
        });
    }
    return rawValue;
  },
}));
github Saleslogix / argos-saleslogix / src / Recurrence.js View on Github external
string.substitute(this.weeklyEveryAfterCompletionSummary, textOptions);
      case 4:
        // monthly on day
        return (textOptions[0] <= 1) ?
          string.substitute(this.monthlySummary, textOptions) :
          string.substitute(this.monthlyEverySummary, textOptions);
      case 5:
        // monthly on day ordinal
        return (textOptions[0] <= 1) ?
          string.substitute(this.monthlyOrdSummary, textOptions) :
          string.substitute(this.monthlyEveryOrdSummary, textOptions);
      case 6:
        // monthly after completion
        return (textOptions[0] <= 1) ?
          string.substitute(this.monthlyAfterCompletionSummary, textOptions) :
          string.substitute(this.monthlyEveryAfterCompletionSummary, textOptions);
      case 7:
        // yearly on day of the month
        return (textOptions[0] <= 1) ?
          string.substitute(this.yearlySummary, textOptions) :
          string.substitute(this.yearlyEverySummary, textOptions);
      case 8:
      // yearly on day ordinal
        return (textOptions[0] <= 1) ?
          string.substitute(this.yearlyOrdSummary, textOptions) :
          string.substitute(this.yearlyEveryOrdSummary, textOptions);
      case 9:
      // Yearly after completion
        return (textOptions[0] <= 1) ?
          string.substitute(this.yearlyAfterCompletionSummary, textOptions) :
          string.substitute(this.yearlyEveryAfterCompletionSummary, textOptions);
      default:
github Saleslogix / argos-saleslogix / src / Format.js View on Github external
bigNumber: function bigNumber(val) {
    let numParse = typeof val !== 'number' ? parseFloat(val) : val;
    const absVal = Math.abs(numParse);

    if (isNaN(numParse)) {
      return val;
    }

    let results = numParse.toString();
    if (absVal >= 1000000000) {
      // Billion
      numParse = numParse / 1000000000;
      results = string.substitute(resource.billionText, {
        val: dojoNumber.format(numParse, { places: 1 }),
      });
    } else if (absVal >= 1000000) {
      numParse = numParse / 1000000;
      results = string.substitute(resource.millionText, {
        val: dojoNumber.format(numParse, { places: 1 }),
      });
    } else if (absVal >= 1000) {
      numParse = numParse / 1000;
      results = string.substitute(resource.thousandText, {
        val: dojoNumber.format(numParse, { places: 1 }),
      });
    } else {
      results = dojoNumber.round(numParse, 2).toString();
    }
github Saleslogix / argos-saleslogix / src / Action.js View on Github external
callPhone: function callPhone(action, selection, phoneProperty, title) {
    if (!selection || !selection.data) {
      return;
    }

    let actionInitiated = false;
    this.setSource({
      entry: selection.data,
      descriptor: selection.data.$descriptor,
      key: selection.data.$key,
    });

    lang.mixin(selection.data, {
      Type: 'atPhoneCall',
      Description: string.substitute(crm.Action.calledText, [selection.data.$descriptor]),
    });

    const value = utility.getValue(selection.data, phoneProperty, '');
    crm.Action.recordToHistory(() => {
      if (!actionInitiated) {
        App.initiateCall(value);
        actionInitiated = true;
      }
    }, selection.data, title);
  },
  sendEmail: function sendEmail(action, selection, emailProperty) {
github Saleslogix / argos-saleslogix / src / Views / History / RelatedView.js View on Github external
getHeader: function getHeader(entry) {
    return string.substitute(this.byText, [format.formatByUser(entry.UserName), format.date(entry.ModifyDate)]);
  },
});
github Saleslogix / argos-saleslogix / src / Views / Activity / Detail.js View on Github external
formatRelatedQuery: function formatRelatedQuery(entry, fmt, property) {
    let toReturn;
    if (property === 'activityId') {
      toReturn = string.substitute(fmt, [utility.getRealActivityId(entry.$key)]);
    } else {
      const theProperty = property || '$key';
      toReturn = string.substitute(fmt, [platformUtility.getValue(entry, theProperty, '')]);
    }
    return toReturn;
  },
  createLayout: function createLayout() {
github Saleslogix / argos-saleslogix / src / Integrations / BOE / Views / Products / List.js View on Github external
formatSearchQuery: function formatSearchQuery(searchQuery) {
    return string.substitute('upper(Name) like "${0}%" or upper(Family) like "${0}%" or ActualId like "${0}%"', [this.escapeSearchQuery(searchQuery.toUpperCase())]);
  },
});
github Saleslogix / argos-saleslogix / src / Integrations / BOE / Views / ERPShipments / List.js View on Github external
formatSearchQuery: function formatSearchQuery(searchQuery) {
    return string.substitute('upper(Account.AccountName) like "${0}%" or upper(ErpExtId) like "${0}%"', [this.escapeSearchQuery(searchQuery.toUpperCase())]);
  },
});
github Saleslogix / argos-saleslogix / src / Views / Lead / Detail.js View on Github external
recordEmailToHistory: function recordEmailToHistory(email) {
    const entry = {
      $name: 'History',
      Type: 'atEMail',
      AccountName: this.entry.Company,
      LeadId: this.entry.$key,
      LeadName: this.entry.LeadNameLastFirst,
      Description: string.substitute(this.emailedText, [this.entry.LeadNameLastFirst]),
      UserId: App.context && App.context.user.$key,
      UserName: App.context && App.context.user.UserName,
      Duration: 15,
      CompletedDate: (new Date()),
    };

    this.navigateToHistoryInsert('atEMail', entry);
    App.initiateEmail(email);
  },
  callWorkPhone: function callWorkPhone() {
github Saleslogix / argos-saleslogix / src / Views / Calendar / WeekView.js View on Github external
getEventQuery: function getEventQuery() {
    const startDate = this.weekStartDate;
    const endDate = this.weekEndDate;
    return string.substitute(
      [
        'UserId eq "${0}" and (',
        '(StartDate gt @${1}@ or EndDate gt @${1}@) and ',
        'StartDate lt @${2}@',
        ')',
      ].join(''), [App.context.user && App.context.user.$key,
        startDate.format('YYYY-MM-DDT00:00:00[Z]'),
        endDate.format('YYYY-MM-DDT23:59:59[Z]'),
      ]
    );
  },
  hideEventList: function hideEventList() {

dojo

Dojo core is a powerful, lightweight library that makes common tasks quicker and easier. Animate elements, manipulate the DOM, and query with easy CSS syntax, all without sacrificing performance.

BSD-3-Clause OR AFL-2.1
Latest version published 2 years ago

Package Health Score

59 / 100
Full package analysis