Drink Coffee with big Mustache

Template for testing mustache templates.

by Avinash_R

HTML

<script src="https://mustache.github.io/extras/mustache.js"></script>

CoffeeScript

template = '{{#viewModes}}\n<h3>{{name}}</h3>\n<div>\n  {{#settings}}\n  <fieldset class=\"ui-widget-content ui-corner-all parentDetails\">\n    {{#parentDetails}}\n    <legend>Parent Details</legend>\n    <input type=\"hidden\" name=\"id\"/>\n    <div>\n      <label>\n        <input type=\"checkbox\" name=\"description\" value=\"true\"/>\n        Show Description \n      </label>\n      <select name=\"descriptionPosition\" disabled=\"disabled\">\n        <option value=\"inline\">Show inline</option>\n        <option value=\"newline\">Show in a new line</option>\n      </select>\n    </div>\n    <div>\n      <label>\n        <input type=\"checkbox\" name=\"colorCoding\" value=\"true\" />\n        Follow color coding\n      </label>\n    </div>\n    <div>\n      <label>\n        <input type=\"checkbox\" name=\"isLink\" value=\"true\" />\n        Show as link\n      </label>\n      <select name=\"linkPage\" disabled=\"disabled\"></select>\n    </div>\n    <div>\n      <label>\n        Image to show\n        <select name=\"image\">\n          <option value=\"\">None</option>\n          <option value=\"banner\">Banner</option>\n          <option value=\"preview\">Preview</option>\n        </select>\n      </label>\n    </div>\n    {{/parentDetails}}\n  </fieldset>\n  {{/settings}}\n</div>\n{{/viewModes}}'

data = {
    viewModes:{
        id: 0,
        settings: {
            parentDetails: {}
        }
    }
}

$ () -> $("body").html(Mustache.render(template, data))