-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
353d253
commit b26c7b6
Showing
43 changed files
with
1,557 additions
and
543 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,5 +14,5 @@ | |
|
||
.card-mindwendel { | ||
@extend .card; | ||
width: 394px; | ||
width: 285px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,6 +74,6 @@ | |
display: block; | ||
} | ||
|
||
.lightbulb-large { | ||
.icon-large { | ||
font-size: 5rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
defmodule Mindwendel.Brainstormings.Lane do | ||
use Mindwendel.Schema | ||
|
||
import Ecto.Changeset | ||
alias Mindwendel.Lanes | ||
alias Mindwendel.Brainstormings.Idea | ||
alias Mindwendel.Brainstormings.Brainstorming | ||
|
||
schema "lanes" do | ||
field :name, :string | ||
field :position_order, :integer | ||
belongs_to :brainstorming, Brainstorming, type: :binary_id | ||
has_many :ideas, Idea, preload_order: [asc: :position_order] | ||
|
||
timestamps() | ||
end | ||
|
||
@doc false | ||
def changeset(lane, attrs) do | ||
lane | ||
|> cast(attrs, [:name, :position_order, :brainstorming_id]) | ||
|> validate_required([:brainstorming_id]) | ||
|> add_position_order_if_missing() | ||
end | ||
|
||
defp add_position_order_if_missing(%Ecto.Changeset{changes: %{position_order: _}} = changeset) do | ||
changeset | ||
end | ||
|
||
defp add_position_order_if_missing( | ||
%Ecto.Changeset{ | ||
data: %Mindwendel.Brainstormings.Lane{ | ||
position_order: nil, | ||
brainstorming_id: brainstorming_id | ||
} | ||
} = changeset | ||
) do | ||
changeset | ||
|> put_change(:position_order, generate_position_order(brainstorming_id)) | ||
end | ||
|
||
defp add_position_order_if_missing(changeset) do | ||
changeset | ||
end | ||
|
||
defp generate_position_order(brainstorming_id) do | ||
max = Lanes.get_max_position_order(brainstorming_id) | ||
if max, do: max + 1, else: 1 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.