From e72c43732fe1604509e14acc44efa9123cf6f59c Mon Sep 17 00:00:00 2001 From: Chase Wilson Date: Sun, 9 Aug 2020 16:58:35 -0500 Subject: [PATCH 1/4] Pause for upstream --- src/lib.rs | 4 +++ src/web/page/templates.rs | 1 + templates/about-base.html | 43 ++++++++++++++---------- templates/base.html | 8 +++-- templates/core/home.html | 6 ++-- templates/crate/builds.html | 5 ++- templates/crate/details.html | 16 ++++----- templates/crate/source.html | 25 +++++++------- templates/header/global_alert.html | 2 +- templates/header/package_navigation.html | 10 +++--- templates/header/topbar.html | 4 +-- templates/icons.html | 16 +++++++++ templates/macros.html | 6 ++-- templates/releases/header.html | 14 ++++---- templates/releases/releases.html | 6 ++-- templates/rustdoc/body.html | 42 +++++++++++------------ templates/rustdoc/head.html | 4 +++ 17 files changed, 124 insertions(+), 88 deletions(-) create mode 100644 templates/icons.html diff --git a/src/lib.rs b/src/lib.rs index 63eaa9ac7..9c8e82b93 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -35,7 +35,11 @@ pub(crate) static GLOBAL_ALERT: Option = Some(GlobalAlert { url: "https://blog.rust-lang.org/2019/09/18/upcoming-docsrs-changes.html", text: "Upcoming docs.rs breaking changes!", css_class: "error", +<<<<<<< HEAD fa_icon: "warning", +======= + fa_icon: "exclamation-triangle", +>>>>>>> 6e25e2c... Pause for upstream }); */ diff --git a/src/web/page/templates.rs b/src/web/page/templates.rs index c5eebac78..abfa54672 100644 --- a/src/web/page/templates.rs +++ b/src/web/page/templates.rs @@ -8,6 +8,7 @@ use postgres::Client; use serde_json::Value; use std::{ collections::HashMap, + fmt, path::PathBuf, sync::{mpsc::channel, Arc}, thread, diff --git a/templates/about-base.html b/templates/about-base.html index 1ca789783..5227918aa 100644 --- a/templates/about-base.html +++ b/templates/about-base.html @@ -2,22 +2,31 @@ {% block header %}
-
-

Docs.rs documentation

-
-
    - {% set text = ' About' %} - {{ macros::active_link(expected="index", href="/about", text=text) }} - {% set text = ' Badges' %} - {{ macros::active_link(expected="badges", href="/about/badges", text=text) }} - {% set text = ' Builds' %} - {{ macros::active_link(expected="builds", href="/about/builds", text=text) }} - {% set text = ' Metadata' %} - {{ macros::active_link(expected="metadata", href="/about/metadata", text=text) }} - {% set text = ' Shorthand URLs' %} - {{ macros::active_link(expected="redirections", href="/about/redirections", text=text) }} -
-
-
+
+

Docs.rs documentation

+
+
    + {% set text = "info-circle" | fas | safe %} + {% set text = text ~ ' About' %} + {{ macros::active_link(expected="index", href="/about", text=text) }} + + {% set text = "fonticons" | fab | safe %} + {% set text = text ~ ' Badges' %} + {{ macros::active_link(expected="badges", href="/about/badges", text=text) }} + + {% set text = "cogs" | fas | safe %} + {% set text = text ~ ' Builds' %} + {{ macros::active_link(expected="builds", href="/about/builds", text=text) }} + + {% set text = "table" | fas | safe %} + {% set text = text ~ ' Metadata' %} + {{ macros::active_link(expected="metadata", href="/about/metadata", text=text) }} + + {% set text = "road" | fas | safe %} + {% set text = text ~ ' Shorthand URLs' %} + {{ macros::active_link(expected="redirections", href="/about/redirections", text=text) }} +
+
+
{% endblock %} diff --git a/templates/base.html b/templates/base.html index 68ce0d944..916786d29 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,4 +1,5 @@ {%- import "macros.html" as macros -%} +{%- import "icons.html" as fa -%} @@ -9,16 +10,19 @@ {%- block meta -%}{%- endblock meta -%} + {# External styles #} - + + + {# Docs.rs styles #} + {%- block css -%}{%- endblock css -%} diff --git a/templates/core/home.html b/templates/core/home.html index c51b3e90d..8a99a4f87 100644 --- a/templates/core/home.html +++ b/templates/core/home.html @@ -4,7 +4,7 @@ {%- block body -%}
-

Docs.rs

+

{{ "cubes" | fas | safe }} Docs.rs

@@ -28,7 +28,7 @@

Docs.rs

Recent Releases - + {{ "rss-square" | fas | safe }}
@@ -54,7 +54,7 @@

Docs.rs

{%- if varsb.show_stars -%}
{{ release.stars }} - + {{ "star" | fas | safe }}
{%- else -%}
{%- if build.build_status -%} - {%- set build_icon = "check" -%} + {{ "check" | fas | safe }} {%- else -%} - {%- set build_icon = "close" -%} + {{ "times" | fas | safe }} {%- endif -%} -
{{ build.rustc_version }}
{{ build.docsrs_version }}
diff --git a/templates/crate/details.html b/templates/crate/details.html index 4868474a9..13de82ac7 100644 --- a/templates/crate/details.html +++ b/templates/crate/details.html @@ -39,7 +39,7 @@ {%- if details.homepage_url -%}
  • - Homepage + {{ "home" | fas | safe }} Homepage
  • {%- endif -%} @@ -48,7 +48,7 @@ {%- if details.documentation_url -%}
  • - Documentation + {{ "file-alt" | far | safe }} Documentation
  • {%- endif -%} @@ -60,14 +60,14 @@ {# If the repo link is for github, show some github stats #} {# TODO: add support for hosts besides github (#35) #} {%- if details.github -%} - - {{ details.github_stars }} - {{ details.github_forks }} - {{ details.github_issues }} + {{ "github" | fab| safe }} + {{ "star" | fas| safe }} {{ details.github_stars }} + {{ fa::s(icon="code-branch") }} {{ details.github_forks }} + {{ "exclamation-circle" | fas | safe }} {{ details.github_issues }} {# If the repo link is unknown, just show a normal link #} {%- else -%} - Repository + {{ fa::s(icon="code-branch") }} Repository {%- endif -%} @@ -77,7 +77,7 @@
  • - Crates.io + {{ "cube" | fas | safe }} Crates.io
  • diff --git a/templates/crate/source.html b/templates/crate/source.html index ea87a06d1..28a6e85d8 100644 --- a/templates/crate/source.html +++ b/templates/crate/source.html @@ -19,7 +19,7 @@ {# If this isn't the root folder, show a 'back' button #} {%- if show_parent_link -%}
  • - .. + {{ "folder-open" | far | safe }} ..
  • {%- endif -%} @@ -32,24 +32,25 @@ {# Directories #} {%- if file.mime == "dir" -%} - + {{ "folder-open" | far | safe }} {# Rust files #} {%- elif file.mime == "text/rust" -%} - + {{ "rust" | fab | safe }} {# Cargo.lock #} {%- elif file.mime == "text/plain" and file.name == "Cargo.lock" -%} - + {{ "lock" | fas | safe }} - {# - TODO: Font awesome v4.6 doesn't support these, upgrade and enable them - {% elif file.mime == "text/markdown" %} - + {# Markdown files #} + {% elif file.mime == "text/markdown" %} + {{ "markdown" | fas | safe }} - {% elif file.mime == "text/plain" and file.name == ".gitignore" %} - + {# .gitignore #} + {% elif file.mime == "text/plain" and file.name == ".gitignore" %} + {{ "git-alt" | fab | safe }} + {# More ideas FontAwesome v5: ".application/x-bzip" @@ -69,11 +70,11 @@ {# Text files or files which mime starts with `text` #} {%- elif file.mime == "text/plain" or file.mime | split(pat="/") | first == "text" -%} - + {{ "file-alt" | far | safe }} {# Binary files and any unrecognized types #} {% else -%} - + {{ "file-archive" | far | safe }} {%- endif -%} {{ file.name }} diff --git a/templates/header/global_alert.html b/templates/header/global_alert.html index 02be56cdd..1c43168b5 100644 --- a/templates/header/global_alert.html +++ b/templates/header/global_alert.html @@ -5,7 +5,7 @@ {%- if global_alert -%}
  • - + {{ global_alert.text }}
  • diff --git a/templates/header/package_navigation.html b/templates/header/package_navigation.html index 3645dd9d4..086d4fc5c 100644 --- a/templates/header/package_navigation.html +++ b/templates/header/package_navigation.html @@ -21,7 +21,7 @@

    {{ title }} {%- else -%} {{ metadata.name }} {{ metadata.version }} - + {{ "copy" | far(extra='id="clipboard" aria-label="Copy crate name and version information"') | safe }} {%- endif -%}

    @@ -61,7 +61,7 @@

  • {# The docs tab redirects to the docs, so the tab will never be selected and seen #} - + {{ "book" | fas | safe }} Documentation
  • @@ -70,7 +70,7 @@

    {# The crate information tab #}
  • - + {{ "cube" | fas | safe }} Crate
  • @@ -79,7 +79,7 @@

  • - + {{ "folder-open" | far | safe }} Source
  • @@ -88,7 +88,7 @@

  • - + {{ "cogs" | fas | safe }} Builds
  • diff --git a/templates/header/topbar.html b/templates/header/topbar.html index e3cd5649f..6dd54d8ab 100644 --- a/templates/header/topbar.html +++ b/templates/header/topbar.html @@ -10,7 +10,7 @@ {# The search bar #}
    {# If there is a search query, put it in the search bar #} @@ -20,7 +20,7 @@ {# The top-left logo and name #} - Docs.rs + {{ "book" | fas | safe }} Docs.rs