~jan0sch/smederee

Showing details for patch c7c4cf1b4adf35cdc5d358f7579660c52192a64a.
2023-02-18 (Sat), 8:55 AM - Jens Grassel - c7c4cf1b4adf35cdc5d358f7579660c52192a64a

HTML/CSS: Adjustments for code segments in file browser.

- add some visual highlight to code segments
- differentiate between "normal" code and segments in markdown files
Summary of changes
3 files modified with 36 lines added and 18 lines removed
  • modules/hub/src/main/resources/assets/css/main.css with 12 added and 0 removed lines
  • modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryFiles.scala.html with 22 added and 18 removed lines
  • modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryOverview.scala.html with 2 added and 0 removed lines
diff -rN -u old-smederee/modules/hub/src/main/resources/assets/css/main.css new-smederee/modules/hub/src/main/resources/assets/css/main.css
--- old-smederee/modules/hub/src/main/resources/assets/css/main.css	2025-01-31 16:52:49.188728400 +0000
+++ new-smederee/modules/hub/src/main/resources/assets/css/main.css	2025-01-31 16:52:49.192728407 +0000
@@ -385,6 +385,18 @@
   background: var(--nord4) none repeat scroll 0% 0%;
 }
 
+.repository-markdown-file-content code {
+  background: var(--nord4);
+  white-space: pre-wrap;
+  word-break: break-all;
+  word-wrap: break-word;
+}
+
+.repository-markdown-file-content pre {
+  background: var(--nord4);
+  padding: 0.25em 0.5em;
+}
+
 td.code-line {
   padding: 0.1em 1em;
 }
diff -rN -u old-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryFiles.scala.html new-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryFiles.scala.html
--- old-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryFiles.scala.html	2025-01-31 16:52:49.188728400 +0000
+++ new-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryFiles.scala.html	2025-01-31 16:52:49.192728407 +0000
@@ -61,26 +61,30 @@
             @for(link <- goBackUri) {
               <a href="@link">@icon(baseUri)("chevron-up")</a>&nbsp;<a href="@link">..</a>
             }
-            @if(actionBaseUri.path.toString.toLowerCase(java.util.Locale.ROOT).endsWith(".md")) {
-              @for(content <- fileContent) {
-                @Html(content)
-              }
-            } else {
-              <table class="pure-table">
-                <tbody class="repository-file-content">
-                @for(tuple <- fileContent.zipWithIndex) {
-                  @defining(tuple._1) { content =>
-                    @defining(tuple._2) { lineNumber =>
-                      <tr class="code-line">
-                        <td class="code-line-number" id="L@lineNumber"><a href="#L@lineNumber">@lineNumber</a></td>
-                        <td class="code-line"><code class="code-line">@content</code></td>
-                      </tr>
-                  }
+              @if(actionBaseUri.path.toString.toLowerCase(java.util.Locale.ROOT).endsWith(".md")) {
+                <div class="repository-markdown-file-content">
+                @for(content <- fileContent) {
+                  @Html(content)
                 }
+                </div>
+              } else {
+                <table class="pure-table">
+                  <thead>
+                  </thead>
+                  <tbody class="repository-file-content">
+                  @for(tuple <- fileContent.zipWithIndex) {
+                    @defining(tuple._1) { content =>
+                      @defining(tuple._2) { lineNumber =>
+                        <tr class="code-line">
+                          <td class="code-line-number" id="L@lineNumber"><a href="#L@lineNumber">@lineNumber</a></td>
+                          <td class="code-line"><code class="code-line">@content</code></td>
+                        </tr>
+                      }
+                    }
+                  }
+                  </tbody>
+                </table>
               }
-                </tbody>
-              </table>
-            }
           }
         </div>
       </div>
diff -rN -u old-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryOverview.scala.html new-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryOverview.scala.html
--- old-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryOverview.scala.html	2025-01-31 16:52:49.188728400 +0000
+++ new-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryOverview.scala.html	2025-01-31 16:52:49.192728407 +0000
@@ -96,7 +96,9 @@
         <div class="l-box">
         @for(content <- vcsRepositoryReadme) {
           @if(vcsRepositoryReadmeFilename.exists(_.matches("(?iu).*\\.(md|markdown)$"))) {
+            <div class="repository-markdown-file-content">
             @Html(content)
+            </div>
           } else {
             @content
           }