Very long document cards.

Requests for new functionality or improvements in existing functionality. Please provide clear descriptions of your request, an example or if possible a real life scenario.
Post Reply
qra
50 Posts
50 Posts
Posts: 56
Joined: Fri Oct 25, 2019 9:08 pm
Location: Poland

Very long document cards.

Post by qra »

Sometimes document types have many related metadata types (20 or more), so the documents cards are very long. Usually users should see all metadata, but preferably only on the "Metadata for document" page.
My point is that only the most important metadatas should be visible on document cards (e.g. in the "Recently accessed" list). Could you consider adding an additional permission or parameter for the metadata type to disable its visibility on document cards?
User avatar
rosarior
Developer
Developer
Posts: 688
Joined: Tue Aug 21, 2018 3:28 am
Location: Puerto Rico
Contact:

Re: Very long document cards.

Post by rosarior »

We have been attempting to implement this. The problem encountered is that adding display logic in the metadata type definition does not make sense and is more of a hack. Display logic belong in the widget which handles the visual representation of the metadata type. What we are planning to do is add a "condition" field, like we did with the workflow states, that will make the widget visible only if the condition return True or a value. This way we will have a feature that will allow hiding of displaying metadata types that supports multiple display strategies and not just a checkbox that can be turned on/off.
qra
50 Posts
50 Posts
Posts: 56
Joined: Fri Oct 25, 2019 9:08 pm
Location: Poland

Re: Very long document cards.

Post by qra »

Many thanks for the answer.
lanterieur
Posts: 19
Joined: Wed Aug 18, 2021 7:54 am

Re: Very long document cards.

Post by lanterieur »

I am surprised by the direction you are going with this issue.

A long card, is only a visual issue.
Why not have it addressed for all cases in the template?

The card is defined in mayan.apps.appearance.templates.appearance.generic_list_items_subtemplate.html
The metadata list is handled by a widget in mayan.apps.metadata.document_metadata_widget.html

Here are 3 examples:
See attached PNG for how it shows

Code: Select all

# See more
# line 51
                                    {% if not hide_columns %}
                                        {% for column in source_columns_non_identifier %}
                                            {% navigation_source_column_resolve column=column as column_value %}{% if column_value != '' %}
                                                {% if forloop.counter == 2 %}<details><summary>{% trans 'See more' %}</summary>{% endif %}
                                                    <div class="text-center" style="">{% if column.include_label %}<span class="source-column-label">{{ column.label }}</span>: {% endif %}{{ column_value }}</div>
                                                {% if source_columns_non_identifier|length > 1 and forloop.last %}</details>{% endif %}
                                            {% endif %}
                                        {% endfor %}
                                    {% endif %}
                                    
# Overflow
# line 51
                                    {% if not hide_columns %}
                                        {% for column in source_columns_non_identifier %}
                                            {% navigation_source_column_resolve column=column as column_value %}{% if column_value != '' %}
                                                {% if forloop.counter == 2 %}<div style="height:150px;overflow-y:auto">{% endif %}
                                                    <div class="text-center" style="">{% if column.include_label %}<span class="source-column-label">{{ column.label }}</span>: {% endif %}{{ column_value }}</div>
                                                {% if source_columns_non_identifier|length > 1 and forloop.last %}</div>{% endif %}
                                            {% endif %}
                                        {% endfor %}
                                    {% endif %}

# Metadata widget See more
{% load i18n %}
<script>
    function preventClickPropagationFromDetailsToPanel(e){
        console.log(e);
        e.stopPropagation();
    }
</script>
{% for entry in queryset %}
{% if queryset|length > 4  and forloop.counter == 1%}<div onclick="preventClickPropagationFromDetailsToPanel(event)"><details><summary>{% endif %}
    <div class="metadata-display" style="word-break: break-all; overflow-wrap: break-word;">
        <b>{{ entry.metadata_type }}: </b><span data-metadata-type="{{ entry.metadata_type_id }}" data-pk="{{ entry.pk }}">{{ entry.value }}</span>
    </div>
    {% if queryset|length > 4 and forloop.counter == 4 %}<span>{% trans 'Show all Metadata' %} ({{queryset|length}})</span>
    </summary>{% endif %}
    {% if queryset|length > 4 and forloop.last %}</details></div>{% endif %}
{% endfor %}
Before
long_card_1.PNG
long_card_1.PNG (43.42 KiB) Viewed 609 times
See more (closed) on the panel
long_card_2.PNG
long_card_2.PNG (36.28 KiB) Viewed 609 times
See more (open) on the panel
long_card_3.PNG
long_card_3.PNG (43.17 KiB) Viewed 609 times
Overflow on the panel
long_card_4.PNG
long_card_4.PNG (39.62 KiB) Viewed 609 times
Overflow on the panel and see more (closed) in metadata widget
long_card_5.PNG
long_card_5.PNG (42.25 KiB) Viewed 609 times
Overflow on the panel and see more (open) in metadata widget
long_card_6.PNG
long_card_6.PNG (42.56 KiB) Viewed 609 times
Post Reply