Skip to content

Commit

Permalink
chore: fix cheatsheets docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Jan 2, 2024
1 parent 9639af9 commit 48b8ca0
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 136 deletions.
32 changes: 0 additions & 32 deletions documentation/dsls/DSL:-AshAdmin.Api.cheatmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,6 @@ This file was generated by Spark. Do not edit it by hand.

An API extension to alter the behavior of an API in the admin UI.

Table of Contents:
* admin

DSL Docs:

## admin

Configure the admin dashboard for a given API.







---

* `:name` (`t:String.t/0`) - The name of the API in the dashboard. Will be derived if not set.

* `:show?` (`t:boolean/0`) - Whether or not this API and its resources should be included in the admin dashboard. The default value is `false`.

* `:default_resource_page` - Set the default page for the resource to be the primary read action or the resource schema. Schema is the default for backwards compatibility, if a resource doesn't have a primary read action it will fallback to the schema view. Valid values are :schema, :primary_read The default value is `:schema`.

* `:resource_group_labels` (`t:keyword/0`) - Humanized names for each resource group to appear in the admin area. These will be used as labels in the top navigation dropdown. If a key for a group does not appear in this mapping, the label will not be rendered. The default value is `[]`.









## admin
Configure the admin dashboard for a given API.
Expand Down
87 changes: 0 additions & 87 deletions documentation/dsls/DSL:-AshAdmin.Resource.cheatmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,93 +5,6 @@ This file was generated by Spark. Do not edit it by hand.

An API extension to alter the behaviour of a resource in the admin UI.

Table of Contents:
* admin
* form
* field

DSL Docs:

## admin

Configure the admin dashboard for a given resource.

* [form](#module-form)
* field





---

* `:name` (`t:String.t/0`) - The proper name to use when this resource appears in the admin interface.

* `:actor?` (`t:boolean/0`) - Whether or not this resource can be used as the actor for requests.

* `:show_action` (`t:atom/0`) - The action to use when linking to the resource/viewing a single record. Defaults to the primary read action.

* `:read_actions` (list of `t:atom/0`) - A list of read actions that can be used to show resource details. By default, all actions are included.

* `:create_actions` (list of `t:atom/0`) - A list of create actions that can create records. By default, all actions are included.

* `:update_actions` (list of `t:atom/0`) - A list of update actions that can be used to update records. By default, all actions are included.

* `:destroy_actions` (list of `t:atom/0`) - A list of destroy actions that can be used to destroy records. By default, all actions are included.

* `:polymorphic_tables` (list of `t:String.t/0`) - For resources that use ash_postgres' polymorphism capabilities, you can provide a list of tables that should be available to
select. These will be added to the list of derivable tables based on scanning all APIs and resources provided to ash_admin.

* `:polymorphic_actions` (list of `t:atom/0`) - For resources that use ash_postgres' polymorphism capabilities, you can provide a list of actions that should require a table to be set.
If this is not set, then *all* actions will require tables.

* `:table_columns` (list of `t:atom/0`) - The list of attributes to render on the table view.

* `:format_fields` (list of `t:term/0`) - The list of fields and their formats.

* `:relationship_display_fields` (list of `t:atom/0`) - The list of attributes to render when it's shown as a relationship on a datatable

* `:resource_group` (`t:atom/0`) - The group in the top resource dropdown that the resource appears in.





### form

Configure the appearance of fields in admin forms.

* [field](#module-field)





---



#### field

Declare non-default behavior for a specific attribute.





* `:name` (`t:atom/0`) - Required. The name of the field to be modified

* `:type` - Required. The type of the value in the form. Use `default` if you are just specifying field order Valid values are :default, :long_text, :short_text, :markdown











## admin
Configure the admin dashboard for a given resource.
Expand Down
7 changes: 0 additions & 7 deletions lib/ash_admin/api.ex
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ defmodule AshAdmin.Api do

@moduledoc """
An API extension to alter the behavior of an API in the admin UI.
Table of Contents:
#{Spark.Dsl.Extension.doc_index([@admin])}
DSL Docs:
#{Spark.Dsl.Extension.doc([@admin])}
"""

def name(api) do
Expand Down
7 changes: 0 additions & 7 deletions lib/ash_admin/resource/resource.ex
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,6 @@ defmodule AshAdmin.Resource do

@moduledoc """
An API extension to alter the behaviour of a resource in the admin UI.
Table of Contents:
#{Spark.Dsl.Extension.doc_index([@admin])}
DSL Docs:
#{Spark.Dsl.Extension.doc([@admin])}
"""

def polymorphic?(resource, apis) do
Expand Down
56 changes: 53 additions & 3 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,59 @@ defmodule AshAdmin.MixProject do
main: "readme",
source_ref: "v#{@version}",
logo: "logos/small-logo.png",
extras: [
"README.md"
]
extras: ["README.md"] ++ extras(),
groups_for_extras: groups_for_extras()
]
end

defp extras do
# Sorting can be done adding numbers at the begining of filenames
"documentation/**/*.{md,livemd,cheatmd}"
|> Path.wildcard()
|> Enum.map(fn path ->
html_filename =
path
|> Path.basename(".md")
|> Path.basename(".livemd")
|> Path.basename(".cheatmd")

title =
html_filename
|> String.split(~r/[-_]/)
|> Enum.map_join(" ", &capitalize/1)
|> case do
"F A Q" ->
"FAQ"

other ->
other
end

{String.to_atom(path),
[
title: title,
default: title == "Get Started"
]}
end)
end

defp capitalize(string) do
string
|> String.split(" ")
|> Enum.map(fn string ->
[hd | tail] = String.graphemes(string)
String.capitalize(hd) <> Enum.join(tail)
end)
end

defp groups_for_extras do
[
Tutorials: [
~r'documentation/tutorials'
],
"How To": ~r'documentation/how_to',
Topics: ~r'documentation/topics',
DSLs: ~r'documentation/dsls'
]
end

Expand Down

0 comments on commit 48b8ca0

Please sign in to comment.