[ENTITY][Note] Add getLanguageLocale() and getNoteLanguageShortDisplay()
[CARDS][Note] Render note's language short display [PLUGINS] Bring back titles to Reply, Repeat and Favourite actions
This commit is contained in:
parent
d044039272
commit
37ef8cddfa
@ -76,6 +76,7 @@ class Favourite extends NoteHandlerPlugin
|
|||||||
$extra_classes = $is_favourite ? 'note-actions-set' : 'note-actions-unset';
|
$extra_classes = $is_favourite ? 'note-actions-set' : 'note-actions-unset';
|
||||||
$favourite_action = [
|
$favourite_action = [
|
||||||
'url' => $favourite_action_url,
|
'url' => $favourite_action_url,
|
||||||
|
'title' => $is_favourite ? 'Remove this note from favourites' : 'Favourite this note!',
|
||||||
'classes' => "button-container favourite-button-container {$extra_classes}",
|
'classes' => "button-container favourite-button-container {$extra_classes}",
|
||||||
'id' => 'favourite-button-container-' . $note->getId(),
|
'id' => 'favourite-button-container-' . $note->getId(),
|
||||||
];
|
];
|
||||||
|
@ -85,6 +85,7 @@ class Repeat extends NoteHandlerPlugin
|
|||||||
$extra_classes = $is_repeat ? 'note-actions-set' : 'note-actions-unset';
|
$extra_classes = $is_repeat ? 'note-actions-set' : 'note-actions-unset';
|
||||||
$repeat_action = [
|
$repeat_action = [
|
||||||
'url' => $repeat_action_url,
|
'url' => $repeat_action_url,
|
||||||
|
'title' => $is_repeat ? 'Remove this repeat' : 'Repeat this note!',
|
||||||
'classes' => "button-container repeat-button-container {$extra_classes}",
|
'classes' => "button-container repeat-button-container {$extra_classes}",
|
||||||
'id' => 'repeat-button-container-' . $note->getId(),
|
'id' => 'repeat-button-container-' . $note->getId(),
|
||||||
];
|
];
|
||||||
|
@ -72,6 +72,7 @@ class Reply extends NoteHandlerPlugin
|
|||||||
|
|
||||||
$reply_action = [
|
$reply_action = [
|
||||||
'url' => $reply_action_url,
|
'url' => $reply_action_url,
|
||||||
|
'title' => 'Reply to this note!',
|
||||||
'classes' => 'button-container reply-button-container note-actions-unset',
|
'classes' => 'button-container reply-button-container note-actions-unset',
|
||||||
'id' => 'reply-button-container-' . $note->getId(),
|
'id' => 'reply-button-container-' . $note->getId(),
|
||||||
];
|
];
|
||||||
|
@ -341,3 +341,15 @@ embed header {
|
|||||||
.note-complementary a {
|
.note-complementary a {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.h-entry-language {
|
||||||
|
position: relative;
|
||||||
|
float: right;
|
||||||
|
background: var(--border);
|
||||||
|
padding: 5px;
|
||||||
|
font-size: var(--default);
|
||||||
|
color: var(--foreground);
|
||||||
|
margin-right: var(--smaller);
|
||||||
|
margin-bottom: var(--smaller);
|
||||||
|
border-radius: var(--smaller);
|
||||||
|
}
|
||||||
|
@ -217,6 +217,16 @@ class Note extends Entity
|
|||||||
return Avatar::getAvatarUrl($this->getActorId(), $size);
|
return Avatar::getAvatarUrl($this->getActorId(), $size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNoteLanguageShortDisplay(): string
|
||||||
|
{
|
||||||
|
return Language::getFromId($this->language_id)->getShortDisplay();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLanguageLocale(): string
|
||||||
|
{
|
||||||
|
return Language::getFromId($this->language_id)->getLocale();
|
||||||
|
}
|
||||||
|
|
||||||
public static function getAllNotesByActor(Actor $actor): array
|
public static function getAllNotesByActor(Actor $actor): array
|
||||||
{
|
{
|
||||||
return DB::sql(
|
return DB::sql(
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{% if app.user or note_actions_hide is defined %}
|
{% if app.user or note_actions_hide is defined %}
|
||||||
<div class="note-actions">
|
<div class="note-actions">
|
||||||
{% for current_action in get_note_actions(note) %}
|
{% for current_action in get_note_actions(note) %}
|
||||||
<a class="{{ current_action["classes"] }}" href="{{ current_action["url"] }}"></a>
|
<a title="{{ current_action["title"] | trans }}" class="{{ current_action["classes"] }}" href="{{ current_action["url"] }}"></a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -74,8 +74,9 @@
|
|||||||
{% set fullname = note.getActorFullname() %}
|
{% set fullname = note.getActorFullname() %}
|
||||||
{% set actor = note.getActor() %}
|
{% set actor = note.getActor() %}
|
||||||
{% set actor_url = actor.getUrl() %}
|
{% set actor_url = actor.getUrl() %}
|
||||||
|
{% set note_language = note.getNoteLanguageShortDisplay() %}
|
||||||
|
|
||||||
<article class="h-entry hentry note">
|
<article class="h-entry hentry note" lang={{ note.getLanguageLocale() }}>
|
||||||
{{ block('note_sidebar') }}
|
{{ block('note_sidebar') }}
|
||||||
<div class="note-wrapper">
|
<div class="note-wrapper">
|
||||||
<div tabindex="0" title="{{ 'Begin a note by the user: ' | trans }} {{ nickname }}." class="note-info">
|
<div tabindex="0" title="{{ 'Begin a note by the user: ' | trans }} {{ nickname }}." class="note-info">
|
||||||
@ -90,12 +91,16 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
{% for block in handle_event('AppendCardNote', {'note': note, 'actor': note.getActor() }) %}
|
{% for block in handle_event('AppendCardNote', {'note': note, 'actor': note.getActor() }) %}
|
||||||
<aside class="note-complementary">
|
<aside title="{{ 'Note\'s complementary information' | trans }}" class="note-complementary">
|
||||||
{{ block | raw }}
|
{{ block | raw }}
|
||||||
</aside>
|
</aside>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{{ block('note_replies') }}
|
{{ block('note_replies') }}
|
||||||
|
|
||||||
|
{% if note_language is defined and note_language is not empty %}
|
||||||
|
<div title="{{ 'Note\'s language' | trans }}" class="h-entry-language">{{ note_language }}</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
{% endmacro macro_note %}
|
{% endmacro macro_note %}
|
||||||
|
Loading…
Reference in New Issue
Block a user