Skip to content

Commit

Permalink
Merge pull request #935 from eyra/link-panl-integration
Browse files Browse the repository at this point in the history
Link Panl Integration
  • Loading branch information
mellelieuwes committed Sep 25, 2024
2 parents 57cf6a1 + 66b362c commit 176aad7
Show file tree
Hide file tree
Showing 214 changed files with 2,246 additions and 1,809 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/banking_proxy_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- id: setup-elixir
uses: erlef/setup-elixir@v1
with:
otp-version: "25.0.4"
otp-version: "25.3.2.7"
elixir-version: "1.14.0"

- name: Setup the Elixir project
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- id: setup-elixir
uses: erlef/setup-elixir@v1
with:
otp-version: "25.0.4"
otp-version: "25.3.2.7"
elixir-version: "1.14.0"

- name: Setup the Elixir project
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- id: setup-elixir
uses: erlef/setup-elixir@v1
with:
otp-version: "25.0.4"
otp-version: "25.3.2.7"
elixir-version: "1.14.0"

- name: Setup the Elixir project
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- id: setup-elixir
uses: erlef/setup-elixir@v1
with:
otp-version: "25.0.4"
otp-version: "25.3.2.7"
elixir-version: "1.14.0"

- name: Setup the Elixir project
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
erlang 25.0.4
erlang 25.3.2.7
elixir 1.14.0-otp-25
nodejs 18.19.0
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
"elixir": "html",
"phoenix-heex": "html"
},
"editor.tabCompletion": "on"
"editor.tabCompletion": "on",
"elixirLS.mixEnv": "dev"
}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

## \#2 unreleased

* Added: Project breadcrumbs for easy navigation and hierarchy overview.
* Changed: Format of the filenames in Storages. Also no folders used anymore. This has impact on Data Donation studies.
* Changed: Assignment does not have a Storage association anymore. Projects can have one Storage that is shared between all the project items.
* Added: Storage project item (BuiltIn and Yoda)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ prepare: test format compile credo

.PHONY: dialyzer
dialyzer: FORCE
cd core && mix dialyzer --force-check
cd core && mix dialyzer --force-check --format short

.PHONY: test
test: ${MIX_PROJECTS:%=test/%}
Expand Down
4 changes: 3 additions & 1 deletion core/.dialyzer_ignore.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[
# https://github.com/phoenixframework/phoenix/issues/5437, fixed in Phoenix 1.7.3 or higher
{"systems/benchmark/export_controller.ex", :no_return},
{"systems/benchmark/export_controller.ex", :call}
{"systems/benchmark/export_controller.ex", :call},
# https://elixirforum.com/t/dialyzer-listed-not-implemented-protocols-as-unknown-functions/2099/12
~r/.*:unknown_function Function .*__impl__\/1 does not exist.*/
]
5 changes: 3 additions & 2 deletions core/assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { decode } from "blurhash";
import { urlBase64ToUint8Array } from "./tools";
import { registerAPNSDeviceToken } from "./apns";
import "./100vh-fix";
import { ViewportResize } from "./viewport_resize";
import { Viewport } from "./viewport";
import { SidePanel } from "./side_panel";
import { Toggle } from "./toggle";
import { Cell } from "./cell";
Expand All @@ -36,6 +36,7 @@ window.registerAPNSDeviceToken = registerAPNSDeviceToken;
window.addEventListener("phx:page-loading-stop", (info) => {
if (info.detail.kind == "initial") {
TimeZone.sendToServer();
Viewport.sendToServer();
}
});

Expand Down Expand Up @@ -108,7 +109,7 @@ let Hooks = {
Tabbar,
TabbarItem,
TabbarFooterItem,
ViewportResize,
Viewport,
Wysiwyg,
AutoSubmit,
Sticky,
Expand Down
24 changes: 20 additions & 4 deletions core/assets/js/tabbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ let tabbarId = "";

export const Tabbar = {
mounted() {
console.log("[Tabbar] mounted");
tabbarId = this.el.id;

var initialTabId = this.el.dataset.initialTab
Expand All @@ -21,6 +22,7 @@ export const Tabbar = {
},

updated() {
console.log("[Tabbar] updated");
var savedTabId = this.loadActiveTab();
this.show(savedTabId, false);
},
Expand All @@ -39,22 +41,36 @@ export const Tabbar = {
},

saveActiveTab(tabId) {
console.info("saveActiveTab ", tabId);
console.info("[Tabbar] saveActiveTab ", tabId);
window.localStorage.setItem(this.getActiveTabKey(), tabId);
},

getTabs() {
return document.querySelectorAll('[id^="tab_"]');
},

getFirstTab() {
var firstTab = document.querySelectorAll('[id^="tab_"]')[0];
return firstTab.id;
var tabs = this.getTabs();
console.log("tabs", tabs);
if (tabs == undefined) {
return undefined;
} else {
return tabs[0].id;
}
},

show(nextTabId, scrollToTop) {
console.log("[Tabbar] nextTabId", nextTabId);
if (nextTabId == undefined) {
return;
}

this.saveActiveTab(nextTabId);
var tabs = Array.from(document.querySelectorAll('[id^="tab_"]'));

// Skip unknown tab
if (!tabs.some((tab) => tab.id === nextTabId)) {
console.warn("Skip unknown tab", nextTabId);
console.warn("[Tabbar] Skip unknown tab", nextTabId);
return;
}

Expand Down
63 changes: 63 additions & 0 deletions core/assets/js/viewport.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import _ from "lodash";

let resizeHandler;

export const Viewport = {
mounted() {
// // Direct push of current window size to properly update view
// this.pushChangeEvent();

window.addEventListener("resize", (event) => {
this.pushChangeEvent();
});
},

updated() {
console.log("[Viewport] updated");
// this.pushChangeEvent();
},

pushChangeEvent() {
console.log("[Viewport] push update event");
this.pushEvent("viewport_changed", {
width: window.innerWidth,
height: window.innerHeight,
});
},

turbolinksDisconnected() {
window.removeEventListener("resize", resizeHandler);
},

sendToServer() {
const viewport = {
width: window.innerWidth,
height: window.innerHeight,
};

console.log("[Viewport]", viewport);

let csrfToken = document
.querySelector("meta[name='csrf-token']")
.getAttribute("content");

if (typeof window.localStorage != "undefined") {
try {
var xhr = new XMLHttpRequest();
xhr.open("POST", "/api/viewport", true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("x-csrf-token", csrfToken);
xhr.onreadystatechange = function () {
console.log(
"[Veiwport] POST onreadystatechange",
this.status,
this.readyState
);
};
xhr.send(`{"viewport": "${viewport}"}`);
} catch (e) {
console.log("[Viewport] Error while sending viewport to server", e);
}
}
},
};
26 changes: 0 additions & 26 deletions core/assets/js/viewport_resize.js

This file was deleted.

2 changes: 1 addition & 1 deletion core/bundles/next/lib/account/participant_signin_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ defmodule Next.Account.ParticipantSigninView do
<div>
<%= for block <- @blocks do %>
<%= if block == :google do %>
<.google_signin />
<.google_signin creator?={false} />
<% end %>
<%= if block == :password do %>
<.password_signin for={@password_form} user_type={:participant}/>
Expand Down
17 changes: 15 additions & 2 deletions core/bundles/next/lib/account/signin_page.ex
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
defmodule Next.Account.SigninPage do
use CoreWeb, :live_view

on_mount({CoreWeb.Live.Hook.Base, __MODULE__})
on_mount({CoreWeb.Live.Hook.User, __MODULE__})
on_mount({CoreWeb.Live.Hook.Uri, __MODULE__})
on_mount({Frameworks.GreenLight.LiveHook, __MODULE__})
on_mount({Frameworks.Fabric.LiveHook, __MODULE__})

import CoreWeb.Layouts.Stripped.Html
import CoreWeb.Layouts.Stripped.Composer
import CoreWeb.Menus

import Frameworks.Pixel.Line

alias Frameworks.Pixel.Tabbar

alias Next.Account.SigninPageBuilder

@impl true
Expand All @@ -29,11 +37,16 @@ defmodule Next.Account.SigninPage do
}
end

defp update_view_model(socket) do
def update_view_model(socket) do
vm = SigninPageBuilder.view_model(nil, socket.assigns)
assign(socket, vm: vm)
end

def update_menus(%{assigns: %{current_user: user, uri: uri}} = socket) do
menus = build_menus(stripped_menus_config(), user, uri)
assign(socket, menus: menus)
end

@impl true
def render(assigns) do
~H"""
Expand Down
14 changes: 14 additions & 0 deletions core/bundles/self/lib/account/signin_page.ex
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
defmodule Self.Account.SigninPage do
use CoreWeb, :live_view

on_mount({CoreWeb.Live.Hook.Base, __MODULE__})
on_mount({CoreWeb.Live.Hook.User, __MODULE__})
on_mount({CoreWeb.Live.Hook.Uri, __MODULE__})
on_mount({Frameworks.GreenLight.LiveHook, __MODULE__})
on_mount({Frameworks.Fabric.LiveHook, __MODULE__})

import CoreWeb.Layouts.Stripped.Html
import CoreWeb.Layouts.Stripped.Composer
import CoreWeb.Menus

alias Systems.Account.User
alias Systems.Account.UserForm

@impl true
def mount(params, _session, socket) do
require_feature(:password_sign_in)

Expand All @@ -18,6 +27,11 @@ defmodule Self.Account.SigninPage do
}
end

def update_menus(%{assigns: %{current_user: user, uri: uri}} = socket) do
menus = build_menus(stripped_menus_config(), user, uri)
assign(socket, menus: menus)
end

defp update_form(%{assigns: %{email: nil}} = socket) do
assign(socket, :form, to_form(%{}))
end
Expand Down
3 changes: 1 addition & 2 deletions core/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ config :plug, :statuses, %{
404 => "Page not found"
}

config :core, :naming, handlers: [Systems.Project.Public]

config :core, CoreWeb.FileUploader, max_file_size: 100_000_000

config :core,
greenlight_auth_module: Core.Authorization,
image_catalog: Core.ImageCatalog.Unsplash,
banking_backend: Systems.Banking.Dummy

Expand Down
11 changes: 11 additions & 0 deletions core/frameworks/concept/branch.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
defprotocol Frameworks.Concept.Branch do
# FIXME: add possibility to resolve dependencies to leafs (siblings)

@type scope :: :self | :parent

@spec name(t, scope) :: binary
def name(_t, _scope)

@spec hierarchy(t) :: list
def hierarchy(_t)
end
24 changes: 0 additions & 24 deletions core/frameworks/concept/context.ex

This file was deleted.

Loading

0 comments on commit 176aad7

Please sign in to comment.