Skip to content

Commit d01f0a6

Browse files
authored
Merge pull request #2 from bigardone/download-manager
2 parents d366d1b + 797685c commit d01f0a6

Some content is hidden

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

52 files changed

+20497
-1
lines changed

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
elixir 1.12.0
1+
elixir 1.12.1
22
erlang 24.0.1

06_download_manager/.formatter.exs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[
2+
import_deps: [:phoenix],
3+
inputs: ["*.{ex,exs}", "{config,lib,test}/**/*.{ex,exs}"]
4+
]

06_download_manager/.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# The directory Mix will write compiled artifacts to.
2+
/_build/
3+
4+
# If you run "mix test --cover", coverage assets end up here.
5+
/cover/
6+
7+
# The directory Mix downloads your dependencies sources to.
8+
/deps/
9+
10+
# Where 3rd-party dependencies like ExDoc output generated docs.
11+
/doc/
12+
13+
# Ignore .fetch files in case you like to edit your project deps locally.
14+
/.fetch
15+
16+
# If the VM crashes, it generates a dump, let's ignore it too.
17+
erl_crash.dump
18+
19+
# Also ignore archive artifacts (built via "mix archive.build").
20+
*.ez
21+
22+
# Ignore package tarball (built via "mix hex.build").
23+
download_manager-*.tar
24+
25+
# If NPM crashes, it generates a log, let's ignore it too.
26+
npm-debug.log
27+
28+
# The directory NPM downloads your dependencies sources to.
29+
/assets/node_modules/
30+
31+
# Since we are building assets from assets/,
32+
# we ignore priv/static. You may want to comment
33+
# this depending on your deployment strategy.
34+
/priv/static/

06_download_manager/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# DownloadManager
2+
3+
To start your Phoenix server:
4+
5+
* Install dependencies with `mix deps.get`
6+
* Install Node.js dependencies with `npm install` inside the `assets` directory
7+
* Start Phoenix endpoint with `mix phx.server`
8+
9+
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
10+
11+
Ready to run in production? Please [check our deployment guides](https://hexdocs.pm/phoenix/deployment.html).
12+
13+
## Learn more
14+
15+
* Official website: https://www.phoenixframework.org/
16+
* Guides: https://hexdocs.pm/phoenix/overview.html
17+
* Docs: https://hexdocs.pm/phoenix
18+
* Forum: https://elixirforum.com/c/phoenix-forum
19+
* Source: https://github.com/phoenixframework/phoenix

06_download_manager/assets/.babelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"presets": [
3+
"@babel/preset-env"
4+
]
5+
}

06_download_manager/assets/css/app.scss

Whitespace-only changes.

06_download_manager/assets/js/app.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// We need to import the CSS so that webpack will load it.
2+
// The MiniCssExtractPlugin is used to separate it out into
3+
// its own CSS file.
4+
import "../css/app.scss"
5+
6+
// webpack automatically bundles all modules in your
7+
// entry points. Those entry points can be configured
8+
// in "webpack.config.js".
9+
//
10+
// Import deps with the dep name or local files with a relative path, for example:
11+
//
12+
// import {Socket} from "phoenix"
13+
// import socket from "./socket"
14+
//
15+
import "phoenix_html"
16+
import {Socket} from "phoenix"
17+
import topbar from "topbar"
18+
import {LiveSocket} from "phoenix_live_view"
19+
20+
let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content")
21+
let liveSocket = new LiveSocket("/live", Socket, {params: {_csrf_token: csrfToken}})
22+
23+
// Show progress bar on live navigation and form submits
24+
topbar.config({barColors: {0: "#29d"}, shadowColor: "rgba(0, 0, 0, .3)"})
25+
window.addEventListener("phx:page-loading-start", info => topbar.show())
26+
window.addEventListener("phx:page-loading-stop", info => topbar.hide())
27+
28+
// connect if there are any LiveViews on the page
29+
liveSocket.connect()
30+
31+
// expose liveSocket on window for web console debug logs and latency simulation:
32+
// >> liveSocket.enableDebug()
33+
// >> liveSocket.enableLatencySim(1000) // enabled for duration of browser session
34+
// >> liveSocket.disableLatencySim()
35+
window.liveSocket = liveSocket
36+

0 commit comments

Comments
 (0)