Improve resources display on mobile

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-06-14 15:13:08 +02:00
parent 24b94d1860
commit 33838974c5
6 changed files with 72 additions and 23 deletions

View File

@@ -20,6 +20,7 @@ defmodule Mobilizon.GraphQL.Schema.ResourceType do
field(:actor, :actor, description: "The resource's owner")
field(:inserted_at, :naive_datetime, description: "The resource's creation date")
field(:updated_at, :naive_datetime, description: "The resource's last update date")
field(:published_at, :naive_datetime, description: "The resource's publication date")
field(:type, :string, description: "The resource's type (if it's a folder)")
field(:path, :string, description: "The resource's path")

View File

@@ -47,7 +47,7 @@ defmodule Mobilizon.Resources do
) do
Resource
|> where([r], r.actor_id == ^group_id and is_nil(r.parent_id))
|> order_by(asc: :type)
|> order_by(asc: :type, asc: :title)
|> preload([r], [:actor, :creator])
|> Page.build_page(page, limit)
end
@@ -55,7 +55,7 @@ defmodule Mobilizon.Resources do
def get_resources_for_folder(%Resource{id: resource_id}, page, limit) do
Resource
|> where([r], r.parent_id == ^resource_id)
|> order_by(asc: :type)
|> order_by(asc: :type, asc: :title)
|> preload([r], [:actor, :creator])
|> Page.build_page(page, limit)
end