Skip to content

Commit

Permalink
Merge pull request #29 from camino-school/reorganize_live_folder
Browse files Browse the repository at this point in the history
Reorganize live folder
  • Loading branch information
endoooo authored Dec 1, 2023
2 parents d8f777b + 80db2ac commit 0b9e692
Show file tree
Hide file tree
Showing 102 changed files with 151 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ defmodule LantternWeb.Admin.ActivityLive.Index do
end

@impl true
def handle_info({LantternWeb.StrandLive.ActivityFormComponent, {:saved, activity}}, socket) do
def handle_info({LantternWeb.LearningContext.ActivityFormComponent, {:saved, activity}}, socket) do
{:noreply, stream_insert(socket, :activities, activity)}
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<:subtitle>Use this form to manage activity records in your database.</:subtitle>
</.header>
<.live_component
module={LantternWeb.StrandLive.ActivityFormComponent}
module={LantternWeb.LearningContext.ActivityFormComponent}
id={@activity.id || :new}
action={@live_action}
activity={@activity}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<:subtitle>Use this form to manage activity records in your database.</:subtitle>
</.header>
<.live_component
module={LantternWeb.StrandLive.ActivityFormComponent}
module={LantternWeb.LearningContext.ActivityFormComponent}
id={@activity.id}
action={@live_action}
activity={@activity}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LantternWeb.Admin.SchoolLive.ImportStudents do
defmodule LantternWeb.Admin.ImportStudentsLive do
use LantternWeb, {:live_view, layout: :admin}

alias NimbleCSV.RFC4180, as: CSV
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LantternWeb.Admin.SchoolLive.ImportTeachers do
defmodule LantternWeb.Admin.ImportTeachersLive do
use LantternWeb, {:live_view, layout: :admin}

alias NimbleCSV.RFC4180, as: CSV
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ defmodule LantternWeb.Admin.StrandLive.Index do
alias Lanttern.LearningContext
alias Lanttern.LearningContext.Strand

alias LantternWeb.LearningContext.StrandFormComponent

@impl true
def mount(_params, _session, socket) do
{:ok,
Expand Down Expand Up @@ -43,7 +45,7 @@ defmodule LantternWeb.Admin.StrandLive.Index do
end

@impl true
def handle_info({LantternWeb.StrandLive.StrandFormComponent, {:saved, strand}}, socket) do
def handle_info({StrandFormComponent, {:saved, strand}}, socket) do
{:noreply, stream_insert(socket, :strands, strand)}
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<:subtitle>Use this form to manage strand records in your database.</:subtitle>
</.header>
<.live_component
module={LantternWeb.StrandLive.StrandFormComponent}
module={LantternWeb.LearningContext.StrandFormComponent}
id={@strand.id || :new}
strand={@strand}
action={@live_action}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<:subtitle>Use this form to manage strand records in your database.</:subtitle>
</.header>
<.live_component
module={LantternWeb.StrandLive.StrandFormComponent}
module={LantternWeb.LearningContext.StrandFormComponent}
id={@strand.id}
strand={@strand}
action={@live_action}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
defmodule LantternWeb.AssessmentPointLive.Explorer do
defmodule LantternWeb.AssessmentPointsLive do
use LantternWeb, :live_view

alias Lanttern.Assessments
alias Lanttern.Assessments.AssessmentPoint
alias Lanttern.Schools
alias Lanttern.Taxonomy

alias LantternWeb.AssessmentPointLive.AssessmentPointEntryEditorComponent
alias LantternWeb.AssessmentPointLive.AssessmentPointCreateFormComponent
# shared components
alias LantternWeb.Assessments.AssessmentPointEntryEditorComponent
alias LantternWeb.Assessments.AssessmentPointCreateFormComponent

# function components

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LantternWeb.AssessmentPointLive.Details do
defmodule LantternWeb.AssessmentPointLive do
use LantternWeb, :live_view

import LantternWeb.DateTimeHelpers
Expand All @@ -11,12 +11,15 @@ defmodule LantternWeb.AssessmentPointLive.Details do
alias Lanttern.Grading
alias Lanttern.Schools.Student

alias LantternWeb.AssessmentPointLive.AssessmentPointEntryEditorComponent
alias LantternWeb.AssessmentPointLive.AssessmentPointUpdateFormComponent
# page components
alias LantternWeb.AssessmentPointLive.RubricsOverlayComponent
alias LantternWeb.AssessmentPointLive.DifferentiationRubricComponent
alias LantternWeb.AssessmentPointLive.FeedbackFormComponent
alias LantternWeb.AssessmentPointLive.FeedbackCommentFormComponent

# shared components
alias LantternWeb.Assessments.AssessmentPointEntryEditorComponent
alias LantternWeb.Assessments.AssessmentPointUpdateFormComponent
alias LantternWeb.Assessments.FeedbackFormComponent
alias LantternWeb.Assessments.FeedbackCommentFormComponent

# render helpers and function components

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ defmodule LantternWeb.AssessmentPointLive.DifferentiationRubricComponent do
alias Lanttern.Assessments
alias Lanttern.Rubrics
alias Lanttern.Rubrics.Rubric
alias LantternWeb.RubricsLive.FormComponent, as: RubricsFormComponent
alias LantternWeb.RubricsLive.RubricSearchInputComponent

# shared components
alias LantternWeb.Rubrics.RubricFormComponent
alias LantternWeb.Rubrics.RubricSearchInputComponent

def render(assigns) do
~H"""
Expand Down Expand Up @@ -35,7 +37,7 @@ defmodule LantternWeb.AssessmentPointLive.DifferentiationRubricComponent do
Create new differentiation rubric
</h4>
<.live_component
module={RubricsFormComponent}
module={RubricFormComponent}
id={"entry-#{@entry.id}"}
action={:new}
rubric={
Expand Down Expand Up @@ -122,7 +124,7 @@ defmodule LantternWeb.AssessmentPointLive.DifferentiationRubricComponent do
def update(%{action: {RubricSearchInputComponent, {:selected, rubric_id}}}, socket),
do: {:ok, link_rubric_to_entry_and_notify(socket, rubric_id)}

def update(%{action: {RubricsFormComponent, {:created, rubric}}}, socket) do
def update(%{action: {RubricFormComponent, {:created, rubric}}}, socket) do
{:ok,
socket
|> link_rubric_to_entry_and_notify(rubric.id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ defmodule LantternWeb.AssessmentPointLive.RubricsOverlayComponent do
alias Lanttern.Assessments
alias Lanttern.Rubrics
alias Lanttern.Rubrics.Rubric
alias LantternWeb.RubricsLive.FormComponent, as: RubricsFormComponent
alias LantternWeb.AssessmentPointLive.DifferentiationRubricComponent
alias LantternWeb.RubricsLive.RubricSearchInputComponent

# shared components
alias LantternWeb.Rubrics.RubricFormComponent
alias LantternWeb.Rubrics.RubricSearchInputComponent

def render(assigns) do
~H"""
Expand Down Expand Up @@ -37,7 +39,7 @@ defmodule LantternWeb.AssessmentPointLive.RubricsOverlayComponent do
<%= if @is_creating_rubric do %>
<h4 class="-mb-2 font-display font-black text-xl text-ltrn-subtle">Create new rubric</h4>
<.live_component
module={RubricsFormComponent}
module={RubricFormComponent}
id={:new}
action={:new}
rubric={
Expand Down Expand Up @@ -140,7 +142,7 @@ defmodule LantternWeb.AssessmentPointLive.RubricsOverlayComponent do
def update(%{action: {RubricSearchInputComponent, {:selected, rubric_id}}}, socket),
do: {:ok, link_rubric_to_assessment_and_notify_parent(socket, rubric_id)}

def update(%{action: {RubricsFormComponent, {:created, rubric}}}, socket) do
def update(%{action: {RubricFormComponent, {:created, rubric}}}, socket) do
{:ok,
socket
|> link_rubric_to_assessment_and_notify_parent(rubric.id)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LantternWeb.CurriculumBNCCLive.EF do
defmodule LantternWeb.BnccEfLive do
use LantternWeb, :live_view

alias Lanttern.BNCC
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LantternWeb.CurriculumLive.Index do
defmodule LantternWeb.CurriculumLive do
use LantternWeb, :live_view

def mount(_params, _session, socket) do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LantternWeb.DashboardLive.Index do
defmodule LantternWeb.DashboardLive do
@moduledoc """
Dashboard live view
"""
Expand All @@ -7,7 +7,8 @@ defmodule LantternWeb.DashboardLive.Index do
alias Lanttern.Personalization
alias Lanttern.Personalization.ProfileView

# view components
# shared components
alias LantternWeb.Personalization.ProfileViewFormComponent

attr :id, :string, required: true
attr :filter_view, :map, required: true
Expand Down Expand Up @@ -164,7 +165,7 @@ defmodule LantternWeb.DashboardLive.Index do
# info handlers

def handle_info(
{LantternWeb.DashboardLive.FilterViewFormComponent, {:created, filter_view}},
{ProfileViewFormComponent, {:created, filter_view}},
socket
) do
socket =
Expand All @@ -178,7 +179,7 @@ defmodule LantternWeb.DashboardLive.Index do
end

def handle_info(
{LantternWeb.DashboardLive.FilterViewFormComponent, {:updated, filter_view}},
{ProfileViewFormComponent, {:updated, filter_view}},
socket
) do
socket =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
>
<:title><%= @filter_view_overlay_title %></:title>
<.live_component
module={LantternWeb.DashboardLive.FilterViewFormComponent}
module={ProfileViewFormComponent}
id={@filter_view.id || :new}
action={@live_action}
filter_view={@filter_view}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LantternWeb.RubricsLive.Explorer do
defmodule LantternWeb.RubricsLive do
use LantternWeb, :live_view

alias Lanttern.Rubrics
Expand Down Expand Up @@ -52,7 +52,7 @@ defmodule LantternWeb.RubricsLive.Explorer do

# info handlers

def handle_info({LantternWeb.RubricsLive.FormComponent, {:created, rubric}}, socket) do
def handle_info({LantternWeb.Rubrics.RubricFormComponent, {:created, rubric}}, socket) do
rubric = Rubrics.get_full_rubric!(rubric.id)

socket =
Expand All @@ -63,7 +63,7 @@ defmodule LantternWeb.RubricsLive.Explorer do
{:noreply, socket}
end

def handle_info({LantternWeb.RubricsLive.FormComponent, {:updated, rubric}}, socket) do
def handle_info({LantternWeb.Rubrics.RubricFormComponent, {:updated, rubric}}, socket) do
rubric = Rubrics.get_full_rubric!(rubric.id)
{:noreply, stream_insert(socket, :rubrics, rubric)}
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@
>
<:title><%= @overlay_title %></:title>
<.live_component
module={LantternWeb.RubricsLive.FormComponent}
module={LantternWeb.Rubrics.RubricFormComponent}
id={@rubric.id || :new}
action={@live_action}
rubric={@rubric}
patch={~p"/rubrics"}
/>
<:actions_left>
<:actions_left :if={@rubric.id}>
<.button
type="button"
theme="ghost"
Expand All @@ -89,7 +89,7 @@
>
Cancel
</.button>
<.button type="submit" form="rubric-form" phx-disable-with="Saving...">
<.button type="submit" form={"rubric-form-#{@rubric.id || :new}"} phx-disable-with="Saving...">
Save
</.button>
</:actions>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LantternWeb.SchoolLive.Class do
defmodule LantternWeb.ClassLive do
use LantternWeb, :live_view

alias Lanttern.Schools
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LantternWeb.SchoolLive.Show do
defmodule LantternWeb.SchoolLive do
use LantternWeb, :live_view

alias Lanttern.Schools
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LantternWeb.SchoolLive.Student do
defmodule LantternWeb.StudentLive do
use LantternWeb, :live_view

alias Lanttern.Schools
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
defmodule LantternWeb.StrandLive.Activity do
defmodule LantternWeb.ActivityLive do
use LantternWeb, :live_view

alias Lanttern.LearningContext
alias LantternWeb.StrandLive.ActivityTabs

# live components
alias LantternWeb.StrandLive.ActivityFormComponent
# page components
alias LantternWeb.ActivityLive.DetailsComponent
alias LantternWeb.ActivityLive.AssessmentComponent
alias LantternWeb.ActivityLive.NotesComponent

# shared components
alias LantternWeb.LearningContext.ActivityFormComponent

@tabs %{
"details" => :details,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@
<div class="ltrn-bg-main-local">
<.live_component
:if={@current_tab == :details}
module={ActivityTabs.DetailsComponent}
module={DetailsComponent}
id="activity-details-details"
activity={@activity}
/>
<.live_component
:if={@current_tab == :assessment}
module={ActivityTabs.AssessmentComponent}
module={AssessmentComponent}
id="activity-details-assessment"
activity={@activity}
live_action={@live_action}
Expand All @@ -85,7 +85,7 @@
/>
<.live_component
:if={@current_tab == :notes}
module={ActivityTabs.NotesComponent}
module={NotesComponent}
id="activity-details-notes"
activity={@activity}
current_user={@current_user}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
defmodule LantternWeb.StrandLive.ActivityTabs.AssessmentComponent do
defmodule LantternWeb.ActivityLive.AssessmentComponent do
use LantternWeb, :live_component

alias Lanttern.Assessments
alias Lanttern.Assessments.AssessmentPoint
alias Lanttern.Schools

# shared components
alias LantternWeb.AssessmentPointLive.ActivityAssessmentPointFormComponent
alias LantternWeb.AssessmentPointLive.EntryEditorComponent
alias LantternWeb.SchoolLive.ClassFilterFormComponent
alias LantternWeb.Schools.ClassFilterFormComponent

@impl true
def render(assigns) do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LantternWeb.StrandLive.ActivityTabs.DetailsComponent do
defmodule LantternWeb.ActivityLive.DetailsComponent do
use LantternWeb, :live_component

alias Lanttern.Curricula
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LantternWeb.StrandLive.ActivityTabs.NotesComponent do
defmodule LantternWeb.ActivityLive.NotesComponent do
use LantternWeb, :live_component

alias Lanttern.Personalization
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LantternWeb.StrandLive.DetailsTabs.AboutComponent do
defmodule LantternWeb.StrandLive.AboutComponent do
use LantternWeb, :live_component

alias Lanttern.Curricula
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
defmodule LantternWeb.StrandLive.DetailsTabs.ActivitiesComponent do
defmodule LantternWeb.StrandLive.ActivitiesComponent do
use LantternWeb, :live_component

alias Lanttern.LearningContext
alias Lanttern.LearningContext.Activity

# live components
alias LantternWeb.StrandLive.ActivityFormComponent
alias LantternWeb.LearningContext.ActivityFormComponent

@impl true
def render(assigns) do
Expand Down
Loading

0 comments on commit 0b9e692

Please sign in to comment.