doc/index.html
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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="A layout example with a side menu that hides on mobile, just like the Pure website."> <title>Side Menu – Layout Examples – Pure</title> <link rel="stylesheet" href="css/pure-min.css"> <link rel="stylesheet" href="css/side-menu.css"> <script src="js/mithril.min.js"></script> <script> //this application only has one module: todo var todo = {}; //for simplicity, we use this module to namespace the model classes //the Todo class has two properties todo.Todo = function(data) { this.description = m.prop(data.description); this.done = m.prop(false); }; //the TodoList class is a list of Todo's todo.TodoList = Array; //the view-model tracks a running list of todos, //stores a description for new todos before they are created //and takes care of the logic surrounding when adding is permitted //and clearing the input after adding a todo to the list todo.vm = (function() { var vm = {} vm.init = function() { //a running list of todos vm.list = new todo.TodoList(); //a slot to store the name of a new todo before it is created vm.description = m.prop(""); //adds a todo to the list, and clears the description field for user convenience vm.add = function() { if (vm.description()) { vm.list.push(new todo.Todo({description: vm.description()})); vm.description(""); } }; } return vm }()) //the controller defines what part of the model is relevant for the current page //in our case, there's only one view-model that handles everything todo.controller = function() { todo.vm.init() } //here's the view todo.view = function() { return m("html", [ m("body", [ m("input", {onchange: m.withAttr("value", todo.vm.description), value: todo.vm.description()}), m("button", {onclick: todo.vm.add}, "Add"), m("table", [ todo.vm.list.map(function(task, index) { return m("tr", [ m("td", [ m("input[type=checkbox]", {onclick: m.withAttr("checked", task.done), checked: task.done()}) ]), m("td", {style: {textDecoration: task.done() ? "line-through" : "none"}}, task.description()), ]) }) ]) ]) ]); }; //initialize the application //m.module(document, {controller: todo.controller, view: todo.view}); </script> </head> <body> <div id="litestore"> <!-- Menu toggle --> <a href="#menu" id="menuLink" class="menu-link"> <!-- Hamburger icon --> <span></span> </a> <div id="menu"> <div class="pure-menu pure-menu-open"> <ul> <li><a class="pure-menu-selected" href="#">Overview</a></li> <li><a href="#">Getting Started</a></li> <li><a href="#">Usage</a></li> <li><a href="#">API</a></li> <li><a href="#">Credits</a></li> </ul> </div> </div> <div id="main"> <div class="header"> <h1>LiteStore</h1> <h2>A subtitle for your page goes here</h2> </div> <div class="content"> <h2 class="content-subhead">How to use this layout</h2> <p> To use this layout, you can just copy paste the HTML, along with the CSS in <a href="/css/layouts/side-menu.css" alt="Side Menu CSS">side-menu.css</a>, and the JavaScript in <a href="/js/ui.js">ui.js</a>. The JS file uses vanilla JavaScript to simply toggle an <code>active</code> class that makes the menu responsive. </p> <h2 class="content-subhead">Now Let's Speak Some Latin</h2> <p> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p> <div class="pure-g"> <div class="pure-u-1-4"> <img class="pure-img-responsive" src="http://farm3.staticflickr.com/2875/9069037713_1752f5daeb.jpg" alt="Peyto Lake"> </div> <div class="pure-u-1-4"> <img class="pure-img-responsive" src="http://farm3.staticflickr.com/2813/9069585985_80da8db54f.jpg" alt="Train"> </div> <div class="pure-u-1-4"> <img class="pure-img-responsive" src="http://farm6.staticflickr.com/5456/9121446012_c1640e42d0.jpg" alt="T-Shirt Store"> </div> <div class="pure-u-1-4"> <img class="pure-img-responsive" src="http://farm8.staticflickr.com/7357/9086701425_fda3024927.jpg" alt="Mountain"> </div> </div> <h2 class="content-subhead">Try Resizing your Browser</h2> <p> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p> </div> </div> </div> </body> <script src="js/ui.js"></script> </html> |