WIP: feature/backpex-migration #92

Closed
moritz wants to merge 50 commits from feature/backpex-migration into main
7 changed files with 35 additions and 3 deletions
Showing only changes of commit a958b49a7c - Show all commits

View file

@ -2,6 +2,10 @@
@import "tailwindcss/components"; @import "tailwindcss/components";
@import "tailwindcss/utilities"; @import "tailwindcss/utilities";
@plugin "daisyui" {
themes: light, dark;
}
@source "../../deps/backpex/**/*.*ex"; @source "../../deps/backpex/**/*.*ex";
@source '../../deps/backpex/assets/js/**/*.*js' @source '../../deps/backpex/assets/js/**/*.*js'

View file

@ -23,6 +23,9 @@ import {LiveSocket} from "phoenix_live_view"
import { Hooks as BackpexHooks } from 'backpex' import { Hooks as BackpexHooks } from 'backpex'
import topbar from "../vendor/topbar" import topbar from "../vendor/topbar"
// Set stored theme as soon as possible
BackpexHooks.BackpexThemeSelector.setStoredTheme()
let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content") let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content")
let liveSocket = new LiveSocket("/live", Socket, { let liveSocket = new LiveSocket("/live", Socket, {
longPollFallbackMs: 2500, longPollFallbackMs: 2500,

20
assets/package-lock.json generated Normal file
View file

@ -0,0 +1,20 @@
{
"name": "assets",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"dependencies": {
"daisyui": "^5.0.43"
}
},
"node_modules/daisyui": {
"version": "5.0.43",
"resolved": "https://registry.npmjs.org/daisyui/-/daisyui-5.0.43.tgz",
"integrity": "sha512-2pshHJ73vetSpsbAyaOncGnNYL0mwvgseS1EWy1I9Qpw8D11OuBoDNIWrPIME4UFcq2xuff3A9x+eXbuFR9fUQ==",
"funding": {
"url": "https://github.com/saadeghi/daisyui?sponsor=1"
}
}
}
}

5
assets/package.json Normal file
View file

@ -0,0 +1,5 @@
{
"dependencies": {
"daisyui": "^5.0.43"
}
}

View file

@ -19,7 +19,6 @@ module.exports = {
}, },
}, },
plugins: [ plugins: [
require("@tailwindcss/forms"),
// Allows prefixing tailwind classes with LiveView classes to add rules // Allows prefixing tailwind classes with LiveView classes to add rules
// only when LiveView classes are applied, for example: // only when LiveView classes are applied, for example:
// //

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" class="[scrollbar-gutter:stable]"> <html lang="en" class="[scrollbar-gutter:stable]" data-theme={assigns[:theme] || "light"}>
<head> <head>
{Application.get_env(:live_debugger, :live_debugger_tags)} {Application.get_env(:live_debugger, :live_debugger_tags)}
@ -13,7 +13,7 @@
<script defer phx-track-static type="text/javascript" src={~p"/assets/app.js"}> <script defer phx-track-static type="text/javascript" src={~p"/assets/app.js"}>
</script> </script>
</head> </head>
<body class="bg-white"> <body>
{@inner_content} {@inner_content}
</body> </body>
</html> </html>

View file

@ -8,6 +8,7 @@ defmodule MvWeb.Router do
plug :put_root_layout, html: {MvWeb.Layouts, :root} plug :put_root_layout, html: {MvWeb.Layouts, :root}
plug :protect_from_forgery plug :protect_from_forgery
plug :put_secure_browser_headers plug :put_secure_browser_headers
plug Backpex.ThemeSelectorPlug
end end
pipeline :api do pipeline :api do