Skip to content

Commit

Permalink
pull de igor
Browse files Browse the repository at this point in the history
  • Loading branch information
interstar committed Jul 5, 2018
1 parent 0964413 commit 7660ff3
Show file tree
Hide file tree
Showing 16 changed files with 54 additions and 3 deletions.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified Procfile
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified project.clj
100644 → 100755
Empty file.
Empty file modified resources/public/index.html
100644 → 100755
Empty file.
Empty file modified src/clj/contascalangos/core.clj
100644 → 100755
Empty file.
Empty file modified src/clj/contascalangos/handler.clj
100644 → 100755
Empty file.
Empty file modified src/clj/contascalangos/server.clj
100644 → 100755
Empty file.
Empty file modified src/cljs/contascalangos/config.cljs
100644 → 100755
Empty file.
Empty file modified src/cljs/contascalangos/core.cljs
100644 → 100755
Empty file.
4 changes: 3 additions & 1 deletion src/cljs/contascalangos/db.cljs
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
(ns contascalangos.db)

(def default-db
{:name "re-frame"})
{:name "re-frame"
:tmp-val ""
:orcamento '(100 -20 120 -30 -40 -15 20)})
17 changes: 17 additions & 0 deletions src/cljs/contascalangos/events.cljs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,20 @@
::set-active-panel
(fn-traced [db [_ active-panel]]
(assoc db :active-panel active-panel)))

(re-frame/reg-event-db
:adicionar
(fn [coeffects event]
(let [db (:db coeffects)
novo-valor (:tmp-nova db)
itens (:orcamento db)]
{:db (assoc db :orcamento (cons novo-valor itens))}
)
))

(re-frame/reg-event-db
:tmp-nova
(fn [coeffects event]
(let [db (:db coeffects)]
{:db (assoc db :tmp-nova (second event))}
)) )
Empty file modified src/cljs/contascalangos/routes.cljs
100644 → 100755
Empty file.
9 changes: 9 additions & 0 deletions src/cljs/contascalangos/subs.cljs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@
(fn [db]
(:name db)))

(re-frame/reg-sub
::orc
(fn [db] (:orcamento db))
)

(re-frame/reg-sub
::active-panel
(fn [db _]
(:active-panel db)))

(re-frame/reg-sub
::tmp-nova
(fn [db] (:tmp-nova db)))
27 changes: 25 additions & 2 deletions src/cljs/contascalangos/views.cljs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,42 @@
(:require
[re-frame.core :as re-frame]
[contascalangos.subs :as subs]
[reagent.core :as r]
))


;; home

(defn home-panel []
(let [name (re-frame/subscribe [::subs/name])]
(let [name (re-frame/subscribe [::subs/name])
orcamento (re-frame/subscribe [::subs/orc])
nova (re-frame/subscribe [::subs/tmp-nova])]
[:div
[:h1 (str "Hello from " @name ". This is the Home Page.")]
[:h1 (str "Olá Calangos do " @name)]

[:div
[:ul
(for [item @orcamento] [:li item])
]
]

[:div (apply + @orcamento)]

[:div
[:input {:type "text"
:value @nova
:on-change #(re-frame/dispatch [:tmp-nova (-> % .-target .-value)] )
}]

[:button {:on-click #(re-frame/dispatch [:adicionar ])} "Adicionar" ]

]


[:div
[:a {:href "#/about"}
"go to About Page"]]

]))


Expand Down

0 comments on commit 7660ff3

Please sign in to comment.