From c77298d9941b154719c7f952669f64cc95c435bc Mon Sep 17 00:00:00 2001 From: Nao Date: Mon, 27 Jul 2020 13:03:25 -0700 Subject: [PATCH 1/4] styling: updated views --- .../help_center/support_posts/_form.html.erb | 63 ++++++++++++------- .../support_posts/_support_post.html.erb | 18 ++---- .../help_center/support_posts/edit.html.erb | 9 +-- .../support_threads/_article.html.erb | 33 ++++++++++ .../support_threads/_form.html.erb | 21 ++----- .../support_threads/_support_thread.html.erb | 15 ++--- .../support_threads/index.html.erb | 10 +-- .../help_center/support_threads/show.html.erb | 40 +----------- .../help_center/user_mailer/new_post.html.erb | 3 - .../user_mailer/new_thread.html.erb | 3 - app/views/layouts/help_center.html.erb | 57 ++++++----------- 11 files changed, 114 insertions(+), 158 deletions(-) create mode 100644 app/views/help_center/support_threads/_article.html.erb diff --git a/app/views/help_center/support_posts/_form.html.erb b/app/views/help_center/support_posts/_form.html.erb index 098a8f9..7d21b11 100644 --- a/app/views/help_center/support_posts/_form.html.erb +++ b/app/views/help_center/support_posts/_form.html.erb @@ -1,32 +1,47 @@ -<%= form_for [@support_thread, @support_post], - url: (@support_post.persisted? ? help_center.support_thread_support_post_path(@support_thread, @support_post) : help_center.support_thread_support_posts_path(@support_thread)), - html: { data: { behavior: "comment-form" } } do |f| %> - - <% if @support_post.errors.any? %> +<%= form_for @support_thread, + url: (@support_thread.persisted? ? help_center.support_thread_path(@support_thread) : help_center.support_threads_path), + html: { data: {behavior: "comment-form"} } do |f| %> + <% if @support_thread.errors.any? %>
-

<%= pluralize(@support_post.errors.count, "error") %> prohibited this support_post from being saved:

- +

<%= pluralize(@support_thread.errors.count, "error") %> prohibited this support_thread from being saved:

<% end %> - -
- <%= f.text_area :body, placeholder: t('add_a_comment'), rows: 8, class: "form-control simplemde", data: { behavior: "comment-body" } %> +
+ <%= f.label :support_category_id, t('choose_a_category') %> + <%= f.collection_select :support_category_id, SupportCategory.sorted, :id, :name, {include_blank: t('pick_a_category')}, {autofocus: true, class: "form-control"} %>
- -
-
- - <%# Describe text formatting options here with a link %> - <%#= link_to "Parsed with Markdown", "https://guides.github.com/features/mastering-markdown/", target: "_blank" %> - -
- - <%= f.button "#{f.object.new_record? ? t('comment') : t('update_comment') }", class: "btn btn-primary", data: {disable_with: " #{t('saving_comment')}"} %> +
+ <%= f.label t('title') %> + <%= f.text_field :title, placeholder: t('how_do_i'), class: "form-control" %> +
+
+ <%= f.label t('position') %> + <%= f.text_field :position, class: "form-control" %> +
+
+ <%= f.label t('content') %> + <%= f.rich_text_area :content %> +
+ <% if local_assigns.fetch(:posts, true) %> + <% if !f.object.new_record? %> + <%= f.fields_for :support_posts do |p| %> +
+ <%= p.label :body, t('what_help_needed') %> + <%= p.text_area :body, placeholder: t('add_a_comment'), rows: 10, class: "form-control simplemde", data: { behavior: "comment-body" } %> +
+ <% end %> + <% end %> + <% end %> +
+ <% if f.object.new_record? %> + <%= f.button t('add'), class: "btn btn-primary", data: {disable_with: " #{t('saving')}"} %> + <% else %> + <%= f.button t('update'), class: "btn btn-primary", data: {disable_with: " #{t('saving')}"} %> + <% end %>
- <% end %> diff --git a/app/views/help_center/support_posts/_support_post.html.erb b/app/views/help_center/support_posts/_support_post.html.erb index 942bde0..9ea1b1b 100644 --- a/app/views/help_center/support_posts/_support_post.html.erb +++ b/app/views/help_center/support_posts/_support_post.html.erb @@ -1,8 +1,6 @@ <%# We don't currently cache the support posts because they have permissions to deal with %> - <%= content_tag :div, id: dom_id(support_post), class: support_post_classes(support_post) do %> -
- +
<% if is_moderator_or_owner?(support_post) %>
<%= link_to icon("fas","edit"), simple_discussion.edit_support_thread_support_post_path(@support_thread, support_post), @@ -19,10 +17,8 @@ %>
<% end %> -
<%= avatar_tag(support_post.user.email) %> - <%= support_post.user.name %> <%= support_user_badge(support_post.user) %> @@ -32,16 +28,13 @@
- -
+
<%= formatted_content support_post.body %>
- <% if @support_thread.solved? && support_post.solved? %> -