Commit 311728b431ac88aab5ced2f4cc547f71c54fba35

Thomas de Grivel 2022-01-14T15:25:28

fix css for line numbers

diff --git a/assets/css/app.scss b/assets/css/app.scss
index 22288df..4ec75b4 100644
--- a/assets/css/app.scss
+++ b/assets/css/app.scss
@@ -44,13 +44,13 @@ img.qrcode {
         color: blue;
     }
 }
-.content_html {
+.content_text {
     border: solid 1px #ccc;
     padding: 0.5em 0.5em 0.5em 3.5em;
     margin: 0;
     position: relative;
 }
-.content_html .line_numbers {
+.content_text .line_numbers {
     position: absolute;
     top: 0.5em;
     left: 0.5em;
diff --git a/lib/kmxgit_web/templates/repository/show_git_content.html.heex b/lib/kmxgit_web/templates/repository/show_git_content.html.heex
index 83d7392..ab50da0 100644
--- a/lib/kmxgit_web/templates/repository/show_git_content.html.heex
+++ b/lib/kmxgit_web/templates/repository/show_git_content.html.heex
@@ -1,17 +1,26 @@
 <h3><%= gettext("Content") %></h3>
-<%= if @git.content_html do %>
-  <div class="content_html">
-    <div class="line_numbers">
-      <pre><%= @git.line_numbers %></pre>
+<div class="file_content">
+  <%= if @git.content_html do %>
+    <div class="content_text">
+      <div class="line_numbers">
+        <pre><%= @git.line_numbers %></pre>
+      </div>
+      <div class="content_html">
+        <%= raw @git.content_html %>
+      </div>
     </div>
-    <%= raw @git.content_html %>
-  </div>
-<% else %>
-  <%= if String.match?(@git.content_type, ~r(^text/)) do %>
-    <pre><%= @git.content %></pre>
+  <% else %>
+    <%= if String.match?(@git.content_type, ~r(^text/)) do %>
+      <div class="content_text">
+        <div class="line_numbers">
+          <pre><%= @git.line_numbers %></pre>
+        </div>
+        <pre><%= @git.content %></pre>
+      </div>
+    <% end %>
   <% end %>
-<% end %>
-<%= if String.match?(@git.content_type, ~r(^image/)) do %>
-  <img src={"data:#{@git.content_type};base64,#{Base.encode64(@git.content)}"}/>
-<% end %>
-<%= link gettext("Download"), to: Routes.repository_path(@conn, :show, Repository.owner_slug(@repo), Repository.splat(@repo, ["_blob", @branch | String.split(@path, "/")])), class: "btn btn-primary" %>
+  <%= if String.match?(@git.content_type, ~r(^image/)) do %>
+    <img src={"data:#{@git.content_type};base64,#{Base.encode64(@git.content)}"}/>
+  <% end %>
+  <%= link gettext("Download"), to: Routes.repository_path(@conn, :show, Repository.owner_slug(@repo), Repository.splat(@repo, ["_blob", @branch | String.split(@path, "/")])), class: "btn btn-primary" %>
+</div>
diff --git a/priv/static/_assets/app.css b/priv/static/_assets/app.css
index 3247fa2..d2217da 100644
--- a/priv/static/_assets/app.css
+++ b/priv/static/_assets/app.css
@@ -14589,14 +14589,14 @@ img.qrcode {
   color: blue;
 }
 
-.content_html {
+.content_text {
   border: solid 1px #ccc;
   padding: 0.5em 0.5em 0.5em 3.5em;
   margin: 0;
   position: relative;
 }
 
-.content_html .line_numbers {
+.content_text .line_numbers {
   position: absolute;
   top: 0.5em;
   left: 0.5em;