From f38db1b2bb72efde83d9641dafb3e4165354d96b Mon Sep 17 00:00:00 2001 From: Finn Espen Gundersen Date: Tue, 6 Oct 2020 19:40:19 +0200 Subject: [PATCH] a few doc clarifications/additions --- Guide/editors.markdown | 6 ++++++ Guide/form.markdown | 6 ++++++ Guide/querybuilder.markdown | 31 +++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/Guide/editors.markdown b/Guide/editors.markdown index e9685ff1f..1cb4ce74c 100644 --- a/Guide/editors.markdown +++ b/Guide/editors.markdown @@ -13,6 +13,12 @@ When using VSCode you need to install a plugin which loads the `.envrc` in your Most likely you want to use [haskell-language-server](/~https://github.com/haskell/haskell-language-server) for smart IDE features like autocompletion and jump-to-symbol. This is not working with IHP yet. [There is an active issue to implement support for this.](/~https://github.com/digitallyinduced/ihp/issues/190) + +## Using VSCode on Windows with Windows Subsystem for Linux + +It is important to not access the files within the WSL from Windows itself (however, the other way around is ok). You can seamlessly (including autosave) work on your projects within WSL from VS Code in Windows by adding the `Remote WSL` extension from Microsoft. + + ## Using IHP with Sublime Text Works great already out of the box. diff --git a/Guide/form.markdown b/Guide/form.markdown index 2b6a75e31..c923cd6d2 100644 --- a/Guide/form.markdown +++ b/Guide/form.markdown @@ -445,6 +445,12 @@ This way no special behavior will be attached to your forms. To dig deeper into the javascript, [take a look at the source in helpers.js](/~https://github.com/digitallyinduced/ihp/blob/master/lib/IHP/static/helpers.js#L115). + +## Working within the Bootstrap CSS framework + +While the default forms layout is vertical with one field per line, it is easy to change. Bootstrap's excellent [forms documentation](https://getbootstrap.com/docs/4.4/components/forms/) shows how. + + ## Working with other CSS Frameworks TODO: This section still has to be implemented. The gist of how rendering can be completely overriden to support a different layout or CSS framework can be found in the implementation of [horizontalFormFor](https://ihp.digitallyinduced.com/api-docs/IHP-View-Form.html#v:horizontalFormFor) (renders a bootstrap 4 form in a horizontal way). diff --git a/Guide/querybuilder.markdown b/Guide/querybuilder.markdown index b796523b6..050540d47 100644 --- a/Guide/querybuilder.markdown +++ b/Guide/querybuilder.markdown @@ -80,6 +80,37 @@ projects <- query @Project -- Query: `SELECT * FROM projects ORDER BY created_at` ``` +Nested orderBys work as expected: +```haskell +projects <- query @Employee + |> orderBy #lastname + |> orderBy #firstname + |> fetch +-- Query: `SELECT * FROM employees ORDER BY lastname, firstname` +``` + +## Limit + +To limit the number of rows returned: +```haskell +projects <- query @Project + |> limit 10 + |> fetch +-- Query: `SELECT * FROM projects LIMIT 10` +``` + +## Offset + +To skip a number of rows: +```haskell +projects <- query @Project + |> offset 10 + |> fetch +-- Query: `SELECT * FROM projects OFFSET 10` +``` +Offset is most often used together with limit to implement paging. + + ## Or ```haskell