Improve resources display on mobile
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
24b94d1860
commit
33838974c5
|
@ -162,7 +162,7 @@ a {
|
||||||
}
|
}
|
||||||
|
|
||||||
.body {
|
.body {
|
||||||
padding: 10px 8px 8px;
|
padding: 8px;
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
|
|
|
@ -20,21 +20,30 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<img
|
<div class="title-wrapper">
|
||||||
class="favicon"
|
<img
|
||||||
v-if="resource.metadata && resource.metadata.faviconUrl"
|
class="favicon"
|
||||||
:src="resource.metadata.faviconUrl"
|
v-if="resource.metadata && resource.metadata.faviconUrl"
|
||||||
/>
|
:src="resource.metadata.faviconUrl"
|
||||||
<h3>{{ resource.title }}</h3>
|
/>
|
||||||
<span class="host" v-if="inline">{{
|
<h3>{{ resource.title }}</h3>
|
||||||
resource.updatedAt | formatDateTimeString
|
</div>
|
||||||
}}</span>
|
<div class="metadata-wrapper">
|
||||||
<span class="host" v-else>{{ urlHostname }}</span>
|
<span class="host" v-if="!inline || preview">{{ urlHostname }}</span>
|
||||||
|
<span
|
||||||
|
class="published-at is-hidden-mobile"
|
||||||
|
v-if="resource.updatedAt || resource.publishedAt"
|
||||||
|
>{{
|
||||||
|
(resource.updatedAt || resource.publishedAt)
|
||||||
|
| formatDateTimeString
|
||||||
|
}}</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<resource-dropdown
|
<resource-dropdown
|
||||||
class="actions"
|
class="actions"
|
||||||
v-if="!inline"
|
v-if="!inline || !preview"
|
||||||
@delete="$emit('delete', resource.id)"
|
@delete="$emit('delete', resource.id)"
|
||||||
@move="$emit('move', resource)"
|
@move="$emit('move', resource)"
|
||||||
@rename="$emit('rename', resource)"
|
@rename="$emit('rename', resource)"
|
||||||
|
@ -53,6 +62,7 @@ export default class ResourceItem extends Vue {
|
||||||
@Prop({ required: true, type: Object }) resource!: IResource;
|
@Prop({ required: true, type: Object }) resource!: IResource;
|
||||||
|
|
||||||
@Prop({ required: false, default: false }) inline!: boolean;
|
@Prop({ required: false, default: false }) inline!: boolean;
|
||||||
|
@Prop({ required: false, default: false }) preview!: boolean;
|
||||||
|
|
||||||
list = [];
|
list = [];
|
||||||
|
|
||||||
|
@ -74,11 +84,12 @@ export default class ResourceItem extends Vue {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
.actions {
|
.actions {
|
||||||
flex: 0;
|
flex: 0;
|
||||||
display: block;
|
display: block;
|
||||||
margin: auto 1rem auto 2rem;
|
margin: auto 1rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,10 +122,15 @@ a {
|
||||||
}
|
}
|
||||||
|
|
||||||
.body {
|
.body {
|
||||||
padding: 10px 8px 8px;
|
padding: 8px;
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
|
.title-wrapper {
|
||||||
|
display: flex;
|
||||||
|
max-width: calc(100vw - 122px);
|
||||||
|
}
|
||||||
|
|
||||||
img.favicon {
|
img.favicon {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 16px;
|
width: 16px;
|
||||||
|
@ -134,13 +150,29 @@ a {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
.host {
|
.metadata-wrapper {
|
||||||
display: block;
|
max-width: calc(100vw - 122px);
|
||||||
margin-top: 5px;
|
|
||||||
font-size: 13px;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
span {
|
||||||
|
&:last-child::before {
|
||||||
|
content: "⋅";
|
||||||
|
padding: 0 5px;
|
||||||
|
}
|
||||||
|
&:first-child::before {
|
||||||
|
content: "";
|
||||||
|
padding: initial;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.host,
|
||||||
|
&.published-at {
|
||||||
|
font-size: 13px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,9 @@ export const GET_RESOURCE = gql`
|
||||||
path
|
path
|
||||||
type
|
type
|
||||||
}
|
}
|
||||||
|
publishedAt
|
||||||
|
updatedAt
|
||||||
|
insertedAt
|
||||||
metadata {
|
metadata {
|
||||||
...ResourceMetadataBasicFields
|
...ResourceMetadataBasicFields
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,7 +198,11 @@
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</b-modal>
|
</b-modal>
|
||||||
<b-modal :active.sync="createLinkResourceModal" has-modal-card>
|
<b-modal
|
||||||
|
:active.sync="createLinkResourceModal"
|
||||||
|
has-modal-card
|
||||||
|
class="link-resource-modal"
|
||||||
|
>
|
||||||
<div class="modal-card">
|
<div class="modal-card">
|
||||||
<section class="modal-card-body">
|
<section class="modal-card-body">
|
||||||
<b-message type="is-danger" v-if="modalError">
|
<b-message type="is-danger" v-if="modalError">
|
||||||
|
@ -215,7 +219,7 @@
|
||||||
</b-field>
|
</b-field>
|
||||||
|
|
||||||
<div class="new-resource-preview" v-if="newResource.title">
|
<div class="new-resource-preview" v-if="newResource.title">
|
||||||
<resource-item :resource="newResource" />
|
<resource-item :resource="newResource" :preview="true" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<b-field :label="$t('Title')">
|
<b-field :label="$t('Title')">
|
||||||
|
@ -737,6 +741,10 @@ nav.breadcrumb ul {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
|
::v-deep .b-checkbox.checkbox {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.actions {
|
.actions {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
|
|
||||||
|
@ -755,11 +763,16 @@ nav.breadcrumb ul {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
color: #444b5d;
|
color: #444b5d;
|
||||||
margin-top: 14px;
|
margin-top: 14px;
|
||||||
|
margin-bottom: 14px;
|
||||||
|
|
||||||
.resource-checkbox {
|
.resource-checkbox {
|
||||||
align-self: center;
|
align-self: center;
|
||||||
padding: 0 3px 0 10px;
|
padding-left: 10px;
|
||||||
opacity: 0.3;
|
opacity: 0.3;
|
||||||
|
|
||||||
|
::v-deep .b-checkbox.checkbox {
|
||||||
|
margin-right: 0.25rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover .resource-checkbox,
|
&:hover .resource-checkbox,
|
||||||
|
|
|
@ -20,6 +20,7 @@ defmodule Mobilizon.GraphQL.Schema.ResourceType do
|
||||||
field(:actor, :actor, description: "The resource's owner")
|
field(:actor, :actor, description: "The resource's owner")
|
||||||
field(:inserted_at, :naive_datetime, description: "The resource's creation date")
|
field(:inserted_at, :naive_datetime, description: "The resource's creation date")
|
||||||
field(:updated_at, :naive_datetime, description: "The resource's last update 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(:type, :string, description: "The resource's type (if it's a folder)")
|
||||||
field(:path, :string, description: "The resource's path")
|
field(:path, :string, description: "The resource's path")
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ defmodule Mobilizon.Resources do
|
||||||
) do
|
) do
|
||||||
Resource
|
Resource
|
||||||
|> where([r], r.actor_id == ^group_id and is_nil(r.parent_id))
|
|> 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])
|
|> preload([r], [:actor, :creator])
|
||||||
|> Page.build_page(page, limit)
|
|> Page.build_page(page, limit)
|
||||||
end
|
end
|
||||||
|
@ -55,7 +55,7 @@ defmodule Mobilizon.Resources do
|
||||||
def get_resources_for_folder(%Resource{id: resource_id}, page, limit) do
|
def get_resources_for_folder(%Resource{id: resource_id}, page, limit) do
|
||||||
Resource
|
Resource
|
||||||
|> where([r], r.parent_id == ^resource_id)
|
|> where([r], r.parent_id == ^resource_id)
|
||||||
|> order_by(asc: :type)
|
|> order_by(asc: :type, asc: :title)
|
||||||
|> preload([r], [:actor, :creator])
|
|> preload([r], [:actor, :creator])
|
||||||
|> Page.build_page(page, limit)
|
|> Page.build_page(page, limit)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue