helpers/jrh_text

Collection of helper functions for text/html/views

Source:
Author:

Methods

(inner) capitalizeFirstLetter(string)

Source:
See:
Parameters:
Name Type Description
string *
Returns:

string with capitalized first letter

(inner) jrBootstrapCollapseBox(title, body, footer)

Source:

Helper funciton to generate some html that shows a bootstrap spoiler box with some debug information

Parameters:
Name Type Description
title string
body string
footer string
Returns:

html string

(inner) jrHtmlFormInputPassword(fieldName, obj, flagRequired, flagExistingIsNonBlank)

Source:

Create html text for a form input password, with a hint saying whether there is an existing value in the database, and a hint saying whether leaving the value blank will preserve existing value, and a hint showing how to clear the database value by using a "-" character (if this is an optional password field)

Parameters:
Name Type Description
fieldName string
obj *
flagRequired boolean
flagExistingIsNonBlank boolean
Returns:

html string

(inner) jrHtmlFormOptionList(choices, id)

Source:

Create an html string containing values

Parameters:
Name Type Description
choices array

list of id -> description pairs

id *

id of currently select id (if any)

Returns:

html for inclusion in form (inside a select form object usually)

(inner) jrHtmlFormOptionListSelect(name, choices, id)

Source:

Create an html input select (drop down) list.

Parameters:
Name Type Description
name string

of the select input

choices array

list of id -> description pairs

id *

id of currently select id (if any)

Returns:

html for inclusion in form

(inner) jrHtmlNiceOptionFromList(choices, id)

Source:

Given a pairlist of form id=>optionlabel, return the optionlabel corresponding to specified id

Parameters:
Name Type Description
choices object
id *

(inner) jrHtmlStrigifyObject(obj)

Source:

Simple wrapper for JSON.stringify that formats output for html using

 tags

Parameters:
Name Type Description
obj *
Returns:

html string

(inner) jrPluralize(number, singular, plural)

Source:

Pluralize a string based on a number (presumably the number of items being referred to)

Examples
"You have eaten " + jrPluralize(4, "one apple", "some apples")
"Should we discard the " + jrPluralize(4, "apple")
So it used the singular if the count is 1, otherwise the plural form; if no plural form is specified, use singular and add "s"
Parameters:
Name Type Description
number int
singular string
plural string
Returns:

string with number specified as signular or plural

(inner) jrPluralizeCount(number, singular, plural)

Source:

Pluralize a string based on a number (presumably the number of items being referred to)

Example
"You have eaten " + jrPluralizeCount(4, "apples", "apples")
So it used the singular if the count is 1, otherwise the plural
Parameters:
Name Type Description
number int
singular string
plural string
Returns:

string with number specified as signular or plural, and number mentioned specifically