Skip to content

Commit 3ef8a30

Browse files
authored
Merge pull request #148 from wyeworks/heex
Migrate soft-deprecated leex templates to HEEx
2 parents 455207a + 51e2f15 commit 3ef8a30

7 files changed

Lines changed: 27 additions & 21 deletions

File tree

lib/elixir_console_web/live/console_live.html.leex renamed to lib/elixir_console_web/live/console_live.html.heex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<div class="flex h-full flex-col sm:flex-row">
22
<div class="flex-1 sm:h-full overflow-scroll">
33
<div class="h-full flex flex-col">
4+
<div class="flex-1"></div>
45
<%= live_component(HistoryComponent, output: @output, id: :history) %>
56
<%= live_component(CommandInputComponent, history: @history, bindings: @sandbox.bindings, id: :command_input) %>
67
</div>

lib/elixir_console_web/live/console_live/command_input_component.html.leex renamed to lib/elixir_console_web/live/console_live/command_input_component.html.heex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
autofocus
1010
name="command"
1111
phx-hook="CommandInput"
12-
data-input_value="<%= @input_value %>"
13-
data-caret_position="<%= @caret_position %>"
12+
data-input_value={@input_value}
13+
data-caret_position={@caret_position}
1414
/>
1515
</div>
1616
</form>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<div class="p-2" id="commandOutput" phx-update="append">
2+
<div id="version-info" class="text-gray-500 font-medium">
3+
<p>Elixir <%= System.version() %>/OTP <%= System.otp_release() %></p>
4+
</div>
5+
<%= for output <- @output do %>
6+
<div id={"command#{output.id}"} class="text-gray-300 font-medium">
7+
<%= print_prompt() %><%= format_command(output.command) %>
8+
</div>
9+
<div id={"output#{output.id}"} class="text-teal-300">
10+
<%= output.result %>
11+
<%= if output.error do %>
12+
<span class="text-pink-400">
13+
<%= output.error %>
14+
</span>
15+
<% end %>
16+
</div>
17+
<% end %>
18+
</div>

lib/elixir_console_web/live/console_live/history_component.html.leex

Lines changed: 0 additions & 13 deletions
This file was deleted.

lib/elixir_console_web/live/console_live/sidebar_component.html.leex renamed to lib/elixir_console_web/live/console_live/sidebar_component.html.heex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<%= if @contextual_help do %>
1919
<div id="documentation-output">
2020
<span class="mb-8 font-bold text-green-400">
21-
<a href="<%= @contextual_help[:link] %>" target="_blank" class="underline"><%= @contextual_help[:func_name] %></a>
21+
<a href={@contextual_help[:link]} target="_blank" class="underline"><%= @contextual_help[:func_name] %></a>
2222
</span>
2323
<span class="text-xs mb-4 font-bold text-gray-400"><%= @contextual_help[:header] %></span>
2424
<span class="contextual-help-doc text-xs text-gray-400"><%= Phoenix.HTML.raw @contextual_help[:doc] %></span>
@@ -33,7 +33,7 @@
3333
<p class="text-sm">Please note some features of the language are not safe to run in a shared environment like this console.
3434
If you are interested in knowing more about the limitations, you must <a class="underline" href="https://github.com/wyeworks/elixir_console#how-much-elixir-can-i-run-in-the-web-console">read here</a>.</p>
3535
<p class="text-sm">Please report any security vulnerabilities to
36-
<a class="underline" href="mailto:elixir-console-security@wyeworks.com">elixir-console-security@wyeworks.com<a>.
36+
<a class="underline" href="mailto:elixir-console-security@wyeworks.com">elixir-console-security@wyeworks.com</a>.
3737
</p>
3838
<% end %>
3939
<% end %>

lib/elixir_console_web/templates/layout/root.html.leex renamed to lib/elixir_console_web/templates/layout/root.html.heex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<%= csrf_meta_tag() %>
1818
<title>Elixir Web Console - WyeWorks</title>
1919
<meta name="description" content="The Elixir Web Console is where you can try the Elixir language without the need to leave the browser." />
20-
<link rel="stylesheet" href="<%= Routes.static_path(@conn, "/css/app.css") %>"/>
20+
<link rel="stylesheet" href={Routes.static_path(@conn, "/css/app.css")} />
2121
<link href="https://fonts.googleapis.com/css?family=Fira+Mono:400,500&display=swap" rel="stylesheet">
2222
</head>
2323
<body class="h-screen bg-white flex flex-col px-10 pb-5">
@@ -45,6 +45,6 @@
4545
<%= @inner_content %>
4646
</div>
4747
</main>
48-
<script type="text/javascript" src="<%= Routes.static_path(@conn, "/js/app.js") %>"></script>
48+
<script type="text/javascript" src={Routes.static_path(@conn, "/js/app.js")}></script>
4949
</body>
5050
</html>

test/elixir_console_web/live/console_live_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ defmodule ElixirConsoleWeb.ConsoleLiveTest do
2020
end
2121

2222
test "command result is displayed", %{html: html} do
23-
assert html =~ ~r/<div id="output.".*3.*<\/div>/s
23+
assert html =~ ~r/<div[^>]*id="output.".*3.*<\/div>/s
2424
end
2525

2626
test "binding value is displayed in the Current Variables section", %{html: html} do
27-
assert html =~ ~r/<h2.*Current Bindings<\/h2><ul><li.*>a: <code.*3<\/code>/s
27+
assert html =~ ~r/<h2[^>]*>Current Bindings<\/h2><ul><li.*>a: <code.*3<\/code>/s
2828
end
2929
end
3030

0 commit comments

Comments
 (0)