Skip to content

Commit

Permalink
templates: separate record detail content
Browse files Browse the repository at this point in the history
  • Loading branch information
tmorrell committed Jan 11, 2025
1 parent af193c7 commit b4d97f8
Show file tree
Hide file tree
Showing 2 changed files with 285 additions and 270 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,277 +147,8 @@
</section>


<div class="ui container">
<div class="ui relaxed grid mt-5">
<div class="two column row top-padded">
{% include "invenio_app_rdm/records/record_content.html" %}

{# Main content #}
<article
class="sixteen wide tablet eleven wide computer column main-record-content">
{% if record.access.record == 'restricted' %}
<section id="record-access-status"
class="ui {{ record.ui.access_status.message_class }} message rel-mt-1"
aria-label="{{ _('Record access information') }}"
>
<i class="{{ record.ui.access_status.icon }} icon" aria-hidden="true"></i>
<strong>{{ record.ui.access_status.title_l10n }}</strong>
{{ record.ui.access_status.description_l10n }}

{% if record.access.embargo.reason %}
<p>{{ _("Reason") }}: {{ record.access.embargo.reason }}</p>
{% endif %}
</section>
{% endif %}

{%- block record_body -%}

{%- block record_header -%}

{%- block record_header_button -%}

{% if is_preview and not is_preview_submission_request and can_manage_record and is_draft %}
<nav class="back-navigation rel-pb-2 pl-0"
aria-label="{{ _('Back-navigation') }}">
{%- set back_page = url_for('invenio_app_rdm_records.deposit_edit', pid_value=record.id) -%}
{%- set back_btn_label = _('Back to edit') -%}
<a class="ui button labeled icon small compact"
href="{{ back_page }}">
<i class="ui icon angle left"></i> {{ back_btn_label }}</a>
</nav>
{% endif %}

{% endblock record_header_button %}

{% if show_record_management_menu %}
<section id="mobile-record-management"
class="ui grid tablet only mobile only">
<div class="sixteen wide column right aligned">
<button id="manage-record-btn"
class="ui small basic icon button m-0"
aria-haspopup="dialog"
aria-expanded="false"
>
<i class="cog icon"></i> {{ _('Manage record') }}
</button>
</div>

<div id="recordManagementMobile"
role="dialog"
class="ui flowing popup transition hidden"
data-record='{{ record | tojson }}'
data-permissions='{{ permissions | tojson }}'
data-is-draft="{{ is_draft | tojson }}"
>
</div>
</section>
{% endif %}

<section id="record-info"
aria-label="{{ _('Publication date and version number') }}">
<div class="ui grid middle aligned">
<div class="two column row">
<div class="left floated left aligned column">
<span class="ui" title="{{ _('Publication date') }}">
{{ _('Published') }} {{ record.ui.publication_date_l10n_long }}
</span>
<span
class="label text-muted"> | {{ _('Version {version_number}').format(version_number=record.ui.version) }}</span>
</div>
<div class="right floated right aligned column">

{% if record.ui.resource_type %}
<span role="note"
class="ui label horizontal small neutral mb-5"
aria-label="{{ _('Resource type') }}"
>
{{ record.ui.resource_type.title_l10n }}
</span>
{% endif %}

<span role="note"
class="ui label horizontal small access-status {{ record.ui.access_status.id }} mb-5"
data-tooltip="{{ record.ui.access_status.description_l10n }}"
data-inverted=""
aria-label="{{ _('Access status') }}"
>
{% if record.ui.access_status.icon %}
<i class="icon {{ record.ui.access_status.icon }}"
aria-hidden="true"></i>
{% endif %}
<span
aria-label="{{ record.ui.access_status.description_l10n }}">
{{ record.ui.access_status.title_l10n }}
</span>
</span>
</div>
</div>
</div>
</section>
<div class="ui divider hidden"></div>

{%- endblock record_header -%}

{# Title #}
{%- block record_title -%}
<section id="record-title-section"
aria-label="{{ _('Record title and creators') }}">
<h1 id="record-title"
class="wrap-overflowing-text">{{ metadata.title }}</h1>

{% if record.ui.creators or record.ui.contributors %}
<section id="creatibutors"
aria-label="{{ _('Creators and contributors') }}">
{%- include "invenio_app_rdm/records/details/creatibutors.html" %}
</section>
{% endif %}
</section>
{%- endblock record_title -%}

{# Description #}
{%- block record_content -%}
{%- include "invenio_app_rdm/records/details/description.html" %}
{%- endblock record_content -%}

{# Files #}
{%- block record_files -%}
{# record has files BUT passed files are empty. This happens when we display are request. #}
{%- if record.files.enabled -%}
<section id="record-files" class="rel-mt-2 rel-mb-3"
aria-label="{{ _('Files') }}">
{%- if permissions.can_read_files -%}
{# record has files AND user can see files #}
{%- set files = files | order_entries | selectattr("status", "==", "completed") | list %}
{%- if files|length > 0 -%}
<h2 id="files-heading">{{ _('Files') }}</h2>
{%- if files|has_previewable_files -%}
{%-set preview_file = files|select_preview_file(default_preview=record.files.default_preview) %}
{{ preview_file_box(preview_file, record.id, is_preview, record, include_deleted) }}
{%- endif -%}
{{ file_list_box(files, record.id, is_preview, include_deleted, record, permissions) }}
{% endif %}
{% else %}
{# record has files BUT user does not have permission to see files #}
<div
class="ui accordion panel mb-10 {{ record.ui.access_status.id }}"
href="#files-preview-accordion-panel">
<h3
class="active title panel-heading {{ record.ui.access_status.id }} m-0">
<div role="button" id="files-preview-accordion-trigger"
tabindex="0" class="trigger"
aria-controls="files-preview-accordion-panel">
{{ _("Files") }}
<i class="angle right icon" aria-hidden="true"></i>
</div>
</h3>
<div role="region" id="files-preview-accordion-panel"
aria-labelledby="files-preview-accordion-trigger"
class="active content preview-container pt-0">
<div
class="ui {{ record.ui.access_status.message_class }} message file-box-message rel-pl-1 rel-pr-1">
<i class="ui {{ record.ui.access_status.icon }} icon"
aria-hidden="true"></i>
<h4
class="inline">{{ record.ui.access_status.title_l10n }}</h4>
<p>{{ record.ui.access_status.description_l10n }}</p>

{% if record.access.embargo.reason %}
<p>{{ _("Reason") }}: {{ record.access.embargo.reason }}</p>
{% endif %}

{% block record_files_access_request %}
{%- if allow_user_requests or allow_guest_requests %}
<div class="ui divider"></div>
<h4>{{ _("Request access") }}</h4>
<p>
{{ _("If you would like to request access to these files, please fill out the form below.") }}
</p>
{%- if record.parent.access.settings %}
{%- set accept_conditions_text = record.parent.access.settings.accept_conditions_text %}
{%- endif %}

{%- if accept_conditions_text %}
<p class="ui small header rel-mt-2 rel-mb-1">
{{ _("You need to satisfy these conditions in order for this request to be accepted:") }}
</p>
<div class="rel-mt-2 rich-input-content">
{{ accept_conditions_text | safe }}
</div>
{%- endif %}

{%- include "invenio_app_rdm/records/details/access-form.html" %}
{%- endif %}
{% endblock record_files_access_request %}
</div>
</div>
</div>
{%- endif %}
</section>
{%- endif %}
{%- endblock record_files -%}

{# Media files #}
{%- block record_media_files -%}
{# record has media files AND user can see files #}
{# can_media_read_files is false when record is fully restricted and users can't see the landing page at all #}
{%- if media_files and media_files.enabled and media_files.entries and permissions.can_media_read_files -%}
{%- set any_visible = media_files.entries | selectattr('access.hidden', 'equalto', false) | list | length > 0 %}
{%- if any_visible %}
<section id="record-media-files" aria-label="{{ _('System files') }}">
{%- set media_files = media_files | order_entries | selectattr("status", "==", "completed") | list %}
{%- if media_files|length > 0 -%}
{{ media_file_list_box(media_files, record.id, is_preview, include_deleted, record, permissions) }}
{%- endif %}
</section>
{%- endif %}
{%- endif %}
{%- endblock record_media_files -%}

{# Additional details #}
{%- block record_details -%}
<section id="additional-details" class="rel-mt-2"
aria-label="{{ _('Additional record details') }}">
{%- include "invenio_app_rdm/records/details/details.html" %}
</section>
{%- endblock record_details -%}

{# Record footer #}
{%- block record_footer -%}
{%- endblock record_footer -%}

{%- endblock record_body %}
</article>

{# Sidebar #}
<aside class="sixteen wide tablet five wide computer column sidebar"
aria-label="{{ _('Record details') }}">
{% block record_sidebar %}
{%- include "invenio_app_rdm/records/details/side_bar.html" %}
{% endblock record_sidebar %}
</aside>
</div>
</div>

<div class="ui container">
<div class="ui relaxed grid">
<div class="two column row">
<div class="sixteen wide tablet eleven wide computer column">
{# Jump up button #}
{%- block jump -%}
<div class="ui grid">
<div class="centered row rel-mt-1">
<button id="jump-btn" class="jump-to-top ui button labeled icon"
aria-label="{{ _('Jump to top of page') }}">
<i class="arrow alternate circle up outline icon"></i>
{{ _("Jump up") }}
</button>
</div>
</div>
{%- endblock jump -%}
</div>
</div>
</div>
</div>
</div>

{%- endblock page_body %}

Expand Down
Loading

0 comments on commit b4d97f8

Please sign in to comment.