diff --git a/components/Attachment/Controller/Attachment.php b/components/Attachment/Controller/Attachment.php index 3e363bc9b8..d2c394371d 100644 --- a/components/Attachment/Controller/Attachment.php +++ b/components/Attachment/Controller/Attachment.php @@ -89,7 +89,7 @@ class Attachment extends Controller try { return $this->attachment($attachment_id, $note_id, function ($res) use ($note_id, $attachment_id) { return [ - '_template' => '/cards/attachments/show.html.twig', + '_template' => 'attachment/view.html.twig', 'download' => $res['attachment']->getDownloadUrl(note: $note_id), 'title' => $res['title'], 'attachment' => $res['attachment'], diff --git a/components/Collection/templates/collection/actors.html.twig b/components/Collection/templates/collection/actors.html.twig index eb3bd23103..3ed9ffcec8 100644 --- a/components/Collection/templates/collection/actors.html.twig +++ b/components/Collection/templates/collection/actors.html.twig @@ -54,7 +54,7 @@

{% trans %}Results{% endtrans %}

{% if actors is defined and actors is not empty %} {% for actor in actors %} - {% block profile_view %}{% include 'cards/profile/view.html.twig' %}{% endblock profile_view %} + {% block profile_view %}{% include 'cards/blocks/profile.html.twig' %}{% endblock profile_view %}
{% endfor %} {% trans %}Page: %page%{% endtrans %} diff --git a/components/Collection/templates/collection/notes.html.twig b/components/Collection/templates/collection/notes.html.twig index f979db1200..bd1e1a7473 100644 --- a/components/Collection/templates/collection/notes.html.twig +++ b/components/Collection/templates/collection/notes.html.twig @@ -1,5 +1,5 @@ {% extends 'stdgrid.html.twig' %} -{% import '/cards/note/view.html.twig' as noteView %} +{% import '/cards/macros/note.html.twig' as noteView %} {% block title %}{% if page_title is defined %}{{ page_title | trans }}{% endif %}{% endblock %} @@ -47,9 +47,9 @@ {% for conversation in notes %} {% block current_note %} {% if conversation is instanceof('array') %} - {{ noteView.macro_note(conversation['note'], conversation['replies']) }} + {{ noteView.note_vanilla(conversation['note'], conversation['replies']) }} {% else %} - {{ noteView.macro_note(conversation) }} + {{ noteView.note_vanilla(conversation) }} {% endif %}
{% endblock current_note %} diff --git a/components/Conversation/Conversation.php b/components/Conversation/Conversation.php index 0f35113bf2..f2c0c3e2cc 100644 --- a/components/Conversation/Conversation.php +++ b/components/Conversation/Conversation.php @@ -217,7 +217,7 @@ class Conversation extends Component */ public function onPrependPostingForm(Request $request, array &$elements): bool { - $elements[] = Formatting::twigRenderFile('cards/note/macro_note_minimal_wrapper.html.twig', ['note' => Note::getById((int) $request->query->get('reply_to_id'))]); + $elements[] = Formatting::twigRenderFile('cards/blocks/note_compact_wrapper.html.twig', ['note' => Note::getById((int) $request->query->get('reply_to_id'))]); return Event::next; } diff --git a/components/Group/templates/group/view.html.twig b/components/Group/templates/group/view.html.twig index 89e31649be..82d92693b9 100644 --- a/components/Group/templates/group/view.html.twig +++ b/components/Group/templates/group/view.html.twig @@ -1,5 +1,5 @@ {% extends 'stdgrid.html.twig' %} -{% import '/cards/note/view.html.twig' as noteView %} +{% import '/cards/macros/note.html.twig' as noteView %} {% set nickname = nickname|escape %} {% block title %}{{ nickname }}{% endblock %} @@ -13,7 +13,7 @@ {% if actor is defined and actor is not null %} {% block profile_view %} - {% include 'cards/profile/view.html.twig' with { 'actor': actor } only %} + {% include 'cards/blocks/profile.html.twig' with { 'actor': actor } only %} {% endblock profile_view %} {% if notes is defined %} @@ -46,9 +46,9 @@ {% for conversation in notes %} {% block current_note %} {% if conversation is instanceof('array') %} - {{ noteView.macro_note(conversation['note'], conversation['replies']) }} + {{ noteView.note_vanilla(conversation['note'], conversation['replies']) }} {% else %} - {{ noteView.macro_note(conversation) }} + {{ noteView.note_vanilla(conversation) }} {% endif %}
{% endblock current_note %} diff --git a/components/LeftPanel/templates/left_panel/view.html.twig b/components/LeftPanel/templates/left_panel/view.html.twig index 078908d8a5..c84be0b916 100644 --- a/components/LeftPanel/templates/left_panel/view.html.twig +++ b/components/LeftPanel/templates/left_panel/view.html.twig @@ -7,18 +7,18 @@
{% if app.user %}
- {% block profile_view %}{% include 'cards/profile/view.html.twig' with { actor: current_actor } %}{% endblock profile_view %} - {{ block("profile_current_actor", "cards/navigation/view.html.twig") }} + {% block profile_view %}{% include 'cards/blocks/profile.html.twig' with { actor: current_actor } %}{% endblock profile_view %} + {{ block("profile_current_actor", "cards/blocks/navigation.html.twig") }}
{% else %}
- {{ block("profile_security", "cards/navigation/view.html.twig") }} + {{ block("profile_security", "cards/blocks/navigation.html.twig") }}
{% endif %} - {{ block("feeds", "cards/navigation/view.html.twig") }} + {{ block("feeds", "cards/blocks/navigation.html.twig") }} - {{ block("footer", "cards/navigation/view.html.twig") }} + {{ block("footer", "cards/blocks/navigation.html.twig") }}
{% endblock leftpanel %} diff --git a/components/RightPanel/templates/right_panel/view.html.twig b/components/RightPanel/templates/right_panel/view.html.twig index f67f221cd4..3660c783fa 100644 --- a/components/RightPanel/templates/right_panel/view.html.twig +++ b/components/RightPanel/templates/right_panel/view.html.twig @@ -1,8 +1,7 @@ {% block rightpanel %} -{% set current_path = app.request.get('_route') %} - + {% endfor %} -{% endblock note_complementary_info %} - -{% macro macro_note(note, replies) %} - {% set actor = note.getActor() %} - {% set nickname = actor.getNickname() %} - {% set fullname = actor.getFullname() %} - {% set actor_uri = actor.getUri() %} - {% set actor_url = actor.getUrl() %} - {% set mention = mention(actor) %} - {% set note_language = note.getNoteLanguageShortDisplay() %} - -
- {{ block('note_sidebar') }} -
-
- {{ block('note_info') }} - {{ block('note_actions') }} -
- - - - {{ block('note_replies') }} - {{ block('note_complementary_info') }} -
-
-{% endmacro macro_note %} - -{% macro macro_note_minimal(note) %} - {% set actor = note.getActor() %} - {% set nickname = actor.getNickname() %} - {% set fullname = actor.getFullname() %} - {% set actor_uri = actor.getUri() %} - {% set actor_url = actor.getUrl() %} - {% set mention = mention(actor) %} - -
- {{ block('note_sidebar') }} -
-
-
- {{ block('note_author') }} -
-
- - -
-
-{% endmacro macro_note_minimal %} +{% endblock note_complementary_info %} \ No newline at end of file diff --git a/templates/cards/blocks/note_compact_wrapper.html.twig b/templates/cards/blocks/note_compact_wrapper.html.twig new file mode 100644 index 0000000000..2c4d710ce9 --- /dev/null +++ b/templates/cards/blocks/note_compact_wrapper.html.twig @@ -0,0 +1,2 @@ +{% from 'cards/macros/note.html.twig' import note_compact %} +{{ note_compact(note) }} \ No newline at end of file diff --git a/templates/cards/profile/view.html.twig b/templates/cards/blocks/profile.html.twig similarity index 97% rename from templates/cards/profile/view.html.twig rename to templates/cards/blocks/profile.html.twig index 0871861cce..4280c6cd69 100644 --- a/templates/cards/profile/view.html.twig +++ b/templates/cards/blocks/profile.html.twig @@ -63,7 +63,7 @@ diff --git a/templates/cards/tag/actor_tag.html.twig b/templates/cards/blocks/tag_actor.html.twig similarity index 100% rename from templates/cards/tag/actor_tag.html.twig rename to templates/cards/blocks/tag_actor.html.twig diff --git a/templates/cards/tag/note_tag.html.twig b/templates/cards/blocks/tag_note.html.twig similarity index 100% rename from templates/cards/tag/note_tag.html.twig rename to templates/cards/blocks/tag_note.html.twig diff --git a/templates/cards/macros/note.html.twig b/templates/cards/macros/note.html.twig new file mode 100644 index 0000000000..3d85597570 --- /dev/null +++ b/templates/cards/macros/note.html.twig @@ -0,0 +1,60 @@ +{% macro note_vanilla(note, replies) %} + {% set actor = note.getActor() %} + {% set nickname = actor.getNickname() %} + {% set fullname = actor.getFullname() %} + {% set actor_uri = actor.getUri() %} + {% set actor_url = actor.getUrl() %} + {% set mention = mention(actor) %} + {% set note_language = note.getNoteLanguageShortDisplay() %} + +
+ {{ block('note_sidebar', 'cards/blocks/note.html.twig') }} +
+
+ {{ block('note_info', 'cards/blocks/note.html.twig') }} + {{ block('note_actions', 'cards/blocks/note.html.twig') }} +
+ + + + {{ block('note_replies', 'cards/blocks/note.html.twig') }} + {{ block('note_complementary_info', 'cards/blocks/note.html.twig') }} +
+
+{% endmacro note_vanilla %} + +{% macro note_compact(note) %} + {% set actor = note.getActor() %} + {% set nickname = actor.getNickname() %} + {% set fullname = actor.getFullname() %} + {% set actor_uri = actor.getUri() %} + {% set actor_url = actor.getUrl() %} + {% set mention = mention(actor) %} + +
+ {{ block('note_sidebar', 'cards/blocks/note.html.twig') }} +
+
+
+ {{ block('note_author', 'cards/blocks/note.html.twig') }} +
+
+ + +
+
+{% endmacro note_compact %} \ No newline at end of file diff --git a/templates/settings/macros.html.twig b/templates/cards/macros/settings.html.twig similarity index 100% rename from templates/settings/macros.html.twig rename to templates/cards/macros/settings.html.twig diff --git a/templates/cards/macros/widgets.html.twig b/templates/cards/macros/widgets.html.twig new file mode 100644 index 0000000000..b2ee76f714 --- /dev/null +++ b/templates/cards/macros/widgets.html.twig @@ -0,0 +1,49 @@ +{% macro nav_ul_li_a(nav, items) %} + +{% endmacro nav_ul_li_a %} + +{% macro nav_a(nav, items) %} + +{% endmacro nav_a %} + +{% macro section(title, blocks, classes) %} +
+ {% for widget in blocks['prepend'] %} + {{ widget | raw }} + {% endfor %} + + {% for widget in blocks['main'] %} + {{ widget | raw }} + {% endfor %} + + {% for widget in blocks['append'] %} + {{ widget | raw }} + {% endfor %} +
+{% endmacro section %} + +{% macro details(blocks, classes, is_open = true) %} +
+ + {% for widget in blocks['summary'] %} + {{ widget | raw }} + {% endfor %} + + + {% for widget in blocks['main'] %} + {{ widget | raw }} + {% endfor %} +
+{% endmacro details %} \ No newline at end of file diff --git a/templates/cards/navigation/view.html.twig b/templates/cards/navigation/view.html.twig deleted file mode 100644 index b2780586d2..0000000000 --- a/templates/cards/navigation/view.html.twig +++ /dev/null @@ -1,93 +0,0 @@ -{% block feeds %} -
-
- - {{ 'Feeds' | trans }} - {% if app.user %} - {# User custom feeds #} - {{ icon('edit', 'icon icon-edit-feed') | raw }} - {% endif %} - - - -
-
-{% endblock feeds %} - -{% block profile_current_actor %} - -{% endblock profile_current_actor %} - -{% block profile_security %} -
-

Account

- -
-{% endblock profile_security %} - -{% block footer %} - -{% endblock footer %} diff --git a/templates/cards/note/macro_note_minimal_wrapper.html.twig b/templates/cards/note/macro_note_minimal_wrapper.html.twig deleted file mode 100644 index 93aeb710d2..0000000000 --- a/templates/cards/note/macro_note_minimal_wrapper.html.twig +++ /dev/null @@ -1,2 +0,0 @@ -{% from 'cards/note/view.html.twig' import macro_note_minimal %} -{{ macro_note_minimal(note) }} \ No newline at end of file diff --git a/templates/note/view.html.twig b/templates/note/view.html.twig index 8af9432527..37b0e80076 100644 --- a/templates/note/view.html.twig +++ b/templates/note/view.html.twig @@ -1,5 +1,5 @@ {% extends 'stdgrid.html.twig' %} -{% import '/cards/note/view.html.twig' as noteView %} +{% import '/cards/macros/note.html.twig' as noteView %} {% block title %}{{ note.getActorNickname() ~ '\'s note' | trans }}{% endblock %} @@ -13,7 +13,7 @@
{% if note is defined and note is not empty %} - {{ noteView.macro_note(note, null) }} + {{ noteView.note_vanilla(note, null) }} {% else %}

{% trans %}No notes here.{% endtrans %}

{% endif %} diff --git a/templates/security/login.html.twig b/templates/security/login.html.twig index e32d6a2fc2..5b6a4d4faf 100644 --- a/templates/security/login.html.twig +++ b/templates/security/login.html.twig @@ -27,6 +27,7 @@

{{ "Your nickname or email address." | trans }}

+
@@ -42,7 +43,6 @@
- {% endif %} diff --git a/templates/settings/base.html.twig b/templates/settings/base.html.twig index bb82a136af..3681068ddd 100644 --- a/templates/settings/base.html.twig +++ b/templates/settings/base.html.twig @@ -1,6 +1,6 @@ {% extends '/stdgrid.html.twig' %} -{% import 'settings/macros.html.twig' as macros %} +{% import 'cards/macros/settings.html.twig' as macros %} {% block title %}{{ 'Settings' | trans }}{% endblock %}