From 50b0b79891922009e6ad8f926cd3514d2bdbf8e8 Mon Sep 17 00:00:00 2001 From: evazion Date: Tue, 24 Mar 2020 18:32:30 -0500 Subject: [PATCH] comments: adjust link to howto:comment. Replace the giant banner about reading the comment guidelines with a smaller link to howto:comment beneath the comment text box. --- app/helpers/application_helper.rb | 1 + app/views/comments/_form.html.erb | 2 +- app/views/comments/_index_by_post.html.erb | 6 ------ app/views/dtext/_form.html.erb | 7 ++++++- app/views/posts/show.html.erb | 3 --- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index dc1080b8a..3447b3306 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -227,6 +227,7 @@ module ApplicationHelper options[:value] ||= instance_variable_get("@#{object}").try(name) options[:preview_id] ||= "dtext-preview" options[:classes] ||= "" + options[:hint] ||= "" options[:type] ||= "text" render "dtext/form", options diff --git a/app/views/comments/_form.html.erb b/app/views/comments/_form.html.erb index 300795e97..fbf255f5e 100644 --- a/app/views/comments/_form.html.erb +++ b/app/views/comments/_form.html.erb @@ -4,7 +4,7 @@ <% if comment.new_record? %> <%= f.hidden_field :post_id %> <% end %> - <%= dtext_field "comment", "body", :classes => "autocomplete-mentions", :value => comment.body, :input_id => "comment_body_for_#{comment.id}", :preview_id => "dtext-preview-for-#{comment.id}" %> + <%= dtext_field "comment", "body", classes: "autocomplete-mentions", value: comment.body, input_id: "comment_body_for_#{comment.id}", preview_id: "dtext-preview-for-#{comment.id}", hint: link_to_wiki("Comment rules", "howto:comment").html_safe %> <%= f.button :submit, "Submit" %> <%= dtext_preview_button "comment", "body", :input_id => "comment_body_for_#{comment.id}", :preview_id => "dtext-preview-for-#{comment.id}" %> <% if comment.new_record? %> diff --git a/app/views/comments/_index_by_post.html.erb b/app/views/comments/_index_by_post.html.erb index 29acbe032..549d17557 100644 --- a/app/views/comments/_index_by_post.html.erb +++ b/app/views/comments/_index_by_post.html.erb @@ -1,10 +1,4 @@
- <% if !CurrentUser.user.is_builder? %> -
-

Before commenting, read the <%= link_to_wiki "how to comment guide", "howto:comment" %>.

-
- <% end %> - <% if @posts.blank? %> <%= render "post_sets/blank" %> <% end %> diff --git a/app/views/dtext/_form.html.erb b/app/views/dtext/_form.html.erb index 8e763fadb..ef79e084e 100644 --- a/app/views/dtext/_form.html.erb +++ b/app/views/dtext/_form.html.erb @@ -10,5 +10,10 @@ <% end %>
- <%= link_to "Formatting help", dtext_help_path, remote: true, method: :get %>. + + <%= link_to "Formatting help", dtext_help_path, remote: true, method: :get %>. + <% if hint.present? %> + <%= hint %>. + <% end %> + diff --git a/app/views/posts/show.html.erb b/app/views/posts/show.html.erb index 890709b9e..6fd74ebf9 100644 --- a/app/views/posts/show.html.erb +++ b/app/views/posts/show.html.erb @@ -120,9 +120,6 @@ <% end %>
- <% if !CurrentUser.user.is_builder? %> -

Before commenting, read the <%= link_to_wiki "how to comment guide", "howto:comment" %>.

- <% end %> <%= render "comments/partials/index/list", comments: @comments, post: @post, page: :post %>