package sihl
The modular functional web framework
Install
Dune Dependency
Authors
Maintainers
Sources
sihl-queue-0.1.9.tbz
sha256=77f0813d75a88edd14b3396e8b848d94c31c28803299b4b1bd4b78b1de4a2e80
sha512=a8907bc35ea14b7c3a7d638979a2a274860202b2de58b84b5621a4908db001ace493d8aa2e5383f4c8b1847efd256938592f63ef75a41521284b3640d3a7442a
doc/src/sihl.database/view.ml.html
Source file view.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
module Repository = Sihl_repository module PartialCollection = struct type controls = { first : Ql.Page.t option ; previous : Ql.Page.t option ; next : Ql.Page.t option ; last : Ql.Page.t option } [@@deriving show, eq, fields, yojson] type 'a t = { member : 'a list ; total_items : int ; controls : controls } [@@deriving show, eq, fields, yojson] let controls_of_pagination page total_items = let limit = Ql.Page.get_limit page in let offset = Ql.Page.get_offset page in let limit = Option.value ~default:25 limit in let offset = Option.value ~default:0 offset in let first = if offset <= 0 then None else Some (Ql.Page.set_offset 0 page) in let previous = if offset - limit >= 0 then Some (Ql.Page.set_offset (offset - limit) page) else None in let next = if offset + limit < total_items then Some (Ql.Page.set_offset (offset + limit) page) else None in let last = if offset < total_items - limit then Some (Ql.Page.set_offset (total_items - 1) page) else None in { first; previous; next; last } ;; let create ~page ~meta items = let total_items = Repository.Meta.total meta in let controls = controls_of_pagination page total_items in { member = items; total_items; controls } ;; end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>