Skip to content

Commit 49e13dc

Browse files
committed
Switch to Up and Running example from hexdocs.pm/phoenix/up_and_running.html
1 parent caa4309 commit 49e13dc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1577
-1166
lines changed

.formatter.exs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[
22
import_deps: [:phoenix],
3-
inputs: ["*.{ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}"],
4-
plugins: [Phoenix.LiveView.HTMLFormatter]
3+
plugins: [Phoenix.LiveView.HTMLFormatter],
4+
inputs: ["*.{heex,ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}"]
55
]

.gitignore

+7-5
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,19 @@ erl_crash.dump
1919
# Also ignore archive artifacts (built via "mix archive.build").
2020
*.ez
2121

22+
# Temporary files, for example, from tests.
23+
/tmp/
24+
2225
# Ignore package tarball (built via "mix hex.build").
23-
live_beats-*.tar
26+
wfloat-*.tar
2427

2528
# Ignore assets that are produced by build tools.
2629
/priv/static/assets/
2730

31+
# Ignore digested assets cache.
32+
/priv/static/cache_manifest.json
33+
2834
# In case you use Node.js/npm, you want to ignore these.
2935
npm-debug.log
3036
/assets/node_modules/
3137

32-
/priv/uploads
33-
/tmp
34-
35-
/.elixir_ls/

README.md

+11-16
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
# web
2-
3-
# TodoHtmx
4-
5-
Simple todo web app with Phoenix and Htmx
6-
7-
View more about Htmx https://htmx.org/docs/
8-
9-
## Feature
10-
- Inline editing row
11-
- Smooth delete row
12-
- Bulk updating multiple rows
13-
- Live search without Ajax
14-
15-
## Usage
16-
172
To start your Phoenix server:
183

19-
* Install dependencies with `mix deps.get`
4+
* Run `mix setup` to install and setup dependencies
205
* Start Phoenix endpoint with `mix phx.server` or inside IEx with `iex -S mix phx.server`
216

227
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
8+
9+
Ready to run in production? Please [check our deployment guides](https://hexdocs.pm/phoenix/deployment.html).
10+
11+
## Learn more
12+
13+
* Official website: https://www.phoenixframework.org/
14+
* Guides: https://hexdocs.pm/phoenix/overview.html
15+
* Docs: https://hexdocs.pm/phoenix
16+
* Forum: https://elixirforum.com/c/phoenix-forum
17+
* Source: https://github.com/phoenixframework/phoenix

assets/css/app.css

+4-146
Original file line numberDiff line numberDiff line change
@@ -1,147 +1,5 @@
1-
/* This file is for your main application CSS */
2-
@import "./phoenix.css";
3-
4-
/* Alerts and form errors used by phx.new */
5-
.alert {
6-
padding: 15px;
7-
margin-bottom: 20px;
8-
border: 1px solid transparent;
9-
border-radius: 4px;
10-
}
11-
.alert-info {
12-
color: #31708f;
13-
background-color: #d9edf7;
14-
border-color: #bce8f1;
15-
}
16-
.alert-warning {
17-
color: #8a6d3b;
18-
background-color: #fcf8e3;
19-
border-color: #faebcc;
20-
}
21-
.alert-danger {
22-
color: #a94442;
23-
background-color: #f2dede;
24-
border-color: #ebccd1;
25-
}
26-
.alert p {
27-
margin-bottom: 0;
28-
}
29-
.alert:empty {
30-
display: none;
31-
}
32-
.invalid-feedback {
33-
color: #a94442;
34-
display: block;
35-
margin: -1rem 0 2rem;
36-
}
37-
38-
/* LiveView specific classes for your customization */
39-
.phx-no-feedback.invalid-feedback,
40-
.phx-no-feedback .invalid-feedback {
41-
display: none;
42-
}
43-
44-
.phx-click-loading {
45-
opacity: 0.5;
46-
transition: opacity 1s ease-out;
47-
}
48-
49-
.phx-loading{
50-
cursor: wait;
51-
}
52-
53-
.phx-modal {
54-
opacity: 1!important;
55-
position: fixed;
56-
z-index: 1;
57-
left: 0;
58-
top: 0;
59-
width: 100%;
60-
height: 100%;
61-
overflow: auto;
62-
background-color: rgba(0,0,0,0.4);
63-
}
64-
65-
.phx-modal-content {
66-
background-color: #fefefe;
67-
margin: 15vh auto;
68-
padding: 20px;
69-
border: 1px solid #888;
70-
width: 80%;
71-
}
72-
73-
.phx-modal-close {
74-
color: #aaa;
75-
float: right;
76-
font-size: 28px;
77-
font-weight: bold;
78-
}
79-
80-
.phx-modal-close:hover,
81-
.phx-modal-close:focus {
82-
color: black;
83-
text-decoration: none;
84-
cursor: pointer;
85-
}
86-
87-
.fade-in-scale {
88-
animation: 0.2s ease-in 0s normal forwards 1 fade-in-scale-keys;
89-
}
90-
91-
.fade-out-scale {
92-
animation: 0.2s ease-out 0s normal forwards 1 fade-out-scale-keys;
93-
}
1+
@import "tailwindcss/base";
2+
@import "tailwindcss/components";
3+
@import "tailwindcss/utilities";
944

95-
.fade-in {
96-
animation: 0.2s ease-out 0s normal forwards 1 fade-in-keys;
97-
}
98-
.fade-out {
99-
animation: 0.2s ease-out 0s normal forwards 1 fade-out-keys;
100-
}
101-
102-
@keyframes fade-in-scale-keys{
103-
0% { scale: 0.95; opacity: 0; }
104-
100% { scale: 1.0; opacity: 1; }
105-
}
106-
107-
@keyframes fade-out-scale-keys{
108-
0% { scale: 1.0; opacity: 1; }
109-
100% { scale: 0.95; opacity: 0; }
110-
}
111-
112-
@keyframes fade-in-keys{
113-
0% { opacity: 0; }
114-
100% { opacity: 1; }
115-
}
116-
117-
@keyframes fade-out-keys{
118-
0% { opacity: 1; }
119-
100% { opacity: 0; }
120-
}
121-
122-
.hidden {
123-
display: none;
124-
}
125-
126-
.flex {
127-
display: flex;
128-
}
129-
130-
.space-between {
131-
justify-content: space-between;
132-
}
133-
134-
.todo .icon-button {
135-
all: unset;
136-
cursor: pointer;
137-
font-size: 16px;
138-
margin: 0 2px;
139-
}
140-
141-
.a-button {
142-
all: unset;
143-
cursor: pointer;
144-
color: #0069d9;
145-
text-decoration: underline;
146-
margin: 0 2px;
147-
}
5+
/* This file is for your main application CSS */

assets/css/phoenix.css

-102
This file was deleted.

assets/js/app.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
// We import the CSS which is extracted to its own file by esbuild.
2-
// Remove this line if you add a your own CSS build pipeline (e.g postcss).
3-
import "../css/app.css"
4-
51
// If you want to use Phoenix channels, run `mix help phx.gen.channel`
62
// to get started and then uncomment the line below.
73
// import "./user_socket.js"
@@ -27,12 +23,15 @@ import {LiveSocket} from "phoenix_live_view"
2723
import topbar from "../vendor/topbar"
2824

2925
let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content")
30-
let liveSocket = new LiveSocket("/live", Socket, {params: {_csrf_token: csrfToken}})
26+
let liveSocket = new LiveSocket("/live", Socket, {
27+
longPollFallbackMs: 2500,
28+
params: {_csrf_token: csrfToken}
29+
})
3130

3231
// Show progress bar on live navigation and form submits
3332
topbar.config({barColors: {0: "#29d"}, shadowColor: "rgba(0, 0, 0, .3)"})
34-
window.addEventListener("phx:page-loading-start", info => topbar.show())
35-
window.addEventListener("phx:page-loading-stop", info => topbar.hide())
33+
window.addEventListener("phx:page-loading-start", _info => topbar.show(300))
34+
window.addEventListener("phx:page-loading-stop", _info => topbar.hide())
3635

3736
// connect if there are any LiveViews on the page
3837
liveSocket.connect()

assets/package.json

-12
This file was deleted.

0 commit comments

Comments
 (0)