Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial commit, need to remove the .#calc file

  • Loading branch information...
commit 1b237d037956383420a9bc1c5cdeddd4ce500171 0 parents
@fvisser authored
13 README
@@ -0,0 +1,13 @@
+# turbid
+
+FIXME: write description
+
+## Usage
+
+FIXME: write
+
+## License
+
+Copyright (C) 2010 FIXME
+
+Distributed under the Eclipse Public License, the same as Clojure.
11 project.clj
@@ -0,0 +1,11 @@
+(defproject turbid "1.0.0-SNAPSHOT"
+ :description "turbid sample webapp"
+ :dependencies [[org.clojure/clojure "1.2.0"]
+ [org.clojure/clojure-contrib "1.2.0"]
+ [compojure "0.5.2"]
+ [hiccup "0.3.1"]]
+ :dev-dependencies [[lein-ring "0.2.4"]
+ [swank-clojure "1.2.1"]]
+ :ring {:handler turbid.core/handler})
+
+
1  src/turbid/.#calc.clj
15 src/turbid/account.clj
@@ -0,0 +1,15 @@
+(ns turbid.account)
+
+;; three types, asset, liability, equity.
+;; double entry: equity = assets - liabilities
+(defrecord Account [name, type, category])
+
+(defn new-asset-account [name category]
+ "Constructor for an asset"
+ (Account. name "asset" category))
+
+(defn new-liability-account [name category]
+ (Account. name "liability" category))
+
+(defn new-equity-account [name category]
+ (Account. name "equity" category))
3  src/turbid/calc.clj
@@ -0,0 +1,3 @@
+(ns turbid.calc
+ (:require [turbid.transaction :as transaction]
+ [turbid.account :as account]))
33 src/turbid/core.clj
@@ -0,0 +1,33 @@
+(ns turbid.core
+ (:use
+ compojure.core,
+ ring.adapter.jetty,
+ hiccup.core)
+ (:require
+ [hiccup.page-helpers :as page]
+ [hiccup.form-helpers :as form]
+ [compojure.route :as route]))
+
+(defn display [] (html [:h1 "Hello World"] ))
+
+(defn display2 [& name] (html [:h1 "Hello " (h (first name))]))
+
+(defn show-form [] (html
+ (doctype :html5)
+ [:header [:title "Form submit"]]
+ [:body
+ [:h1 "Simple username form"]
+ [:div.form
+ (form/form-to [:POST "/form"]
+ (form/label :name "Name: ")
+ (form/text-field {:size "25"} :name))]]))
+
+(defn display-result []
+ (html
+ [:body [:h1 "Nothing here yet"]]))
+
+(defroutes handler
+ (GET "/" [] (display ))
+ (GET "/user/:id" [id] (display2 id))
+ (GET "/form" [] (show-form ))
+ (route/not-found "<h1>Page not found</h1>"))
9 src/turbid/transaction.clj
@@ -0,0 +1,9 @@
+(ns turbid.transaction)
+
+;; defines a financial transaction.
+(defrecord Transaction [amount, date, description, debitAccount, creditAccount])
+
+(defn new-transaction [amount date description debitAccount creditAccount]
+ "constructor for transaction"
+ (Transaction. amount date description debitAccount creditAccount))
+
9 src/turbid/transactions.clj
@@ -0,0 +1,9 @@
+(ns turbid.transaction)
+
+
+(defrecord Transaction [amount, date, description, debitAccount, creditAccount])
+
+(defn transaction [amount date description debitAccount creditAccount]
+ "constructor for transaction"
+ (Transaction. amount date description debitAccount creditAccount))
+
6 test/turbid/test/core.clj
@@ -0,0 +1,6 @@
+(ns turbid.test.core
+ (:use [turbid.core] :reload)
+ (:use [clojure.test]))
+
+(deftest replace-me ;; FIXME: write
+ (is false "No tests have been written."))
Please sign in to comment.
Something went wrong with that request. Please try again.