From 5a01c3afca4c722008f6f0718f7fbee8d2485f0e Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Sun, 15 Dec 2024 18:12:57 +0300 Subject: [PATCH] added history button to help center & policy post pages --- app/views/posts/document.html.erb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views/posts/document.html.erb b/app/views/posts/document.html.erb index a5cb84a16..e08d748ab 100644 --- a/app/views/posts/document.html.erb +++ b/app/views/posts/document.html.erb @@ -2,9 +2,15 @@ « Back to help center <% end %> <% unless @post.nil? %> - <% if (moderator? && @post.post_type_id == HelpDoc.post_type_id) || (admin? && @post.post_type_id == PolicyDoc.post_type_id) %> + <% + is_hc = @post.post_type_id == HelpDoc.post_type_id + is_policy = @post.post_type_id == PolicyDoc.post_type_id + history_path = is_hc ? help_post_history_path(@post.doc_slug) : policy_post_history_path(@post.doc_slug) + %> + <% if (moderator? && is_hc) || (admin? && is_policy) %> <%= link_to 'edit', edit_post_path(@post), class: "button is-outlined is-muted" %> <% end %> + <%= link_to 'history', history_path, class: "button is-outlined is-muted" %> <% end %> <% if @post.help_category == '$Moderator' %>