about summary refs log tree commit diff
path: root/app/assets
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-02-05 15:25:55 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-02-05 15:25:55 +0100
commit87830f99e7e47f19ce9368cca93b66a8c1c34517 (patch)
tree649f1cf1ee158d26f7f4726bbfad06b263141d5b /app/assets
parentff2da21d3c889b797ad58a0ff4fae150f195b016 (diff)
Fix #552 - Replace image links with image icons in status text in the UI
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/components/components/status_content.jsx3
-rw-r--r--app/assets/stylesheets/components.scss8
2 files changed, 11 insertions, 0 deletions
diff --git a/app/assets/javascripts/components/components/status_content.jsx b/app/assets/javascripts/components/components/status_content.jsx
index 81c104860..9263a76f5 100644
--- a/app/assets/javascripts/components/components/status_content.jsx
+++ b/app/assets/javascripts/components/components/status_content.jsx
@@ -42,11 +42,14 @@ const StatusContent = React.createClass({
     for (var i = 0; i < links.length; ++i) {
       let link    = links[i];
       let mention = this.props.status.get('mentions').find(item => link.href === item.get('url'));
+      let media   = this.props.status.get('media_attachments').find(item => link.href === item.get('text_url') || link.href === item.get('remote_url'));
 
       if (mention) {
         link.addEventListener('click', this.onMentionClick.bind(this, mention), false);
       } else if (link.textContent[0] === '#' || (link.previousSibling && link.previousSibling.textContent && link.previousSibling.textContent[link.previousSibling.textContent.length - 1] === '#')) {
         link.addEventListener('click', this.onHashtagClick.bind(this, link.text), false);
+      } else if (media) {
+        link.innerHTML = '<i class="fa fa-fw fa-photo"></i>';
       } else {
         link.setAttribute('target', '_blank');
         link.setAttribute('rel', 'noopener');
diff --git a/app/assets/stylesheets/components.scss b/app/assets/stylesheets/components.scss
index ca0ec0cec..85d34c531 100644
--- a/app/assets/stylesheets/components.scss
+++ b/app/assets/stylesheets/components.scss
@@ -125,6 +125,10 @@
 
     &:hover {
       text-decoration: underline;
+
+      .fa {
+        color: lighten($color1, 40%);
+      }
     }
 
     &.mention {
@@ -136,6 +140,10 @@
         }
       }
     }
+
+    .fa {
+      color: lighten($color1, 30%);
+    }
   }
 
   .status__content__spoiler-link {