Code coverage report for lib/docview.js

Statements: 93.75% (15 / 16)      Branches: 90% (9 / 10)      Functions: 100% (4 / 4)      Lines: 93.75% (15 / 16)      Ignored: none     

All files » lib/ » docview.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65          1                               1 156 156     1           156     156 155       1     156               156     156 155     156       1    
/*
Copyright (c) 2011, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://yuilibrary.com/license/
*/
YUI.add('docview', function (Y) {
 
    /*
    Selleck
    Copyright (c) 2011 Yahoo! Inc.
    Licensed under the BSD License.
    */
 
    /**
    View class borrowed from [Selleck](https://github.com/rgrove/selleck)  
    The view class is a **`handlebars`** template helper.
    @class DocView
    @constructor
    @param {Object} data Meta data to use in this template
    @param {String} templateName The name of the template file to render.
    **/
    function DocView(data, templateName) {
        this.templateName = templateName;
        Y.mix(this, data);
    }
 
    DocView.prototype = {
        /**
         * **Mustache** `lambda` method for setting the HTML title
         * @method htmlTitle
         */
        htmlTitle: function () {
            var name = this.displayName || this.name,
                title = name;
 
            if (title) {
                Iif (this.projectName) {
                    title += ' - ' + this.projectName;
                }
            } else {
                title = this.projectName;
            }
 
            return title;
        },
 
        /**
         * **Mustache** `lambda` method for setting the title
         * @method title
         */
        title: function () {
            var name = this.displayName || this.name,
                title = this.projectName;
 
            if (name) {
                title += ': ' + name;
            }
 
            return title;
        }
    };
 
    Y.DocView = DocView;
});