1
0

3 Revīzijas e83d906103 ... 58bdd7099f

Autors SHA1 Ziņojums Datums
  ghorsington 58bdd7099f Fix button scaling on mobile 5 gadi atpakaļ
  ghorsington 3878fbdd31 Fix dates not being displayed correctly 5 gadi atpakaļ
  ghorsington 58abe0466d Inline artifacts script 5 gadi atpakaļ

+ 1 - 10
src/app.py

@@ -36,7 +36,7 @@ class Artifact:
 
     def __init__(self, id, date, changelog, artifacts):
         self.id = id
-        self.date = date
+        self.date = date.strip()
         self.changelog = changelog
         self.artifacts = [ArtifactItem(**item)
                           for item in artifacts]
@@ -140,14 +140,5 @@ def index():
     projects = get_projects()
     return render_template("main.html", projects=projects)
 
[email protected]_filter('timestamp')
-def timestamp_filter(filename):
-  try:
-      timestamp = str(os.path.getmtime(filename[1:]))
-  except OSError:
-      return filename
-  newfilename = "{0}?v={1}".format(filename, timestamp)
-  return newfilename
-
 if __name__ == "__main__":
     app.run(host='0.0.0.0')

+ 0 - 21
src/static/script/artifacts.js

@@ -1,21 +0,0 @@
-function init() {
-    let dates = document.querySelectorAll("span.build-date");
-
-    for (let date of dates) {
-        date.textContent = new Date(date.textContent).toLocaleString();
-    }
-
-    let artifacts = document.querySelectorAll("div.artifact-item");
-    for (let artifact of artifacts) {
-        let contents = artifact.querySelector(".artifact-contents");
-        if (!contents || !(contents instanceof HTMLElement))
-            continue;
-        artifact.addEventListener("click", e => {
-            e.preventDefault();
-            if (contents.classList.contains("contents-visible"))
-                contents.classList.remove("contents-visible");
-            else
-                contents.classList.add("contents-visible");
-        });
-    }
-}

+ 4 - 0
src/static/style/main.scss

@@ -13,6 +13,10 @@ $menu-label-color: hsl(0, 0%, 96%);
   div#main-view {
     min-height: initial;
   }
+
+  a.button-scale {
+    width: initial !important;
+  }
 }
 
 @media (min-width: $tablet) {

+ 29 - 3
src/templates/project_view.html

@@ -2,7 +2,7 @@
 
 {%block head%}
 <link rel="stylesheet" href="{{ url_for('static', filename='style/fontello/css/fontello.css') }}"" />
-<script src="{{ url_for('static', filename='script/artifacts.js') | timestamp }}"></script>
+</script>
 {%endblock%}
 
 {%block title%}{{selected_project.info.name}}{%endblock%}
@@ -55,7 +55,10 @@
                     <tbody>
                         {%-for download_item in artifact.artifacts%}
                         <tr>
-                            <td class="min-size"><a class="button is-link" style="width: calc({{download_item.width}} * 0.6rem);" href="{{ url_for('download_item', project_id=selected_project.id, artifact_id=artifact.id, download_item=download_item.file)}}">{{download_item.file}}</a></td>
+                            <td class="min-size"><a class="button is-link button-scale"
+                                    style="width: calc({{download_item.width * 0.5}}em);"
+                                    href="{{ url_for('download_item', project_id=selected_project.id, artifact_id=artifact.id, download_item=download_item.file)}}">{{download_item.file}}</a>
+                            </td>
                             <td>{{download_item.description}}</td>
                         </tr>
                         {%-endfor%}
@@ -74,5 +77,28 @@
 </div>
 {%-endfor%}
 
-<script>init();</script>
+<script>
+    function init() {
+        let dates = document.querySelectorAll("span.build-date");
+
+        for (let date of dates) {
+            date.textContent = new Date(date.textContent).toLocaleString();
+        }
+
+        let artifacts = document.querySelectorAll("div.artifact-item");
+        for (let artifact of artifacts) {
+            let contents = artifact.querySelector(".artifact-contents");
+            if (!contents || !(contents instanceof HTMLElement))
+                continue;
+            artifact.addEventListener("click", e => {
+                e.preventDefault();
+                if (contents.classList.contains("contents-visible"))
+                    contents.classList.remove("contents-visible");
+                else
+                    contents.classList.add("contents-visible");
+            });
+        }
+    }
+    init();
+</script>
 {%endblock%}