Skip to content

Commit 3d8172a

Browse files
committed
More changes
1 parent b26fae9 commit 3d8172a

File tree

5 files changed

+8
-23
lines changed

5 files changed

+8
-23
lines changed

README.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,7 @@
33
This is an Erlang web application using the [Nitrogen Web
44
Framework](https://nitrogenproject.com).
55

6-
<img width="905" alt="image" src="https://github.com/davecaos/beamdex/assets/6124495/8e47aefd-438c-46d5-a911-5eef5e3bf486">
7-
8-
# Building
9-
10-
You can rebuild the project by typing:
11-
12-
make
13-
14-
If this fails, it likely means that its a slim release and Erlang is not
15-
installed on this machine. Please [install
16-
Erlang](https://www.erlang-solutions.com/resources/download.html).
6+
Those are the slides of the talk [Modern Clicks (Erlang Fullstack Web Development with Nitrogen](https://github.com/davecaos/beamdex/blob/main/presentation.pdf) for Elixir Fortaleza Conf 2023
177

188
# Running
199

@@ -46,4 +36,4 @@ Compiled Erlang modules (ebin files) go in `site/ebin`
4636

4737
By default Nitrogen comes with an application called [sync](http://github.com/rustyio/sync) which provides automatic code reloading when the related .erl file or .ebin file is updated. To use this, run the following on the Erlang shell:
4838

49-
sync:go().
39+
sync:go().

presentation.pdf

6.26 MB
Binary file not shown.

site/src/index.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ draw_pokemon_main_grid() ->
3737
}
3838
}.
3939

40-
event({show_details, Number}) ->
41-
PokemonsDetails = pokemon:draw_pokemon_details(Number),
40+
event({show_details, Pokemon}) ->
41+
PokemonsDetails = pokemon:draw_pokemon_details(Pokemon),
4242
wf:update(pokemon_body, PokemonsDetails);
4343

4444
event(close_details) ->

src/elements/pokemon.erl

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,10 @@ draw_card(Pokemon) ->
1010
body=[
1111
#panel{class=card__header, body=[
1212
#panel{class=poke__number, body=["#00",Pokemon#pokemon.number]},
13-
% You can add inline styles
14-
#button{style="background:transparent; border: none; cursor: pointer;",
15-
% This posback will be solved with the event({show_details, Number}) funtion on index.erl module
13+
#button{style="background:transparent; border: none; cursor: pointer;",
1614
postback = {show_details, Pokemon},
1715
body=[
1816
#panel{class=info__icon,
19-
% You can add html, but must be stringified
2017
body="<svg stroke=\"currentColor\" fill=\"currentColor\" stroke-width=\"0\" viewBox=\"0 0 512 512\" height=\"1em\" width=\"1em\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z\"></path></svg>"
2118
}
2219
]
@@ -31,7 +28,6 @@ draw_card(Pokemon) ->
3128
}.
3229

3330
draw_pokemon_details(Pokemon) ->
34-
%% You can debbug on the fly with ?PRINT/1 macro.
3531
?PRINT(Pokemon),
3632
#panel{
3733
class=pokemon_details_container,
@@ -40,7 +36,7 @@ draw_pokemon_details(Pokemon) ->
4036
#panel{class='card-title',style="background: linear-gradient(#a8ff98,#d6a2e4);",body=Pokemon#pokemon.name},
4137
#panel{
4238
class=box,
43-
style="background: linear-gradient(#a8ff98,#d6a2e4); margin:5px;",
39+
style="background: linear-gradient(#a8ff98,#d6a2e4);",
4440
body=[
4541
#panel{body=#image{style="max-width: 300px;", image=["/images/avatar/", "00",Pokemon#pokemon.number,".jpeg"]}},
4642
#panel{
@@ -50,7 +46,6 @@ draw_pokemon_details(Pokemon) ->
5046
]
5147
},
5248
#panel{style="text-align: right;",
53-
% This posback will be solved with the event(close_details) funtion on index.erl module
5449
body=#button{style="text-align: center;", body="Close", postback=close_details}
5550
}
5651

src/index.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ draw_pokemon_main_grid() ->
3737
}
3838
}.
3939

40-
event({show_details, Number}) ->
41-
PokemonsDetails = pokemon:draw_pokemon_details(Number),
40+
event({show_details, Pokemon}) ->
41+
PokemonsDetails = pokemon:draw_pokemon_details(Pokemon),
4242
wf:update(pokemon_body, PokemonsDetails);
4343

4444
event(close_details) ->

0 commit comments

Comments
 (0)