Skip to content

Commit

Permalink
few misc admin updates
Browse files Browse the repository at this point in the history
  • Loading branch information
leafo committed Jan 17, 2024
1 parent f9c8d3a commit c305947
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
9 changes: 8 additions & 1 deletion applications/admin.moon
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,17 @@ class AdminApplication extends lapis.Application

[community_posts: "/community-posts"]: capture_errors_json with_params {
{"page", shapes.page_number}
{"user_id", types.empty + types.db_id}
{"topic_id", types.empty + types.db_id}
}, (params) =>
import Posts from require "community.models"

@pager = Posts\paginated "order by id desc", {
filter = db.clause {
user_id: params.user_id
topic_id: params.topic_id
}, allow_empty: true, prefix: "where"

@pager = Posts\paginated "? order by id desc", filter, {
per_page: 50
prepare_results: (posts) ->
preload posts, "user", topic: { category: "streak" }
Expand Down
7 changes: 7 additions & 0 deletions views/admin/community_posts.moon
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ class AdminCommunityPosts extends require "widgets.admin.page"

column_content: =>
h2 "Community posts"

@filter_form (field) ->
field "user_id"
field "topic_id"

@render_pager @pager

@column_table @posts, {
Expand Down Expand Up @@ -37,6 +42,8 @@ class AdminCommunityPosts extends require "widgets.admin.page"
if user\is_spam!
strong " spam"
}
"deleted"
"edits_count"
{"text", (post) ->
text @truncate post\extract_text!, 80
}
Expand Down

0 comments on commit c305947

Please sign in to comment.