This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
219c219,220 | |
< 'save': {method:'POST'}, | |
--- | |
> 'create': {method:'POST'}, | |
> 'update': {method:'PUT'}, | |
421a423,431 | |
> | |
> Resource.prototype.$save = function(a1, a2, a3) { | |
> if (this.id) { | |
> Resource.prototype.$update.call(this, a1, a2, a3); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DB.transaction do | |
rows_affected = DB[:cod_pro].returning.where({:CD_COD_PRO => cd_cod_pro}).update({:DS_CODIGO_COBRANCA => cd_unimed, | |
:DS_NOME_COBRANCA => descricao_unimed}) | |
puts "atualizou cd_cod_pro #{cd_cod_pro} #{ary.inspect} " | |
raise "sql update cod_pro errado " if rows_affected != 1 | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns bindboom | |
(:use [seesaw core table mig]) | |
(:require [seesaw.bind :as bind])) | |
(defn example | |
[] | |
(let [a (atom nil) | |
p (mig-panel | |
:constraints ["", "[left]"] | |
:items [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defr LikeButton | |
[component props state] | |
:get-initial-state #(identity {:liked true}) | |
[:p {:on-click #(swap! component update-in [:liked] not)} | |
"You " (if (:liked state) "liked" "not liked") " this. Click to toggle"] | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns app.crud | |
(:require | |
[om.core :as om :include-macros true] | |
[om.dom :as dom :include-macros true] | |
[ajax.core :refer [GET]] | |
[app.utils :refer [e-value]])) | |
(defn js-margin-right [] | |
#js {:margin-right "10px"}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn empresa-ficha [{:keys [id nome cnpj inscricao-estadual] :as empresa} _ {:keys [state-owner state-korks]}] | |
(let [get-state (partial om/get-state state-owner state-korks) | |
set-state! (partial om/set-state! state-owner state-korks)] | |
(reify | |
om/IRender | |
(render [_] | |
(dom/form | |
#js {:className "form form-condensed" | |
:role "form" | |
:style #js {:margin-top "10px"}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn concat-korks | |
[korks k2orks] | |
(if-not (sequential? korks) | |
(if-not (sequential? k2orks) | |
[korks k2orks] | |
(if (list? k2orks) | |
(conj k2orks korks) | |
(into [korks] k2orks))) | |
(if (list? korks) | |
(if-not (sequential? k2orks) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn concat-korks | |
"Takes two sequentials and concats them. Respects the type of the first sequential. | |
Favors vector in none is a sequential" | |
[korks k2orks] | |
(if-not (sequential? korks) | |
(if-not (sequential? k2orks) | |
[korks k2orks] | |
(if (list? k2orks) | |
(conj k2orks korks) | |
(into [korks] k2orks))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn edit-buttons [_ _ {:keys [ch>]}] | |
(reify | |
om/IRender | |
(render [_] | |
(dom/div #js {:className "form-group btn-group" | |
:style (js-margin-right)} | |
(dom/button #js {:className "btn btn-default" | |
:onClick (fn [e] | |
(.preventDefault e) | |
(put! ch> {:event e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defroutes rotas | |
#_(ANY "/empresa" [] | |
(resource | |
:available-media-types ["application/edn"] | |
:method-allowed? (request-method-in :get :post) | |
:handle-ok (fn [ctx] | |
(k/select ent/empresa (k/fields :id :nome))) | |
:post! (fn [ctx] | |
(let [empresa (read-edn-from-body ctx)] | |
{::result (insert-empresa empresa)})) |
OlderNewer