7 * Represents static UI element composed of rectangle and caption that can be used as a section title.
8 * This component is required by {{#crossLink "Library"}}{{/crossLink}} class.
10 * Use following snippet to include component in your `index.html` file:
12 * <script type='text/javascript' src='./css/car/components/boxCaption/boxCaption.js'></script>
13 * <link rel="stylesheet" href="./css/car/components/boxCaption/boxCaption.css" />
15 * Box caption provides following options for UI representations:
17 * * {{#crossLink "BoxCaption/init:method"}}{{/crossLink}} - Standard size of rectangle and light text color
18 * (e.g. Exterior brightness in {{#crossLinkModule "DashboardApplication"}}{{/crossLinkModule}})
19 * * {{#crossLink "BoxCaption/initSmall:method"}}{{/crossLink}} - Small size of rectangle and light text color
20 * (e.g. Category title in {{#crossLink "Library"}}{{/crossLink}})
22 * Use following code to initialize:
24 * $('#box').boxCaptionPlugin('init', "Caption"); // OR
25 * $('#box').boxCaptionPlugin('initSmall', "Caption");
32 * Generates and shows default box caption element on the screen.
35 * @param caption {String} Caption text.
37 init: function (caption) {
39 var appendText = '<div class="boxIconRectangle bgColorTheme"></div>';
40 appendText += '<div class="boxIconCaption fontSizeXSmall fontWeightBold fontColorLight">';
41 appendText += caption.toUpperCase();
42 appendText += '</div>';
43 this.append(appendText);
46 * Generates and shows small box caption element on the screen.
49 * @param caption {String} Caption text.
51 initSmall: function (caption) {
53 var appendText = '<div class="boxIconRectangleSmall bgColorTheme"></div>';
54 appendText += '<div class="boxIconCaptionSmall fontSizeXXSmall fontWeightBold fontColorLight">';
55 appendText += caption.toUpperCase();
56 appendText += '</div>';
57 this.append(appendText);
61 * jQuery extension method for {{#crossLink "BoxCaption"}}{{/crossLink}} plugin.
62 * @param method {Object|jQuery selector} Identificator (name) of method or jQuery selector.
63 * @method boxCaptionPlugin
65 * @return Result of called method.
67 $.fn.boxCaptionPlugin = function (method) {
68 // Method calling logic
69 if (BoxCaption[method]) {
70 return BoxCaption[method].apply(this, Array.prototype.slice.call(arguments, 1));
71 } else if (typeof method === 'object' || !method) {
72 return BoxCaption.init.apply(this, arguments);
74 $.error('Method ' + method + ' does not exist on jQuery.boxCaptionPlugin');