diff --git a/assets/js/app.js b/assets/js/app.js index b97d716..a50db41 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -51,6 +51,7 @@ app.ports.joinRoom.subscribe(options => { // Incoming room events channel.on("vote", app.ports.gotVote.send) channel.on("reset", app.ports.gotReset.send) + channel.on("reveal", app.ports.gotReveal.send) // Outgoing room events app.ports.roomActions.subscribe(action => { diff --git a/assets/src/PlanningPokerAPI.elm b/assets/src/PlanningPokerAPI.elm index db07d69..ce31c1b 100644 --- a/assets/src/PlanningPokerAPI.elm +++ b/assets/src/PlanningPokerAPI.elm @@ -1,6 +1,7 @@ port module PlanningPokerAPI exposing ( gotPresence , gotReset + , gotReveal , gotVote , joinRoom , newProfile @@ -78,4 +79,7 @@ port gotPresence : (Decode.Value -> msg) -> Sub msg port gotVote : (Decode.Value -> msg) -> Sub msg +port gotReveal : (Decode.Value -> msg) -> Sub msg + + port gotReset : (Decode.Value -> msg) -> Sub msg diff --git a/assets/src/PlanningPokerRoom.elm b/assets/src/PlanningPokerRoom.elm index f2c4f12..d5cda82 100644 --- a/assets/src/PlanningPokerRoom.elm +++ b/assets/src/PlanningPokerRoom.elm @@ -43,6 +43,7 @@ type Msg | JoinRoom | GotPresence Decode.Value | GotVote Decode.Value + | GotReveal | GotReset @@ -120,7 +121,7 @@ update key msg model = ) Reveal -> - ( { model | showVotes = True } + ( model , API.reveal ) @@ -166,6 +167,11 @@ update key msg model = _ -> ( model, Cmd.none ) + GotReveal -> + ( { model | showVotes = True } + , Cmd.none + ) + GotReset -> let newPlayers = @@ -381,6 +387,7 @@ subscriptions = Sub.batch [ API.gotPresence GotPresence , API.gotReset (\_ -> GotReset) + , API.gotReveal (\_ -> GotReveal) , API.gotVote GotVote ] diff --git a/lib/planningpoker_web/channels/room_channel.ex b/lib/planningpoker_web/channels/room_channel.ex index 9f5980c..ff7904d 100644 --- a/lib/planningpoker_web/channels/room_channel.ex +++ b/lib/planningpoker_web/channels/room_channel.ex @@ -42,6 +42,10 @@ defmodule PlanningpokerWeb.RoomChannel do broadcast!(socket, "reset", %{}) {:noreply, socket} end + def handle_in("reveal", _, socket) do + broadcast!(socket, "reveal", %{}) + {:noreply, socket} + end def handle_in(_event, _data, socket) do {:noreply, socket} end