Commit 1b1c4db0 authored by Sindre Sorhus's avatar Sindre Sorhus

Remove Fun app

parent a52a4fc2
...@@ -217,9 +217,6 @@ ...@@ -217,9 +217,6 @@
<li> <li>
<a href="labs/architecture-examples/o_O/" data-source="http://weepy.github.com/o_O/" data-content="o_O: HTML binding for teh lulz: &lt;br> - Elegantly binds objects to HTML&lt;br>- Proxies through jQuery, Ender, etc&lt;br>- Automatic dependency resolution&lt;br>- Plays well with others">Funnyface.js</a> <a href="labs/architecture-examples/o_O/" data-source="http://weepy.github.com/o_O/" data-content="o_O: HTML binding for teh lulz: &lt;br> - Elegantly binds objects to HTML&lt;br>- Proxies through jQuery, Ender, etc&lt;br>- Automatic dependency resolution&lt;br>- Plays well with others">Funnyface.js</a>
</li> </li>
<li>
<a href="labs/architecture-examples/fun/" data-source="https://github.com/marcuswestin/fun" data-content="Fun is not an MVC framework, but a programming language meant to tackle MVC/UI programming on a deeper, more fundamental level - part reactive/functional and part sequential/procedural.">Fun</a>
</li>
<li> <li>
<a href="labs/dependency-examples/knockoutjs_require/" data-source="http://knockoutjs.com" data-content="This project is an adaptation of /architecture-examples/knockoutjs with require.js.">Knockout + RequireJS</a> <a href="labs/dependency-examples/knockoutjs_require/" data-source="http://knockoutjs.com" data-content="This project is an adaptation of /architecture-examples/knockoutjs with require.js.">Knockout + RequireJS</a>
</li> </li>
......
import localstorage
import list
import text
<head>
<meta charset="utf-8" />
<title>"Fun • TodoMVC"</title>
<link rel="stylesheet" href="../../assets/base.css" />
<link rel="stylesheet" href="css/app.css" />
</head>
tasks = []
localstorage.persist(tasks, 'todos-fun')
nextId = 1
localstorage.persist(nextId, 'todos-id')
displayTasks = tasks
displayFilter = 'all'
<section id="todoapp">
<header id="header">
<h1>"todos"</h1>
newTaskName = ''
<input id="new-todo" placeholder="What needs to be done?" autofocus=true data=newTaskName onkeypress=handler(event) {
if (event.keyCode is 13) {
trimmedName = text.trim(newTaskName.copy())
id = nextId.copy()
if trimmedName is ! '' {
tasks push: { title:trimmedName, completed:false, id:id }
newTaskName set: ''
}
nextId set: nextId.copy() + 1
}
}/>
</header>
if tasks.length {
<section id="main">
toggleAll = false
<input id="toggle-all" type="checkbox" data=toggleAll onchange=handler() {
for task in tasks {
task.completed set: !toggleAll.copy()
}
} />
<label for="toggle-all">"Mark all as complete"</label>
<ul id="todo-list">
for task in displayTasks {
<li class=(task.completed ? "complete" : "")>
<div class="view">
<input class="toggle" type="checkbox" data=task.completed />
<label>task.title</label>
<button class="destroy"></button onclick=handler() {
tasks set: list.filter(tasks.copy(), function(checkTask) { return checkTask.id is ! task.id })
}>
</div>
// TODO Implement editing
<input class="edit" data=task.title />
</li>
}
</ul>
</section>
<footer id="footer">
completedTasks = list.filter(tasks, function(task) { return task.completed })
pluralize = function(num) { return num is > 1 ? "items" : "item" }
<span id="todo-count">
numTasksLeft = tasks.length - completedTasks.length
<strong>numTasksLeft</strong>" "pluralize(numTasksLeft)" left"
</span>
<ul id="filters">
<li><a href="#" class=(displayFilter is 'all' ? 'selected' : '')>"All"</a></li onclick=handler() {
displayTasks set: tasks
displayFilter set:'all'
}>
<li><a href="#" class=(displayFilter is 'active' ? 'selected' : '')>"Active"</a></li onclick=handler() {
displayTasks set: list.filter(tasks, function(task) { return !task.completed })
displayFilter set:'active'
}>
<li><a href="#" class=(displayFilter is 'completed' ? 'selected' : '')>"Completed"</a></li onclick=handler() {
displayTasks set: list.filter(tasks, function(task) { return task.completed })
displayFilter set:'completed'
}>
</ul>
<button id="clear-completed">"Clear completed ("completedTasks.length")"</button onclick=handler() {
remainingTasks = []
for task in tasks {
if !task.completed {
remainingTasks push: task
}
}
tasks set: remainingTasks
}>
</footer>
}
</section>
<footer id="info">
<p>"Double-click to edit a todo"</p>
<p>"Created with "<a href="https://github.com/marcuswestin/fun">"Fun"</a>" by "<a href="http://marcuswest.in">"Marcus Westin"</a></p>
</footer>
/*
Fun injects "hook" dom nodes into the dom tree. The
reason why is too involved to outline here. However,
they break a few of the todo app styles, such as
`#todo-list li:last-child { border-bottom:none; }`.
This should be rectified in fun in the future, but
these css modifications are fine in the meantime.
*/
body {
background:
#EEE url('../../assets/bg.png');
}
#todo-list li:last-child {
border-bottom: 1px dotted #CCC;
}
#todo-list li label {
margin:20px 22px;
}
This diff is collapsed.
Fun TodoMVC
===========
This is an implementation of the [TodoMVC example application](http://addyosmani.github.com/todomvc/) in [Fun](https://github.com/marcuswestin/fun), a new programming language for web apps.
Note that `index.html` is the compiled output - see `app.fun` for the original source.
Getting started
---------------
To make changes to the todos-fun example you need to install fun:
sudo npm install fun@0.2.22 -g
fun app.fun --normalize.css=false
To compile, run
fun --compile app.fun --normalize.css=false > index.html
...@@ -63,7 +63,6 @@ We also have a number of in-progress applications in Labs: ...@@ -63,7 +63,6 @@ We also have a number of in-progress applications in Labs:
- [Dijon](https://github.com/creynders/dijon-framework) - [Dijon](https://github.com/creynders/dijon-framework)
- [rAppid.js](http://www.rappidjs.com) - [rAppid.js](http://www.rappidjs.com)
- [o_O](http://weepy.github.com/o_O) - [o_O](http://weepy.github.com/o_O)
- [Fun](https://github.com/marcuswestin/fun)
- [KnockoutJS](http://knockoutjs.com) + [RequireJS](http://requirejs.org) (using AMD) - [KnockoutJS](http://knockoutjs.com) + [RequireJS](http://requirejs.org) (using AMD)
- [AngularJS](http://angularjs.org) + [RequireJS](http://requirejs.org) (using AMD) - [AngularJS](http://angularjs.org) + [RequireJS](http://requirejs.org) (using AMD)
- [AngularJS](http://angularjs.org) (optimized) - [AngularJS](http://angularjs.org) (optimized)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment