soyjavi пре 13 година
родитељ
комит
c2cfaf1e6b

+ 0 - 12
examples/todo.js/app/app.js

@@ -1,12 +0,0 @@
-var App = (function(lng, undefined) {
-
-    lng.App.init({
-        name: 'ToDo.JS',
-        version: '0.1'
-    });
-
-    return {
-
-    };
-
-})(Lungo);

+ 0 - 67
examples/todo.js/app/data.js

@@ -1,67 +0,0 @@
-App.Data = (function(lng, App, undefined) {
-
-    //CONFIG: Data.Sql
-    lng.Data.Sql.init({
-        name: 'todo.js',
-        version: '1.0',
-        schema: [
-            { name: 'todo', drop: false, fields: {
-                id: 'INTEGER PRIMARY KEY',
-                name: 'TEXT',
-                description: 'TEXT',
-                type: 'STRING',
-                done: 'INTEGER DEFAULT 0',
-                created_at: 'DATETIME'
-                }
-            },
-            { name: 'types', drop: false, fields: {
-                id: 'INTEGER PRIMARY KEY',
-                name: 'TEXT'
-                }
-            }
-        ]
-    });
-
-    var refresh = function() {
-        _pendingTodos();
-        _doneTodos();
-    };
-
-    var insertTodo = function(data) {
-        lng.Data.Sql.insert('todo', data);
-    };
-
-    var removeTodo = function(id) {
-        lng.Data.Sql.drop('todo', {id:id});
-    };
-
-    var updateTodo = function(id, data) {
-        lng.Data.Sql.update('todo', data, {id:id});
-        refresh();
-    };
-
-    var doneTodo = function(id) {
-        lng.Data.Sql.update('todo', {done:1}, {id:id});
-    };
-
-    var _pendingTodos = function() {
-        lng.Data.Sql.select('todo', {done:0}, function(result) {
-            App.View.list('#pending', 'pending-tmp', result);
-        });
-    };
-
-    var _doneTodos = function() {
-        lng.Data.Sql.select('todo', {done:1}, function(result){
-            App.View.list('#done', 'list-tmp', result);
-        });
-    };
-
-    return {
-        refresh: refresh,
-        insertTodo: insertTodo,
-        removeTodo: removeTodo,
-        updateTodo: updateTodo,
-        doneTodo: doneTodo
-    }
-
-})(Lungo, App);

+ 0 - 84
examples/todo.js/app/events.js

@@ -1,84 +0,0 @@
-App.Events = (function(lng, undefined) {
-
-    //Login
-    lng.dom('#btnLogin').tap(function(event) {
-        lng.Router.section('main');
-        App.Data.refresh();
-    });
-
-    //Create new todo
-    lng.dom('#btnNewTodo').tap(function(event) {
-
-        var name = lng.dom('#txtNewName');
-        var description = lng.dom('#txtNewDescription');
-        var type = lng.dom('#txtNewType');
-
-        App.Data.insertTodo({
-            name: name.val(),
-            description: description.val(),
-            done: 0,
-            created_at: Date('now')
-        });
-
-        name.val('');
-        description.val('');
-
-        App.View.returnToMain('ToDo created', 'check');
-    });
-
-    //View ToDo
-    lng.dom('#done li, #pending li').tap(function(event) {
-        var todo_id = lng.dom(this).attr('id');
-        App.View.todo(todo_id)
-    });
-
-    //Done ToDo
-    lng.dom('#btnDoneTodo').tap(function(event) {
-        var current_todo = lng.Data.Cache.get('current_todo');
-
-        App.Data.doneTodo(current_todo.id);
-        App.View.returnToMain('ToDo done', 'check');
-    });
-
-    //Update ToDo
-    lng.dom('#btnUpdateTodo').tap(function(event) {
-        var current_todo = lng.Data.Cache.get('current_todo');
-        var name = lng.dom('#txtEditName');
-        var description = lng.dom('#txtEditDescription');
-        var type = lng.dom('#txtNewType');
-
-        App.Data.updateTodo(current_todo.id, {
-            name: name.val(),
-            description: description.val()
-        });
-
-        App.View.returnToMain('ToDo updated', 'pencil');
-    });
-
-    //Delete ToDo
-    lng.dom('#btnDeleteTodo').tap(function(event) {
-        var current_todo = lng.Data.Cache.get('current_todo');
-
-        var options = [
-            {
-                name: '...Yes, delete it!',
-                icon: 'check',
-                color: 'green',
-                callback: function(){
-                    App.Data.removeTodo(current_todo.id);
-                    App.View.returnToMain('ToDo deleted', 'trash');
-                }
-            },
-            {
-                name: '...No, sorry.',
-                icon: 'home',
-                color: 'red',
-                callback: function() {
-                    lng.Sugar.Growl.hide();
-                }
-            }
-        ];
-        lng.Sugar.Growl.option('Are you sure?', options);
-    });
-
-})(Lungo);

+ 0 - 7
examples/todo.js/app/services.js

@@ -1,7 +0,0 @@
-App.Services = (function(lng, App, undefined) {
-
-    return {
-
-    }
-
-})(Lungo, App);

+ 0 - 63
examples/todo.js/app/view.js

@@ -1,63 +0,0 @@
-App.View = (function(lng, App, undefined) {
-
-    lng.View.Template.create('pending-tmp',
-        '<li id="{{id}}">\
-            <a href="#">\
-                <span class="icon check"></span>\
-                {{name}}\
-                <small>{{description}}</small>\
-            </a>\
-        </li>'
-    );
-
-    lng.View.Template.create('list-tmp',
-        '<li id="{{id}}">\
-            <a href="#">\
-                <span class="icon folder"></span>\
-                {{name}}\
-                <small>{{description}}</small>\
-            </a>\
-        </li>'
-    );
-
-    var todo = function(id) {
-        lng.Data.Sql.select('todo', {id:id}, function(result){
-            if (result.length > 0) {
-                var data = result[0];
-                lng.Data.Cache.set('current_todo', data);
-
-                lng.dom('#txtEditName').val(data.name);
-                lng.dom('#txtEditDescription').val(data.description);
-                lng.dom('#txtEditName').val(data.name);
-
-                lng.Router.section('view');
-            }
-        });
-    };
-
-    var returnToMain = function(message, icon) {
-        lng.Sugar.Growl.show(message, 'Please wait...', icon, true, 2);
-        App.Data.refresh();
-
-        setTimeout(function() {
-            lng.Router.back();
-            lng.Sugar.Growl.hide();
-        }, 2000);
-    };
-
-    var list = function(container, template, rows) {
-        lng.View.Template.List.create({
-            el: container,
-            template: template,
-            data: rows
-        });
-        lng.View.Element.count('a[href="' + container + '"]', rows.length);
-    };
-
-    return{
-        todo: todo,
-        returnToMain: returnToMain,
-        list: list
-    }
-
-})(Lungo, App);

BIN
examples/todo.js/assets/images/default.png


BIN
examples/todo.js/assets/images/icon-72.png


BIN
examples/todo.js/assets/images/icon.png


BIN
examples/todo.js/assets/images/icon@2x.png


Разлика између датотеке није приказан због своје велике величине
+ 0 - 32
examples/todo.js/assets/sugars/lungo.sugar.growl.min.css


Разлика између датотеке није приказан због своје велике величине
+ 0 - 13
examples/todo.js/assets/sugars/lungo.sugar.growl.min.js


+ 0 - 114
examples/todo.js/index.html

@@ -1,114 +0,0 @@
-<!doctype html>
-<html manifest="APP.appcache">
-<head>
-    <meta charset="utf-8">
-    <title>ToDo.js with LungoJS</title>
-    <meta name="description" content="">
-    <meta name="author" content="Javier Jiménez Villar (@soyjavi)">
-    <!-- Mobile viewport optimization http://goo.gl/b9SaQ -->
-    <meta name="HandheldFriendly" content="True">
-    <meta name="MobileOptimized" content="320">
-    <meta http-equiv="cleartype" content="on">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;">
-    <meta name="apple-mobile-web-app-capable" content="yes">
-    <meta name="apple-mobile-web-app-status-bar-style" content="black">
-    <!-- For iPhone 4 with high-resolution Retina display: -->
-    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/images/icon@2x.png">
-    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/images/icon-72.png">
-    <link rel="apple-touch-icon-precomposed" href="assets/images/icon.png">
-    <link rel="apple-touch-startup-image" href="assets/images/default.png">
-    <!-- Main Stylesheet -->
-    <link rel="stylesheet" href="../../release/lungo.css">
-    <link rel="stylesheet" href="../../release/lungo.theme.default.css">
-    <!-- Sugars :) -->
-    <link rel="stylesheet" href="assets/sugars/lungo.sugar.growl.min.css">
-</head>
-
-<body class="app">
-    <section id="login">
-        <article class="splash indented">
-            <div>
-                <h1>ToDo.<span }
->js<span></h1>
-                <input type="text" placeholder="Type your user" />
-                <input type="password" placeholder="Type your password" />
-                <a href="#" id="btnLogin" class="button big" data-icon="key">Test Demo!</a>
-                <div class="copyright">Copyright TapQuo Inc, 2011</div>
-            </div>
-        </article>
-    </section>
-
-	<section id="main">
-		<header data-title="ToDo.js">
-            <nav class="right">
-			     <a href="#new" data-target="section" class="active" data-icon="plus"><abbr>New Task</abbr></a>
-            </nav>
-		</header>
-
-        <article id="pending" class="list"></article>
-        <article id="done" class="list"></article>
-
-        <footer class="toolbar with-labels">
-            <nav>
-                <a href="#pending" data-target="article" class="current" data-label="Pending" data-icon="folder"></a>
-                <a href="#done" data-target="article" data-label="Done" data-icon="check"></a>
-            </nav>
-        </footer>
-    </section>
-
-    <section id="view">
-        <header data-title="View" >
-            <nav class="left">
-                <a href="#back" data-target="section" class="current" data-icon="left"><abbr>Back</abbr></a>
-            </nav>
-            <nav class="right">
-                <a href="#" id="btnDeleteTodo" class="active" data-icon="trash"><abbr>Delete</abbr></a>
-            </nav>
-        </header>
-        <article class="list indented">
-            <ul class="form">
-                <li class="tip dark" data-icon="pencil small">Edit ToDo</li>
-                <li class="dark">
-                    <label>Name</label>
-                    <input type="text" id="txtEditName" placeholder="Input text"/>
-                    <label>Description</label>
-                    <textarea id="txtEditDescription" placeholder="Textarea sample"></textarea>
-                </li>
-                <a href="#" id="btnUpdateTodo" class="button big" data-icon="pencil">Update</a>
-                <a href="#" id="btnDoneTodo" class="button big red" data-icon="check">Done</a>
-            </ul>
-        </article>
-    </section>
-
-    <section id="new">
-		<header data-title="New ToDo">
-            <nav>
-                <a href="#back" data-target="section" class="current" data-icon="left"><abbr>Back</abbr></a>
-            </nav>
-        </header>
-		<article class="list indented">
-            <ul class="form">
-                <li>
-                    <label>Name</label>
-                    <input type="text" id="txtNewName" placeholder="Input text"/>
-                </li>
-                <li>
-                    <label>Description</label>
-                    <textarea id="txtNewDescription" placeholder="Textarea sample"></textarea>
-                </li>
-                <a href="#" id="btnNewTodo" class="button big" data-icon="check">Add ToDo</a>
-            </ul>
-		</article>
-	</section>
-
-    <!-- LungoJS (Production mode) -->
-    <script src="../../release/lungo.js"></script>
-    <script src="assets/sugars/lungo.sugar.growl.min.js"></script>
-    <!-- LungoJS - Sandbox App -->
-    <script src="app/app.js"></script>
-    <script src="app/data.js"></script>
-    <script src="app/events.js"></script>
-    <script src="app/services.js"></script>
-    <script src="app/view.js"></script>
-</body>
-</html>

+ 0 - 9
examples/todo.js/todo.appcache

@@ -1,9 +0,0 @@
-CACHE MANIFEST
-CACHE:
-index.html
-/assets/images/default.png
-/assets/images/icon-72.png
-/assets/images/icon.png
-/assets/images/icon@2x.png
-/assets/sugars/lungo.sugar.growl.css
-/assets/sugars/lungo.sugar.growl.js