Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to functional views #356

Merged
merged 53 commits into from
Sep 26, 2024
Merged
Changes from 10 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
aad847f
started changing static page to function component
JannikStreek Sep 18, 2024
2a37c0c
save
JannikStreek Sep 18, 2024
e1f4df4
move files
JannikStreek Sep 18, 2024
93296de
one page works
JannikStreek Sep 18, 2024
a74ec3a
fix routes and added form back in
JannikStreek Sep 19, 2024
503c9e8
refactor util function call
JannikStreek Sep 19, 2024
f06df1c
remove layout view
JannikStreek Sep 19, 2024
2a57a83
landing page view works
JannikStreek Sep 19, 2024
e84397e
update brainstorming controller
JannikStreek Sep 19, 2024
5fdde9a
added back removed root content
JannikStreek Sep 19, 2024
77686b3
add back plug
JannikStreek Sep 19, 2024
9931a76
fix live view module loading
JannikStreek Sep 19, 2024
1fc32c5
include live helpers
JannikStreek Sep 19, 2024
3adf8e3
fix link in edit
JannikStreek Sep 19, 2024
c02a2f8
wip admin/brainstorming_live/edit.html.heex
JannikStreek Sep 19, 2024
f2c64f8
Restore basic Admin edit functionality
PragTob Sep 22, 2024
bec331e
Merge branch 'master' into upgrade-to-functional-views
PragTob Sep 22, 2024
82e1803
leave notes about HTML export
PragTob Sep 22, 2024
74db2e3
make brainstorming#show render
PragTob Sep 22, 2024
d0d3d78
Introduce rendering ideas, random path fixes
PragTob Sep 22, 2024
032024a
Remove patch to users path which seemed accidental
PragTob Sep 22, 2024
25c8bc0
make verified routes helper available in conn case tests
PragTob Sep 22, 2024
189f5b3
add buttons to brainstorming page back in
JannikStreek Sep 23, 2024
e2427e3
add back modal new idea
JannikStreek Sep 23, 2024
7773333
add idea modal working
JannikStreek Sep 24, 2024
10b87d2
add back logo
JannikStreek Sep 24, 2024
77fccef
add back idea cards
JannikStreek Sep 24, 2024
fe9b626
add back uuid
JannikStreek Sep 24, 2024
16f6dd8
idea index working again
JannikStreek Sep 24, 2024
68d1699
share modal working
JannikStreek Sep 24, 2024
c5d3dff
improve modal
JannikStreek Sep 24, 2024
619cdea
styled inputs
JannikStreek Sep 25, 2024
28dee2e
upgrade live view and remove live dashboard as it is in conflict with…
JannikStreek Sep 25, 2024
9058b8e
errors now working for idea fornm
JannikStreek Sep 25, 2024
a711ca9
remove view dependency as no longer needed
JannikStreek Sep 25, 2024
52b48d7
fix warnings
JannikStreek Sep 25, 2024
b25ca21
fix routes in test
JannikStreek Sep 25, 2024
4a3a7bd
fix test
JannikStreek Sep 25, 2024
c12e357
label editing in admin works again
JannikStreek Sep 25, 2024
8774361
fix tests, one test is commented and will be extracted to a new issue
JannikStreek Sep 25, 2024
a187b68
revert live view upgrade and fix confirm warning
JannikStreek Sep 25, 2024
116684e
update locals
JannikStreek Sep 25, 2024
bcd0a7d
fix design of labels in admin
JannikStreek Sep 25, 2024
64e00c0
fix html export
JannikStreek Sep 25, 2024
fc7b809
missed files
JannikStreek Sep 25, 2024
fc0a9c6
remove todo
JannikStreek Sep 25, 2024
4d3854f
add error files
JannikStreek Sep 25, 2024
87e156a
remove todo
JannikStreek Sep 25, 2024
7656ba4
update package lock
JannikStreek Sep 25, 2024
639751d
update language files
JannikStreek Sep 25, 2024
414c2c2
Merge branch 'master' into upgrade-to-functional-views
JannikStreek Sep 25, 2024
3e0e6d8
fix reload when labels error
JannikStreek Sep 26, 2024
143c9e4
Merge remote-tracking branch 'origin/upgrade-to-functional-views' int…
JannikStreek Sep 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 66 additions & 19 deletions lib/mindwendel_web.ex
Original file line number Diff line number Diff line change
@@ -17,13 +17,68 @@ defmodule MindwendelWeb do
and import those modules here.
"""

def static_paths, do: ~w(assets fonts images favicon.ico robots.txt)

def router do
quote do
use Phoenix.Router, helpers: false

# Import common connection and controller functions to use in pipelines
import Plug.Conn
import Phoenix.Controller
import Phoenix.LiveView.Router
end
end

def channel do
quote do
use Phoenix.Channel
end
end

def controller do
quote do
use Phoenix.Controller, namespace: MindwendelWeb
use Phoenix.Controller,
formats: [:html, :json],
layouts: [html: MindwendelWeb.Layouts]

import Plug.Conn
import MindwendelWeb.Gettext
alias MindwendelWeb.Router.Helpers, as: Routes

unquote(verified_routes())
end
end

def html do
quote do
# this is temporary https://hexdocs.pm/phoenix_view/Phoenix.View.html#module-replaced-by-phoenix-component
# import Phoenix.View
JannikStreek marked this conversation as resolved.
Show resolved Hide resolved

use Phoenix.Component
import Phoenix.HTML.Form

# Import convenience functions from controllers
import Phoenix.Controller,
only: [get_csrf_token: 0, view_module: 1, view_template: 1]

# Include general helpers for rendering HTML
unquote(html_helpers())
end
end

defp html_helpers do
quote do
# HTML escaping functionality
import Phoenix.HTML
# Core UI components and translation
import MindwendelWeb.CoreComponents
import MindwendelWeb.Gettext

# Shortcut for generating JS commands
alias Phoenix.LiveView.JS

# Routes generation with the ~p sigil
unquote(verified_routes())
end
end

@@ -42,6 +97,15 @@ defmodule MindwendelWeb do
end
end

def verified_routes do
quote do
use Phoenix.VerifiedRoutes,
endpoint: MindwendelWeb.Endpoint,
router: MindwendelWeb.Router,
statics: MindwendelWeb.static_paths()
end
end

def live_view do
quote do
use Phoenix.LiveView,
@@ -59,23 +123,6 @@ defmodule MindwendelWeb do
end
end

def router do
quote do
use Phoenix.Router

import Plug.Conn
import Phoenix.Controller
import Phoenix.LiveView.Router
end
end

def channel do
quote do
use Phoenix.Channel
import MindwendelWeb.Gettext
end
end

defp view_helpers do
quote do
# Use all HTML functionality (forms, tags, etc)
Loading