Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

CIRCLE / cloud

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 94
  • Merge Requests 10
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Closed
Open
Issue #318 opened Oct 02, 2014 by Őry Máté@orymate 
  • Report abuse
  • New issue
Report abuse New issue

:heavy_exclamation_mark: support emojis 😿

in vm name/description etc.

diff --git a/circle/circle/settings/base.py b/circle/circle/settings/base.py
index 79ae63c..0c887fe 100644
--- a/circle/circle/settings/base.py
+++ b/circle/circle/settings/base.py
@@ -266,6 +266,7 @@ THIRD_PARTY_APPS = (
     'statici18n',
     'django_sshkey',
     'autocomplete_light',
+    'emoji',
 )

 # Apps specific for this project go here.
@@ -468,3 +469,5 @@ MAX_NODE_RAM = get_env_variable("MAX_NODE_RAM", 1024)

 # Url to download the client: (e.g. http://circlecloud.org/client/download/)
 CLIENT_DOWNLOAD_URL = get_env_variable('CLIENT_DOWNLOAD_URL', 'http://circlecloud.org/client/download/')
+
+EMOJI_IMG_TAG='<img src="{0}" alt="{1}" title="{2}" class="emoji" width="20">'
diff --git a/circle/dashboard/templates/dashboard/index-vm.html b/circle/dashboard/templates/dashboard/index-vm.html
index 0d780a6..b66ba95 100644
--- a/circle/dashboard/templates/dashboard/index-vm.html
+++ b/circle/dashboard/templates/dashboard/index-vm.html
@@ -1,4 +1,5 @@
 {% load i18n %}
+{% load emoji_tags %}
 <div class="panel panel-default">
   <div class="panel-heading">
     <div class="pull-right toolbar">
@@ -23,7 +24,7 @@
         {% if forloop.last and instances|length < 5 %} list-group-item-last{% endif %}">
         <span class="index-vm-list-name">
           <i class="fa {{ i.get_status_icon }}" title="{{ i.get_status_display }}"></i>
-          {{ i.name }}
+          {{ i.name|emoji_replace }}
         </span>
         <small class="text-muted">
           {% if i.owner == request.user %}{{ i.short_hostname }}
diff --git a/circle/dashboard/templates/dashboard/vm-detail.html b/circle/dashboard/templates/dashboard/vm-detail.html
index 8d9b43f..75f1d0f 100644
--- a/circle/dashboard/templates/dashboard/vm-detail.html
+++ b/circle/dashboard/templates/dashboard/vm-detail.html
@@ -1,5 +1,6 @@
 {% extends "dashboard/base.html" %}
 {% load i18n %}
+{% load emoji_tags %}

 {% block title-page %}{{ instance.name }} | vm{% endblock %}

@@ -56,7 +57,7 @@
         </form>
       </div>
       <div id="vm-details-h1-name" class="vm-details-home-edit-name">
-        {{ instance.name }}
+        {{ instance.name|emoji_replace }}
       </div>
       <small>{{ instance.primary_host.get_fqdn }}</small>
     </h1>
diff --git a/circle/dashboard/templates/dashboard/vm-detail/home.html b/circle/dashboard/templates/dashboard/vm-detail/home.html
index 6ad3508..aff682c 100644
--- a/circle/dashboard/templates/dashboard/vm-detail/home.html
+++ b/circle/dashboard/templates/dashboard/vm-detail/home.html
@@ -1,9 +1,10 @@
 {% load i18n %}
+{% load emoji_tags %}
 <div class="row">
   <div class="col-md-4">
     <dl>
       <dt>{% trans "System" %}:</dt>
-      <dd><i class="fa fa-{{ os_type_icon }}"></i> {{ instance.system }}</dd>
+      <dd><i class="fa fa-{{ os_type_icon }}"></i> {{ instance.system|emoji_replace }}</dd>
       <dt style="margin-top: 5px;">
         {% trans "Name" %}:
         {% if is_operator %}
@@ -12,7 +13,7 @@
       </dt>
       <dd>
         <div class="vm-details-home-edit-name-click">
-          <small class="vm-details-home-edit-name">{{ instance.name }}</small>
+          <small class="vm-details-home-edit-name">{{ instance.name|emoji_replace }}</small>
         </div>
         <div class="js-hidden vm-details-home-rename-form-div" id="vm-details-home-rename">
           <form method="POST">
@@ -38,7 +39,7 @@
       <dd>
         {% csrf_token %}
         <div class="vm-details-home-edit-description-click">
-          <small class="vm-details-home-edit-description">{{ instance.description|linebreaks }}</small>
+          <small class="vm-details-home-edit-description">{{ instance.description|emoji_replace|linebreaks }}</small>
         </div>
         <div id="vm-details-home-description" class="js-hidden">
           <form method="POST">
@@ -83,7 +84,7 @@
         {% if instance.tags.all %}
           {% for t in instance.tags.all %}
             <div class="label label-primary label-tag" style="display: inline-block">
-              {{ t }}
+              {{ t|emoji_replace }}
               {% if is_operator %}
                 <a href="#" class="vm-details-remove-tag"><i class="fa fa-times"></i></a>
               {% endif %}
diff --git a/circle/dashboard/templates/dashboard/vm-list.html b/circle/dashboard/templates/dashboard/vm-list.html
index c7bc1dc..a615aea 100644
--- a/circle/dashboard/templates/dashboard/vm-list.html
+++ b/circle/dashboard/templates/dashboard/vm-list.html
@@ -1,5 +1,6 @@
 {% extends "dashboard/base.html" %}
 {% load i18n %}
+{% load emoji_tags %}

 {% block title-page %}{% trans "Virtual machines" %}{% endblock %}

@@ -91,7 +92,7 @@
           <tr class="{% cycle 'odd' 'even' %}" data-vm-pk="{{ i.pk }}">
             <td class="pk"><div id="vm-{{i.pk}}">{{i.pk}}</div> </td>
             <td class="name"><a class="real-link" href="{% url "dashboard.views.detail" i.pk %}">
-                {{ i.name }}</a>
+                {{ i.name|emoji_replace }}</a>
             </td>
             <td class="state">
               <i class="fa fa-fw
  • Bach Dániel @bachdaniel

    Reassigned to @kviktor

    Oct 03, 2014

    Reassigned to @kviktor

    Reassigned to @kviktor
    Toggle commit list
  • Kálmán Viktor @kviktor commented Nov 28, 2014
    Owner
    diff --git a/circle/dashboard/static/dashboard/dashboard.css b/circle/dashboard/static/dashboard/dashboard
    index 8cf5ae8..d469865 100644
    --- a/circle/dashboard/static/dashboard/dashboard.css
    +++ b/circle/dashboard/static/dashboard/dashboard.css
    @@ -528,7 +528,7 @@ footer a, footer a:hover, footer a:visited {
     }
    
     #dashboard-template-list a small {
    -  max-width: 50%;
    +  max-width: 45%;
       float: left;
       padding-top: 2px;
       text-overflow: ellipsis;
    @@ -1012,3 +1012,7 @@ textarea[name="new_members"] {
     .disk-resize-btn {
       margin-right: 5px;
     }
    +
    +.emoji {
    +  max-width: 20px;
    +}
    diff --git a/circle/dashboard/static/dashboard/dashboard.js b/circle/dashboard/static/dashboard/dashboard.
    index a497d6b..0806409 100644
    --- a/circle/dashboard/static/dashboard/dashboard.js
    +++ b/circle/dashboard/static/dashboard/dashboard.js
    @@ -411,6 +411,20 @@ $(function () {
         $(this).removeClass("btn-default").addClass("btn-primary");
         return false;
       });
    +
    +  emojify.setConfig({
    +    'img_dir': "/static/dashboard/emojify.js/images/emoji",
    +    'ignored_tags': {
    +      'script': 1,
    +      'textarea': 1,
    +      'a': 0,
    +      'pre': 0,
    +      'code': 0,
    +    },
    +    'ignore_emoticons': true,
    +  });
    +
    +  emojify.run();
     });
    
     function generateVmHTML(pk, name, host, icon, _status, fav, is_last) {
    
    • bower https://github.com/hassankhan/emojify.js
    ```diff diff --git a/circle/dashboard/static/dashboard/dashboard.css b/circle/dashboard/static/dashboard/dashboard index 8cf5ae8..d469865 100644 --- a/circle/dashboard/static/dashboard/dashboard.css +++ b/circle/dashboard/static/dashboard/dashboard.css @@ -528,7 +528,7 @@ footer a, footer a:hover, footer a:visited { } #dashboard-template-list a small { - max-width: 50%; + max-width: 45%; float: left; padding-top: 2px; text-overflow: ellipsis; @@ -1012,3 +1012,7 @@ textarea[name="new_members"] { .disk-resize-btn { margin-right: 5px; } + +.emoji { + max-width: 20px; +} diff --git a/circle/dashboard/static/dashboard/dashboard.js b/circle/dashboard/static/dashboard/dashboard. index a497d6b..0806409 100644 --- a/circle/dashboard/static/dashboard/dashboard.js +++ b/circle/dashboard/static/dashboard/dashboard.js @@ -411,6 +411,20 @@ $(function () { $(this).removeClass("btn-default").addClass("btn-primary"); return false; }); + + emojify.setConfig({ + 'img_dir': "/static/dashboard/emojify.js/images/emoji", + 'ignored_tags': { + 'script': 1, + 'textarea': 1, + 'a': 0, + 'pre': 0, + 'code': 0, + }, + 'ignore_emoticons': true, + }); + + emojify.run(); }); function generateVmHTML(pk, name, host, icon, _status, fav, is_last) { ``` + bower https://github.com/hassankhan/emojify.js
  • Nyíri Tamás @nyirit

    Reassigned to @bubi

    Aug 27, 2015

    Reassigned to @bubi

    Reassigned to @bubi
    Toggle commit list
  • Kálmán Viktor @kviktor

    Assignee removed

    Sep 09, 2015

    Assignee removed

    Assignee removed
    Toggle commit list
  • Write
  • Preview
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
No due date
0
Labels
None
Assign labels
  • View labels
4
4 participants
Reference: circle/cloud#318