diff --git a/README.md b/README.md index dbf36168..89acb9e9 100644 --- a/README.md +++ b/README.md @@ -454,6 +454,16 @@ defmodule MyApp.Blog.PostAdmin do end ``` +If you need to hide the "New " 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 @@ -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: