Skip to content

Commit de902df

Browse files
committed
Refactor repository list view
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent c7ed8c6 commit de902df

3 files changed

Lines changed: 72 additions & 44 deletions

File tree

fedcode/forms.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,8 @@ class SearchRepositoryForm(forms.Form):
137137
label=False,
138138
widget=forms.TextInput(
139139
attrs={
140-
"placeholder": "Please Enter a Repository URL ex: https://github.com/nexB/vulnerablecode-data",
141-
"class": "input is-rounded",
142-
"style": "width: 90%;",
140+
"placeholder": "Search a repository...",
141+
"class": "input",
143142
},
144143
),
145144
)

fedcode/pipes/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
def create_note(pkg, note_dict):
22-
# TODO: also take argument for source of the note ideally github blob for
22+
# TODO: also take argument for source of the note ideally github blob for
2323
# for file.
2424
note, _ = Note.objects.get_or_create(acct=pkg.acct, content=saneyaml.dump(note_dict))
2525
pkg.notes.add(note)

fedcode/templates/repo_list.html

Lines changed: 69 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,86 @@
11
{% extends "base.html" %}
2+
23
{% block title %}
3-
Git Repository List
4+
Git Repositories
45
{% endblock %}
56

67
{% block extra-head %}
8+
<style>
9+
/* Remove the border below the table header */
10+
thead th {
11+
border-bottom: none !important;
12+
}
13+
14+
tbody tr:hover {
15+
background-color: #e0e0e0 !important;
16+
cursor: pointer;
17+
}
18+
19+
tbody tr:nth-child(even):hover {
20+
background-color: #d3d3d3 !important;
21+
}
22+
</style>
723
{% endblock %}
24+
25+
826
{% block content %}
927
<div class="columns">
1028
<div class="column">
1129
</div>
1230
<div class="column is-two-thirds">
13-
14-
<div class="content is-normal">
15-
<h1>Git Repository List</h1>
16-
<hr/>
17-
<div>
18-
19-
<form method="get" class="has-text-centered box" action="">
20-
{{ form }}
21-
<button type="submit" class="button is-link is-rounded">Search</button>
22-
</form>
23-
24-
{% for repo in repo_list %}
25-
<article class="media box mt-4 ">
26-
<div class="media-left has-text-centered">
27-
<h2>Number of Reviews</h2>
28-
<p>{{ repo.review_count }}</p>
29-
</div>
30-
<div class="media-content ">
31-
<div class="content" style="border-left: 4px solid black;">
32-
<h3 class="ml-3 mr-3"><a href="{{ repo.url }}"> {{ repo.url }}</a></h3>
33-
<small>@{{ repo.admin.user.username }}</small>
34-
{% if user.person %}
35-
<a class="is-center button ml-3" href="{% url 'review-create' repo.id %}">Create Review </a>
36-
{% endif %}
37-
{% if user.service %}
38-
<form method="post" action="{% url 'sync-activity' repo.id %}">
39-
{% csrf_token %}
40-
<input type="submit" class="is-center button mt-2 ml-3 is-info" value="Sync">
41-
</form>
42-
{% endif %}
43-
31+
<div class="content is-normal">
32+
<h1>Git Repository List</h1>
33+
<hr />
34+
<div>
35+
<form method="get" class="box px-6 mx-0" action="">
36+
<div class="field has-addons">
37+
<div class="control is-expanded">
38+
{{ form.search }}
39+
</div>
40+
<div class="control">
41+
<button type="submit" class="button is-info">Search</button>
42+
</div>
43+
</div>
44+
</form>
45+
<div class="box">
46+
<table class="table is-striped is-hoverable is-fullwidth">
47+
<thead>
48+
<tr>
49+
<th colspan="3">
50+
<div class="box is-small">
51+
<div class="columns">
52+
<div class="column is-three-fifths">Repository</div>
53+
<div class="column is-one-fifth">Creator</div>
54+
<div class="column is-one-fifth">Review</div>
55+
</div>
56+
</div>
57+
</th>
58+
</tr>
59+
</thead>
60+
<tbody>
61+
{% for repo in repo_list %}
62+
<tr>
63+
<td colspan="3">
64+
<a href="{{ repo.url }}" class="has-text-info">
65+
<div class="columns px-5">
66+
<div class="column is-three-fifths">{{ repo.url }}</div>
67+
<div class="column is-one-fifth">@{{ repo.admin.user.username }}</div>
68+
<div class="column is-one-fifth">{{ repo.review_count }}</div>
69+
</div>
70+
</a>
71+
</td>
72+
</tr>
73+
{% empty %}
74+
<tr>
75+
<td colspan="3" class="has-text-centered">No Repository found.</td>
76+
</tr>
77+
{% endfor %}
78+
</tbody>
79+
</table>
80+
</div>
4481
</div>
45-
4682
</div>
47-
</article>
48-
{% endfor %}
49-
50-
</div>
51-
52-
</div>
5383
</div>
5484
<div class="column"></div>
5585
</div>
56-
5786
{% endblock %}

0 commit comments

Comments
 (0)