mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
validate commission base price to be present, example image in directory listing to be present
This commit is contained in:
parent
4c0b440f58
commit
18e932560d
2 changed files with 3 additions and 3 deletions
|
@ -21,7 +21,7 @@ defmodule Philomena.Commissions.Item do
|
|||
def changeset(item, attrs) do
|
||||
item
|
||||
|> cast(attrs, [:item_type, :description, :base_price, :add_ons, :example_image_id])
|
||||
|> validate_required([:commission_id, :item_type, :description])
|
||||
|> validate_required([:commission_id, :base_price, :item_type, :description])
|
||||
|> validate_length(:description, max: 300, count: :bytes)
|
||||
|> validate_length(:add_ons, max: 500, count: :bytes)
|
||||
|> validate_number(:base_price, greater_than_or_equal_to: 0, less_than_or_equal_to: 500)
|
||||
|
|
|
@ -53,7 +53,7 @@ elixir:
|
|||
|
||||
br
|
||||
|
||||
= for item <- Enum.take_random(c.items, 5) do
|
||||
= for item <- Enum.take_random(c.items, 5), not is_nil(item.example_image) do
|
||||
= render PhilomenaWeb.ImageView, "_image_container.html", image: item.example_image, size: :thumb_small, conn: @conn
|
||||
|
||||
p
|
||||
|
|
Loading…
Reference in a new issue