Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

status_emoji: Extract status emoji template.

AnushaNathRoy5e05dcbc8f40
diff --git a/static/styles/right_sidebar.css b/static/styles/right_sidebar.css
index 59ac84fb5d6..8db920c16e0 100644
--- a/static/styles/right_sidebar.css
+++ b/static/styles/right_sidebar.css
@@ -113,14 +113,7 @@
width: calc(100% - 24px);
.status_emoji {
- height: 16px;
- width: 16px;
- /* We are setting minimum width here because when the user's name is very long,
- emoji's width decreases and causes it to break. */
- min-width: 16px;
- margin-left: 4px;
- margin-right: 4px;
- top: 8px;
+ top: 9px;
}
}
diff --git a/static/styles/zulip.css b/static/styles/zulip.css
index 6a29751000c..1aae23a1c64 100644
--- a/static/styles/zulip.css
+++ b/static/styles/zulip.css
@@ -2453,6 +2453,16 @@ div.topic_edit_spinner .loading_indicator_spinner {
top: 3px;
}
+.status_emoji {
+ height: 16px;
+ width: 16px;
+ /* We are setting minimum width here because when the user's name is very long,
+ emoji's width decreases and causes it to break. */
+ min-width: 16px;
+ margin-left: 4px;
+ margin-right: 4px;
+}
+
/* FIXME: Combine this rule with the one in portico.css somehow? */
#pw_strength {
width: 100%;
diff --git a/static/templates/status_emoji.hbs b/static/templates/status_emoji.hbs
new file mode 100644
index 00000000000..74b33657d26
--- /dev/null
+++ b/static/templates/status_emoji.hbs
@@ -0,0 +1,10 @@
+{{#if emoji_alt_code}}
+<div class="emoji_alt_code">&nbsp:{{emoji_name}}:</div>
+{{else if still_url}}
+<img src="{{still_url}}" class="emoji status_emoji" data-animated-url="{{url}}" data-still-url="{{still_url}}" />
+{{else if url}}
+{{!-- note that we have no still_url --}}
+<img src="{{url}}" class="emoji status_emoji" data-animated-url="{{url}}" />
+{{else if emoji_code}}
+<div class="emoji status_emoji emoji-{{emoji_code}}"></div>
+{{/if}}
diff --git a/static/templates/user_presence_row.hbs b/static/templates/user_presence_row.hbs
index 0a1e27dda3f..fc875bf72b4 100644
--- a/static/templates/user_presence_row.hbs
+++ b/static/templates/user_presence_row.hbs
@@ -6,19 +6,7 @@
data-user-id="{{user_id}}"
data-name="{{name}}">
<span class="user-name">{{name}}</span>
- {{#if status_emoji_info}}
- {{#if status_emoji_info.emoji_alt_code}}
- <div class="emoji_alt_code">&nbsp:{{status_emoji_info.emoji_name}}:</div>
- {{else}}
- {{#if status_emoji_info.still_url}}
- <img src="{{status_emoji_info.still_url}}" class="emoji status_emoji" data-animated-url="{{status_emoji_info.url}}" data-still-url="{{status_emoji_info.still_url}}" />
- {{else if status_emoji_info.url}}
- <img src="{{status_emoji_info.url}}" class="emoji status_emoji" data-animated-url="{{status_emoji_info.url}}" data-still-url="{{status_emoji_info.still_url}}" />
- {{else}}
- <div class="emoji status_emoji emoji-{{status_emoji_info.emoji_code}}"></div>
- {{/if}}
- {{/if}}
- {{/if}}
+ {{> status_emoji status_emoji_info}}
</a>
<span class="unread_count">{{#if num_unread}}{{num_unread}}{{/if}}</span>
</div>