Skip to content

Commit

Permalink
Velg blant matvarespesifikke porsjonsstørrelser
Browse files Browse the repository at this point in the history
  • Loading branch information
magnars committed Oct 25, 2023
1 parent 7154f09 commit 0e1423f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/matvaretabellen/pages/food_page.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(ns matvaretabellen.pages.food-page
(:require [broch.core :as b]
[clojure.string :as str]
[datomic-type-extensions.api :as d]
[matvaretabellen.components.toc :refer [Toc]]
[matvaretabellen.crumbs :as crumbs]
Expand Down Expand Up @@ -106,7 +107,10 @@
[:div {:style {:margin-bottom 5}} [:i18n ::portion-size]]
[:select.select.form-field#portion-selector
[:option {:value "100"} "100 gram"]
[:option {:value "1000"} "1000 gram"]]]]
(for [portion (:food/portions food)]
(let [grams (int (b/num (:portion/quantity portion)))]
[:option {:value grams} (str "1 " (str/lower-case (:portion-kind/name (:portion/kind portion)))
" (" grams " gram)")]))]]]
[:div.container.container-narrow.text#naringsinnhold
[:h3.h3 [:i18n ::nutrition-heading]]
[:ul.subtle-list
Expand Down

0 comments on commit 0e1423f

Please sign in to comment.