diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 000000000..6227ba921
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,108 @@
+[asdf-vm]: https://asdf-vm.com/
+
+# 🚀 Getting Started
+
+These instructions will get you a copy of the project up and running on your
+local machine for development and testing purposes.
+
+## 📥 Prerequisites
+
+The following software is required to be installed on your system:
+
+- [Erlang 25+](https://www.erlang.org/downloads)
+- [Elixir 1.14+](https://elixir-lang.org/install.html)
+- [PostgreSQL 13+](https://www.postgresql.org/download/)(^See [this section](#-docker) for setting up with docker.)
+
+We recommend using [asdf version manager][asdf-vm] to install and manage all
+the programming languages' requirements.
+
+If you prefer to use docker, see the [section below](#-docker).
+
+## 🔧 Setup
+
+First, clone the repository:
+
+```
+git clone git@github.com:cesium/atomic.git
+cd atomic
+```
+
+Then, run the setup script to get all dependencies configured. Make sure the database is up and running.
+
+```
+bin/setup
+```
+
+Then you should change the `.env.dev` file as needed. Run this script again if
+needed.
+
+## 🔨 Development
+
+Start the development server and then you can visit `http://localhost:4000`
+from your browser.
+
+```
+bin/server
+```
+
+Run the tests.
+
+```
+bin/test
+```
+
+Lint your code.
+
+```
+bin/lint
+```
+
+Format your code.
+
+```
+bin/format
+```
+
+## 🐳 Docker
+
+For data persistence this project uses a PostgreSQL database. You should have
+PostgreSQL up and running.
+
+If you want to setup the required database using docker containers you can
+easily do it with [docker-compose](https://docs.docker.com/compose/install/).
+
+Create and start the database containers.
+
+```
+cp .env.dev.sample .env.dev
+docker-compose -f docker-compose.dev.yml -f {linux,darwin}.yml up db
+```
+
+Start the previously created containers.
+
+```
+docker-compose -f docker-compose.dev.yml -f {linux,darwin}.yml start
+```
+
+Stop the containers.
+
+```
+docker-compose -f docker-compose.dev.yml -f {linux,darwin}.yml stop
+```
+
+Destroy the containers and volumes created.
+
+```
+docker-compose -f docker-compose.dev.yml -f {linux,darwin}.yml down -v
+```
+
+## 🔗 References
+
+You can use these resources to learn more about the technologies this project
+uses.
+
+- [Getting Started with Elixir](https://elixir-lang.org/getting-started/introduction.html)
+- [Erlang/Elixir Syntax: A Crash Course](https://elixir-lang.org/crash-course.html)
+- [Elixir School Course](https://elixirschool.com/en/)
+- [Phoenix Guides Overview](https://hexdocs.pm/phoenix/overview.html)
+- [Phoenix Documentation](https://hexdocs.pm/phoenix)
diff --git a/lib/atomic/activities/speaker.ex b/lib/atomic/activities/speaker.ex
index ba1cdcec1..20e9da4b9 100644
--- a/lib/atomic/activities/speaker.ex
+++ b/lib/atomic/activities/speaker.ex
@@ -3,11 +3,13 @@ defmodule Atomic.Activities.Speaker do
The person who speaks and provides the activity
"""
use Atomic.Schema
+ alias Atomic.Activities.Activity
+ alias Atomic.Activities.ActivitySpeaker
schema "speakers" do
field :bio, :string
field :name, :string
-
+ many_to_many :activities, Activity, join_through: ActivitySpeaker, on_replace: :delete
timestamps()
end
diff --git a/lib/atomic_web/live/department_live/form_component.ex b/lib/atomic_web/live/department_live/form_component.ex
index 9724b22f4..732fccdf4 100644
--- a/lib/atomic_web/live/department_live/form_component.ex
+++ b/lib/atomic_web/live/department_live/form_component.ex
@@ -41,6 +41,9 @@ defmodule AtomicWeb.DepartmentLive.FormComponent do
end
defp save_department(socket, :new, department_params) do
+ department_params =
+ Map.put(department_params, "organization_id", socket.assigns.organization.id)
+
case Departments.create_department(department_params) do
{:ok, _department} ->
{:noreply,
diff --git a/lib/atomic_web/live/department_live/index.ex b/lib/atomic_web/live/department_live/index.ex
index 448207478..c95dcbdaf 100644
--- a/lib/atomic_web/live/department_live/index.ex
+++ b/lib/atomic_web/live/department_live/index.ex
@@ -3,6 +3,7 @@ defmodule AtomicWeb.DepartmentLive.Index do
alias Atomic.Departments
alias Atomic.Departments.Department
+ alias Atomic.Organizations
@impl true
def mount(_params, _session, socket) do
@@ -10,7 +11,7 @@ defmodule AtomicWeb.DepartmentLive.Index do
end
@impl true
- def handle_params(params, _url, socket) do
+ def handle_params(%{"org" => _id} = params, _url, socket) do
{:noreply, apply_action(socket, socket.assigns.live_action, params)}
end
@@ -20,15 +21,17 @@ defmodule AtomicWeb.DepartmentLive.Index do
|> assign(:department, Departments.get_department!(id))
end
- defp apply_action(socket, :new, _params) do
+ defp apply_action(socket, :new, %{"org" => id}) do
socket
|> assign(:page_title, "New Department")
+ |> assign(:organization, Organizations.get_organization!(id))
|> assign(:department, %Department{})
end
- defp apply_action(socket, :index, _params) do
+ defp apply_action(socket, :index, %{"org" => id}) do
socket
|> assign(:page_title, "Listing Departments")
+ |> assign(:organization, Organizations.get_organization!(id))
|> assign(:department, nil)
end
diff --git a/lib/atomic_web/live/department_live/index.html.heex b/lib/atomic_web/live/department_live/index.html.heex
index 475faa969..abc44402d 100644
--- a/lib/atomic_web/live/department_live/index.html.heex
+++ b/lib/atomic_web/live/department_live/index.html.heex
@@ -1,8 +1,8 @@