diff --git a/fedcode/forms.py b/fedcode/forms.py index 83fd553..b493ae4 100644 --- a/fedcode/forms.py +++ b/fedcode/forms.py @@ -110,9 +110,8 @@ class SearchPackageForm(forms.Form): label=False, widget=forms.TextInput( attrs={ - "placeholder": "Please enter a valid purl ex: pkg:maven/org.apache.commons/io", - "class": "input is-rounded", - "style": "width: 90%;", + "placeholder": "Search a package...", + "class": "input ", }, ), ) diff --git a/fedcode/models.py b/fedcode/models.py index 34e6564..3bad2d4 100644 --- a/fedcode/models.py +++ b/fedcode/models.py @@ -295,6 +295,10 @@ def __str__(self): def followers_count(self): return Follow.objects.filter(package=self).count() + @property + def notes_count(self): + return Note.objects.filter(acct=self.acct).count() + @property def followers(self): return Follow.objects.filter(package=self).values("person_id") diff --git a/fedcode/pipes/utils.py b/fedcode/pipes/utils.py index adc06c2..47858b9 100644 --- a/fedcode/pipes/utils.py +++ b/fedcode/pipes/utils.py @@ -19,6 +19,8 @@ def create_note(pkg, note_dict): + # TODO: also take argument for source of the note ideally github blob for + # for file. note, _ = Note.objects.get_or_create(acct=pkg.acct, content=saneyaml.dump(note_dict)) pkg.notes.add(note) create_activity = CreateActivity(actor=pkg.to_ap, object=note.to_ap) diff --git a/fedcode/templates/pkg_list.html b/fedcode/templates/pkg_list.html index f32bd45..45f85eb 100644 --- a/fedcode/templates/pkg_list.html +++ b/fedcode/templates/pkg_list.html @@ -4,6 +4,24 @@ All Packages {% endblock %} +{% block extra-head %} + +{% endblock %} + {% block content %}
@@ -11,30 +29,57 @@
-

Package List

+

Discover Packages


-
- {{ form }} - -
- {% for package in package_list %} -
-
-

Number of Followers

-

{{ package.followers_count }}

-
-
-
-

{{ package.purl }}

- Created by @{{ package.service.user.username }} -
+
+
+
+ {{ form.search }} +
+
+
-
- {% endfor %} + +
+ + + + + + + + {% for package in package_list %} + + + + {% empty %} + + + + {% endfor %} + +
+
+
+
Package URL
+
Activity
+
Followers
+
+
+
+ +
+
{{ package.purl }}
+
{{ package.notes_count }}
+
{{ package.followers_count }}
+
+
+
No packages found.
+
{% if is_paginated %} -
-
{% endblock %} \ No newline at end of file diff --git a/fedcode/templates/user_profile.html b/fedcode/templates/user_profile.html index 363f5c2..f05a522 100644 --- a/fedcode/templates/user_profile.html +++ b/fedcode/templates/user_profile.html @@ -22,9 +22,8 @@ - to generate your profile picture based on your email address — {{ person.user.email }} + to create your profile picture using your email address — {{ person.user.email }}

-