Skip to content

Commit

Permalink
https://github.com/bonfire-networks/bonfire-app/issues/1078
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanminutillo committed Nov 19, 2024
1 parent 6fc3645 commit 36ca9b8
Show file tree
Hide file tree
Showing 31 changed files with 327 additions and 474 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Bonfire.UiBoundaries
# Bonfire.UI.Boundaries

A template for creating custom extensions for [Bonfire](https://bonfire.cafe/)

Expand All @@ -10,7 +10,7 @@ git clone https://github.com/bonfire-networks/bonfire_ui_boundaries.git {your-ex
cd {your-extension-name-here}
```
- Rename all the modules names to match your extension name:
- Find & replace Bonfire.UiBoundaries -> Bonfire.YourExtensionName
- Find & replace Bonfire.UI.Boundaries -> Bonfire.YourExtensionName
- Find & replace bonfire_ui_boundaries -> bonfire_your_extension_name
- Rename the `bonfire_ui_boundaries.exs` config file to match your extension name `bonfire_your_extension_name.exs`
- Add paths to the router if you need it. If you add paths you will need to include the route module on [bonfire-app router module](https://github.com/bonfire-networks/bonfire-app/blob/main/lib/web/router.ex#L51)
Expand All @@ -32,7 +32,7 @@ cd {your-extension-name-here}
git push -u origin main
```
- Add the extension on your bonfire deps.path to include it in your local development
- Add `use_if_enabled(Bonfire.UiBoundaries.Web.Routes)` in your app's `Router` module
- Add `use_if_enabled(Bonfire.UI.Boundaries.Web.Routes)` in your app's `Router` module
- Add the extension on deps.git also (specifying the branch name) to allow others that do not have it in their fork to use it
- Write a meaningful readme
- TADA 🔥!
Expand All @@ -52,8 +52,8 @@ declare_extension(
"ExtensionTemplate",
icon: "bi:app",
default_nav: [
Bonfire.UiBoundaries.Web.HomeLive,
Bonfire.UiBoundaries.Web.AboutLive
Bonfire.UI.Boundaries.Web.HomeLive,
Bonfire.UI.Boundaries.Web.AboutLive
])
```
Expand Down
5 changes: 4 additions & 1 deletion config/bonfire_ui_boundaries.exs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import Config

#### Extension-specific compile-time configuration goes here, everything else should be in `Bonfire.UiBoundaries.RuntimeConfig`
#### Extension-specific compile-time configuration goes here, everything else should be in `Bonfire.UI.Boundaries.RuntimeConfig`

config :bonfire_ui_boundaries,
endpoint_module: Bonfire.Web.Endpoint
2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Config

#### General configuration useful for tests, everything else should be in `bonfire_ui_boundaries.exs` or `Bonfire.UiBoundaries.RuntimeConfig`
#### General configuration useful for tests, everything else should be in `bonfire_ui_boundaries.exs` or `Bonfire.UI.Boundaries.RuntimeConfig`

# You probably won't want to touch these. You might override some in
# other config files.
Expand Down
2 changes: 1 addition & 1 deletion config/runtime.exs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import Config

Bonfire.UiBoundaries.RuntimeConfig.config()
Bonfire.UI.Boundaries.RuntimeConfig.config()
2 changes: 1 addition & 1 deletion lib/fake.ex
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
defmodule Bonfire.UiBoundaries.Fake do
defmodule Bonfire.UI.Boundaries.Fake do
end
2 changes: 1 addition & 1 deletion lib/integration.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Bonfire.UiBoundaries do
defmodule Bonfire.UI.Boundaries do
@moduledoc "./README.md" |> File.stream!() |> Enum.drop(1) |> Enum.join()

alias Bonfire.Common.Config
Expand Down
2 changes: 1 addition & 1 deletion lib/migrations.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Bonfire.UiBoundaries.Migrations do
defmodule Bonfire.UI.Boundaries.Migrations do
@moduledoc false
use Ecto.Migration
end
2 changes: 1 addition & 1 deletion lib/runtime_config.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Bonfire.UiBoundaries.RuntimeConfig do
defmodule Bonfire.UI.Boundaries.RuntimeConfig do
use Bonfire.Common.Localise

@behaviour Bonfire.Common.ConfigModule
Expand Down
8 changes: 2 additions & 6 deletions lib/web/components/acls/acl_live.sface
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,9 @@
{l("Remove")}
</button>
<:open_btn>
<button
type="button"
data-role="remove_from_boundary_modal"
class="btn-outline btn-xs btn btn-circle"
>
<div data-role="remove_from_boundary_modal" class="btn-outline btn-xs btn btn-circle">
<#Icon iconify="ic:baseline-minus" class="w-4 h-4" />
</button>
</div>
</:open_btn>
</Bonfire.UI.Common.OpenModalLive>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@
</section>

<:open_btn>
<button type="button" class="btn btn-neutral btn-sm">
{l("Edit")}</button>
<div class="btn btn-neutral btn-sm">
{l("Edit")}</div>
</:open_btn>
</Bonfire.UI.Common.OpenModalLive>
</div>
2 changes: 1 addition & 1 deletion lib/web/components/acls/edit_acl_live.sface
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
{l("Remove")}
</button>
<:open_btn>
<button type="button" data-role="remove_from_boundary_modal" class="text-base-content">{l("Remove")}</button>
<div data-role="remove_from_boundary_modal" class="text-base-content">{l("Remove")}</div>
</:open_btn>
</Bonfire.UI.Common.OpenModalLive>
</li>
Expand Down
8 changes: 4 additions & 4 deletions lib/web/components/circles/circle_live.sface
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@

<button type="submit" class="w-full mt-3 normal-case btn btn-primary">{l("Save")}</button>
<:open_btn>
<button type="button" class="btn btn-neutral h-10 min-h-10">
{l("Edit circle")}</button>
<div class="btn btn-neutral h-10 min-h-10">
{l("Edit circle")}</div>
</:open_btn>
</Bonfire.UI.Common.OpenModalLive>
</div>
Expand All @@ -70,8 +70,8 @@
)}</p>
</div>
<:open_btn>
<button type="button" class="btn btn-error btn-circle h-10 min-h-10 max-w-10"><#Icon iconify="ph:trash-fill" class="w-4 h-4" />
<span class="sr-only">{l("Delete circle")}</span></button>
<div class="btn btn-error btn-circle h-10 min-h-10 max-w-10"><#Icon iconify="ph:trash-fill" class="w-4 h-4" />
<span class="sr-only">{l("Delete circle")}</span></div>
</:open_btn>
<:action_btns>
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
</div> --}
<button type="submit" class="w-full mt-3 normal-case btn btn-primary">{l("Save")}</button>
<:open_btn>
<button type="button" class="">{l("Edit name")}</button>
<div class="">{l("Edit name")}</div>
</:open_btn>
</Bonfire.UI.Common.OpenModalLive>
</li>
Expand All @@ -118,7 +118,7 @@
)}</p>
</div>
<:open_btn>
<button type="button" class="text-error">{l("Delete circle")}</button>
<div class="text-error">{l("Delete circle")}</div>
</:open_btn>
<:action_btns>
<button
Expand Down
2 changes: 1 addition & 1 deletion lib/web/components/display/boundary_details_live.sface
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
{l("Remove")}
</button>
<:open_btn>
<button type="button" data-role="remove_from_boundary_modal" class="text-base-content">{l("Remove")}</button>
<div data-role="remove_from_boundary_modal" class="text-base-content">{l("Remove")}</div>
</:open_btn>
</Bonfire.UI.Common.OpenModalLive>
</li>
Expand Down
4 changes: 2 additions & 2 deletions lib/web/components/display/boundary_icon_stateless_live.sface
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
/>
</div>
<:open_btn>
<button type="button" class={@class}>
<div class={@class}>
<Bonfire.UI.Boundaries.Web.BoundariesPresetNameLive
boundary_preset={@boundary_preset}
with_icon={@with_icon}
with_label={@with_label}
icon_class={@icon_class}
/>
</button>
</div>
</:open_btn>
</Bonfire.UI.Common.OpenModalLive>
</div>
Expand Down
4 changes: 2 additions & 2 deletions lib/web/components/set/boundaries_general_access_live.sface
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
hide_custom={@hide_custom}
/>
<:open_btn>
<button type="button" class="btn btn-neutral btn-xs">
<div class="btn btn-neutral btn-xs">
{l("Advanced")}
<#Icon iconify="codicon:settings" class="w-4 h-4" />
</button>
</div>
</:open_btn>
</Bonfire.UI.Common.OpenModalLive>
</div>
Expand Down
4 changes: 2 additions & 2 deletions lib/web/components/set/boundary_items_live.sface
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
</div>

<:open_btn>
<button type="button" class="btn btn-sm btn-circle btn-ghost" aria-label="Add description">
<div class="btn btn-sm btn-circle btn-ghost" aria-label="Add description">
<#Icon iconify="heroicons-outline:information-circle" class="w-4 h-4 text-base-content/70" />
</button>
</div>
</:open_btn>
</Bonfire.UI.Common.OpenModalLive> -->
</div>
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Code.eval_file("mess.exs", (if File.exists?("../../lib/mix/mess.exs"), do: "../../lib/mix/"))

defmodule Bonfire.UiBoundaries.MixProject do
defmodule Bonfire.UI.Boundaries.MixProject do
use Mix.Project

def project do
Expand Down
2 changes: 1 addition & 1 deletion priv/repo/seeds.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Inside the script, you can read and write to any of your
# repositories directly:
#
# Bonfire.UiBoundaries.Repo.insert!(%Bonfire.UiBoundaries.SomeSchema{})
# Bonfire.UI.Boundaries.Repo.insert!(%Bonfire.UI.Boundaries.SomeSchema{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as they will fail if something goes wrong.
6 changes: 3 additions & 3 deletions test/support/channel_case.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Bonfire.UiBoundaries.ChannelCase do
defmodule Bonfire.UI.Boundaries.ChannelCase do
@moduledoc """
This module defines the test case to be used by
channel tests.
Expand All @@ -17,13 +17,13 @@ defmodule Bonfire.UiBoundaries.ChannelCase do

use ExUnit.CaseTemplate

import Bonfire.UiBoundaries
import Bonfire.UI.Boundaries

using do
quote do
# Import conveniences for testing with channels
import Phoenix.ChannelTest
import Bonfire.UiBoundaries.ChannelCase
import Bonfire.UI.Boundaries.ChannelCase

# The default endpoint for testing
@endpoint Application.compile_env!(:bonfire, :endpoint_module)
Expand Down
17 changes: 9 additions & 8 deletions test/support/conn_case.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Bonfire.UiBoundaries.ConnCase do
defmodule Bonfire.UI.Boundaries.ConnCase do
@moduledoc """
This module defines the test case to be used by
tests that require setting up a connection.
Expand Down Expand Up @@ -26,22 +26,23 @@ defmodule Bonfire.UiBoundaries.ConnCase do
import Bonfire.UI.Common.Testing.Helpers

import Phoenix.LiveViewTest
# import Bonfire.UiBoundaries.ConnCase, async: true
# import Bonfire.UI.Boundaries.ConnCase, async: true
import PhoenixTest

import Bonfire.UiBoundaries.Test.ConnHelpers
import Bonfire.UiBoundaries.Test.FakeHelpers
import Bonfire.UI.Boundaries.Test.ConnHelpers
import Bonfire.UI.Boundaries.Test.FakeHelpers

alias Bonfire.UiBoundaries.Fake
import Bonfire.UiBoundaries.Fake
# alias Bonfire.UiBoundaries.Web.Router.Helpers, as: Routes
alias Bonfire.UI.Boundaries.Fake
import Bonfire.UI.Boundaries.Fake
# alias Bonfire.UI.Boundaries.Web.Router.Helpers, as: Routes

# The default endpoint for testing
@endpoint Application.compile_env!(:bonfire, :endpoint_module)
end
end

setup tags do
import Bonfire.UiBoundaries
import Bonfire.UI.Boundaries

Bonfire.Common.Test.Interactive.setup_test_repo(tags)

Expand Down
2 changes: 1 addition & 1 deletion test/support/conn_helpers.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Bonfire.UiBoundaries.Test.ConnHelpers do
defmodule Bonfire.UI.Boundaries.Test.ConnHelpers do
import ExUnit.Assertions
import Plug.Conn
import Phoenix.ConnTest
Expand Down
8 changes: 4 additions & 4 deletions test/support/data_case.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Bonfire.UiBoundaries.DataCase do
defmodule Bonfire.UI.Boundaries.DataCase do
@moduledoc """
This module defines the setup for tests requiring
access to the application's data layer.
Expand All @@ -10,19 +10,19 @@ defmodule Bonfire.UiBoundaries.DataCase do
we enable the SQL sandbox, so changes done to the database
are reverted at the end of every test. If you are using
PostgreSQL, you can even run database tests asynchronously
by setting `use Bonfire.UiBoundaries.DataCase, async: true`, although
by setting `use Bonfire.UI.Boundaries.DataCase, async: true`, although
this option is not recommended for other databases.
"""

use ExUnit.CaseTemplate
import Bonfire.UiBoundaries
import Bonfire.UI.Boundaries

using do
quote do
import Ecto
import Ecto.Changeset
import Ecto.Query
# import Bonfire.UiBoundaries.DataCase
# import Bonfire.UI.Boundaries.DataCase
end
end

Expand Down
4 changes: 2 additions & 2 deletions test/support/data_helpers.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Bonfire.UiBoundaries.DataHelpers do
defmodule Bonfire.UI.Boundaries.DataHelpers do
# import ExUnit.Assertions
# alias Bonfire.UiBoundaries.Fake
# alias Bonfire.UI.Boundaries.Fake
end
12 changes: 6 additions & 6 deletions test/support/fake_helpers.ex
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
defmodule Bonfire.UiBoundaries.Test.FakeHelpers do
defmodule Bonfire.UI.Boundaries.Test.FakeHelpers do
alias Bonfire.Data.Identity.Account
alias Bonfire.UiBoundaries.Fake
alias Bonfire.UiBoundaries.Accounts
alias Bonfire.UiBoundaries.Users
alias Bonfire.UI.Boundaries.Fake
alias Bonfire.UI.Boundaries.Accounts
alias Bonfire.UI.Boundaries.Users

import ExUnit.Assertions

import Bonfire.UiBoundaries
import Bonfire.UI.Boundaries

import Bonfire.UiBoundaries.Fake
import Bonfire.UI.Boundaries.Fake
end
Loading

0 comments on commit 36ca9b8

Please sign in to comment.