-
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.
feature: show caption for labels #273
- Loading branch information
1 parent
44f87ad
commit 12928e3
Showing
5 changed files
with
47 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
defmodule MindwendelWeb.LabelLive.CaptionsComponent do | ||
use MindwendelWeb, :live_component | ||
end |
14 changes: 14 additions & 0 deletions
14
lib/mindwendel_web/live/label_live/captions_component.html.heex
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,14 @@ | ||
<div class="d-flex flex-row justify-content-end"> | ||
<%= for brainstorming_idea_label <- @brainstorming.labels do %> | ||
<div class="m-1"> | ||
<span | ||
class="badge rounded-pill" | ||
id={"idea-label-#{uuid()}"} | ||
data-color={brainstorming_idea_label.color} | ||
phx-hook="SetIdeaLabelBackgroundColor" | ||
> | ||
<%= brainstorming_idea_label.name %> | ||
</span> | ||
</div> | ||
<% end %> | ||
</div> |
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,24 @@ | ||
defmodule MindwendelWeb.LabelLive.CaptionsTest do | ||
alias MindwendelWeb.LabelLive.CaptionsComponent | ||
use MindwendelWeb.ConnCase | ||
import Phoenix.LiveViewTest | ||
|
||
alias Mindwendel.Factory | ||
|
||
setup do | ||
%{brainstorming: Factory.insert!(:brainstorming)} | ||
end | ||
|
||
test "captions contain all labels", %{ | ||
brainstorming: brainstorming | ||
} do | ||
captions_component = render_component(CaptionsComponent, brainstorming: brainstorming) | ||
|
||
# make sure that there is at least one label in the list: | ||
assert Enum.count(brainstorming.labels) > 0 | ||
|
||
Enum.each(brainstorming.labels, fn label -> | ||
assert captions_component =~ label.name | ||
end) | ||
end | ||
end |