Skip to content

Commit

Permalink
Merge branch 'master' of github.com:aesmail/kaffy
Browse files Browse the repository at this point in the history
  • Loading branch information
aesmail committed Sep 9, 2023
2 parents 79bee2b + 78517f0 commit 3ada6e3
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,16 @@ defmodule MyApp.Blog.PostAdmin do
end
```

If you need to hide the "New <Schema>" button, you can define the `default_actions/1` function in your admin module:

```elixir
defmodule MyApp.Blog.PostAdmin do
def default_actions(_schema) do
# default actions are [:new, :edit, :delete] by default.
[:delete] # cannot create or edit posts, can only delete.
end
end
```

### Form Pages

Expand Down Expand Up @@ -519,6 +529,17 @@ def form_fields(_schema) do
]
```

If you don't want users to be able to edit or delete records, you can define the `default_actions/1` function in your admin module:

```elixir
defmodule MyApp.Blog.PostAdmin do
def default_actions(_schema) do
# default actions are [:new, :edit, :delete] by default.
[:new] # only create records, cannot edit or delete.
end
end
```

#### Association Forms

A `belongs_to` association should be referenced by the field name, *not* the association name. For example, a schema with the following association:
Expand Down

0 comments on commit 3ada6e3

Please sign in to comment.