Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds method to set an AST on a page #379

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions lib/beacon/content.ex
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,21 @@
end
end

@doc """
Sets the template of a page based the given `ast`.

## Example

iex> set_page_ast(page, ast)
{:ok, %Page{}}

"""
@doc type: :pages
@spec set_page_ast(Page.t(), map()) :: {:ok, Page.t()} | {:error, Changeset.t()}

Check warning on line 517 in lib/beacon/content.ex

View workflow job for this annotation

GitHub Actions / quality: OTP 26 | Elixir 1.15 | Phoenix ~> 1.7 | LiveView ~> 0.20

invalid_contract

Invalid type specification for function set_page_ast.
def set_page_ast(%Page{} = page, ast) do
Map.put(page, :template, HEExDecoder.decode(ast))
end

@doc """
Updates a page.

Expand Down
Loading