Login
4 branches 0 tags
Ben (Desktop/Arch) Revert "Added EasyMDE" a975034 1 month ago 181 Commits
rubhub / templates / project_blob.html
{% import "markdown_content.html" as md %}
<!DOCTYPE html>
<html>

  <head>
    <title>{{ owner.name }}/{{ project.name }} - {{ file_path }}</title>
  </head>

  <body>
    {% include "sidebar.html" %}
    <main>
      <section>
        <div class="page-header">
          <h1 class="project-header">
            <a href="{{ owner.uri() }}">{{ owner.name }}</a> /
            <a href="{{ project.uri() }}">{{ project.name }}</a>
          </h1>
        </div>

        {% include "project_tabs.html" %}

        <div class="card">
          <div class="repo-bar">
            {% if summary.branches.len() > 0 || summary.tags.len() > 0 %}
            <select name="branch-name" class="branch-switcher" data-base-suffix="blob" data-current-path="{{ file_path }}" data-base-href="{{ project.uri() }}">
              {% if summary.branches.len() > 0 %}
              <optgroup label="Branches">
                {% for branch in summary.branches %}
                <option value="{{ branch }}" {% if branch==selected_branch.as_str() %}selected{% endif %}>{{ branch }}</option>
                {% endfor %}
              </optgroup>
              {% endif %}
              {% if summary.tags.len() > 0 %}
              <optgroup label="Tags">
                {% for tag in summary.tags %}
                <option value="{{ tag }}" {% if tag==selected_branch.as_str() %}selected{% endif %}>{{ tag }}</option>
                {% endfor %}
              </optgroup>
              {% endif %}
            </select>
            {% else %}
            <select name="branch-name" disabled>
              <option selected>Empty Repo</option>
            </select>
            {% endif %}

            <span class="repo-branches">
              <a href="{{ project.uri_branches() }}">
                ⎇ {{ summary.branches.len() }} branch{% if summary.branches.len() != 1 %}es{% endif %}
              </a>
            </span>

            <span class="repo-tags">
              <a href="{{ project.uri_tags() }}">
                🏷 {{ summary.tags.len() }} tag{% if summary.tags.len() != 1 %}s{% endif %}
              </a>
            </span>

            <div class="flex-gap"> </div>

            {% include "project_clone_url.html" %}
          </div>

          {% if let Some(info) = info %}
          <div class="commit-bar">
            {% if let Some(commit) = info.commits.first() %}
            <div class="commit">
              <span class="commit-author" title="{{ commit.author }}">{{ commit.author }}</span>
              <span class="commit-message" title="{{ commit.message }}">{{ commit.message }}</span>
              <span class="commit-id">{{ commit.id }}</span>
              <span class="commit-time">{{ commit.relative_time() }}</span>
              <a href="{{ project.uri_log(&selected_branch, 0) }}" class="commit-count">⟲ {{ info.commit_count }} Commit{% if info.commit_count != 1 %}s{% endif %}</a>
            </div>
            {% endif %}
          </div>
          {% endif %}

          <div class="file-view">
            <div class="file-header">
              <div class="path-breadcrumb">
                <a href="{{ project.uri_tree(&selected_branch, "") }}">{{ project.slug }}</a>
                {% for (i, part) in path_parts.iter().enumerate() %}
                  {% if i == path_parts.len() - 1 %}
                    / {{ part }}
                  {% else %}
                    / <a href="{{ project.uri_tree(&selected_branch, &path_parts[..=i].join("/")) }}">{{ part }}</a>
                  {% endif %}
                {% endfor %}
              </div>
              <div class="file-actions">
                <a href="{{ raw_url }}" class="file-action-link">Raw</a>
                {% if let Some(src_url) = source_url %}
                <a href="{{ src_url }}" class="file-action-link">Source</a>
                {% endif %}
              </div>
            </div>
            <div class="file-metadata">
              <span class="file-meta-item">{{ mime_type }}</span>
              <span class="file-meta-separator">•</span>
              <span class="file-meta-item">{{ human_readable_size }}</span>
              {% if let Some(lines) = line_count %}
              <span class="file-meta-separator">•</span>
              <span class="file-meta-item">{{ *lines }} line{% if *lines != 1 %}s{% endif %}</span>
              {% endif %}
            </div>

            {% if is_image %}
            <div class="image-view">
              <img src="{{ raw_url }}" alt="{{ file_path }}" />
            </div>
            {% elif is_binary %}
            <div class="binary-notice">
              <p>Binary file</p>
            </div>
            {% elif is_rendered_markdown %}
            {% call md::render(markdown_frontmatter, file_content) %}
            {% else %}
            <pre class="file-content"><code>{{ file_content }}</code></pre>
            {% endif %}
          </div>
        </div>
      </section>
    </main>
  </body>

</html>