about summary refs log tree commit diff
path: root/app/views/stream_entries/_status.html.haml
diff options
context:
space:
mode:
authorBen Roberts <ben@thatmustbe.me>2017-04-12 14:04:33 -0400
committerEugen <eugen@zeonfederated.com>2017-04-12 20:04:33 +0200
commit0254ee9795822ec75ff64ace6ec2b91573bc9a52 (patch)
tree2e06fe9639cbfb568eedcddbc9515939158ef3cc /app/views/stream_entries/_status.html.haml
parente32edd247f04916270d5b2477c1ff1777e75cf51 (diff)
significant improvement in microformats markup (#1063)
* significant improvement in microformats markup

This is a huge improvement and I believe will close #965.

Had these microformats reviewed by others in the community to help
ensure they are at least correct, if not complete.

I did not want to change the structure of the page, and so there it does
not fully mark up the entire ancestry chain, or reply chain, only the
direct decendants and direct ancestors are correctly associated, but
this is likely fine as the most important bit is to have access to the
urls for those toots which are now correctly fetchable.

* improve code climate

* trying to pass code climate tests

* code climate

* fix p-summary for content warning posts

* fix error introduced when merging via github
Diffstat (limited to 'app/views/stream_entries/_status.html.haml')
-rw-r--r--app/views/stream_entries/_status.html.haml16
1 files changed, 13 insertions, 3 deletions
diff --git a/app/views/stream_entries/_status.html.haml b/app/views/stream_entries/_status.html.haml
index 1333d4d82..f389a8dfe 100644
--- a/app/views/stream_entries/_status.html.haml
+++ b/app/views/stream_entries/_status.html.haml
@@ -1,12 +1,22 @@
 - include_threads ||= false
 - is_predecessor  ||= false
 - is_successor    ||= false
+- direct_reply_id ||= false
+- parent_id       ||= false
+- is_direct_parent  = direct_reply_id == status.id
+- is_direct_child  = parent_id == status.in_reply_to_id
+- parent_id       ||= false
 - centered        ||= include_threads && !is_predecessor && !is_successor
+- h_class         = microformats_h_class(status, is_predecessor, is_successor, include_threads)
+- style_classes   = style_classes(status, is_predecessor, is_successor, include_threads)
+- mf_classes      = microformats_classes(status, is_direct_parent, is_direct_child)
+- entry_classes   = h_class + ' ' + mf_classes + ' ' + style_classes
 
 - if status.reply? && include_threads
-  = render partial: 'stream_entries/status', collection: @ancestors, as: :status, locals: { is_predecessor: true }
+  = render partial: 'stream_entries/status', collection: @ancestors, as: :status, locals: { is_predecessor: true, direct_reply_id: status.in_reply_to_id}
+
+.entry{ class: entry_classes }
 
-.entry{ class: entry_classes(status, is_predecessor, is_successor, include_threads) }
   - if status.reblog?
     .pre-header
       %div.pre-header__icon
@@ -19,4 +29,4 @@
   = render partial: centered ? 'stream_entries/detailed_status' : 'stream_entries/simple_status', locals: { status: status.proper }
 
 - if include_threads
-  = render partial: 'stream_entries/status', collection: @descendants, as: :status, locals: { is_successor: true }
+  = render partial: 'stream_entries/status', collection: @descendants, as: :status, locals: { is_successor: true, parent_id: status.id}