mirror of
https://github.com/ash-project/ash_hq.git
synced 2024-09-19 12:53:49 +12:00
improvement: show code snippets on mobile
improvement: hide fields that are auto-set
This commit is contained in:
parent
be531f75b0
commit
e03114c1e9
4 changed files with 8 additions and 2 deletions
|
@ -24,6 +24,7 @@ COPY ./mix.exs .
|
|||
COPY ./mix.lock .
|
||||
COPY ./config/config.exs config/config.exs
|
||||
COPY ./config/prod.exs config/prod.exs
|
||||
COPY ./assets/tailwind.colors.json ./assets/tailwind.colors.json
|
||||
RUN mix deps.get && \
|
||||
mix deps.compile
|
||||
COPY ./lib ./lib
|
||||
|
|
|
@ -9,6 +9,7 @@ defmodule AshHq.Docs.Search.Steps.BuildResults do
|
|||
input[:results]
|
||||
|> Kernel.||([])
|
||||
|> List.flatten()
|
||||
|> Enum.reject(&is_nil/1)
|
||||
|> Enum.sort_by(
|
||||
# false comes first, and we want all things where the name matches to go first
|
||||
&{name_match_rank(&1), -&1.match_rank, Map.get(&1, :extension_order, -1),
|
||||
|
|
|
@ -284,7 +284,7 @@ defmodule AshHqWeb.Pages.Home do
|
|||
</p>
|
||||
</div>
|
||||
|
||||
<div class="pt-6 pb-6 w-full max-w-6xl hidden sm:block">
|
||||
<div class="pt-6 pb-6 w-full max-w-6xl">
|
||||
<div class="flex flex-col lg:flex-row gap-10 mx-8 lg:mx-0">
|
||||
<CodeExample
|
||||
id="define-a-resource"
|
||||
|
|
|
@ -142,6 +142,10 @@ defmodule Utils do
|
|||
entities
|
||||
|> Enum.with_index()
|
||||
|> Enum.flat_map(fn {entity, index} ->
|
||||
keys_to_remove =
|
||||
Enum.map(entity.auto_set_fields || [], &elem(&1, 0))
|
||||
|
||||
option_schema = Keyword.drop(entity.schema || [], keys_to_remove)
|
||||
[
|
||||
%{
|
||||
name: entity.name,
|
||||
|
@ -153,7 +157,7 @@ defmodule Utils do
|
|||
args: entity.args,
|
||||
type: :entity,
|
||||
path: path,
|
||||
options: add_argument_indices(schema(entity.schema, path ++ [entity.name]), entity.args)
|
||||
options: add_argument_indices(schema(option_schema, path ++ [entity.name]), entity.args)
|
||||
}
|
||||
] ++ build_entities(List.flatten(Keyword.values(entity.entities)), path ++ [entity.name])
|
||||
end)
|
||||
|
|
Loading…
Reference in a new issue