diff options
| author | Bobby <[email protected]> | 2022-11-21 22:53:25 -0500 |
|---|---|---|
| committer | Bobby <[email protected]> | 2022-11-21 22:53:25 -0500 |
| commit | 24b486e5e6e2bf57b24c9ec4f9056a270ad115d2 (patch) | |
| tree | 64da60539a370f6f025645cd5ac58cdbfcc027d7 | |
| parent | d0032061cfdbf6d99588febb0c9d26c9510410d6 (diff) | |
| download | thatcomputerscientist-24b486e5e6e2bf57b24c9ec4f9056a270ad115d2.tar.xz thatcomputerscientist-24b486e5e6e2bf57b24c9ec4f9056a270ad115d2.zip | |
repo improvements
| -rw-r--r-- | dev_status/views.py | 30 | ||||
| -rw-r--r-- | templates/dev_status/home.html | 9 |
2 files changed, 12 insertions, 27 deletions
diff --git a/dev_status/views.py b/dev_status/views.py index c6d90943..19f83125 100644 --- a/dev_status/views.py +++ b/dev_status/views.py @@ -18,31 +18,17 @@ def home(request): if not request.user.is_authenticated: filter = 'public' context = {} - repos = [] - user = g.get_user() - for repo in user.get_repos(type=filter, sort=sort, direction=direction): - if 'luciferreeves' in repo.full_name: - if search != '': - search = search.lower() - search = ''.join(e for e in search if e.isalnum()) - repo_name = repo.name.lower() - repo_name = ''.join(e for e in repo_name if e.isalnum()) - repo_desc = repo.description.lower() if repo.description else '' - repo_desc = ''.join(e for e in repo_desc if e.isalnum()) - if search in repo_name or search in repo_desc: - repos.append(repo) - else: - repos.append(repo) + repos = g.get_user().get_repos(type=filter, sort=sort, direction=direction) - context['repo_length'] = len(repos) - - # Pagination - start = (int(page) - 1) * int(items) - end = start + int(items) - repos = repos[start:end] + if search != '': + search = search.lower() + repos = [repo for repo in repos if search in str(repo.name).lower() or search in str(repo.description).lower()] + else: + repos = [repo for repo in repos if 'luciferreeves' in str(repo.full_name).lower()] + context['repo_length'] = len(repos) + context['repos'] = repos[(int(page) - 1) * int(items):int(page) * int(items)] context['title'] = '{} Repositories'.format(str(filter).capitalize()) - context['repos'] = repos context['page'] = int(page) context['items'] = int(items) context['num_pages'] = math.ceil(context['repo_length'] / int(items)) diff --git a/templates/dev_status/home.html b/templates/dev_status/home.html index eef64b7b..6b3a820b 100644 --- a/templates/dev_status/home.html +++ b/templates/dev_status/home.html @@ -11,7 +11,7 @@ {% endif %} {% comment %} Search and Filter {% endcomment %} - <table> + <table style="margin: 0 auto;" <form action="" method="get"> <tr> <td> @@ -76,9 +76,9 @@ {% endif %} </td> <td width="500px"> - <p style="margin: 10px auto;"><a class="anavdef" href="{% url 'dev_status:repo' repo.name %}" style="font-size: 18px;"> + <h3 style="margin: 0px auto 8px auto;"><a href="{% url 'dev_status:repo' repo.name %}" style="font-size: 18px;"> {{ repo.name }} - </a></p> + </a></h3> {% if repo.description %} <p style="margin-top: 0px;"><small>{{ repo.description }}</small></p> {% else %} @@ -109,8 +109,7 @@ </td> <td width="136px"> <table> - <tr><td><a href="{% url 'dev_status:repo' repo.name %}">View Source</a></td></tr> - <tr><td><a href="{{ repo.html_url }}" target="_blank">View on GitHub</a></td></tr> + <tr><td style="color: #c9d1d9; background-color: #21262d; border-color: #f0f6fc; padding: 5px 10px; border-radius: 4px;"><a style="color: #c9d1d9; text-decoration: none; font-family: sans-serif; font-size: 14px;" href="{{ repo.html_url }}" target="_blank">View on GitHub</a></td></tr> </table> </td> </tr> |
