Browse files

still working

  • Loading branch information...
1 parent 150b9d8 commit 39c99804accf2f3b7d474528f669718f557b0310 @hiroprotagonist committed Mar 31, 2012
View
39 nodepad/public/javascripts/application.js
@@ -0,0 +1,39 @@
+var ccd = {
+ // Create this closure to contain the cached modules
+ module: function() {
+ // Internal module cache.
+ var modules = {};
+
+ // Create a new module reference scaffold or load an
+ // existing module.
+ return function(name) {
+ // If this module has already been created, return it.
+ if (modules[name]) {
+ return modules[name];
+ }
+
+ // Create a module and save it under this name
+ return modules[name] = { /*Views: {}*/ };
+ };
+ }()
+};
+
+// Using the jQuery ready event is excellent for ensuring all
+// code has been downloaded and evaluated and is ready to be
+// initialized. Treat this as your single entry point into the
+// application.
+jQuery(function($) {
+ // Initialize your application here.
+/*
+ um = ccd.module('user');
+ ulist = new um.List;
+
+ var joinDialog = new um.Joinform({el: $('body'), collection: ulist});
+ $('#show_join_form').click(function() {
+ joinDialog.show();
+ });
+
+ listview = new um.Listview({ 'el': $('#main'), collection: ulist });
+ ulist.fetch();
+ */
+});
View
96 nodepad/public/javascripts/modules/user.js
@@ -0,0 +1,96 @@
+// src/modules/user.js
+// Module reference argument, assigned at the bottom
+(function(User) {
+
+ // ??? does this break soc
+ // var app = chat.app;
+ // Define a user
+ // this.set({ messages: new Message.List() });
+ User.Model = Backbone.Model.extend({
+ urlRoot: '/users',
+ idAttribute: "_id",
+ initialize: function() {}
+ });
+
+ // Define a user list
+ User.List = Backbone.Collection.extend({
+ url: '/users',
+ model: User.Model
+ });
+ User.Quickview = Backbone.View.extend({
+ initialize: function() {
+ _.bindAll(this, "render");
+ this.model.bind("change", this.render)
+ },
+ render: function() {
+ var template = _.template( $(template.you), {'data': this.model.attributes});
+ this.$el.html( template );
+ return this;
+ },
+ events: {
+ 'click button[data-role="increase-day"]': 'increaseDay'
+ },
+ increaseDay: function() {
+ console.log(this.model.fetch());
+ }
+ });
+ User.Listview = Backbone.View.extend({
+ initialize: function() {
+ _.bindAll(this, "render");
+ this.collection.bind("all", this.render);
+ },
+ render: function() {
+ this.$el.empty();
+ var els = []
+ , module = ccd.module('user');
+ this.collection.each(function(item) {
+ var view = new module.Quickview({model: item});
+ els.push(view.render().el);
+ });
+ this.$el.append(els);
+ return this;
+ }
+ });
+
+ User.Joinform = Backbone.View.extend({
+ events: {
+ 'click #join_form_join': 'submit_join',
+ 'click #join_form_cancel': 'cancel_join'
+ },
+ render: function() {
+ var dialog = this.template({data:{}});
+ this. myel = $(dialog).dialog({
+ autoOpen: false,
+ height:480,
+ width: 640,
+ title: 'Join CCD',
+ modal: true
+ });
+
+ this.delegateEvents(this.events);
+ return this;
+ },
+ initialize: function() {
+ _.bindAll(this, 'render');
+ this.template = _.template($("#join_form_container").html());
+ this.render().el;
+ },
+ show: function() {
+ $(this.myel).dialog( 'open' );
+ },
+ close: function() {
+ $(this.myel).dialog( 'close' );
+ },
+ submit_join: function() {
+ var data = {
+ name: $('#join_form_name').val(),
+ phase: 'black',
+ day: 0
+ }
+ this.collection.create( data );
+ },
+ cancel_join: function() { console.log('cancel');}
+ });
+
+
+})(ccd.module("user"));
View
9 nodepad/public/javascripts/templates.js
@@ -0,0 +1,9 @@
+var template = {
+ you: '<div class="plate" date-phase="<%= data.phase %>" id="<%= data._id %>">\
+ <div class="name"><%= data.name %></div>\
+ <div class="day"><%= data.day %></div>\
+ <button data-role="increase-day">+</button>\
+ </div>'
+}
+
+
View
114 nodepad/public/stylesheets/style.css
@@ -1,8 +1,110 @@
-body {
- padding: 50px;
- font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
+/* HTML5 Boilerplate */
+
+article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; }
+audio, canvas, video { display: inline-block; *display: inline; *zoom: 1; }
+audio:not([controls]) { display: none; }
+[hidden] { display: none; }
+
+html { font-size: 100%; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }
+html, button, input, select, textarea { font-family: sans-serif; color: #222; }
+body { margin: 0; font-size: 1em; line-height: 1.4; }
+
+::-moz-selection { background: #fe57a1; color: #fff; text-shadow: none; }
+::selection { background: #fe57a1; color: #fff; text-shadow: none; }
+
+a { color: #00e; }
+a:visited { color: #551a8b; }
+a:hover { color: #06e; }
+a:focus { outline: thin dotted; }
+a:hover, a:active { outline: 0; }
+abbr[title] { border-bottom: 1px dotted; }
+b, strong { font-weight: bold; }
+blockquote { margin: 1em 40px; }
+dfn { font-style: italic; }
+hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; }
+ins { background: #ff9; color: #000; text-decoration: none; }
+mark { background: #ff0; color: #000; font-style: italic; font-weight: bold; }
+pre, code, kbd, samp { font-family: monospace, serif; _font-family: 'courier new', monospace; font-size: 1em; }
+pre { white-space: pre; white-space: pre-wrap; word-wrap: break-word; }
+
+q { quotes: none; }
+q:before, q:after { content: ""; content: none; }
+small { font-size: 85%; }
+sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; }
+sup { top: -0.5em; }
+sub { bottom: -0.25em; }
+
+ul, ol { margin: 1em 0; padding: 0 0 0 40px; }
+dd { margin: 0 0 0 40px; }
+nav ul, nav ol { list-style: none; list-style-image: none; margin: 0; padding: 0; }
+
+img { border: 0; -ms-interpolation-mode: bicubic; vertical-align: middle; }
+svg:not(:root) { overflow: hidden; }
+figure { margin: 0; }
+
+form { margin: 0; }
+fieldset { border: 0; margin: 0; padding: 0; }
+
+label { cursor: pointer; }
+legend { border: 0; *margin-left: -7px; padding: 0; white-space: normal; }
+button, input, select, textarea { font-size: 100%; margin: 0; vertical-align: baseline; *vertical-align: middle; }
+button, input { line-height: normal; }
+button, input[type="button"], input[type="reset"], input[type="submit"] { cursor: pointer; -webkit-appearance: button; *overflow: visible; }
+button[disabled], input[disabled] { cursor: default; }
+input[type="checkbox"], input[type="radio"] { box-sizing: border-box; padding: 0; *width: 13px; *height: 13px; }
+input[type="search"] { -webkit-appearance: textfield; -moz-box-sizing: content-box; -webkit-box-sizing: content-box; box-sizing: content-box; }
+input[type="search"]::-webkit-search-decoration, input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
+button::-moz-focus-inner, input::-moz-focus-inner { border: 0; padding: 0; }
+textarea { overflow: auto; vertical-align: top; resize: vertical; }
+input:valid, textarea:valid { }
+input:invalid, textarea:invalid { background-color: #f0dddd; }
+
+table { border-collapse: collapse; border-spacing: 0; }
+td { vertical-align: top; }
+
+.chromeframe { margin: 0.2em 0; background: #ccc; color: black; padding: 0.2em 0; }
+@media only screen and (min-width: 35em) {
}
+.ir { display: block; border: 0; text-indent: -999em; overflow: hidden; background-color: transparent; background-repeat: no-repeat; text-align: left; direction: ltr; *line-height: 0; }
+.ir br { display: none; }
+.hidden { display: none !important; visibility: hidden; }
+.visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
+.visuallyhidden.focusable:active, .visuallyhidden.focusable:focus { clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto; }
+.invisible { visibility: hidden; }
+.clearfix:before, .clearfix:after { content: ""; display: table; }
+.clearfix:after { clear: both; }
+.clearfix { *zoom: 1; }
-a {
- color: #00B7FF;
-}
+@media print {
+ * { background: transparent !important; color: black !important; box-shadow:none !important; text-shadow: none !important; filter:none !important; -ms-filter: none !important; }
+ a, a:visited { text-decoration: underline; }
+ a[href]:after { content: " (" attr(href) ")"; }
+ abbr[title]:after { content: " (" attr(title) ")"; }
+ .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; }
+ pre, blockquote { border: 1px solid #999; page-break-inside: avoid; }
+ thead { display: table-header-group; }
+ tr, img { page-break-inside: avoid; }
+ img { max-width: 100% !important; }
+ @page { margin: 0.5cm; }
+ p, h2, h3 { orphans: 3; widows: 3; }
+ h2, h3 { page-break-after: avoid; }
+}
+/* My Style */
+.plate {
+ display: block;
+ float: left;
+ height: 200px;
+ width: 150px;
+ margin: 20px;
+ padding: 15px;
+ border-radius: 17px;
+ box-shadow: 0px 7px 15px -3px #666666;
+}
+.plate.dark { color: white; }
+.plate.light { color: black; }
+.name {
+ font-size: large;
+}
+.day {
+ font-size: xx-large;
+}
View
4 nodepad/views/layout.jade
@@ -7,5 +7,7 @@ html
script(src="javascripts/libs/underscore-min.js")
script(src="javascripts/libs/jquery-ui.custom.min.js")
script(src="javascripts/libs/backbone-min.js")
-
+ script(src="javascripts/templates.js")
+ script(src="javascripts/modules/user.js")
+ script(src="javascripts/application.js")
body!= body
View
1 nodepad/views/user/you.jade
@@ -1,4 +1,3 @@
h1= 'Moinsen'
p Welcome to #{user.login}
a(href='/logout') Logout
-

0 comments on commit 39c9980

Please sign in to comment.