Permalink
Browse files

Initial load up

  • Loading branch information...
0 parents commit d098a7ced2803899b55690ece64d070a725370dd @subsonic subsonic committed Dec 20, 2012
BIN .DS_Store
Binary file not shown.
11 LICENSE
@@ -0,0 +1,11 @@
+New BSD License
+http://www.opensource.org/licenses/bsd-license.php
+Copyright (c) 2009, Rob Conery (robconery@gmail.com)
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+Neither the name of the SubSonic nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,37 @@
+# A Browser-based Shopping Cart, Powered by KnockoutJS
+
+Knockout Cart contains most of the shopping cart logic you'll need to power a simple store. [We use it at Tekpub](http://tekpub.com/gifts/new) to power our gift shopping experience - in fact that's where this is from.
+
+It stores the cart information in localStorage on your user's browser - so the cart experience is persisted from session to session (providing the same browser is used). In addition, there's a very simple discount apparatus that you can tweak as needed.
+
+## Security
+
+The first question that should be on your mind is "what about people monkeying with prices and discounts in localStorage" - and that's a very good concern.
+
+The simple answer is that this will post the cart information to your server in nested arrays - YOU will have to verify that the information is correct and valid before you post it off to the card processor.
+
+You should be doing this anyway :).
+
+## Tweaks
+
+This is a single file to play with as you need. I've included a templates page as well so you can pop the cart in wherever you like and work on it as you will. I'm sure there are some optimizations that can be made to make Knockout... less "Knockout-y" - but I find that if it works, it works.
+
+The template is just what we used and isn't supposed to be something you drop in and use. It's just here as an example to show how we've done the bindings.
+
+Also: **the styling is done by Twitter Bootstrap** so if it looks weird, that's why.
+
+It works for us and we've had no complaints, so far.
+
+## Install
+
+The cart needs KnockoutJS (2.x or greater) and jQuery. Make sure you have those, then pop cart.js into your scripts directory, reference it, and you're off and running.
+
+You can open a console to play with the cart if you like - it's namespaced under Tekpub.Cart.
+
+## Tests
+
+The Jasmine tests are under the "spec" directory. Just double click the file to run. I'll be adding more of them over time.
+
+## Help and Issues
+
+As always - if there's something you think could be done better, we're all ears. If you can provide a pull request - that's even better!
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <title>Jasmine Spec Runner</title>
+
+ <link rel="shortcut icon" type="image/png" href="lib/jasmine-1.3.0/jasmine_favicon.png">
+ <link rel="stylesheet" type="text/css" href="lib/jasmine-1.3.0/jasmine.css">
+ <script type="text/javascript" src="lib/jasmine-1.3.0/jasmine.js"></script>
+ <script type="text/javascript" src="lib/jasmine-1.3.0/jasmine-html.js"></script>
+
+ <!-- include source files here... -->
+ <script src="http://ajax.aspnetcdn.com/ajax/knockout/knockout-2.1.0.js"></script>
+ <script type="text/javascript" src="src/cart.js"></script>
+
+ <!-- include spec files here... -->
+ <script type="text/javascript" src="spec/SpecHelper.js"></script>
+ <script type="text/javascript" src="spec/cart_spec.js"></script>
+
+
+ <script type="text/javascript">
+ (function() {
+ var jasmineEnv = jasmine.getEnv();
+ jasmineEnv.updateInterval = 1000;
+
+ var htmlReporter = new jasmine.HtmlReporter();
+
+ jasmineEnv.addReporter(htmlReporter);
+
+ jasmineEnv.specFilter = function(spec) {
+ return htmlReporter.specFilter(spec);
+ };
+
+ var currentWindowOnload = window.onload;
+
+ window.onload = function() {
+ if (currentWindowOnload) {
+ currentWindowOnload();
+ }
+ execJasmine();
+ };
+
+ function execJasmine() {
+ jasmineEnv.execute();
+ }
+
+ })();
+ </script>
+
+</head>
+
+<body>
+</body>
+</html>
@@ -0,0 +1,20 @@
+Copyright (c) 2008-2011 Pivotal Labs
+
+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.
Oops, something went wrong.

0 comments on commit d098a7c

Please sign in to comment.