Skip to content

Commit 26eb04d

Browse files
authored
Merge pull request #2161 from LoseGameng/fix/issue-2135
added the version display on the main screen
2 parents 2c40694 + c190be6 commit 26eb04d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

services/app/apps/codebattle/lib/codebattle_web/templates/root/landing.html.heex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,9 @@
387387
CasperMosh
388388
</a>
389389
</p>
390+
<p class="mb-0 mt-2 small text-muted">
391+
Version: <%= app_short_version() %>
392+
</p>
390393
</div>
391394
</div>
392395
</div>

services/app/apps/codebattle/lib/codebattle_web/views/root_view.ex

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ defmodule CodebattleWeb.RootView do
55

66
alias Codebattle.Feedback
77

8+
@app_version Application.compile_env(:codebattle, :app_version)
89
def csrf_token do
910
Plug.CSRFProtection.get_csrf_token()
1011
end
@@ -20,6 +21,20 @@ defmodule CodebattleWeb.RootView do
2021
Enum.map(Feedback.get_all(), &item/1)
2122
end
2223

24+
def app_short_version do
25+
case @app_version do
26+
"" -> "undefined"
27+
version -> String.slice(version, 0, 7)
28+
end
29+
end
30+
31+
def github_commit_link do
32+
case @app_version do
33+
"" -> "/"
34+
version -> "https://github.com/hexlet-codebattle/codebattle/commit/#{version}"
35+
end
36+
end
37+
2338
defp item(%{title: title, description: description, pubDate: pub_date, link: link, guid: guid}) do
2439
"""
2540
<item>

0 commit comments

Comments
 (0)