Commit graph

6 commits

Author SHA1 Message Date
Kevin Morris
dbe5cb4a33
fix(fastapi): only include comment-edit.js where needed
Closes: #178

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-18 16:42:26 -08:00
Kevin Morris
8040ef5a9c
fix(FastAPI): use pkgbase in package actions
Previously, `result` was being used which was directly set to
`pkgbase` before rendering the actions.html partial. It didn't
make much sense. This commit cleans things up a bit.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-15 19:02:53 -07:00
Kevin Morris
0895dd07ee
feat(FastAPI): add /pkgbase/{name}/comments/{id}/pin (post)
In addition, fix up some templates to display pinned comments,
and include the unpin form input for pinned comments, which is
not yet implemented.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-02 16:59:38 -07:00
Kevin Morris
5e95cfbc8a
fix(FastAPI): get_pkgbase -> get_pkg_or_base
`get_pkgbase` has been replaced with `get_pkg_or_base`, which is
quite similar, but it does take a new `cls` keyword argument which
is to be the model class which we search for via its `Name` column.

Additionally, this change fixes a bug in the `/packages/{name}` route
by supplying the Package object in question to the context and modifying
the template to use it instead of a hacky through-base workaround.

Examples:

    pkgbase = get_pkg_or_base("some_pkgbase_name", PackageBase)
    pkg = get_pkg_or_base("some_package_name", Package)

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-02 16:59:09 -07:00
Kevin Morris
ab8a44cede
fix(FastAPI): only show comments partial if they exist
This was incorrectly displaying a comment section header
when no comments existed.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-09-12 00:47:34 -07:00
Kevin Morris
ae3d302c47 implement /packages/{name} as its own route
A few things added with this commit:

- aurweb.packages.util
    - A module providing package and pkgbase helpers.
- aurweb.template.register_filter
    - A decorator that can be used to register a filter:
      @register_filter("some_filter") def f(): pass

Additionally, template partials have been split off a bit
differently. Changes:

- /packages/{name} is defined in packages/show.html.
- partials/packages/package_actions.html is now
  partials/packages/actions.html.
- partials/packages/details.html has been added.
- partials/packages/comments.html has been added.
- partials/packages/comment.html has been added.
- models.dependency_type additions: name and id constants.
- models.relation_type additions: name and id constants.
- models.official_provider additions: base official url constant.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-27 20:48:40 -07:00