gitar

Bugfixes and preparation for M3 integration

Gitar has been in bug squishing mode for a while now, but now my exams are done I'm bringing it back. I did some small changes, but mostly removing redundant cruft (like the mdac-tags) so everything looks better.

Author
Maarten Vangeneugden
Date
Sept. 11, 2020, 5:52 p.m.
Hash
f9e996825fdabc3a93948a48a27cba1fbf84d5dd
Parent
a95db70d50b8bfc4e06210bb403a603676eb9cad
Modified files
templates/gitar/directory.djhtml
templates/gitar/file.djhtml
templates/gitar/header.djhtml
templates/gitar/index.djhtml
templates/gitar/repositories.djhtml

templates/gitar/directory.djhtml

99 additions and 0 deletions.

View changes Hide changes
+
1
{% load i18n %}
+
2
{% load static %}
+
3
+
4
{% block title %}{{ repository_name }} | Gitar{% endblock title %}
+
5
+
6
{% block stylesheets %}
+
7
    {{ block.super }}
+
8
     <link href="{% static "website/gitar.css" %}" rel="stylesheet" media="screen, projection" />
+
9
{% endblock stylesheets %}
+
10
+
11
{% block description %}
+
12
{{repository_description}}
+
13
{% endblock description %}
+
14
+
15
{% block header %}
+
16
<header>                                                                                                                                                                                         
+
17
    <h1>{{ repository_name }}</h1>  
+
18
    <label for="nav-drawer-toggle"></label>
+
19
</header>
+
20
{% endblock header %}
+
21
+
22
{% block main %}
+
23
<section>
+
24
    <div class="row">
+
25
        <div class="col hide-on-med-and-down l4">
+
26
            <!-- Add tertiary information such as branches and licensing here.  -->
+
27
            <h3 class="{{mdc}}-text">{{repository_name}}</h3>
+
28
            <h5 class="{{mdc}}-text">{% trans "Description" %}</h5>
+
29
            {{repository_description}}
+
30
            <h5 class="{{mdc}}-text">{% trans "Branches" %}</h5>
+
31
            {% for bbranch in branches %}
+
32
            <a class="{{mdac}}-text text-accent-3" href="{% url 'gitar-repository' repository_name bbranch %}">
+
33
                {{bbranch}}
+
34
            </a><br />
+
35
            {% endfor %}
+
36
            <h5 class="{{mdc}}-text">{% trans "Extra information" %}</h5>
+
37
            <div class="chip">
+
38
                {{repository_language}}
+
39
                <i class="material-icons {{mdac}}-text text-accent-3">code</i>
+
40
            </div><br />
+
41
            <div class="chip">
+
42
                {{repository_license}}
+
43
                <i class="material-icons {{mdac}}-text text-accent-3">copyright</i>
+
44
            </div><br />
+
45
        </div>
+
46
        <div class="col s12 m8 l5">
+
47
            <!-- Main area with links to files and subdirectories -->
+
48
            <h3 class="{{mdc}}-text">{% trans "Files" %}</h3>
+
49
            <table class="highlight">
+
50
                {% if subdirectories %}
+
51
                <thead>
+
52
                    {% for subdirectory in subdirectories %}
+
53
                    <tr>
+
54
                        <th>
+
55
                        <a class="{{mdac}}-text text-accent-4" href="{% url 'gitar-path-explorer' repository_name branch subdirectory.path %}">
+
56
                            {{subdirectory.name}}
+
57
                        </a>
+
58
                        </th>
+
59
                    </tr>
+
60
                    {% endfor %}
+
61
                </thead>
+
62
                {% endif %}
+
63
                <tbody>
+
64
                    {% for file in files %}
+
65
                    <tr>
+
66
                        <td>
+
67
                        <a class="{{mdac}}-text text-accent-3" href="{% url 'gitar-path-explorer' repository_name branch file.path %}">
+
68
                            {{file.name}}
+
69
                        </a>
+
70
                        </td>
+
71
                            <td>{{file.commit|truncatechars:6}}</td>
+
72
                    </tr>
+
73
                    {% endfor %}
+
74
                </tbody>
+
75
            </table>
+
76
        </div>
+
77
        <div class="col hide-on-small-only m4 l3">
+
78
            <!-- List of commits on the current branch, chronologically. -->
+
79
            <h3 class="{{mdc}}-text">{% trans "Commits" %}</h3>
+
80
            {% for commit in commits %}
+
81
            <hr />
+
82
            <a
+
83
                class="{{mdac}}-text text-accent-3 tooltipped"
+
84
                {# href="{% url 'gitar-commit' repository_name commit.hash %}" #}
+
85
                data-position="left"
+
86
                data-delay="50"
+
87
                data-tooltip="Viewing commits is not implemented yet!">
+
88
                {{commit.hash|truncatechars:15}}
+
89
            </a>
+
90
            <span class="{{mdc}}-text text-lighten-2">
+
91
                {% trans "by" %} {{commit.author}}
+
92
            </span><br />
+
93
            {{commit.description|lower|capfirst}}{% if commit.description|last != "." %}.{% endif %}
+
94
            {% endfor %}
+
95
        </div>
+
96
    </div>
+
97
</section>
+
98
{% endblock main %}
+
99

templates/gitar/file.djhtml

87 additions and 0 deletions.

View changes Hide changes
+
1
{% load i18n %}
+
2
{% load static %}
+
3
+
4
{% block title %}{{repository_name}}/{{file_name}} | Gitar{% endblock title %}
+
5
+
6
{% block stylesheets %}
+
7
    {{ block.super }}
+
8
    <link href="{% static "website/gitar.css" %}" rel="stylesheet" media="screen, projection" />
+
9
    <link rel="stylesheet" type="text/css" href="/static/website/syntax.css" />
+
10
    <link rel="stylesheet" type="text/css" href="/static/gitar/css/file.css" />
+
11
    <style>
+
12
    table.highlight tr {
+
13
        line-height: 15px;
+
14
    }
+
15
+
16
    /* These vendor prefixes are still necessary, yeah...*/
+
17
    .line-number {
+
18
      -moz-user-select: none;
+
19
      -webkit-user-select: none;
+
20
      -ms-user-select: none;
+
21
      user-select: none;
+
22
    }
+
23
    </style>
+
24
{% endblock stylesheets %}
+
25
+
26
{% block description %}
+
27
Content of {{file_name}} in {{repository_name}}
+
28
{% endblock description %}
+
29
+
30
{% block header %}
+
31
<header>                                                                                                                                                                                         
+
32
    <h1>{{ repository_name }}</h1>  
+
33
    <label for="nav-drawer-toggle"></label>
+
34
</header>
+
35
{% endblock header %}
+
36
+
37
{% comment %}
+
38
{% block stylesheets %}
+
39
<link href="/static/website/materialize/css/google-icons.css" rel="stylesheet" />
+
40
<link href="/static/website/materialize/css/materialize.css" rel="stylesheet" media="screen, projection" />
+
41
<!--<link rel="stylesheet href="https://cdn.rawgit.com/tonsky/FiraCode/1.204/distr/fira_code.css">-->
+
42
<!-- TODO: Download Fira Code stylesheet and serve via the static folder!
+
43
    This is necessary BEFORE activating the Fira Code ligature font, because
+
44
    using a CDN I do not controll brings in tonnes of JS code from Google,
+
45
    Amazon, and whatnot. -->
+
46
<!--<style>
+
47
td {
+
48
	padding: 0 0 0 0;
+
49
}
+
50
pre {
+
51
	margin-top: 10px;
+
52
	margin-bottom: 10px;
+
53
}
+
54
table {
+
55
	line-height: 0px;
+
56
	padding-top: 0px;
+
57
	padding-bottom: 0px;
+
58
	border-spacing: 0 0;
+
59
	margin-top: 0px;
+
60
	margin-bottom: 0px;
+
61
}
+
62
</style>-->
+
63
{# For the syntax coloring of Gitar. TODO for later. #}
+
64
<link rel="stylesheet" type="text/css" href="/static/website/syntax.css" />
+
65
<link rel="stylesheet" type="text/css" href="/static/gitar/css/file.css" />
+
66
{% endblock stylesheets %}
+
67
{% endcomment %}
+
68
+
69
<!-- NOTE: Currently I'm using an ordered list to get numbers, but now I can't
+
70
link to the different lines. So until I figure out a way to make tables behave
+
71
correctly, this ought to be the temporary solution-->
+
72
{% block main %}
+
73
<section style="font-family: 'Fira Code', monospace;">
+
74
    <h3>{{file_name}}</h3>
+
75
	<table class="highlight">
+
76
		{% for line in content %}
+
77
		<tr>
+
78
            <td id="{{ forloop.counter }}" class="line-number" style=":hover { background-color: #00E676;}">
+
79
                <a style=":hover { background-color: #00e676;}" href="#{{ forloop.counter }}">
+
80
                <pre>{{ forloop.counter }}</pre></a></td>
+
81
			<td><pre>{{ line|safe }}</pre></td>
+
82
		</tr>
+
83
		{% endfor %}
+
84
	</table>
+
85
</section>
+
86
{% endblock main %}
+
87

templates/gitar/header.djhtml

36 additions and 0 deletions.

View changes Hide changes
+
1
	Copyright 2015 Maarten Vangeneugden
+
2
+
3
	Licensed under the Apache License, Version 2.0 (the "License");
+
4
	you may not use this file except in compliance with the License.
+
5
	You may obtain a copy of the License at
+
6
+
7
	   https://www.apache.org/licenses/LICENSE-2.0
+
8
+
9
	Unless required by applicable law or agreed to in writing, software
+
10
	distributed under the License is distributed on an "AS IS" BASIS,
+
11
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+
12
	See the License for the specific language governing permissions and
+
13
	limitations under the License.
+
14
{% endcomment %}
+
15
<!DOCTYPE html>
+
16
<html>
+
17
	<head>
+
18
		<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
+
19
		<link href="/static/website/materialize/css/materialize.css" rel="stylesheet" media="screen, projection" />
+
20
		<meta charset="utf-8" /> <!-- Just in case you didn't know ASCII sucks. -->
+
21
		<meta name="author" content="Vngngdn (Maarten Vangeneugden)"> <!-- Yep, yours truly. Forward any solliciting to /dev/null. -->
+
22
		<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <!--Because this page is suited for mobile devices.-->
+
23
		<meta name="description" content="Vngngdn's personal web page. That should intrigue you enough to get over here." />
+
24
	</head>
+
25
	<body>
+
26
		{# This is actually the navigation bar. Perhaps it should be in its own template file. #}
+
27
		<header>
+
28
			<div class="navbar-fixed"> <!-- Fixes the navbar to the top. I like that. -->
+
29
				<nav>
+
30
					<div class="nav-wrapper blue"> <!-- I admit this looks redundant, but hey, at least it's not DreamWeaver. -->
+
31
						<a class="brand-logo">Vngngdn</a>
+
32
					</div>
+
33
				</nav>
+
34
			</div>
+
35
		</header>
+
36

templates/gitar/index.djhtml

86 additions and 0 deletions.

View changes Hide changes
+
1
{% load i18n %}
+
2
{% load static %}
+
3
+
4
{% block stylesheets %}
+
5
    {{ block.super }}
+
6
     <link href="{% static "website/gitar.css" %}" rel="stylesheet" media="screen, projection" />
+
7
{% endblock stylesheets %}
+
8
+
9
{% block title %}{% trans "Gitar | Index page" %}{% endblock title %}
+
10
+
11
{% block description %}
+
12
{% trans "My personal answer to GitHub." %}
+
13
{% endblock description %}
+
14
+
15
{% block header %}
+
16
<header>                                                                                                                                                                                         
+
17
    <h1>Gitar</h1>  
+
18
    <label for="nav-drawer-toggle"></label>
+
19
</header>
+
20
{% endblock header %}
+
21
+
22
{% block nav %}
+
23
<input id="nav-drawer-toggle" type="checkbox" />
+
24
<nav>
+
25
    <label for="nav-drawer-toggle"><!--🡨-->🡠</label>
+
26
    <h2>{% trans "Navigation" %}</h2>
+
27
    {% for title, date, blog_text, link in posts %}
+
28
    <a class="nav-link" href="{{ link }}">{{ title }}</a>
+
29
    {% endfor %}
+
30
    <hr class="half" />
+
31
    <a class="nav-link" href="{% url 'about-index' %}">{% trans "Front page" %}</a>
+
32
  </nav>
+
33
{% endblock nav %}
+
34
+
35
+
36
{% block main %}
+
37
+
38
{# with mdac=materialDesign_accentColor %} {# You'll see why this is handy shortly. #}
+
39
{# with mdc=materialDesign_color #}
+
40
<section class="emphasis">
+
41
    <h1>{% trans "About Gitar" %}</h1>
+
42
    <p>
+
43
        {% blocktrans %}
+
44
		Gitar is a simple web app to easily host Git repositories using the Django framework.
+
45
        It's a hobby project of me, to make it easy for
+
46
        people to scroll through the code I publish, in a read-only fashion. It
+
47
        makes use of
+
48
        <a href="http://pygments.org/" target="_blank">Pygments</a>
+
49
        to read the source files, and apply the appropriate syntax coloring.
+
50
        {% endblocktrans %}
+
51
	</p>
+
52
    <p>
+
53
        {% blocktrans %}All repositories are automatically updated when changes
+
54
        have been pushed to the server, without any manual intervention from me.
+
55
        Special attention goes to clean URL design, adhering to web standards,
+
56
        and responsive design across all screen types.{% endblocktrans %}
+
57
    </p>
+
58
    <p>
+
59
        {% blocktrans %}Gitar <b>is a project under development!</b>
+
60
        While it's certainly presentable, there's still a lot of room for improvement.<br />
+
61
        Also, if you happen to walk in while I'm working, it's possible you'll
+
62
        fall through the floor, so be warned =D{% endblocktrans %}
+
63
    </p>
+
64
</section>
+
65
<section>
+
66
    <h3>{% trans "Public repositories" %}</h3>
+
67
		{% for repository in repositories %} {# ARGH DON'T YOU LOVE THE READABILITY #}
+
68
            <p>
+
69
                <a class="btn fill" href="{% url 'gitar-repository' repository_name=repository.name %}">
+
70
                    {{ repository.name }}
+
71
                </a>
+
72
                {{ repository.description }} 
+
73
            </p>
+
74
            <dl>
+
75
            <dt>🅿️</dt>
+
76
            <dd>{{ repository.programmingLanguage }}</dd>
+
77
                <!--<li><i class="material-icons">description</i> 
+
78
                    {{ repository.fileCount }}</li>-->
+
79
            <dt>©️</dt>
+
80
            <dd>{{ repository.license }}</dd>
+
81
            </dl>
+
82
            <hr>
+
83
		{% endfor %}
+
84
</section>
+
85
{% endblock main %}
+
86

templates/gitar/repositories.djhtml

23 additions and 0 deletions.

View changes Hide changes
+
1
+
2
{% block title %}Gitar | Index page{% endblock title %}
+
3
{% block description %}
+
4
Vngngdn's Gitar app. Really nothing more to say, except that it FREAKING ROCKS!
+
5
{% endblock description %}
+
6
{% block main %}
+
7
{% with mdac=materialDesign_accentColor %} {# You'll see why this is handy shortly. #}
+
8
<div class="section {{ materialDesign_color }} lighten-2">
+
9
	<p class="flow-text container white-text">
+
10
		Gitar is a simple web app to easily host Git repositories using the Django framework.
+
11
	</p>
+
12
</div>
+
13
<div class="container section">
+
14
+
15
	<ul>
+
16
	{% for file in files %}
+
17
	<li>{{ file }}</li>
+
18
	{% endfor %}
+
19
	</ul>
+
20
	</div>
+
21
{% endwith %}
+
22
{% endblock main %}
+
23