diff --git a/app/assets/stylesheets/specific/post_tooltips.scss b/app/assets/stylesheets/specific/post_tooltips.scss index 96b5e9775..674b810b8 100644 --- a/app/assets/stylesheets/specific/post_tooltips.scss +++ b/app/assets/stylesheets/specific/post_tooltips.scss @@ -56,7 +56,11 @@ $tooltip-width: 164px * 3 - 10; // 3 thumbnails wide. border-color: #767676; .qtip-content { - padding: 4px 6px; + padding: 0; + + > * { + padding: 2px 6px; + } .post-tooltip-body { @include thin-scrollbar; @@ -68,16 +72,41 @@ $tooltip-width: 164px * 3 - 10; // 3 thumbnails wide. } } - .post-tooltip-footer { - .post-tooltip-disable { - float: right; - margin-top: 2px; + .post-tooltip-header { + background-color: $menu_color; + display: flex; + white-space: nowrap; + overflow: hidden; + + .post-tooltip-header-left { + flex: 1; } + + .post-tooltip-header-right { + flex: 1; + text-align: right; + } + + .fa-xs { + vertical-align: baseline; + } + + .post-tooltip-disable { + margin-left: 0.5em; + } + } + + .post-tooltip-info { + margin-left: 0.5em; + color: #555; + font-size: 10px; } } - &:not(:hover) a { - color: #666666; + &:not(:hover) { + a, span { + color: #777 !important; + } } &.post-tooltip-loading { diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 827f6d463..6511eb377 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -83,9 +83,11 @@ module ApplicationHelper raw content_tag(:time, duration, datetime: datetime, title: title) end - def time_ago_in_words_tagged(time) + def time_ago_in_words_tagged(time, compact: false) if time.past? - raw time_tag(time_ago_in_words(time) + " ago", time) + text = time_ago_in_words(time) + " ago" + text = text.gsub(/almost|about|over/, "") if compact + raw time_tag(text, time) else raw time_tag("in " + distance_of_time_in_words(Time.now, time), time) end diff --git a/app/models/post.rb b/app/models/post.rb index e538e4439..2e807b72c 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -509,6 +509,15 @@ class Post < ApplicationRecord source end end + + def source_domain + return "" unless source =~ %r!\Ahttps?://!i + + url = Addressable::URI.parse(normalized_source) + url.domain + rescue + "" + end end module TagMethods diff --git a/app/views/posts/show.html+tooltip.erb b/app/views/posts/show.html+tooltip.erb index 66a072477..d9d896c33 100644 --- a/app/views/posts/show.html+tooltip.erb +++ b/app/views/posts/show.html+tooltip.erb @@ -1,14 +1,50 @@ +