diff --git a/core/Makefile b/core/Makefile index b8cc455d9..3a4003f6e 100644 --- a/core/Makefile +++ b/core/Makefile @@ -23,6 +23,9 @@ gettext: build: build-digest build-app +build-assets: + @cd .assets && npm run build + build-digest: @mix phx.digest diff --git a/core/assets/js/feldspar_app.js b/core/assets/js/feldspar_app.js index 4d1e25a11..8cf14c428 100644 --- a/core/assets/js/feldspar_app.js +++ b/core/assets/js/feldspar_app.js @@ -1,12 +1,12 @@ export const FeldsparApp = { mounted() { + console.log("FeldsparApp MOUNTED"); + const iframe = this.getIframe(); - if (iframe.contentDocument.readyState === "complete") { + iframe.addEventListener("load", () => { this.onFrameLoaded(); - } - else { - iframe.contentDocument.addEventListener("load", ()=>{ this.onFrameLoaded() }); - } + }); + iframe.setAttribute("src", this.el.dataset.src); }, getIframe() { @@ -14,15 +14,17 @@ export const FeldsparApp = { }, onFrameLoaded() { - console.log("Initializing iframe app") + console.log("Initializing iframe app"); this.channel = new MessageChannel(); this.channel.port1.onmessage = (e) => { this.handleMessage(e); }; - this.getIframe().contentWindow.postMessage("init", "*", [this.channel.port2]); + this.getIframe().contentWindow.postMessage("init", "*", [ + this.channel.port2, + ]); }, handleMessage(e) { this.pushEvent("app_event", e.data); - } + }, }; diff --git a/core/assets/package.json b/core/assets/package.json index 10b2f9411..e9476ce2c 100644 --- a/core/assets/package.json +++ b/core/assets/package.json @@ -4,7 +4,8 @@ "license": "MIT", "scripts": { "deploy": "NODE_ENV=production webpack --mode production", - "watch": "webpack --mode development --watch" + "watch": "webpack --mode development --watch", + "build": "webpack --mode development" }, "dependencies": { "@ryangjchandler/spruce": "^2.7.1", diff --git a/core/assets/static/images/icons/facebook.svg b/core/assets/static/images/icons/facebook.svg new file mode 100644 index 000000000..7d658d953 --- /dev/null +++ b/core/assets/static/images/icons/facebook.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/core/assets/static/images/icons/instagram.svg b/core/assets/static/images/icons/instagram.svg new file mode 100644 index 000000000..37751bca9 --- /dev/null +++ b/core/assets/static/images/icons/instagram.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/core/assets/tailwind.config.js b/core/assets/tailwind.config.js index 8f02ec07a..4217de3a0 100644 --- a/core/assets/tailwind.config.js +++ b/core/assets/tailwind.config.js @@ -50,7 +50,7 @@ module.exports = { "square-border-striped": "url('/images/square_border_striped.png')", }, spacing: { - "1px": "1px", + aap: "1px", "2px": "2px", "3px": "3px", "5px": "5px", @@ -75,7 +75,7 @@ module.exports = { "200px": "200px", "224px": "224px", "248px": "248px", - 15: "60x", + 15: "60px", 30: "120px", 34: "136px", 35: "140px", @@ -112,6 +112,7 @@ module.exports = { sheet: "760px", popup: "480px", "side-panel": "535px", + "left-column": "368px", "popup-sm": "520px", "popup-md": "730px", "popup-lg": "1228px", diff --git a/core/config/dev.exs b/core/config/dev.exs index c2eb7dd83..165355f35 100644 --- a/core/config/dev.exs +++ b/core/config/dev.exs @@ -41,7 +41,7 @@ config :core, CoreWeb.Endpoint, "node_modules/webpack/bin/webpack.js", "--mode", "development", - "--watch-stdin", + "--watch", cd: Path.expand("../assets", __DIR__) ] ] @@ -74,7 +74,8 @@ config :core, :apns_backend, Core.APNS.LoggingBackend config :core, :static_path, File.cwd!() - |> Path.join("tmp") + |> Path.join("priv") + |> Path.join("static") |> Path.join("uploads") |> tap(&File.mkdir_p!/1) @@ -100,8 +101,9 @@ config :core, :feldspar, backend: Systems.Feldspar.LocalFS, local_fs_root_path: File.cwd!() - |> Path.join("tmp") - |> Path.join("feldspar") + |> Path.join("priv") + |> Path.join("static") + |> Path.join("feldspar_apps") |> tap(&File.mkdir_p!/1) try do diff --git a/core/config/test.exs b/core/config/test.exs index 74d43cff4..0d4123c34 100644 --- a/core/config/test.exs +++ b/core/config/test.exs @@ -1,5 +1,8 @@ import Config +# Print only errors during test +config :logger, level: :warn + # Setup for MinIO config :ex_aws, :s3, scheme: "http://", @@ -27,9 +30,6 @@ config :core, Core.Repo, pool_size: 10, queue_target: 5000 -# Print only warnings and errors during test -config :logger, level: :error - # Reduce password hashing impact on test duration config :bcrypt_elixir, log_rounds: 4 diff --git a/core/frameworks/concept/tool_model.ex b/core/frameworks/concept/tool_model.ex index defe93dcc..e5bdb55cb 100644 --- a/core/frameworks/concept/tool_model.ex +++ b/core/frameworks/concept/tool_model.ex @@ -17,6 +17,9 @@ defprotocol Frameworks.Concept.ToolModel do @spec form(t) :: atom() def form(_t) + @spec launcher(t) :: %{url: binary()} | %{function: (map() -> any()), props: map()} + def launcher(_t) + @spec task_labels(t) :: map() def task_labels(_t) @@ -35,6 +38,7 @@ defimpl Frameworks.Concept.ToolModel, for: Ecto.Changeset do def open_label(%{data: tool}), do: ToolModel.open_label(tool) def ready?(%{data: tool}), do: ToolModel.ready?(tool) def form(%{data: tool}), do: ToolModel.form(tool) + def launcher(%{data: tool}), do: ToolModel.launcher(tool) def task_labels(%{data: tool}), do: ToolModel.task_labels(tool) def attention_list_enabled?(%{data: tool}), do: ToolModel.attention_list_enabled?(tool) def group_enabled?(%{data: tool}), do: ToolModel.group_enabled?(tool) diff --git a/core/frameworks/pixel/components/align.ex b/core/frameworks/pixel/components/align.ex index e06855f2d..88664b7b2 100644 --- a/core/frameworks/pixel/components/align.ex +++ b/core/frameworks/pixel/components/align.ex @@ -18,7 +18,7 @@ defmodule Frameworks.Pixel.Align do def vertical_center(assigns) do ~H""" -
+
<%= render_slot(@inner_block) %>
""" diff --git a/core/frameworks/pixel/components/line.ex b/core/frameworks/pixel/components/line.ex index 8742b3b10..0e458da9a 100644 --- a/core/frameworks/pixel/components/line.ex +++ b/core/frameworks/pixel/components/line.ex @@ -4,9 +4,12 @@ defmodule Frameworks.Pixel.Line do """ use CoreWeb, :html + attr(:color, :string, default: "bg-grey4") + attr(:height, :string, default: "h-px") + def line(assigns) do ~H""" -
+
""" end end diff --git a/core/frameworks/pixel/components/text.ex b/core/frameworks/pixel/components/text.ex index 55292c8e1..e80f696a6 100644 --- a/core/frameworks/pixel/components/text.ex +++ b/core/frameworks/pixel/components/text.ex @@ -185,7 +185,7 @@ defmodule Frameworks.Pixel.Text do def title1(assigns) do ~H""" -
+
<%= render_slot(@inner_block) %>
""" diff --git a/core/frameworks/utililty/legacy_routes_controller.ex b/core/frameworks/utililty/legacy_routes_controller.ex deleted file mode 100644 index 6ac591f86..000000000 --- a/core/frameworks/utililty/legacy_routes_controller.ex +++ /dev/null @@ -1,38 +0,0 @@ -defmodule Frameworks.Utility.LegacyRoutesController do - use CoreWeb, :controller - - alias Core.Accounts - - alias Systems.{ - Campaign, - Assignment - } - - # task/:type/:id/callback -> assignment/:id/callback - def task_callback(%{assigns: %{current_user: user}} = conn, %{"type" => "campaign", "id" => id}) do - %{promotable_assignment: %{crew: crew}} = - Campaign.Public.get!(id, promotable_assignment: [:crew]) - - case crew do - nil -> - redirect_to(conn, Accounts.start_page_path(user)) - - crew -> - # expect one assignment here - [assignment] = Assignment.Public.list_by_crew(crew) - redirect_to_live(conn, Systems.Alliance.CallbackPage, assignment) - end - end - - defp redirect_to_live(conn, action, [model | _]), do: redirect_to_live(conn, action, model) - defp redirect_to_live(conn, action, %{id: id}), do: redirect_to_live(conn, action, id) - - defp redirect_to_live(conn, action, id), - do: redirect_to(conn, Routes.live_path(conn, action, id)) - - defp redirect_to(conn, path) do - conn - |> put_status(:moved_permanently) - |> redirect(to: path) - end -end diff --git a/core/lib/core/authorization.ex b/core/lib/core/authorization.ex index d48df87d8..f4e341f57 100644 --- a/core/lib/core/authorization.ex +++ b/core/lib/core/authorization.ex @@ -43,9 +43,10 @@ defmodule Core.Authorization do grant_access(Systems.NextAction.OverviewPage, [:member]) grant_access(Systems.Campaign.OverviewPage, [:researcher]) grant_access(Systems.Campaign.ContentPage, [:owner]) - grant_access(Systems.Assignment.ContentPage, [:researcher, :owner]) + grant_access(Systems.Assignment.CrewPage, [:participant, :tester]) + grant_access(Systems.Assignment.ContentPage, [:owner]) grant_access(Systems.Assignment.LandingPage, [:participant]) - grant_access(Systems.Alliance.CallbackPage, [:participant, :tester]) + grant_access(Systems.Alliance.CallbackPage, [:owner]) grant_access(Systems.Lab.PublicPage, [:member]) grant_access(Systems.Promotion.LandingPage, [:visitor, :member, :owner]) grant_access(Systems.Pool.OverviewPage, [:researcher]) @@ -74,9 +75,9 @@ defmodule Core.Authorization do grant_access(CoreWeb.User.Profile, [:member]) grant_access(CoreWeb.User.Settings, [:member]) grant_access(CoreWeb.User.SecuritySettings, [:member]) - grant_access(CoreWeb.FaceAlliance, [:member]) + grant_access(CoreWeb.FakeQualtrics, [:member]) - grant_actions(CoreWeb.FaceAllianceController, %{ + grant_actions(CoreWeb.FakeAllianceController, %{ index: [:visitor, :member] }) @@ -86,31 +87,49 @@ defmodule Core.Authorization do def get_node!(id), do: Repo.get!(Core.Authorization.Node, id) - def make_node(), do: %Core.Authorization.Node{} + def prepare_node() do + %Core.Authorization.Node{} + end + + def prepare_node(nil) do + %Core.Authorization.Node{} + end - def make_node(%Core.Authorization.Node{} = parent) do - %Core.Authorization.Node{parent_id: parent.id} + def prepare_node(roles) when is_list(roles) do + %Core.Authorization.Node{role_assignments: roles} end - def make_node(nil), do: make_node() + def prepare_node(parent_id) when is_integer(parent_id) do + %Core.Authorization.Node{parent_id: parent_id} + end - def make_node(parent_id) when is_integer(parent_id) do + def prepare_node(%Core.Authorization.Node{id: parent_id}) do %Core.Authorization.Node{parent_id: parent_id} end - def make_node(parent) do - GreenLight.AuthorizationNode.id(parent) |> make_node + def prepare_node(principal, role) do + role = prepare_role(principal, role) + prepare_node([role]) + end + + def prepare_role(principal, role) when is_atom(role) do + principal_id = GreenLight.Principal.id(principal) + + %Core.Authorization.RoleAssignment{ + principal_id: principal_id, + role: :owner + } end def create_node(parent \\ nil) do - case make_node(parent) |> Core.Repo.insert() do + case prepare_node(parent) |> Core.Repo.insert() do {:ok, node} -> {:ok, node.id} error -> error end end def create_node!(parent \\ nil) do - case make_node(parent) |> Core.Repo.insert() do + case prepare_node(parent) |> Core.Repo.insert() do {:ok, node} -> node error -> error end diff --git a/core/lib/core_web/controllers/fake_alliance_controller.ex b/core/lib/core_web/controllers/fake_alliance_controller.ex index 64cfdf6c8..2d3b1a820 100644 --- a/core/lib/core_web/controllers/fake_alliance_controller.ex +++ b/core/lib/core_web/controllers/fake_alliance_controller.ex @@ -1,4 +1,4 @@ -defmodule CoreWeb.FaceAllianceController do +defmodule CoreWeb.FakeAllianceController do use CoreWeb, :controller def index(conn, _params) do diff --git a/core/lib/core_web/controllers/fake_alliance_html.ex b/core/lib/core_web/controllers/fake_alliance_html.ex index 4af374b66..a8a526c40 100644 --- a/core/lib/core_web/controllers/fake_alliance_html.ex +++ b/core/lib/core_web/controllers/fake_alliance_html.ex @@ -1,4 +1,4 @@ -defmodule CoreWeb.FaceAllianceHTML do +defmodule CoreWeb.FakeAllianceHTML do use CoreWeb, :html embed_templates("fake_alliance_html/*") diff --git a/core/lib/core_web/controllers/layouts/stripped/component.ex b/core/lib/core_web/controllers/layouts/stripped/component.ex index c9cc6c7eb..559a1b797 100644 --- a/core/lib/core_web/controllers/layouts/stripped/component.ex +++ b/core/lib/core_web/controllers/layouts/stripped/component.ex @@ -47,6 +47,8 @@ defmodule CoreWeb.Layouts.Stripped.Component do attr(:title, :string, default: nil) attr(:menus, :map, required: true) + attr(:footer?, :boolean, default: true) + slot(:inner_block, required: true) def stripped(assigns) do @@ -70,7 +72,7 @@ defmodule CoreWeb.Layouts.Stripped.Component do
<% end %>
-
+
<%= render_slot(@inner_block) %> @@ -79,9 +81,11 @@ defmodule CoreWeb.Layouts.Stripped.Component do
-
- <.content_footer /> -
+ <%= if @footer? do %> +
+ <.content_footer /> +
+ <% end %>
diff --git a/core/lib/core_web/live/fake_alliance.ex b/core/lib/core_web/live/fake_alliance.ex deleted file mode 100644 index 21e2703bb..000000000 --- a/core/lib/core_web/live/fake_alliance.ex +++ /dev/null @@ -1,40 +0,0 @@ -defmodule CoreWeb.FaceAlliance do - @moduledoc """ - The home screen. - """ - use CoreWeb, :live_view - alias Frameworks.Pixel.Hero - alias Frameworks.Pixel.Text - alias Frameworks.Pixel.Button - - def mount(%{"id" => id}, _session, socket) do - redirect_url = "/task/#{id}/callback" - - socket = - socket - |> assign(redirect_url: redirect_url) - - {:ok, socket} - end - - @impl true - def handle_uri(socket), do: socket - - # data(redirect_url, :string) - @impl true - def render(assigns) do - ~H""" -
- - - - - Fake alliance - This fake alliance is used to validate the survey tool flow with an external tool. - <.spacing value="M" /> - - -
- """ - end -end diff --git a/core/lib/core_web/live/fake_qualtrics.ex b/core/lib/core_web/live/fake_qualtrics.ex new file mode 100644 index 000000000..64dc07287 --- /dev/null +++ b/core/lib/core_web/live/fake_qualtrics.ex @@ -0,0 +1,37 @@ +defmodule CoreWeb.FakeQualtrics do + @moduledoc """ + The home screen. + """ + use CoreWeb, :live_view + alias Frameworks.Pixel.Text + alias Frameworks.Pixel.Button + + def mount(%{"re" => redirect_url}, _session, socket) do + socket = + socket + |> assign(redirect_url: redirect_url) + + {:ok, socket} + end + + @impl true + def handle_uri(socket), do: socket + + @impl true + def render(assigns) do + ~H""" +
+
+ Qualtrics emulator +
+ + + Questionnaire + This page is used to validate the questionnaire roundtrip. + <.spacing value="M" /> + + +
+ """ + end +end diff --git a/core/lib/core_web/live/routes.ex b/core/lib/core_web/live/routes.ex index f867db81e..9ef290c2b 100644 --- a/core/lib/core_web/live/routes.ex +++ b/core/lib/core_web/live/routes.ex @@ -8,7 +8,7 @@ defmodule CoreWeb.Live.Routes do scope "/", CoreWeb do pipe_through(:browser) get("/switch-language/:locale", LanguageSwitchController, :index) - live("/fake_survey/:id", FaceAlliance) + live("/fake_qualtrics", FakeQualtrics) end if Mix.env() in [:test] do diff --git a/core/lib/core_web/ui/step_indicator.ex b/core/lib/core_web/ui/step_indicator.ex index 7bc1b314b..ea6c9bbd0 100644 --- a/core/lib/core_web/ui/step_indicator.ex +++ b/core/lib/core_web/ui/step_indicator.ex @@ -4,8 +4,8 @@ defmodule CoreWeb.UI.StepIndicator do """ use CoreWeb, :html - defp center_correction_for_number(1), do: "mr-1px" - defp center_correction_for_number(4), do: "mr-1px" + defp center_correction_for_number(1), do: "mr-px" + defp center_correction_for_number(4), do: "mr-px" defp center_correction_for_number(_), do: "" attr(:text, :string, required: true) @@ -15,7 +15,7 @@ defmodule CoreWeb.UI.StepIndicator do def step_indicator(assigns) do ~H"""
- <%= @text %> + <%= @text %>
""" end diff --git a/core/mix.lock b/core/mix.lock index b3100e977..add9e9bf3 100644 --- a/core/mix.lock +++ b/core/mix.lock @@ -105,6 +105,7 @@ "surface_catalogue": {:hex, :surface_catalogue, "0.5.2", "2ca7179bc157910dd76e6167489f8186b1ec36aeba3ec1606fb8c85e7c75ff20", [:mix], [{:earmark, "~>1.4.21", [hex: :earmark, repo: "hexpm", optional: false]}, {:esbuild, "~> 0.2", [hex: :esbuild, repo: "hexpm", optional: false]}, {:html_entities, "~> 0.4", [hex: :html_entities, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.16.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: false]}, {:surface, "~>0.8.0 or ~>0.9.0", [hex: :surface, repo: "hexpm", optional: false]}], "hexpm", "53ca6fa8e5fc6f375ca9ab422ac8ac507b942681bd3c44defbfd20ecae968723"}, "sweet_xml": {:hex, :sweet_xml, "0.7.3", "debb256781c75ff6a8c5cbf7981146312b66f044a2898f453709a53e5031b45b", [:mix], [], "hexpm", "e110c867a1b3fe74bfc7dd9893aa851f0eed5518d0d7cad76d7baafd30e4f5ba"}, "table_rex": {:hex, :table_rex, "3.0.0", "5189b71b3b92ed461358f40f7b7b630dc37716bf6c8ab3e934b2bc63a99028bd", [:mix], [], "hexpm", "582776d24cbe6a4d30a39a7f02035b1bc979b6cd64923d7234dd2f0ad21a18c7"}, + "tailwind": {:hex, :tailwind, "0.2.1", "83d8eadbe71a8e8f67861fe7f8d51658ecfb258387123afe4d9dc194eddc36b0", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}], "hexpm", "e8a13f6107c95f73e58ed1b4221744e1eb5a093cd1da244432067e19c8c9a277"}, "telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"}, "telemetry_metrics": {:hex, :telemetry_metrics, "0.6.1", "315d9163a1d4660aedc3fee73f33f1d355dcc76c5c3ab3d59e76e3edf80eef1f", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7be9e0871c41732c233be71e4be11b96e56177bf15dde64a8ac9ce72ac9834c6"}, "telemetry_poller": {:hex, :telemetry_poller, "1.0.0", "db91bb424e07f2bb6e73926fcafbfcbcb295f0193e0a00e825e589a0a47e8453", [:rebar3], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b3a24eafd66c3f42da30fc3ca7dda1e9d546c12250a2d60d7b81d264fbec4f6e"}, diff --git a/core/priv/gettext/en/LC_MESSAGES/eyra-data-donation.po b/core/priv/gettext/en/LC_MESSAGES/eyra-data-donation.po index 7f16411ac..006fdad74 100644 --- a/core/priv/gettext/en/LC_MESSAGES/eyra-data-donation.po +++ b/core/priv/gettext/en/LC_MESSAGES/eyra-data-donation.po @@ -9,43 +9,3 @@ msgid "" msgstr "" "Language: en\n" - -#, elixir-autogen, elixir-format -msgid "config.nrofsubjects.label" -msgstr "How many participants do you need?" - -#, elixir-autogen, elixir-format, fuzzy -msgid "task.description.label" -msgstr "Description" - -#, elixir-autogen, elixir-format -msgid "task.title.label" -msgstr "Title" - -#, elixir-autogen, elixir-format, fuzzy -msgid "task.list.hint" -msgstr "Use the arrows to order the flow" - -#, elixir-autogen, elixir-format, fuzzy -msgid "task.platform.label" -msgstr "Organisation" - -#, elixir-autogen, elixir-format -msgid "pdf-replace-file-button" -msgstr "Replace PDF" - -#, elixir-autogen, elixir-format -msgid "pdf-select-file-button" -msgstr "Select PDF" - -#, elixir-autogen, elixir-format -msgid "pdf-select-placeholder" -msgstr "Select a pdf file" - -#, elixir-autogen, elixir-format -msgid "add.to.button" -msgstr "Add" - -#, elixir-autogen, elixir-format, fuzzy -msgid "pdf-select-label" -msgstr "Manual" diff --git a/core/priv/gettext/en/LC_MESSAGES/eyra-document.po b/core/priv/gettext/en/LC_MESSAGES/eyra-document.po index 4ff7d5826..2612fca7d 100644 --- a/core/priv/gettext/en/LC_MESSAGES/eyra-document.po +++ b/core/priv/gettext/en/LC_MESSAGES/eyra-document.po @@ -46,3 +46,7 @@ msgstr "Manual" #, elixir-autogen, elixir-format msgid "pdf-select-placeholder" msgstr "Select a pdf file" + +#, elixir-autogen, elixir-format, fuzzy +msgid "component.title" +msgstr "Manual" diff --git a/core/priv/gettext/en/LC_MESSAGES/eyra-enums.po b/core/priv/gettext/en/LC_MESSAGES/eyra-enums.po index 54efdba86..53bcc4717 100644 --- a/core/priv/gettext/en/LC_MESSAGES/eyra-enums.po +++ b/core/priv/gettext/en/LC_MESSAGES/eyra-enums.po @@ -328,7 +328,7 @@ msgstr "Benchmark" #, elixir-autogen, elixir-format msgid "project_templates.data_donation" -msgstr "Data Donation Study" +msgstr "Data Donation" #, elixir-autogen, elixir-format, fuzzy msgid "project_templates.empty" @@ -337,3 +337,15 @@ msgstr "Empty" #, elixir-autogen, elixir-format, fuzzy msgid "templates.data_donation" msgstr "Online study" + +#, elixir-autogen, elixir-format, fuzzy +msgid "platforms.apple" +msgstr "Apple" + +#, elixir-autogen, elixir-format, fuzzy +msgid "platforms.samsung" +msgstr "Samsung" + +#, elixir-autogen, elixir-format, fuzzy +msgid "platforms.tiktok" +msgstr "TikTok" diff --git a/core/priv/gettext/en/LC_MESSAGES/eyra-marketplace.po b/core/priv/gettext/en/LC_MESSAGES/eyra-marketplace.po index d2ce7e26c..d0e1c2253 100644 --- a/core/priv/gettext/en/LC_MESSAGES/eyra-marketplace.po +++ b/core/priv/gettext/en/LC_MESSAGES/eyra-marketplace.po @@ -18,10 +18,6 @@ msgstr "There are currently no research studies available to participate in. As msgid "empty.title" msgstr "Looking for a study?" -#, elixir-autogen, elixir-format -msgid "reward.label" -msgstr "Reward: %{value} credits" - #, elixir-autogen, elixir-format msgid "assignment.status.complete.label" msgstr "Closed" @@ -30,10 +26,6 @@ msgstr "Closed" msgid "assignment.status.completed.label" msgstr "Finished" -#, elixir-autogen, elixir-format -msgid "assignment.status.expired.label" -msgstr "Expired" - #, elixir-autogen, elixir-format msgid "assignment.status.pending.label" msgstr "Enrolled" diff --git a/core/priv/gettext/en/LC_MESSAGES/eyra-workflow.po b/core/priv/gettext/en/LC_MESSAGES/eyra-workflow.po index a95faacbd..7a1604593 100644 --- a/core/priv/gettext/en/LC_MESSAGES/eyra-workflow.po +++ b/core/priv/gettext/en/LC_MESSAGES/eyra-workflow.po @@ -80,9 +80,9 @@ msgid "tabbar.item.workflow.forward" msgstr "Go to Workflow" #, elixir-autogen, elixir-format, fuzzy -msgid "item.questionaire.description" +msgid "item.questionnaire.description" msgstr "Redirects participants to an online questionnaire." #, elixir-autogen, elixir-format, fuzzy -msgid "item.questionaire.title" +msgid "item.questionnaire.title" msgstr "Questionnaire" diff --git a/core/priv/gettext/eyra-data-donation.pot b/core/priv/gettext/eyra-data-donation.pot index e88bc155d..d231fbf6d 100644 --- a/core/priv/gettext/eyra-data-donation.pot +++ b/core/priv/gettext/eyra-data-donation.pot @@ -9,43 +9,3 @@ ## effect: edit them in PO (.po) files instead. msgid "" msgstr "" - -#, elixir-autogen, elixir-format -msgid "config.nrofsubjects.label" -msgstr "" - -#, elixir-autogen, elixir-format -msgid "task.description.label" -msgstr "" - -#, elixir-autogen, elixir-format -msgid "task.title.label" -msgstr "" - -#, elixir-autogen, elixir-format -msgid "task.list.hint" -msgstr "" - -#, elixir-autogen, elixir-format -msgid "task.platform.label" -msgstr "" - -#, elixir-autogen, elixir-format -msgid "pdf-replace-file-button" -msgstr "" - -#, elixir-autogen, elixir-format -msgid "pdf-select-file-button" -msgstr "" - -#, elixir-autogen, elixir-format -msgid "pdf-select-placeholder" -msgstr "" - -#, elixir-autogen, elixir-format -msgid "add.to.button" -msgstr "" - -#, elixir-autogen, elixir-format -msgid "pdf-select-label" -msgstr "" diff --git a/core/priv/gettext/eyra-document.pot b/core/priv/gettext/eyra-document.pot index 3d8ca056a..c505de8d9 100644 --- a/core/priv/gettext/eyra-document.pot +++ b/core/priv/gettext/eyra-document.pot @@ -46,3 +46,7 @@ msgstr "" #, elixir-autogen, elixir-format msgid "pdf-select-placeholder" msgstr "" + +#, elixir-autogen, elixir-format +msgid "component.title" +msgstr "" diff --git a/core/priv/gettext/eyra-enums.pot b/core/priv/gettext/eyra-enums.pot index 0cdb3562c..34a208b63 100644 --- a/core/priv/gettext/eyra-enums.pot +++ b/core/priv/gettext/eyra-enums.pot @@ -337,3 +337,15 @@ msgstr "" #, elixir-autogen, elixir-format msgid "templates.data_donation" msgstr "" + +#, elixir-autogen, elixir-format +msgid "platforms.apple" +msgstr "" + +#, elixir-autogen, elixir-format +msgid "platforms.samsung" +msgstr "" + +#, elixir-autogen, elixir-format +msgid "platforms.tiktok" +msgstr "" diff --git a/core/priv/gettext/eyra-marketplace.pot b/core/priv/gettext/eyra-marketplace.pot index e062666ec..0bc8967a2 100644 --- a/core/priv/gettext/eyra-marketplace.pot +++ b/core/priv/gettext/eyra-marketplace.pot @@ -18,10 +18,6 @@ msgstr "" msgid "empty.title" msgstr "" -#, elixir-autogen, elixir-format -msgid "reward.label" -msgstr "" - #, elixir-autogen, elixir-format msgid "assignment.status.complete.label" msgstr "" @@ -30,10 +26,6 @@ msgstr "" msgid "assignment.status.completed.label" msgstr "" -#, elixir-autogen, elixir-format -msgid "assignment.status.expired.label" -msgstr "" - #, elixir-autogen, elixir-format msgid "assignment.status.pending.label" msgstr "" diff --git a/core/priv/gettext/eyra-workflow.pot b/core/priv/gettext/eyra-workflow.pot index e15857852..01294f7cd 100644 --- a/core/priv/gettext/eyra-workflow.pot +++ b/core/priv/gettext/eyra-workflow.pot @@ -80,9 +80,9 @@ msgid "tabbar.item.workflow.forward" msgstr "" #, elixir-autogen, elixir-format -msgid "item.questionaire.description" +msgid "item.questionnaire.description" msgstr "" #, elixir-autogen, elixir-format -msgid "item.questionaire.title" +msgid "item.questionnaire.title" msgstr "" diff --git a/core/priv/gettext/nl/LC_MESSAGES/eyra-data-donation.po b/core/priv/gettext/nl/LC_MESSAGES/eyra-data-donation.po index ebbc377df..ebb7d6837 100644 --- a/core/priv/gettext/nl/LC_MESSAGES/eyra-data-donation.po +++ b/core/priv/gettext/nl/LC_MESSAGES/eyra-data-donation.po @@ -9,43 +9,3 @@ msgid "" msgstr "" "Language: nl\n" - -#, elixir-autogen, elixir-format -msgid "config.nrofsubjects.label" -msgstr "Aantal gewenste deelnemers" - -#, elixir-autogen, elixir-format, fuzzy -msgid "task.description.label" -msgstr "Beschrijving" - -#, elixir-autogen, elixir-format -msgid "task.title.label" -msgstr "Titel" - -#, elixir-autogen, elixir-format, fuzzy -msgid "task.list.hint" -msgstr "Verander volgorde met de pijltjes" - -#, elixir-autogen, elixir-format, fuzzy -msgid "task.platform.label" -msgstr "Organisatie" - -#, elixir-autogen, elixir-format -msgid "pdf-replace-file-button" -msgstr "Vervang PDF" - -#, elixir-autogen, elixir-format -msgid "pdf-select-file-button" -msgstr "Kies PDF" - -#, elixir-autogen, elixir-format -msgid "pdf-select-placeholder" -msgstr "Kies een pdf bestand" - -#, elixir-autogen, elixir-format -msgid "add.to.button" -msgstr "Voeg toe" - -#, elixir-autogen, elixir-format, fuzzy -msgid "pdf-select-label" -msgstr "Handleiding" diff --git a/core/priv/gettext/nl/LC_MESSAGES/eyra-document.po b/core/priv/gettext/nl/LC_MESSAGES/eyra-document.po index 1d394c532..e387cf81a 100644 --- a/core/priv/gettext/nl/LC_MESSAGES/eyra-document.po +++ b/core/priv/gettext/nl/LC_MESSAGES/eyra-document.po @@ -46,3 +46,7 @@ msgstr "Handleiding" #, elixir-autogen, elixir-format msgid "pdf-select-placeholder" msgstr "Kies een pdf bestand" + +#, elixir-autogen, elixir-format, fuzzy +msgid "component.title" +msgstr "Handleiding" diff --git a/core/priv/gettext/nl/LC_MESSAGES/eyra-enums.po b/core/priv/gettext/nl/LC_MESSAGES/eyra-enums.po index 05f8c6afa..714599c21 100644 --- a/core/priv/gettext/nl/LC_MESSAGES/eyra-enums.po +++ b/core/priv/gettext/nl/LC_MESSAGES/eyra-enums.po @@ -337,3 +337,15 @@ msgstr "Leeg" #, elixir-autogen, elixir-format, fuzzy msgid "templates.data_donation" msgstr "Online studie" + +#, elixir-autogen, elixir-format, fuzzy +msgid "platforms.apple" +msgstr "Apple" + +#, elixir-autogen, elixir-format, fuzzy +msgid "platforms.samsung" +msgstr "Samsung" + +#, elixir-autogen, elixir-format, fuzzy +msgid "platforms.tiktok" +msgstr "TikTok" diff --git a/core/priv/gettext/nl/LC_MESSAGES/eyra-marketplace.po b/core/priv/gettext/nl/LC_MESSAGES/eyra-marketplace.po index 575be82f4..3012b5c24 100644 --- a/core/priv/gettext/nl/LC_MESSAGES/eyra-marketplace.po +++ b/core/priv/gettext/nl/LC_MESSAGES/eyra-marketplace.po @@ -18,10 +18,6 @@ msgstr "Op dit moment zijn er geen onderzoeksstudies beschikbaar. Zodra er een s msgid "empty.title" msgstr "Op zoek naar een studie?" -#, elixir-autogen, elixir-format -msgid "reward.label" -msgstr "Beloning: %{value} credits" - #, elixir-autogen, elixir-format msgid "assignment.status.complete.label" msgstr "Gesloten" @@ -30,10 +26,6 @@ msgstr "Gesloten" msgid "assignment.status.completed.label" msgstr "Afgerond" -#, elixir-autogen, elixir-format -msgid "assignment.status.expired.label" -msgstr "Verlopen" - #, elixir-autogen, elixir-format msgid "assignment.status.pending.label" msgstr "Aangemeld" diff --git a/core/priv/gettext/nl/LC_MESSAGES/eyra-workflow.po b/core/priv/gettext/nl/LC_MESSAGES/eyra-workflow.po index 190391671..320598f43 100644 --- a/core/priv/gettext/nl/LC_MESSAGES/eyra-workflow.po +++ b/core/priv/gettext/nl/LC_MESSAGES/eyra-workflow.po @@ -80,9 +80,9 @@ msgid "tabbar.item.workflow.forward" msgstr "Ga naar Werklijst" #, elixir-autogen, elixir-format, fuzzy -msgid "item.questionaire.description" +msgid "item.questionnaire.description" msgstr "Stuurt deelnemers naar een online vragenlijst." #, elixir-autogen, elixir-format, fuzzy -msgid "item.questionaire.title" +msgid "item.questionnaire.title" msgstr "Vragenlijst" diff --git a/core/systems/alliance/_public.ex b/core/systems/alliance/_public.ex index b3c18a8cd..6585a5fef 100644 --- a/core/systems/alliance/_public.ex +++ b/core/systems/alliance/_public.ex @@ -32,6 +32,7 @@ defmodule Systems.Alliance.Public do import Ecto.Query, warn: false alias Ecto.Multi alias Core.Repo + alias Core.Authorization alias Frameworks.{ Signal @@ -59,7 +60,7 @@ defmodule Systems.Alliance.Public do @doc """ Creates a alliance_tool. """ - def prepare_tool(attrs, auth_node \\ Core.Authorization.make_node()) do + def prepare_tool(attrs, auth_node \\ Authorization.prepare_node()) do %Alliance.ToolModel{} |> Alliance.ToolModel.changeset(:mount, attrs) |> Ecto.Changeset.put_assoc(:auth_node, auth_node) diff --git a/core/systems/alliance/controller.ex b/core/systems/alliance/controller.ex new file mode 100644 index 000000000..fab592c9d --- /dev/null +++ b/core/systems/alliance/controller.ex @@ -0,0 +1,8 @@ +defmodule Systems.Alliance.Controller do + use CoreWeb, :controller + + def callback(conn, %{"id" => _id}) do + conn + |> redirect(to: "/assignment/#{1}") + end +end diff --git a/core/systems/alliance/tool_form.ex b/core/systems/alliance/tool_form.ex index f3edadc7f..cb997e225 100644 --- a/core/systems/alliance/tool_form.ex +++ b/core/systems/alliance/tool_form.ex @@ -3,12 +3,10 @@ defmodule Systems.Alliance.ToolForm do import CoreWeb.UI.StepIndicator - alias Phoenix.LiveView alias Frameworks.Pixel.Panel alias Frameworks.Pixel.Text import Frameworks.Pixel.Form alias Frameworks.Pixel.Button - alias Frameworks.Concept.Directable alias Systems.{ Alliance @@ -20,16 +18,11 @@ defmodule Systems.Alliance.ToolForm do %{ id: id, entity: entity, - uri_origin: uri_origin, + callback_url: callback_url, user: user }, socket ) do - callback_path = - CoreWeb.Router.Helpers.live_path(socket, Systems.Alliance.CallbackPage, entity.id) - - callback_url = uri_origin <> callback_path - changeset = Alliance.ToolModel.changeset(entity, :create, %{}) { @@ -48,25 +41,25 @@ defmodule Systems.Alliance.ToolForm do # Handle Events - @impl true - def handle_event( - "test-roundtrip", - _params, - %{assigns: %{user: user, changeset: changeset, entity: entity}} = socket - ) do - changeset = Alliance.ToolModel.validate(changeset, :roundtrip) + # @impl true + # def handle_event( + # "test-roundtrip", + # _params, + # %{assigns: %{user: user, changeset: changeset, entity: entity}} = socket + # ) do + # changeset = Alliance.ToolModel.validate(changeset, :roundtrip) - if changeset.valid? do - Directable.director(entity).assign_tester_role(entity, user) + # if changeset.valid? do + # Directable.director(entity).assign_tester_role(entity, user) - fake_panl_id = "TEST-" <> Faker.UUID.v4() - external_path = Alliance.ToolModel.external_path(entity, fake_panl_id) + # fake_panl_id = "TEST-" <> Faker.UUID.v4() + # external_path = Alliance.ToolModel.external_path(entity, fake_panl_id) - {:noreply, LiveView.redirect(socket, external: external_path)} - else - {:noreply, socket |> assign(changeset: changeset)} - end - end + # {:noreply, LiveView.redirect(socket, external: external_path)} + # else + # {:noreply, socket |> assign(changeset: changeset)} + # end + # end @impl true def handle_event("save", %{"tool_model" => attrs}, %{assigns: %{entity: entity}} = socket) do @@ -77,6 +70,14 @@ defmodule Systems.Alliance.ToolForm do } end + @impl true + def handle_event("change", _, socket) do + { + :noreply, + socket + } + end + # Saving def save(socket, entity, type, attrs) do @@ -194,24 +195,6 @@ defmodule Systems.Alliance.ToolForm do <.spacing value="L" /> <.url_input form={form} field={:url} label_text={dgettext("eyra-alliance", "config.url.label")} /> - <.spacing value="S" /> - - <%= dgettext("eyra-alliance", "test.roundtrip.title") %> - <.spacing value="M" /> - <%= dgettext("eyra-alliance", "test.roundtrip.text") %> - <.spacing value="M" /> - <.wrap> - - - <.spacing value="XL" />
diff --git a/core/systems/alliance/tool_model.ex b/core/systems/alliance/tool_model.ex index 52b98c062..a20234c9e 100644 --- a/core/systems/alliance/tool_model.ex +++ b/core/systems/alliance/tool_model.ex @@ -25,6 +25,10 @@ defmodule Systems.Alliance.ToolModel do def id(tool), do: tool.auth_node_id end + defimpl Frameworks.Concept.Directable do + def director(%{director: director}), do: Frameworks.Concept.System.director(director) + end + @operational_fields ~w(url)a @fields @operational_fields @required_fields ~w()a @@ -172,6 +176,7 @@ defmodule Systems.Alliance.ToolModel do def open_label(_), do: dgettext("eyra-alliance", "open.cta.title") def ready?(tool), do: Alliance.ToolModel.ready?(tool) def form(_), do: Alliance.ToolForm + def launcher(%{url: url}), do: %{url: url} def task_labels(_) do %{ diff --git a/core/systems/alliance/work_view.ex b/core/systems/alliance/work_view.ex new file mode 100644 index 000000000..9fd103d6f --- /dev/null +++ b/core/systems/alliance/work_view.ex @@ -0,0 +1,15 @@ +defmodule Systems.Alliance.WorkView do + use CoreWeb, :html + + attr(:url, :string, required: true) + + def work_view(assigns) do + ~H""" +
+
+ -
-
+ <.stripped menus={@menus} footer?={false}> + <.app_view url={@app_url} /> + """ end @impl true - def handle_event("app_event", params, socket) do - {:noreply, assign(socket, :error, "Unsupported message: #{inspect(params)}")} + def handle_event("app_event", %{"__type__" => type, "json_string" => event}, socket) do + { + :noreply, + socket |> handle(type, event) + } + end + + @impl true + def handle_event("app_event", event, socket) do + { + :noreply, + socket |> handle(nil, inspect(event)) + } + end + + defp handle(socket, "CommandSystemDonate", event) do + Frameworks.Pixel.Flash.put_error(socket, "Unsupported donation " <> event) + end + + defp handle(socket, _, event) do + Frameworks.Pixel.Flash.put_error(socket, "Unsupported " <> event) end end diff --git a/core/systems/feldspar/app_view.ex b/core/systems/feldspar/app_view.ex new file mode 100644 index 000000000..4ec810bab --- /dev/null +++ b/core/systems/feldspar/app_view.ex @@ -0,0 +1,19 @@ +defmodule Systems.Feldspar.AppView do + use CoreWeb, :html + + attr(:url, :string, required: true) + + def app_view(assigns) do + ~H""" +
+ <%!-- Ensure that updates don't alter the hierarchy in front of the iframe. + Changing the preceding siblings of the iframe would result in a reload of the iframe + due to Morphdom (https://github.com/patrick-steele-idem/morphdom/issues/200). + --%> +
+ +
+
+ """ + end +end diff --git a/core/systems/feldspar/local_fs.ex b/core/systems/feldspar/local_fs.ex index 114360def..96c168601 100644 --- a/core/systems/feldspar/local_fs.ex +++ b/core/systems/feldspar/local_fs.ex @@ -14,7 +14,7 @@ defmodule Systems.Feldspar.LocalFS do end def get_public_url(id) do - "#{Endpoint.url()}/#{static_path()}/#{id}" + "#{Endpoint.url()}/#{public_path()}/#{id}" end def remove(id) do @@ -33,5 +33,5 @@ defmodule Systems.Feldspar.LocalFS do |> Access.fetch!(:local_fs_root_path) end - def static_path, do: "/feldspar_apps" + def public_path, do: "/feldspar/apps" end diff --git a/core/systems/feldspar/plugs.ex b/core/systems/feldspar/plug.ex similarity index 80% rename from core/systems/feldspar/plugs.ex rename to core/systems/feldspar/plug.ex index 3fa8a29e0..8fd01567d 100644 --- a/core/systems/feldspar/plugs.ex +++ b/core/systems/feldspar/plug.ex @@ -3,7 +3,7 @@ defmodule Systems.Feldspar.Plug do defmacro setup() do quote do - plug(Systems.Feldspar.Plug, at: Systems.Feldspar.LocalFS.static_path()) + plug(Systems.Feldspar.Plug, at: Systems.Feldspar.LocalFS.public_path()) end end @@ -20,7 +20,7 @@ defmodule Systems.Feldspar.Plug do conn, options ) do - call(Systems.Feldspar.Internal.get_backend(), conn, options) + call(Systems.Feldspar.Private.get_backend(), conn, options) end def call(Systems.Feldspar.LocalFS, conn, options) do diff --git a/core/systems/feldspar/tool_form.ex b/core/systems/feldspar/tool_form.ex index e53ab1213..5342aba47 100644 --- a/core/systems/feldspar/tool_form.ex +++ b/core/systems/feldspar/tool_form.ex @@ -11,8 +11,12 @@ defmodule Systems.Feldspar.ToolForm do %{assigns: %{entity: entity}} = socket, {_local_relative_path, local_full_path, remote_file} ) do + archive_ref = + Feldspar.Public.store(local_full_path) + |> Feldspar.Public.get_public_url() + socket - |> save(entity, %{archive_ref: local_full_path, archive_name: remote_file}) + |> save(entity, %{archive_ref: archive_ref, archive_name: remote_file}) end @impl true diff --git a/core/systems/feldspar/tool_model.ex b/core/systems/feldspar/tool_model.ex index 05de500b5..b9d68fd46 100644 --- a/core/systems/feldspar/tool_model.ex +++ b/core/systems/feldspar/tool_model.ex @@ -47,6 +47,15 @@ defmodule Systems.Feldspar.ToolModel do def ready?(tool), do: Feldspar.ToolModel.ready?(tool) def form(_), do: Feldspar.ToolForm + def launcher(%{archive_ref: archive_ref}) when is_binary(archive_ref) do + %{ + function: &Feldspar.AppView.app_view/1, + props: %{url: archive_ref <> "/index.html"} + } + end + + def launcher(_), do: nil + def task_labels(_) do %{ pending: dgettext("eyra-feldspar", "pending.label"), diff --git a/core/systems/lab/_public.ex b/core/systems/lab/_public.ex index 45c8eeba0..c27277079 100644 --- a/core/systems/lab/_public.ex +++ b/core/systems/lab/_public.ex @@ -23,7 +23,7 @@ defmodule Systems.Lab.Public do |> filter_double_time_slots() end - def prepare_tool(attrs, auth_node \\ Core.Authorization.make_node()) do + def prepare_tool(attrs, auth_node \\ Core.Authorization.prepare_node()) do %Lab.ToolModel{} |> Lab.ToolModel.changeset(:mount, attrs) |> Ecto.Changeset.put_assoc(:auth_node, auth_node) diff --git a/core/systems/lab/tool_model.ex b/core/systems/lab/tool_model.ex index cb61dd806..c7be6c7d0 100644 --- a/core/systems/lab/tool_model.ex +++ b/core/systems/lab/tool_model.ex @@ -83,6 +83,7 @@ defmodule Systems.Lab.ToolModel do def open_label(_), do: dgettext("link-lab", "open.cta.title") def ready?(tool), do: Lab.ToolModel.ready?(tool) def form(_), do: Lab.Form + def launcher(_), do: %{function: fn _ -> nil end, props: %{}} def task_labels(_) do %{ diff --git a/core/systems/next_action/_public.ex b/core/systems/next_action/_public.ex index 132d40dd5..cf2611bac 100644 --- a/core/systems/next_action/_public.ex +++ b/core/systems/next_action/_public.ex @@ -71,7 +71,7 @@ defmodule Systems.NextAction.Public do conflict_target: {:unsafe_fragment, conflict_target_fragment} ) |> tap( - &Signal.Public.dispatch!(:next_action_created, %{ + &Signal.Public.dispatch!({:next_action, :created}, %{ action_type: action, user: user, action: &1, @@ -94,7 +94,11 @@ defmodule Systems.NextAction.Public do |> where_key_is(key) |> Repo.delete_all() |> tap(fn _ -> - Signal.Public.dispatch!(:next_action_cleared, %{user: user, action_type: action, key: key}) + Signal.Public.dispatch!({:next_action, :cleared}, %{ + user: user, + action_type: action, + key: key + }) end) end diff --git a/core/systems/next_action/_switch.ex b/core/systems/next_action/_switch.ex index 2eb1b9fe9..9aa82a4ab 100644 --- a/core/systems/next_action/_switch.ex +++ b/core/systems/next_action/_switch.ex @@ -5,11 +5,11 @@ defmodule Systems.NextAction.Switch do NextAction } - def intercept(:next_action_created, %{user: user, action: _action}) do + def intercept({:next_action, :created}, %{user: user, action: _action}) do NextAction.Presenter.update(user, user, NextAction.OverviewPage) end - def intercept(:next_action_cleared, %{user: user, action_type: _action_type}) do + def intercept({:next_action, :cleared}, %{user: user, action_type: _action_type}) do NextAction.Presenter.update(user, user, NextAction.OverviewPage) end end diff --git a/core/systems/notification/_public.ex b/core/systems/notification/_public.ex index a7831508a..fc45e8437 100644 --- a/core/systems/notification/_public.ex +++ b/core/systems/notification/_public.ex @@ -102,7 +102,7 @@ defmodule Systems.Notification.Public do {:ok, box} = %Box{} |> Box.changeset(%{}) - |> Ecto.Changeset.put_assoc(:auth_node, Authorization.make_node()) + |> Ecto.Changeset.put_assoc(:auth_node, Authorization.prepare_node()) |> Repo.insert() |> Authorization.assign_role(user, :owner) diff --git a/core/systems/project/_assembly.ex b/core/systems/project/_assembly.ex index 90f6e64b9..1979da06f 100644 --- a/core/systems/project/_assembly.ex +++ b/core/systems/project/_assembly.ex @@ -13,7 +13,7 @@ defmodule Systems.Project.Assembly do } def delete(%Project.Model{auth_node: %{id: node_id}}) do - from(ra in Core.Authorization.RoleAssignment, + from(ra in Authorization.RoleAssignment, where: ra.node_id == ^node_id ) |> Repo.delete_all() @@ -27,25 +27,21 @@ defmodule Systems.Project.Assembly do end def create(name, user, :empty) do - project = prepare_project(name, []) + project = prepare_project(name, [], user) Multi.new() - |> Multi.put(:user, user) |> Multi.insert(:project, project) - |> EctoHelper.run(:assign_role, &assign_role/1) |> Repo.transaction() end def create(name, user, template) do items = prepare_items(template) - project = prepare_project(name, items) + project = prepare_project(name, items, user) Multi.new() - |> Multi.put(:user, user) |> Multi.insert(:project, project) |> EctoHelper.run(:auth, &update_auth/2) |> EctoHelper.run(:path, &update_path/2) - |> EctoHelper.run(:assign_role, &assign_role/1) |> Repo.transaction() end @@ -71,8 +67,8 @@ defmodule Systems.Project.Assembly do # PREPARE - defp prepare_project(name, items) when is_list(items) do - Project.Public.prepare(%{name: name}, items) + defp prepare_project(name, items, user) when is_list(items) do + Project.Public.prepare(%{name: name}, items, user) end defp prepare_items(:data_donation) do @@ -167,26 +163,22 @@ defmodule Systems.Project.Assembly do # AUTHORIZATION - def assign_role(%{user: user, project: project}) do - {:ok, Authorization.assign_role(user, project, :owner)} - end - def update_auth(multi, %{project: project}), do: update_auth(multi, project) def update_auth(multi, %{node: node}), do: update_auth(multi, node) def update_auth(multi, %{item: item}), do: update_auth(multi, item) def update_auth(multi, %Project.Model{} = project) do auth_tree = Project.Model.auth_tree(project) - Core.Authorization.link(multi, auth_tree) + Authorization.link(multi, auth_tree) end def update_auth(multi, %Project.NodeModel{} = project) do auth_tree = Project.NodeModel.auth_tree(project) - Core.Authorization.link(multi, auth_tree) + Authorization.link(multi, auth_tree) end def update_auth(multi, %Project.ItemModel{} = project) do auth_tree = Project.ItemModel.auth_tree(project) - Core.Authorization.link(multi, auth_tree) + Authorization.link(multi, auth_tree) end end diff --git a/core/systems/project/_public.ex b/core/systems/project/_public.ex index e9e28f982..420e87ca4 100644 --- a/core/systems/project/_public.ex +++ b/core/systems/project/_public.ex @@ -62,11 +62,11 @@ defmodule Systems.Project.Public do |> Repo.one() end - def get_tool_refs_by_tool(%{id: id} = tool, preload \\ []) do + def get_tool_ref_by_tool(%{id: id} = tool, preload \\ []) do field = Project.ToolRefModel.tool_id_field(tool) query_tool_refs_by_tool(id, field, preload) - |> Repo.all() + |> Repo.one() end def query_tool_refs_by_tool(tool_id, field, preload \\ []) @@ -109,20 +109,21 @@ defmodule Systems.Project.Public do def prepare( %{name: _name} = attrs, - items + items, + user ) when is_list(items) do {:ok, root} = prepare_node(%{name: "Project", project_path: []}, items) |> Ecto.Changeset.apply_action(:prepare) - prepare(attrs, root) + prepare(attrs, root, Authorization.prepare_node(user, :owner)) end def prepare( %{name: _name} = attrs, %Project.NodeModel{} = root, - %Authorization.Node{} = auth_node \\ Authorization.make_node() + %Authorization.Node{} = auth_node ) do %Project.Model{} |> Project.Model.changeset(attrs) @@ -133,7 +134,7 @@ defmodule Systems.Project.Public do def prepare_node( %{name: _, project_path: _} = attrs, items, - auth_node \\ Authorization.make_node() + auth_node \\ Authorization.prepare_node() ) when is_list(items) do %Project.NodeModel{} diff --git a/core/systems/project/_switch.ex b/core/systems/project/_switch.ex index b9aad0836..a5a5fc15a 100644 --- a/core/systems/project/_switch.ex +++ b/core/systems/project/_switch.ex @@ -43,8 +43,8 @@ defmodule Systems.Project.Switch do end defp handle({:tool, signal}, %{tool: tool} = message) do - Project.Public.get_tool_refs_by_tool(tool) - |> Enum.each(&dispatch!({:tool_ref, signal}, Map.merge(message, %{tool_ref: &1}))) + Project.Public.get_tool_ref_by_tool(tool) + |> then(&dispatch!({:tool_ref, signal}, Map.merge(message, %{tool_ref: &1}))) end defp update_pages(%Project.ItemModel{} = item) do diff --git a/core/systems/project/overview_page.ex b/core/systems/project/overview_page.ex index 99b483671..47aa9ef44 100644 --- a/core/systems/project/overview_page.ex +++ b/core/systems/project/overview_page.ex @@ -152,6 +152,14 @@ defmodule Systems.Project.OverviewPage do } end + @impl true + def handle_info(%{auto_save: _status}, socket) do + { + :noreply, + socket + } + end + @impl true def handle_info({:handle_auto_save_done, :project_overview_popup}, socket) do { diff --git a/core/systems/project/tool_ref_view.ex b/core/systems/project/tool_ref_view.ex new file mode 100644 index 000000000..724461531 --- /dev/null +++ b/core/systems/project/tool_ref_view.ex @@ -0,0 +1,29 @@ +defmodule Systems.Project.ToolRefView do + use CoreWeb, :html + + alias Frameworks.Concept + + alias Systems.{ + Project + } + + defp get_tool(tool_ref), do: Project.ToolRefModel.tool(tool_ref) + defp get_work(tool), do: Concept.ToolModel.launcher(tool) + + attr(:tool_ref, :map, required: true) + attr(:task, :map, required: true) + + def tool_ref_view(%{tool_ref: tool_ref} = assigns) do + assigns = + tool_ref + |> get_tool() + |> get_work() + |> then(&assign(assigns, :work, &1)) + + ~H""" +
+ <.function_component function={@work.function} props={@work.props} /> +
+ """ + end +end diff --git a/core/systems/workflow/builder_view.ex b/core/systems/workflow/builder_view.ex index a3258517f..ef375a8b6 100644 --- a/core/systems/workflow/builder_view.ex +++ b/core/systems/workflow/builder_view.ex @@ -71,9 +71,8 @@ defmodule Systems.Workflow.BuilderView do } end - defp order_items(%{assigns: %{workflow: %{items: items}}} = socket) do - ordered_items = Enum.sort_by(items, & &1.position) - assign(socket, ordered_items: ordered_items) + defp order_items(%{assigns: %{workflow: workflow}} = socket) do + assign(socket, ordered_items: Workflow.Model.ordered_items(workflow)) end defp update_item_types(%{assigns: %{ordered_items: ordered_items}} = socket) do diff --git a/core/systems/workflow/item_cell.ex b/core/systems/workflow/item_cell.ex index c98733a63..6cefde422 100644 --- a/core/systems/workflow/item_cell.ex +++ b/core/systems/workflow/item_cell.ex @@ -49,11 +49,11 @@ defmodule Systems.Workflow.ItemCell do {:noreply, socket} end - defp update_item_view(%{assigns: %{item: %{title: title}}} = socket) do + defp update_item_view(%{assigns: %{item: %{title: _title}}} = socket) do item_view = %{ function: &Workflow.ItemViews.collapsed/1, props: %{ - title: title, + # title: title, inner_block: nil } } @@ -77,17 +77,26 @@ defmodule Systems.Workflow.ItemCell do end defp update_tool_form( - %{assigns: %{id: id, item: %{tool_ref: tool_ref}, user: user, uri_origin: uri_origin}} = - socket + %{ + assigns: %{ + id: id, + item: %{id: item_id, tool_ref: tool_ref}, + user: user, + uri_origin: uri_origin + } + } = socket ) do tool = Project.ToolRefModel.flatten(tool_ref) tool_form_module = Concept.ToolModel.form(tool) + callback_path = ~p"/assignment/callback/#{item_id}" + callback_url = uri_origin <> callback_path + tool_form = %{ id: "#{id}_tool_form", module: tool_form_module, entity: tool, - uri_origin: uri_origin, + callback_url: callback_url, user: user } diff --git a/core/systems/workflow/item_form.ex b/core/systems/workflow/item_form.ex index 8e095c0dd..8b64ea522 100644 --- a/core/systems/workflow/item_form.ex +++ b/core/systems/workflow/item_form.ex @@ -57,6 +57,14 @@ defmodule Systems.Workflow.ItemForm do } end + @impl true + def handle_event("change", _params, socket) do + { + :noreply, + socket + } + end + # Saving def save(socket, %Workflow.ItemModel{} = entity, attrs) do diff --git a/core/systems/workflow/items_views.ex b/core/systems/workflow/item_views.ex similarity index 57% rename from core/systems/workflow/items_views.ex rename to core/systems/workflow/item_views.ex index 8636f5aa2..b4e8c41d2 100644 --- a/core/systems/workflow/items_views.ex +++ b/core/systems/workflow/item_views.ex @@ -1,10 +1,18 @@ defmodule Systems.Workflow.ItemViews do use CoreWeb, :html - alias Systems.Workflow alias Frameworks.Pixel.Panel alias Frameworks.Pixel.Align + import CoreWeb.UI.StepIndicator + + alias Systems.{ + Workflow, + Project + } + + import Project.ToolRefView + attr(:title, :string, required: true) attr(:description, :string, required: true) attr(:items, :list, required: true) @@ -47,6 +55,69 @@ defmodule Systems.Workflow.ItemViews do """ end + attr(:items, :list, required: true) + attr(:selected_item_id, :integer, required: true) + + def work_list(assigns) do + ~H""" +
+ <%= for {item, index} <- Enum.with_index(@items) do %> + <.work_item {item} index={index} selected?={item.id == @selected_item_id} /> + <% end %> +
+ """ + end + + attr(:id, :any, required: true) + attr(:title, :map, required: true) + attr(:icon, :string, required: true) + attr(:status, :atom, default: :pending) + attr(:index, :integer, required: true) + attr(:selected?, :boolean, default: true) + attr(:event, :string, default: "work_item_selected") + + def work_item(assigns) do + ~H""" +
+
+ +
+ <%= if @status == :pending do %> + <.step_indicator bg_color="bg-grey4" text={@index+1} /> + <% else %> +
+ ready +
+ <% end %> + <%= @title %> +
+ <%= if @icon do %> +
+ {@icon} +
+ <% end %> +
+
+
+
+ """ + end + + attr(:item, :map, required: true) + attr(:task, :map, required: true) + + def launcher(%{item: %{tool_ref: tool_ref}} = assigns) when not is_nil(tool_ref) do + ~H""" +
+ <.tool_ref_view tool_ref={@item.tool_ref} task={@task} /> +
+ """ + end + defp relative_position(0, _count), do: :top defp relative_position(position, count) when position == count - 1, do: :bottom defp relative_position(_position, _count), do: :middle @@ -89,6 +160,7 @@ defmodule Systems.Workflow.ItemViews do def collapsed(assigns) do ~H"""
+ <%= if @title do %> <%= @title %> <.spacing value="M" /> diff --git a/core/systems/workflow/model.ex b/core/systems/workflow/model.ex index 29161cb71..f93c19026 100644 --- a/core/systems/workflow/model.ex +++ b/core/systems/workflow/model.ex @@ -42,4 +42,8 @@ defmodule Systems.Workflow.Model do def flatten(%{items: items}) do Enum.map(items, &Workflow.ItemModel.flatten/1) end + + def ordered_items(%Workflow.Model{items: items}) do + Enum.sort_by(items, & &1.position) + end end diff --git a/core/systems/workflow/platforms.ex b/core/systems/workflow/platforms.ex index ccf30a167..b03b2eb74 100644 --- a/core/systems/workflow/platforms.ex +++ b/core/systems/workflow/platforms.ex @@ -7,9 +7,12 @@ defmodule Systems.Workflow.Platforms do [ :facebook, :instagram, + :tiktok, :twitter, :google, :youtube, - :whatsapp + :whatsapp, + :apple, + :samsung ]} end diff --git a/core/test/frameworks/signal/test_helper.ex b/core/test/frameworks/signal/test_helper.ex index 390a2e3d2..48759d3d7 100644 --- a/core/test/frameworks/signal/test_helper.ex +++ b/core/test/frameworks/signal/test_helper.ex @@ -10,7 +10,7 @@ defmodule Frameworks.Signal.TestHelper do defmacro refute_signal_dispatched(signal) do quote bind_quoted: [signal: signal] do - refute_received({:signal_test, {^signal, _}}) + refute_received({:signal_test, {^signal, _}}, 1000) end end diff --git a/core/test/systems/assignment/_public_test.exs b/core/test/systems/assignment/_public_test.exs index 8afc79b8f..df5e1424e 100644 --- a/core/test/systems/assignment/_public_test.exs +++ b/core/test/systems/assignment/_public_test.exs @@ -313,7 +313,7 @@ defmodule Systems.Assignment.PublicTest do Crew.Public.reject_task(task_id, %{category: :other, message: "rejected"}) - assert_next_action(user, "/assignment/#{id}") + assert_next_action(user, "/assignment/#{id}/landing") end test "next_action cleared after acceptence of task" do @@ -325,7 +325,7 @@ defmodule Systems.Assignment.PublicTest do Crew.Public.reject_task(task_id, %{category: :other, message: "rejected"}) Crew.Public.accept_task(task_id) - refute_next_action(user, "/assignment/#{id}") + refute_next_action(user, "/assignment/#{id}/landing") end test "exclude/2" do diff --git a/core/test/systems/campaign/_public_test.exs b/core/test/systems/campaign/_public_test.exs index 6a55400b1..4f3826c65 100644 --- a/core/test/systems/campaign/_public_test.exs +++ b/core/test/systems/campaign/_public_test.exs @@ -285,6 +285,8 @@ defmodule Systems.Campaign.PublicTest do # accept task should send signal to campaign to reward student Crew.Public.accept_task(task) + Bookkeeping.Public.list_accounts(["wallet"]) + assert Enum.empty?(Bookkeeping.Public.list_accounts(["wallet"])) assert Enum.empty?(Bookkeeping.Public.list_entries({:wallet, "fake_currency", student.id})) diff --git a/core/test/systems/campaign/monitor_view_test.exs b/core/test/systems/campaign/monitor_view_test.exs index d61ed6987..67643e952 100644 --- a/core/test/systems/campaign/monitor_view_test.exs +++ b/core/test/systems/campaign/monitor_view_test.exs @@ -1,8 +1,7 @@ defmodule Systems.Campaign.MonitorViewTest do - use CoreWeb.ConnCase, async: false + use CoreWeb.ConnCase, async: true import Phoenix.ConnTest import Phoenix.LiveViewTest - import Frameworks.Signal.TestHelper import ExUnit.Assertions @@ -32,12 +31,16 @@ defmodule Systems.Campaign.MonitorViewTest do %{id: id, promotable_assignment: %{crew: crew}} = Campaign.Factories.create_campaign(user, :accepted, 1) - {:ok, %{task: task}} = Crew.Public.apply_member(crew, user, ["task1"]) + {:ok, %{crew_task: task}} = Crew.Public.apply_member(crew, user, ["task1"]) - Crew.Public.update_task(task, %{ - started_at: Timestamp.naive_from_now(-60), - expire_at: Timestamp.naive_from_now(-31) - }) + Crew.Public.update_task( + task, + %{ + started_at: Timestamp.naive_from_now(-60), + expire_at: Timestamp.naive_from_now(-31) + }, + :locked + ) {:ok, _view, html} = live(conn, Routes.live_path(conn, Campaign.ContentPage, id)) @@ -57,12 +60,16 @@ defmodule Systems.Campaign.MonitorViewTest do %{id: id, promotable_assignment: %{crew: crew}} = Campaign.Factories.create_campaign(user, :accepted, 1) - {:ok, %{task: task}} = Crew.Public.apply_member(crew, user, ["task1"]) + {:ok, %{crew_task: task}} = Crew.Public.apply_member(crew, user, ["task1"]) - Crew.Public.update_task(task, %{ - started_at: Timestamp.naive_from_now(-60), - expire_at: Timestamp.naive_from_now(-31) - }) + Crew.Public.update_task( + task, + %{ + started_at: Timestamp.naive_from_now(-60), + expire_at: Timestamp.naive_from_now(-31) + }, + :locked + ) {:ok, view, _html} = live(conn, Routes.live_path(conn, Campaign.ContentPage, id)) @@ -81,20 +88,27 @@ defmodule Systems.Campaign.MonitorViewTest do %{id: id, promotable_assignment: %{crew: crew}} = Campaign.Factories.create_campaign(user, :accepted, 1) - {:ok, %{task: task}} = Crew.Public.apply_member(crew, user, ["task1"]) + {:ok, %{crew_task: task}} = Crew.Public.apply_member(crew, user, ["task1"]) - Crew.Public.update_task(task, %{ - started_at: Timestamp.naive_from_now(-60), - expire_at: Timestamp.naive_from_now(-31) - }) + Crew.Public.update_task( + task, + %{ + started_at: Timestamp.naive_from_now(-60), + expire_at: Timestamp.naive_from_now(-31) + }, + :locked + ) - {:ok, view, _html} = live(conn, Routes.live_path(conn, Campaign.ContentPage, id)) + {:ok, view, html} = live(conn, Routes.live_path(conn, Campaign.ContentPage, id)) + + html =~ "Goedgekeurd0" - view - |> element("[phx-click=\"accept\"]") - |> render_click() + html = + view + |> element("[phx-click=\"accept\"]") + |> render_click() - assert_signals_dispatched({:crew_task, :updated}, 1) + html =~ "Goedgekeurd1" end test "Member applied but expired and not completed: accept_all", %{ @@ -103,29 +117,39 @@ defmodule Systems.Campaign.MonitorViewTest do %{id: id, promotable_assignment: %{crew: crew}} = Campaign.Factories.create_campaign(user, :accepted, 2) - {:ok, %{task: task}} = Crew.Public.apply_member(crew, user, ["task1"]) + {:ok, %{crew_task: task}} = Crew.Public.apply_member(crew, user, ["task1"]) - Crew.Public.update_task(task, %{ - started_at: Timestamp.naive_from_now(-60), - expire_at: Timestamp.naive_from_now(-31) - }) + Crew.Public.update_task( + task, + %{ + started_at: Timestamp.naive_from_now(-60), + expire_at: Timestamp.naive_from_now(-31) + }, + :locked + ) user2 = Factories.insert!(:member) - {:ok, %{task: task2}} = Crew.Public.apply_member(crew, user2, ["task2"]) + {:ok, %{crew_task: task2}} = Crew.Public.apply_member(crew, user2, ["task2"]) - Crew.Public.update_task(task2, %{ - started_at: Timestamp.naive_from_now(-60), - expire_at: Timestamp.naive_from_now(-31) - }) + Crew.Public.update_task( + task2, + %{ + started_at: Timestamp.naive_from_now(-60), + expire_at: Timestamp.naive_from_now(-31) + }, + :locked + ) - {:ok, view, _html} = live(conn, Routes.live_path(conn, Campaign.ContentPage, id)) + {:ok, view, html} = live(conn, Routes.live_path(conn, Campaign.ContentPage, id)) - _html = + html =~ "Goedgekeurd0" + + html = view |> element("[phx-click=\"accept_all_pending_started\"]") |> render_click() - assert_signals_dispatched({:crew_task, :updated}, 2) + html =~ "Goedgekeurd2" end test "Member completed: accept_all", %{ @@ -134,36 +158,46 @@ defmodule Systems.Campaign.MonitorViewTest do %{id: id, promotable_assignment: %{crew: crew}} = Campaign.Factories.create_campaign(user, :accepted, 2) - {:ok, %{task: task}} = Crew.Public.apply_member(crew, user, ["task1"]) + {:ok, %{crew_task: task}} = Crew.Public.apply_member(crew, user, ["task1"]) - Crew.Public.update_task(task, %{ - status: :completed, - completed_at: Timestamp.naive_now() - }) + Crew.Public.update_task( + task, + %{ + status: :completed, + completed_at: Timestamp.naive_now() + }, + :locked + ) user2 = Factories.insert!(:member) - {:ok, %{task: task2}} = Crew.Public.apply_member(crew, user2, ["task2"]) + {:ok, %{crew_task: task2}} = Crew.Public.apply_member(crew, user2, ["task2"]) - Crew.Public.update_task(task2, %{ - status: :completed, - completed_at: Timestamp.naive_now() - }) + Crew.Public.update_task( + task2, + %{ + status: :completed, + completed_at: Timestamp.naive_now() + }, + :locked + ) - {:ok, view, _html} = live(conn, Routes.live_path(conn, Campaign.ContentPage, id)) + {:ok, view, html} = live(conn, Routes.live_path(conn, Campaign.ContentPage, id)) - _html = + html =~ "Goedgekeurd0" + + html = view |> element("[phx-click=\"accept_all_completed\"]") |> render_click() - assert_signals_dispatched({:crew_task, :updated}, 2) + html =~ "Goedgekeurd2" end test "Member applied and completed", %{conn: %{assigns: %{current_user: user}} = conn} do %{id: id, promotable_assignment: %{crew: crew}} = Campaign.Factories.create_campaign(user, :accepted, 1) - {:ok, %{task: task}} = Crew.Public.apply_member(crew, user, ["task1"]) + {:ok, %{crew_task: task}} = Crew.Public.apply_member(crew, user, ["task1"]) Crew.Public.activate_task(task) {:ok, _view, html} = live(conn, Routes.live_path(conn, Campaign.ContentPage, id)) diff --git a/core/test/systems/campaign/x.html b/core/test/systems/campaign/x.html new file mode 100644 index 000000000..7f6ee7b31 --- /dev/null +++ b/core/test/systems/campaign/x.html @@ -0,0 +1,201 @@ +
next_wide
+ Menu +

+ content.title +

\ No newline at end of file diff --git a/core/test/systems/crew/_public_test.exs b/core/test/systems/crew/_public_test.exs index 036c24bf4..272baf5d3 100644 --- a/core/test/systems/crew/_public_test.exs +++ b/core/test/systems/crew/_public_test.exs @@ -8,8 +8,8 @@ defmodule Systems.Crew.PublicTest do alias Systems.Crew test "list/0 returns all created crews with preloaded references" do - {:ok, crew1} = Crew.Public.prepare(Core.Authorization.make_node()) |> Core.Repo.insert() - {:ok, crew2} = Crew.Public.prepare(Core.Authorization.make_node()) |> Core.Repo.insert() + {:ok, crew1} = Crew.Public.prepare(Core.Authorization.prepare_node()) |> Core.Repo.insert() + {:ok, crew2} = Crew.Public.prepare(Core.Authorization.prepare_node()) |> Core.Repo.insert() list = Crew.Public.list() assert list |> Enum.find(&(&1.id == crew1.id)) assert list |> Enum.find(&(&1.id == crew2.id)) @@ -19,7 +19,7 @@ defmodule Systems.Crew.PublicTest do end test "get/1 returns crew with preloaded references" do - {:ok, crew} = Crew.Public.prepare(Core.Authorization.make_node()) |> Core.Repo.insert() + {:ok, crew} = Crew.Public.prepare(Core.Authorization.prepare_node()) |> Core.Repo.insert() crew = Crew.Public.get!(crew.id) assert crew.tasks == [] @@ -66,7 +66,7 @@ defmodule Systems.Crew.PublicTest do %{id: user_id} = user = Factories.insert!(:member) crew = Factories.insert!(:crew) - {:ok, %{member: %{user_id: ^user_id}, task: task}} = + {:ok, %{member: %{user_id: ^user_id}, crew_task: task}} = Crew.Public.apply_member(crew, user, ["task1"]) assert %{ @@ -139,7 +139,8 @@ defmodule Systems.Crew.PublicTest do user = Factories.insert!(:member) crew = Factories.insert!(:crew) - {:ok, %{member: member, task: task}} = Crew.Public.apply_member(crew, user, ["task1"], nil) + {:ok, %{member: member, crew_task: task}} = + Crew.Public.apply_member(crew, user, ["task1"], nil) assert Crew.Public.mark_expired() @@ -151,7 +152,7 @@ defmodule Systems.Crew.PublicTest do user = Factories.insert!(:member) crew = Factories.insert!(:crew) - {:ok, %{member: member, task: task}} = + {:ok, %{member: member, crew_task: task}} = Crew.Public.apply_member(crew, user, ["task1"], expire_at(1)) assert Crew.Public.mark_expired() @@ -164,7 +165,7 @@ defmodule Systems.Crew.PublicTest do user = Factories.insert!(:member) crew = Factories.insert!(:crew) - {:ok, %{member: member, task: task}} = + {:ok, %{member: member, crew_task: task}} = Crew.Public.apply_member(crew, user, ["task1"], expire_at(-1)) Crew.Public.lock_task(task) @@ -181,7 +182,7 @@ defmodule Systems.Crew.PublicTest do user = Factories.insert!(:member) crew = Factories.insert!(:crew) - {:ok, %{member: member, task: task}} = + {:ok, %{member: member, crew_task: task}} = Crew.Public.apply_member(crew, user, ["task1"], expire_at(-1)) assert Crew.Public.mark_expired() @@ -197,10 +198,10 @@ defmodule Systems.Crew.PublicTest do user2 = Factories.insert!(:member) crew = Factories.insert!(:crew) - {:ok, %{member: member1, task: task1}} = + {:ok, %{member: member1, crew_task: task1}} = Crew.Public.apply_member(crew, user1, ["task1"], expire_at(-1)) - {:ok, %{member: member2, task: task2}} = + {:ok, %{member: member2, crew_task: task2}} = Crew.Public.apply_member(crew, user2, ["task2"], expire_at(1)) assert Crew.Public.mark_expired() @@ -218,7 +219,7 @@ defmodule Systems.Crew.PublicTest do user = Factories.insert!(:member) crew = Factories.insert!(:crew) - {:ok, %{member: %{id: member_id} = member, task: task}} = + {:ok, %{member: %{id: member_id} = member, crew_task: task}} = Crew.Public.apply_member(crew, user, ["task1"], expire_at(-1)) assert Crew.Public.member?(crew, user) @@ -572,7 +573,7 @@ defmodule Systems.Crew.PublicTest do }) assert Crew.Public.count_tasks(crew, [:completed]) == 0 - {:ok, %{task: task}} = Crew.Public.accept_task(task) + {:ok, %{crew_task: task}} = Crew.Public.accept_task(task) assert %{status: :accepted} = Crew.Public.activate_task!(task) assert Crew.Public.count_tasks(crew, [:completed]) == 0 end @@ -596,7 +597,7 @@ defmodule Systems.Crew.PublicTest do assert Crew.Public.count_tasks(crew, [:completed]) == 0 - {:ok, %{task: task}} = + {:ok, %{crew_task: task}} = Crew.Public.reject_task(task, %{ category: :attention_checks_failed, message: "rejection message" @@ -627,7 +628,7 @@ defmodule Systems.Crew.PublicTest do assert {:ok, %{ - task: %{ + crew_task: %{ status: :accepted, accepted_at: accepted_at } @@ -660,7 +661,7 @@ defmodule Systems.Crew.PublicTest do assert {:ok, %{ - task: %{ + crew_task: %{ status: :rejected, rejected_at: rejected_at, rejected_category: :attention_checks_failed, diff --git a/core/test/systems/feldspar/app_page_test.exs b/core/test/systems/feldspar/app_page_test.exs index 6f4cfb42a..550e13f4c 100644 --- a/core/test/systems/feldspar/app_page_test.exs +++ b/core/test/systems/feldspar/app_page_test.exs @@ -5,17 +5,17 @@ defmodule Systems.Feldspar.AppPageTest do describe "render an app page" do test "renders page with iframe", %{conn: conn} do - {:ok, _view, html} = live(conn, ~p"/apps/test") + {:ok, _view, html} = live(conn, ~p"/feldspar/apps/test") assert html =~ "