Permalink
Browse files

further menus

  • Loading branch information...
stenno
stenno committed Aug 13, 2010
1 parent 09b5b0d commit 1d53a781fe6dd3b1aa16047e8ff098b767ce550f
View
@@ -8,18 +8,23 @@
<div id="menu"></div>
<div id="account"></div>
<div id="desktop">Nothing loaded yet</div>
- <div id="project"></div>
+ <div id="projects"></div>
<div id="sidebar"></div>
</body>
<script src="vendor/couchapp/loader.js"></script>
<script type="text/javascript" charset="utf-8">
$.couch.app(function(app) {
$("#account").evently("account", app);
$("#desktop").evently("desktop", app);
- $("#project").evently("projects", app);
-
+ $("#projects").evently("projects", app);
+ $("#menu").evently("menu", app);
$.evently.connect("#account", "#desktop", ["loggedIn"]);
- $.evently.connect("#desktop", "#project", ["showProject"]);
+ $.evently.connect("#menu", "#desktop", ["menuClick"]);
+ $.evently.connect("#menu", "#projects", ["menuClick"]);
+
+ $.evently.connect("#desktop", "#projects", ["showProject"]);
+
+
});
</script>
</html>
@@ -58,7 +58,13 @@ div.avatar {
height : 60px;
text-align: center;
}
-
+a.menuitem {
+ border:2px solid #ffffff;
+ float:left;
+}
+div#desktop {
+ clear:both;
+}
div.avatar .name {
padding-top:2px;
}
File renamed without changes.
View
@@ -0,0 +1,14 @@
+{
+ "_id":"project2",
+ "type":"project",
+ "users":["stenno","other"],
+ "tasklists": [
+ {
+ "name":"important",
+ "tasks":[
+ {"name":"important1"},
+ {"name":"important2"}
+ ]
+ }
+ ]
+}
View
@@ -0,0 +1,13 @@
+{
+ "_id":"project3",
+ "type":"project",
+ "users":["other"],
+ "tasklists": [
+ {
+ "name":"another_list",
+ "tasks": [
+ {"name":"yet_another_task"}
+ ]
+ }
+ ]
+}
@@ -1,4 +1,5 @@
-<div>Hello {{username}}</div>
+
+<div id="username">Hello {{username}}</div>
<div id="project_list">
{{#projects}}
<a href="#" class="project" id="{{name}}">{{name}}</a>
@@ -1,4 +1,3 @@
function() {
- $.log("this is this", this);
$(this).trigger("showProject",[this.id]);
}
@@ -0,0 +1,9 @@
+function(e, name) {
+ var menutriggers = ["desktop"];
+ if (menutriggers.indexOf(name) < 0) {
+ $(this).text("");
+ }
+ else {
+ $(this).trigger(name);
+ }
+}
@@ -1 +0,0 @@
-Project:
@@ -0,0 +1,2 @@
+ <div><a href="#" name="desktop" class="menuitem">Desktop</a></div>
+ <div><a href="#" name="allProjects" class="menuitem">All Projects</a></div>
@@ -0,0 +1,5 @@
+function() {
+ var menu = $(this);
+ var name = this.name;
+ menu.trigger("menuClick", [name]);
+}
@@ -0,0 +1,6 @@
+function(data) {
+ var projects = data.rows.map(function(row) {
+ return {project:row.value._id};
+ });
+ return {projects:projects};
+}
@@ -0,0 +1,5 @@
+<ul>
+ {{#projects}}
+ <li>{{project}}</li>
+ {{/projects}}
+</ul>
@@ -0,0 +1,3 @@
+{
+ "view":"projects"
+}
@@ -0,0 +1,9 @@
+function(e, name) {
+ var menutriggers = ["allProjects"];
+ if (menutriggers.indexOf(name) < 0) {
+ $(this).text("");
+ }
+ else {
+ $(this).trigger(name);
+ }
+}

0 comments on commit 1d53a78

Please sign in to comment.