Skip to content

Commit

Permalink
Cleaned up project cards and prepared project form for future
Browse files Browse the repository at this point in the history
  • Loading branch information
mellelieuwes committed Nov 26, 2023
1 parent 1614a28 commit 394cecb
Show file tree
Hide file tree
Showing 57 changed files with 463 additions and 237 deletions.
4 changes: 2 additions & 2 deletions core/frameworks/concept/presenter.ex
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
defmodule Frameworks.Concept.Presenter do
@type model :: pos_integer() | map
@type page :: atom()
@type model :: pos_integer() | map | nil
@type assigns :: map

@callback view_model(model, page, assigns) :: map()
@callback view_model(page, model, assigns) :: map()

defmacro __using__(_opts) do
quote do
Expand Down
2 changes: 1 addition & 1 deletion core/frameworks/utililty/view_model_builder.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defprotocol Frameworks.Utility.ViewModelBuilder do
@type accumulator :: map
@type model :: map | list
@type model :: map | list | nil
@type page :: atom() | tuple()
@type assigns :: map

Expand Down
10 changes: 6 additions & 4 deletions core/lib/core_web/ui/dialog/dialog.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule CoreWeb.UI.Dialog do
alias Frameworks.Pixel.Button

attr(:title, :string, required: true)
attr(:text, :string, required: true)
attr(:text, :string, default: nil)
attr(:buttons, :list, default: [])
slot(:inner_block)

Expand All @@ -15,9 +15,11 @@ defmodule CoreWeb.UI.Dialog do
<div class="text-title5 font-title5 sm:text-title3 sm:font-title3">
<%= @title %>
</div>
<div class="text-bodymedium font-body sm:text-bodylarge">
<%= @text %>
</div>
<%= if @text do %>
<div class="text-bodymedium font-body sm:text-bodylarge">
<%= @text %>
</div>
<% end %>
<div>
<%= render_slot(@inner_block) %>
</div>
Expand Down
20 changes: 12 additions & 8 deletions core/lib/core_web/ui/empty.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ defmodule CoreWeb.UI.Empty do

attr(:title, :string, required: true)
attr(:body, :string, required: true)
attr(:illustration, :string, default: "cards")
attr(:illustration, :string)
attr(:button, :map, default: nil)

def empty(assigns) do
~H"""
Expand All @@ -15,18 +16,21 @@ defmodule CoreWeb.UI.Empty do
<div class="text-bodymedium sm:text-bodylarge font-body">
<%= @body %>
</div>
<%= if @button do %>
<div>
<.spacing value="L" />
<.wrap>
<Button.dynamic {@button} />
</.wrap>
</div>
<% end %>
</div>
<div class="w-full mt-6 md:mt-0">
<div class="w-full mt-6 hidden md:block">
<img
class="hidden md:block object-fill w-full"
class="object-fill w-full"
src={"/images/illustrations/#{@illustration}.svg"}
alt=""
/>
<img
class="md:hidden object-fill w-full"
src={"/images/illustrations/#{@illustration}_mobile.svg"}
alt=""
/>
</div>
</div>
"""
Expand Down
4 changes: 0 additions & 4 deletions core/priv/gettext/en/LC_MESSAGES/eyra-consent.po
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ msgstr ""
"Language: en\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#, elixir-autogen, elixir-format
msgid "consent-out-of-sync-error"
msgstr "Someone made changes to the consent text. Please refresh the page to continue."

#, elixir-autogen, elixir-format
msgid "default.consent.text"
msgstr "<div>Write here your custom consent terms and conditions..</div>"
Expand Down
2 changes: 1 addition & 1 deletion core/priv/gettext/en/LC_MESSAGES/eyra-enums.po
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ msgstr "Empty"

#, elixir-autogen, elixir-format, fuzzy
msgid "templates.data_donation"
msgstr "Online study"
msgstr "Data donation"

#, elixir-autogen, elixir-format, fuzzy
msgid "platforms.apple"
Expand Down
34 changes: 33 additions & 1 deletion core/priv/gettext/en/LC_MESSAGES/eyra-project.po
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ msgstr "Here you will find an overview of all your projects. There are no projec

#, elixir-autogen, elixir-format
msgid "overview.empty.title"
msgstr "Welcome"
msgstr "Your journey starts here"

#, elixir-autogen, elixir-format
msgid "overview.title"
Expand Down Expand Up @@ -158,3 +158,35 @@ msgstr "Settings"
#, elixir-autogen, elixir-format, fuzzy
msgid "tabbar.item.settings.forward"
msgstr "Go to Settings"

#, elixir-autogen, elixir-format
msgid "default.name"
msgstr "New project"

#, elixir-autogen, elixir-format, fuzzy
msgid "add.first.item.button"
msgstr "Add first item"

#, elixir-autogen, elixir-format
msgid "node.empty.description"
msgstr "Here you will find an overview your items. There are no items yet available. You can now add your first item."

#, elixir-autogen, elixir-format, fuzzy
msgid "node.empty.title"
msgstr "Blank canvas"

#, elixir-autogen, elixir-format
msgid "tool_ref.tag.benchmark"
msgstr "Benchmark"

#, elixir-autogen, elixir-format
msgid "tool_ref.tag.default"
msgstr "Tool"

#, elixir-autogen, elixir-format
msgid "tool_ref.tag.questionnaire"
msgstr "Questionnaire"

#, elixir-autogen, elixir-format, fuzzy
msgid "form.text"
msgstr "Project settings"
4 changes: 4 additions & 0 deletions core/priv/gettext/en/LC_MESSAGES/eyra-ui.po
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,7 @@ msgstr "Edit"
#, elixir-autogen, elixir-format
msgid "copy.clipboard.button"
msgstr "Copy"

#, elixir-autogen, elixir-format, fuzzy
msgid "submit.button"
msgstr "Save"
4 changes: 0 additions & 4 deletions core/priv/gettext/eyra-consent.pot
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
msgid ""
msgstr ""

#, elixir-autogen, elixir-format
msgid "consent-out-of-sync-error"
msgstr ""

#, elixir-autogen, elixir-format
msgid "default.consent.text"
msgstr ""
Expand Down
32 changes: 32 additions & 0 deletions core/priv/gettext/eyra-project.pot
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,35 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "tabbar.item.settings.forward"
msgstr ""

#, elixir-autogen, elixir-format
msgid "default.name"
msgstr ""

#, elixir-autogen, elixir-format
msgid "add.first.item.button"
msgstr ""

#, elixir-autogen, elixir-format
msgid "node.empty.description"
msgstr ""

#, elixir-autogen, elixir-format
msgid "node.empty.title"
msgstr ""

#, elixir-autogen, elixir-format
msgid "tool_ref.tag.benchmark"
msgstr ""

#, elixir-autogen, elixir-format
msgid "tool_ref.tag.default"
msgstr ""

#, elixir-autogen, elixir-format
msgid "tool_ref.tag.questionnaire"
msgstr ""

#, elixir-autogen, elixir-format
msgid "form.text"
msgstr ""
4 changes: 4 additions & 0 deletions core/priv/gettext/eyra-ui.pot
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,7 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "copy.clipboard.button"
msgstr ""

#, elixir-autogen, elixir-format
msgid "submit.button"
msgstr ""
4 changes: 0 additions & 4 deletions core/priv/gettext/nl/LC_MESSAGES/eyra-consent.po
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ msgstr ""
"Language: nl\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#, elixir-autogen, elixir-format
msgid "consent-out-of-sync-error"
msgstr "Iemand heeft de consent tekst is aangepast. Ververs de pagina om verder te gaan."

#, elixir-autogen, elixir-format
msgid "default.consent.text"
msgstr "<div>Beschrijf hier de consent voorwaarden</div>"
Expand Down
2 changes: 1 addition & 1 deletion core/priv/gettext/nl/LC_MESSAGES/eyra-enums.po
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ msgstr "Leeg"

#, elixir-autogen, elixir-format, fuzzy
msgid "templates.data_donation"
msgstr "Online studie"
msgstr "Data donatie"

#, elixir-autogen, elixir-format, fuzzy
msgid "platforms.apple"
Expand Down
34 changes: 33 additions & 1 deletion core/priv/gettext/nl/LC_MESSAGES/eyra-project.po
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ msgstr "Hier kan vind je een overzicht van al je projecten. Op dit moment zijn e

#, elixir-autogen, elixir-format
msgid "overview.empty.title"
msgstr "Welkom"
msgstr "Here start je reis"

#, elixir-autogen, elixir-format
msgid "overview.title"
Expand Down Expand Up @@ -158,3 +158,35 @@ msgstr "Instellingen"
#, elixir-autogen, elixir-format, fuzzy
msgid "tabbar.item.settings.forward"
msgstr "Ga naar Instellingen"

#, elixir-autogen, elixir-format
msgid "default.name"
msgstr "Nieuw project"

#, elixir-autogen, elixir-format, fuzzy
msgid "add.first.item.button"
msgstr "Maak eerste item aan"

#, elixir-autogen, elixir-format
msgid "node.empty.description"
msgstr "Hier vind je een overzicht van je items. Op dit moment zijn er nog geen items beschikbaar. Je kan nu je eerste item aanmaken."

#, elixir-autogen, elixir-format, fuzzy
msgid "node.empty.title"
msgstr "Leeg canvas"

#, elixir-autogen, elixir-format
msgid "tool_ref.tag.benchmark"
msgstr "Benchmark"

#, elixir-autogen, elixir-format
msgid "tool_ref.tag.default"
msgstr "Tool"

#, elixir-autogen, elixir-format
msgid "tool_ref.tag.questionnaire"
msgstr "Vragenlijst"

#, elixir-autogen, elixir-format, fuzzy
msgid "form.text"
msgstr "Project instellingen"
4 changes: 4 additions & 0 deletions core/priv/gettext/nl/LC_MESSAGES/eyra-ui.po
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,7 @@ msgstr "Bewerken"
#, elixir-autogen, elixir-format
msgid "copy.clipboard.button"
msgstr "Kopieer"

#, elixir-autogen, elixir-format, fuzzy
msgid "submit.button"
msgstr "Opslaan"
4 changes: 2 additions & 2 deletions core/systems/alliance/_presenter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Systems.Alliance.Presenter do
alias Systems.Alliance

@impl true
def view_model(%Alliance.ToolModel{director: director} = tool, page, assigns) do
Frameworks.Utility.Module.get(director, "Presenter").view_model(tool, page, assigns)
def view_model(page, %Alliance.ToolModel{director: director} = tool, assigns) do
Frameworks.Utility.Module.get(director, "Presenter").view_model(page, tool, assigns)
end
end
2 changes: 0 additions & 2 deletions core/systems/alliance/callback_page.ex
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ defmodule Systems.Alliance.CallbackPage do

defp activate_participant_task(socket), do: socket

defoverridable handle_view_model_updated: 1

def handle_view_model_updated(socket), do: socket

@impl true
Expand Down
8 changes: 4 additions & 4 deletions core/systems/assignment/_presenter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ defmodule Systems.Assignment.Presenter do
}

@impl true
def view_model(%Alliance.ToolModel{} = tool, Alliance.CallbackPage = page, assigns) do
def view_model(Alliance.CallbackPage = page, %Alliance.ToolModel{} = tool, assigns) do
builder(page).view_model(tool, assigns)
end

@impl true
def view_model(
%Assignment.Model{director: director} = assignment,
Assignment.LandingPage = page,
%Assignment.Model{director: director} = assignment,
assigns
) do
Module.get(director, "Presenter").view_model(assignment, page, assigns)
Module.get(director, "Presenter").view_model(page, assignment, assigns)
end

@impl true
def view_model(%Assignment.Model{} = assignment, page, assigns) do
def view_model(page, %Assignment.Model{} = assignment, assigns) do
builder(page).view_model(assignment, assigns)
end

Expand Down
12 changes: 6 additions & 6 deletions core/systems/assignment/content_page_builder.ex
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,12 @@ defmodule Systems.Assignment.ContentPageBuilder do
title: dgettext("eyra-workflow", "item.library.title"),
description: dgettext("eyra-workflow", "item.library.description"),
items: [
%{
id: :donate,
type: :feldspar_tool,
title: dgettext("eyra-workflow", "item.donate.title"),
description: dgettext("eyra-workflow", "item.donate.description")
},
%{
id: :questionnaire,
type: :alliance_tool,
Expand All @@ -237,12 +243,6 @@ defmodule Systems.Assignment.ContentPageBuilder do
type: :document_tool,
title: dgettext("eyra-workflow", "item.download.title"),
description: dgettext("eyra-workflow", "item.download.description")
},
%{
id: :donate,
type: :feldspar_tool,
title: dgettext("eyra-workflow", "item.donate.title"),
description: dgettext("eyra-workflow", "item.donate.description")
}
]
}
Expand Down
2 changes: 0 additions & 2 deletions core/systems/assignment/crew_page.ex
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ defmodule Systems.Assignment.CrewPage do
}
end

defoverridable handle_view_model_updated: 1

def handle_view_model_updated(socket) do
socket
|> update_flow()
Expand Down
2 changes: 1 addition & 1 deletion core/systems/assignment/gdpr_form.ex
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ defmodule Systems.Assignment.GdprForm do
%{status: :on},
%{assigns: %{entity: %{auth_node: auth_node} = assignment}} = socket
) do
consent_agreement = %Consent.AgreementModel{auth_node: auth_node}
consent_agreement = Consent.Public.prepare_agreement(auth_node: auth_node)
Assignment.Public.update_consent_agreement(assignment, consent_agreement)

{
Expand Down
2 changes: 0 additions & 2 deletions core/systems/assignment/landing_page.ex
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ defmodule Systems.Assignment.LandingPage do
}
end

defoverridable handle_view_model_updated: 1

def handle_view_model_updated(socket) do
socket
|> update_task_view()
Expand Down
4 changes: 4 additions & 0 deletions core/systems/assignment/model.ex
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ defmodule Systems.Assignment.Model do

def tool(_), do: nil

def tag(%{special: special}) do
Assignment.Templates.translate(special)
end

def preload_graph(:down) do
[
:excluded,
Expand Down
Loading

0 comments on commit 394cecb

Please sign in to comment.