diff --git a/app/assets/stylesheets/posts.scss b/app/assets/stylesheets/posts.scss index a1a548af6..59e004d26 100644 --- a/app/assets/stylesheets/posts.scss +++ b/app/assets/stylesheets/posts.scss @@ -12,6 +12,11 @@ } } +.sticky { + position: sticky; + top: 50px; +} + .post--container { max-width: 100%; diff --git a/app/views/posts/_expanded.html.erb b/app/views/posts/_expanded.html.erb index 82733701f..7a6f2710f 100644 --- a/app/views/posts/_expanded.html.erb +++ b/app/views/posts/_expanded.html.erb @@ -38,44 +38,47 @@
<% if post_type.has_votes %>
-
- <% existing_vote = my_vote(post) %> - <% unless post.locked? %> - - <% end %> -
- +<%= post.upvote_count %> -
-
- −<%= post.downvote_count %> -
- <% unless post.locked? %> - - <% end %> -
- <% if user_signed_in? && post.post_type.has_reactions && post.post_type.reactions.any? %> -
+ <% sticky_votes = user_preference('sticky_vote_tool', community: false) == 'true' %> +
class="sticky" <% end %>> +
+ <% existing_vote = my_vote(post) %> + <% unless post.locked? %> + + <% end %> +
+ +<%= post.upvote_count %> +
+
+ −<%= post.downvote_count %> +
<% unless post.locked? %> - <% end %>
- <% end %> + <% if user_signed_in? && post.post_type.has_reactions && post.post_type.reactions.any? %> +
+ <% unless post.locked? %> + + <% end %> +
+ <% end %> +
<% end %> @@ -148,9 +151,10 @@ <% end %> <% end %> -
+
<%= raw(sanitize(post.body, scrubber: scrubber)) %> - +
+
<% been_edited = post.last_edited_by_id != nil %> <% if been_edited then last_edited_by_self = post.user_id == post.last_edited_by_id end %> diff --git a/config/config/preferences.yml b/config/config/preferences.yml index 36be0760a..8ecdcaabb 100644 --- a/config/config/preferences.yml +++ b/config/config/preferences.yml @@ -72,4 +72,10 @@ sticky_header: type: boolean description: > Make the top navigation bar sticky. + default: false + +sticky_vote_tool: + type: boolean + description: > + Make the up and downvote buttons scroll along with the post default: false \ No newline at end of file