refactor: Extract message_controls template.

This is a pretty coherent chunk of template code
related to these icons:

    - edit pencil
    - reactions
    - chevron
    - star

Moving it to a partial will simplify future diffs
where we re-work the message HTML.

This is a pure code move.
This commit is contained in:
Steve Howell 2019-02-23 14:58:06 +00:00 committed by Tim Abbott
parent 386dde2923
commit 76e379bd4f
2 changed files with 29 additions and 28 deletions

View File

@ -0,0 +1,28 @@
<div class="message_controls{{#status_message}} sender-status-controls{{/status_message}} no-select">
{{#if msg/sent_by_me}}
<div class="edit_content"></div>
{{/if}}
{{#unless msg/sent_by_me}}
<div class="reaction_button">
<i class="fa fa-smile-o" title="{{#tr this}}Add emoji reaction{{/tr}} (:)" aria-label="{{#tr this}}Add emoji reaction{{/tr}} (:)" role="button" aria-haspopup="true" tabindex="0"></i>
</div>
{{/unless}}
{{#unless msg/locally_echoed}}
<div class="info actions_hover">
<i class="fa fa-chevron-down" title="{{#tr this}}Message actions{{/tr}} (i)" title="{{#tr this}}Message actions{{/tr}}" role="button" aria-haspopup="true" tabindex="0" aria-label="{{#tr this}}Message actions{{/tr}}"></i>
</div>
{{/unless}}
<div class="message_failed {{#unless msg.failed_request}}notvisible{{/unless}}">
<i class="fa fa-refresh refresh-failed-message" data-toggle="tooltip" title="{{t 'Retry' }}" aria-label="{{t 'Retry' }}" role="button" tabindex="0"></i>
<i class="fa fa-times-circle remove-failed-message" aria-hidden="true" data-toggle="tooltip" title="{{t 'Cancel' }}"></i>
</div>
{{#unless msg/locally_echoed}}
<div class="star fa {{#if msg/starred}}fa-star{{else}}fa-star-o{{/if}} {{#if msg/starred}}{{else}}empty-star{{/if}}" title="{{#tr this.msg}}__starred_status__ this message{{/tr}} (*)">
</div>
{{/unless}}
</div>

View File

@ -67,35 +67,8 @@
{{/unless}}
{{/if_and}}
<div class="message_controls{{#status_message}} sender-status-controls{{/status_message}} no-select">
{{partial "message_controls"}}
{{#if msg/sent_by_me}}
<div class="edit_content"></div>
{{/if}}
{{#unless msg/sent_by_me}}
<div class="reaction_button">
<i class="fa fa-smile-o" title="{{#tr this}}Add emoji reaction{{/tr}} (:)" aria-label="{{#tr this}}Add emoji reaction{{/tr}} (:)" role="button" aria-haspopup="true" tabindex="0"></i>
</div>
{{/unless}}
{{#unless msg/locally_echoed}}
<div class="info actions_hover">
<i class="fa fa-chevron-down" title="{{#tr this}}Message actions{{/tr}} (i)" title="{{#tr this}}Message actions{{/tr}}" role="button" aria-haspopup="true" tabindex="0" aria-label="{{#tr this}}Message actions{{/tr}}"></i>
</div>
{{/unless}}
<div class="message_failed {{#unless msg.failed_request}}notvisible{{/unless}}">
<i class="fa fa-refresh refresh-failed-message" data-toggle="tooltip" title="{{t 'Retry' }}" aria-label="{{t 'Retry' }}" role="button" tabindex="0"></i>
<i class="fa fa-times-circle remove-failed-message" aria-hidden="true" data-toggle="tooltip" title="{{t 'Cancel' }}"></i>
</div>
{{#unless msg/locally_echoed}}
<div class="star fa {{#if msg/starred}}fa-star{{else}}fa-star-o{{/if}} {{#if msg/starred}}{{else}}empty-star{{/if}}" title="{{#tr this.msg}}__starred_status__ this message{{/tr}} (*)">
</div>
{{/unless}}
</div>
</div>
<div class="message_content">{{#unless status_message}}{{#if use_match_properties}}{{{msg/match_content}}}{{else}}{{{msg/content}}}{{/if}}{{/unless}}</div>