Permalink
Browse files

initial import

  • Loading branch information...
Jakub Kuźma
Jakub Kuźma committed Aug 12, 2011
0 parents commit de61765baf200cedd4efeee308c7ba2cdec47316
Showing with 97 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +20 −0 LICENSE
  3. +1 −0 README.md
  4. +1 −0 css/main.css
  5. +20 −0 ficha.json
  6. +18 −0 index.html
  7. +35 −0 lib/main.js
@@ -0,0 +1,2 @@
+assets
+.bpm
20 LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2011 Strobe Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
+# ficha
@@ -0,0 +1 @@
+/* TODO: Add your app CSS here */
@@ -0,0 +1,20 @@
+{
+ "name": "ficha",
+ "bpm": "1.0.0",
+ "bpm:build": {
+ "bpm_libs.js": {
+ "directories": [
+ "lib"
+ ],
+ "minifier": "uglify-js"
+ },
+ "bpm_styles.css": {
+ "directories": [
+ "css"
+ ]
+ }
+ },
+ "dependencies": {
+ "sproutcore": ">= 0-pre"
+ }
+}
@@ -0,0 +1,18 @@
+<html>
+ <head>
+ <link rel="stylesheet" href="assets/bpm_styles.css" type="text/css" media="screen" charset="utf-8" />
+ <title>Ficha</title>
+ </head>
+ <body>
+ <h1>Ficha</h1>
+
+ <script type="text/x-handlebars">
+ {{view Ficha.SideView valueBinding="Ficha.cardController.currentCard.front" placeholder="Front Side"}}
+ {{view Ficha.SideView valueBinding="Ficha.cardController.currentCard.back" placeholder="Back Side"}}
+
+ {{#view SC.Button target="Ficha.cardController" action="newCard"}}Create New Card{{/view}}
+ </script>
+ </body>
+ <script type="text/javascript" src="assets/bpm_libs.js"></script>
+ <script type="text/javascript" src="lib/main.js"></script>
+</html>
@@ -0,0 +1,35 @@
+var Ficha = SC.Application.create();
+
+Ficha.Card = SC.Object.extend({
+ front: null,
+ back: null,
+
+ ready: function () {
+ return this.get("front") && this.get("back");
+ }.property("front", "back")
+});
+
+Ficha.cardsController = SC.ArrayController.create();
+
+Ficha.cardController = SC.Object.create({
+ currentCard: null,
+
+ newCard: function () {
+ this.set("currentCard", Ficha.Card.create());
+ },
+
+ createCard: function () {
+ Ficha.cardsController.pushObject(this.get("currentCard"));
+ this.set("currentCard", null); // alternatively, invoke this.newCard()
+ }
+});
+
+Ficha.SideView = SC.TextField.extend({
+ insertNewline: function () {
+ var currentCard = Ficha.cardController.currentCard;
+
+ if (currentCard.get("ready")) {
+ Ficha.cardController.createCard();
+ }
+ }
+});

0 comments on commit de61765

Please sign in to comment.