]> cat aescling's git repositories - mastodon.git/commitdiff
Fix #700 - hide spoilers on static pages
authorEugen Rochko <eugen@zeonfederated.com>
Fri, 31 Mar 2017 11:54:36 +0000 (13:54 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Fri, 31 Mar 2017 11:54:36 +0000 (13:54 +0200)
app/assets/javascripts/extras.jsx
app/assets/stylesheets/stream_entries.scss
app/views/stream_entries/_detailed_status.html.haml
app/views/stream_entries/_simple_status.html.haml
config/locales/en.yml

index 5738863ddd0ff4fc89dada6aacc30474af6f233b..c13feceffef809f80fbf88917faf96619a7af809 100644 (file)
@@ -24,4 +24,17 @@ $(() => {
       window.location.href = $(e.target).attr('href');
     }
   });
+
+  $('.status__content__spoiler-link').on('click', e => {
+    e.preventDefault();
+    const contentEl = $(e.target).parent().parent().find('div');
+
+    if (contentEl.is(':visible')) {
+      contentEl.hide();
+      $(e.target).parent().attr('style', 'margin-bottom: 0');
+    } else {
+      contentEl.show();
+      $(e.target).parent().attr('style', null);
+    }
+  });
 });
index b9a9a1da3ead60dd94a8186087f082ebf5d2e628..4a6dc6aa44db584dac076145592ba01f2e19781c 100644 (file)
       a {
         color: $color4;
       }
+
+      a.status__content__spoiler-link {
+        color: $color5;
+        background: $color3;
+
+        &:hover {
+          background: lighten($color3, 8%);
+        }
+      }
     }
 
     .status__attachments {
       a {
         color: $color4;
       }
+
+      a.status__content__spoiler-link {
+        color: $color5;
+        background: $color3;
+
+        &:hover {
+          background: lighten($color3, 8%);
+        }
+      }
     }
 
     .detailed-status__meta {
index 8c0456b1fe5862ccf6ff165672d471d66d35401e..11940883e4b920f6bce582eae05065545b31d857 100644 (file)
@@ -9,8 +9,10 @@
 
   .status__content.e-content.p-name.emojify<
     - unless status.spoiler_text.blank?
-      %p= status.spoiler_text
-    %div{ style: "direction: #{rtl?(status.content) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status)
+      %p{ style: 'margin-bottom: 0' }<
+        %span>= "#{status.spoiler_text} "
+        %a.status__content__spoiler-link{ href: '#' }= t('statuses.show_more')
+    %div{ style: "display: #{status.spoiler_text.blank? ? 'block' : 'none'}; direction: #{rtl?(status.content) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status)
 
   - unless status.media_attachments.empty?
     - if status.media_attachments.first.video?
index cb2c976ce492cfdcf73a5ef7f022ff39300b743f..2eb9bf1667c226e60b0eadfe10450de535660ecf 100644 (file)
 
   .status__content.e-content.p-name.emojify<
     - unless status.spoiler_text.blank?
-      %p= status.spoiler_text
-    %div{ style: "direction: #{rtl?(status.content) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status)
+      %p{ style: 'margin-bottom: 0' }<
+        %span>= "#{status.spoiler_text} "
+        %a.status__content__spoiler-link{ href: '#' }= t('statuses.show_more')
+    %div{ style: "display: #{status.spoiler_text.blank? ? 'block' : 'none'}; direction: #{rtl?(status.content) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status)
 
   - unless status.media_attachments.empty?
     .status__attachments
index 965001e059865c53f4d3dbb6f511496d8c677f4b..157f107a59ae00da293ede5e0979062f1d949c66 100644 (file)
@@ -138,6 +138,7 @@ en:
   statuses:
     open_in_web: Open in web
     over_character_limit: character limit of %{max} exceeded
+    show_more: Show more
     visibilities:
       private: Only show to followers
       public: Public