View Source Claper.Forms (Claper v1.7.0)

The Forms context.

Link to this section Summary

Functions

Add an empty form field to a form changeset.

Returns an %Ecto.Changeset{} for tracking form changes.

Returns an %Ecto.Changeset{} for tracking form submit changes.

Creates a form.

Creates a form submit.

Creates or update a FormSubmit.

Deletes a form submit.

Gets a single form.

Gets a single form for a given position.

Gets a single FormSubmit.

Gets a single FormSubmit by its ID.

Returns the list of form submissions for a given presentation file.

Returns the list of forms for a given presentation file.

Returns the list of forms for a given presentation file and a given position.

Remove a form field from a form changeset.

Link to this section Functions

Link to this function

add_form_field(changeset)

View Source

Add an empty form field to a form changeset.

Link to this function

change_form(form, attrs \\ %{})

View Source

Returns an %Ecto.Changeset{} for tracking form changes.

examples

Examples

iex> change_form(form)
%Ecto.Changeset{data: %Form{}}
Link to this function

change_form_submit(form_submit, attrs \\ %{})

View Source

Returns an %Ecto.Changeset{} for tracking form submit changes.

examples

Examples

iex> change_form_submit(form_submit)
%Ecto.Changeset{data: %FormSubmit{}}
Link to this function

create_form(attrs \\ %{})

View Source

Creates a form.

examples

Examples

iex> create_form(%{field: value})
{:ok, %Form{}}

iex> create_form(%{field: bad_value})
{:error, %Ecto.Changeset{}}
Link to this function

create_form_submit(attrs \\ %{})

View Source

Creates a form submit.

examples

Examples

iex> create_form_submit(%{field: value})
{:ok, %FormSubmit{}}

iex> create_form_submit(%{field: bad_value})
{:error, %Ecto.Changeset{}}
Link to this function

create_or_update_form_submit(event_uuid, attrs)

View Source

Creates or update a FormSubmit.

examples

Examples

iex> create_or_update_form_submit(%{field: value})
{:ok, %FormSubmit{}}

iex> create_or_update_form_submit(%{field: bad_value})
{:error, %Ecto.Changeset{}}
Link to this function

create_or_update_form_submit(fs, event_uuid, attrs)

View Source
Link to this function

delete_form(event_uuid, form)

View Source

Deletes a form.

examples

Examples

iex> delete_form("123e4567-e89b-12d3-a456-426614174000", form)
{:ok, %Form{}}

iex> delete_form("123e4567-e89b-12d3-a456-426614174000", form)
{:error, %Ecto.Changeset{}}
Link to this function

delete_form_submit(event_uuid, fs)

View Source

Deletes a form submit.

examples

Examples

iex> delete_form_submit(post, event_id)
{:ok, %FormSubmit{}}

iex> delete_form_submit(post, event_id)
{:error, %Ecto.Changeset{}}
Link to this function

disable_all(presentation_file_id, position)

View Source
Link to this function

get_form!(id, preload \\ [])

View Source

Gets a single form.

Raises Ecto.NoResultsError if the Form does not exist.

examples

Examples

iex> get_form!(123)
%Poll{}

iex> get_form!(456)
** (Ecto.NoResultsError)
Link to this function

get_form_current_position(presentation_file_id, position)

View Source

Gets a single form for a given position.

examples

Examples

iex> get_form!(123, 0)
%Form{}
Link to this function

get_form_submit(user_id, form_id)

View Source

Gets a single FormSubmit.

examples

Examples

iex> get_form_submit!(321, 123)
%FormSubmit{}
Link to this function

get_form_submit_by_id!(id, preload \\ [])

View Source

Gets a single FormSubmit by its ID.

Raises Ecto.NoResultsError if the FormSubmit does not exist.

examples

Examples

iex> get_form_submit_by_id!("123e4567-e89b-12d3-a456-426614174000")
%Post{}

iex> get_form_submit_by_id!("123e4567-e89b-12d3-a456-426614174123")
** (Ecto.NoResultsError)
Link to this function

list_form_submits(presentation_file_id)

View Source

Returns the list of form submissions for a given presentation file.

examples

Examples

iex> list_form_submits(123)
[%FormSubmit{}, ...]
Link to this function

list_forms(presentation_file_id)

View Source

Returns the list of forms for a given presentation file.

examples

Examples

iex> list_forms(123)
[%Form{}, ...]
Link to this function

list_forms_at_position(presentation_file_id, position)

View Source

Returns the list of forms for a given presentation file and a given position.

examples

Examples

iex> list_forms_at_position(123, 0)
[%Form{}, ...]
Link to this function

remove_form_field(changeset, field)

View Source

Remove a form field from a form changeset.

Link to this function

set_status(id, presentation_file_id, position, status)

View Source
Link to this function

update_form(event_uuid, form, attrs)

View Source

Updates a form.

examples

Examples

iex> update_form("123e4567-e89b-12d3-a456-426614174000", form, %{field: new_value})
{:ok, %Form{}}

iex> update_form("123e4567-e89b-12d3-a456-426614174000", form, %{field: bad_value})
{:error, %Ecto.Changeset{}}