help_center 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -0
  3. data/LICENSE.txt +21 -21
  4. data/README.md +168 -164
  5. data/Rakefile +10 -10
  6. data/app/assets/stylesheets/help_center.scss +140 -139
  7. data/app/controllers/help_center/application_controller.rb +37 -37
  8. data/app/controllers/help_center/notifications_controller.rb +19 -19
  9. data/app/controllers/help_center/support_categories_controller.rb +58 -58
  10. data/app/controllers/help_center/support_posts_controller.rb +72 -72
  11. data/app/controllers/help_center/support_threads_controller.rb +82 -82
  12. data/app/helpers/help_center/support_posts_helper.rb +29 -29
  13. data/app/helpers/help_center/support_threads_helper.rb +28 -28
  14. data/app/jobs/help_center/support_post_notification_job.rb +42 -42
  15. data/app/jobs/help_center/support_thread_notification_job.rb +40 -40
  16. data/app/mailers/help_center/user_mailer.rb +28 -28
  17. data/app/models/support_category.rb +16 -13
  18. data/app/models/support_post.rb +15 -15
  19. data/app/models/support_subscription.rb +19 -19
  20. data/app/models/support_thread.rb +85 -85
  21. data/app/views/help_center/support_categories/_form.html.erb +39 -35
  22. data/app/views/help_center/support_categories/_support_thread.html.erb +25 -25
  23. data/app/views/help_center/support_categories/edit.html.erb +7 -7
  24. data/app/views/help_center/support_categories/index.html.erb +19 -19
  25. data/app/views/help_center/support_categories/new.html.erb +5 -5
  26. data/app/views/help_center/support_categories/show.html.erb +19 -20
  27. data/app/views/help_center/support_posts/_form.html.erb +47 -47
  28. data/app/views/help_center/support_posts/_support_post.html.erb +57 -57
  29. data/app/views/help_center/support_posts/edit.html.erb +23 -23
  30. data/app/views/help_center/support_threads/_form.html.erb +49 -49
  31. data/app/views/help_center/support_threads/_support_thread.html.erb +25 -25
  32. data/app/views/help_center/support_threads/edit.html.erb +7 -7
  33. data/app/views/help_center/support_threads/index.html.erb +19 -19
  34. data/app/views/help_center/support_threads/new.html.erb +5 -5
  35. data/app/views/help_center/support_threads/show.html.erb +29 -42
  36. data/app/views/help_center/user_mailer/new_post.html.erb +9 -9
  37. data/app/views/help_center/user_mailer/new_thread.html.erb +9 -9
  38. data/app/views/layouts/help_center.html.erb +130 -128
  39. data/app/views/shared/_category_actions.html.erb +16 -0
  40. data/app/views/shared/_spacer.html.erb +1 -1
  41. data/app/views/shared/_thread_actions.html.erb +16 -0
  42. data/bin/console +14 -14
  43. data/bin/setup +8 -8
  44. data/config/locales/en.yml +56 -55
  45. data/config/routes.rb +24 -24
  46. data/db/migrate/20170417012930_create_support_categories.rb +19 -19
  47. data/db/migrate/20170417012931_create_support_threads.rb +18 -18
  48. data/db/migrate/20170417012933_create_support_subscriptions.rb +11 -11
  49. data/help_center.gemspec +27 -29
  50. data/lib/generators/help_center/controllers_generator.rb +13 -13
  51. data/lib/generators/help_center/helpers_generator.rb +13 -13
  52. data/lib/generators/help_center/views_generator.rb +13 -13
  53. data/lib/help_center.rb +23 -23
  54. data/lib/help_center/engine.rb +10 -10
  55. data/lib/help_center/slack.rb +22 -22
  56. data/lib/help_center/support_user.rb +10 -10
  57. data/lib/help_center/version.rb +3 -3
  58. metadata +7 -19
  59. data/help_center-0.0.1.gem +0 -0
@@ -1,49 +1,49 @@
1
- <%= form_for @support_thread,
2
- url: (@support_thread.persisted? ? help_center.support_thread_path(@support_thread) : help_center.support_threads_path),
3
- html: { data: {behavior: "comment-form"} } do |f| %>
4
- <% if @support_thread.errors.any? %>
5
- <div id="error_explanation">
6
- <h2><%= pluralize(@support_thread.errors.count, "error") %> prohibited this support_thread from being saved:</h2>
7
- <ul>
8
- <% @support_thread.errors.full_messages.each do |message| %>
9
- <li><%= message %></li>
10
- <% end %>
11
- </ul>
12
- </div>
13
- <% end %>
14
- <div class="mb-4">
15
- <%= f.label :support_category_id, t('choose_a_category') %>
16
- <%= f.collection_select :support_category_id, SupportCategory.sorted, :id, :name, {include_blank: t('pick_a_category')}, {autofocus: true, class: "form-control form-input"} %>
17
- </div>
18
- <div class="mb-4">
19
- <%= f.label t('title') %>
20
- <%= f.text_field :title, placeholder: t('how_do_i'), class: "form-control form-input" %>
21
- </div>
22
- <div class="mb-4">
23
- <%= f.label t('position') %>
24
- <%= f.text_field :position, class: "form-control form-input" %>
25
- </div>
26
- <div class="mb-4">
27
- <%= f.label t('content') %>
28
- <%= f.rich_text_area :content %>
29
- </div>
30
- <% if local_assigns.fetch(:posts, true) %>
31
- <% if !f.object.new_record? %>
32
- <%= f.fields_for :support_posts do |p| %>
33
- <div class="mb-4">
34
- <%= p.label :body, t('what_help_needed') %>
35
- <%= p.text_area :body, placeholder: t('add_a_comment'), rows: 10, class: "form-control simplemde", data: { behavior: "comment-body" } %>
36
- </div>
37
- <% end %>
38
- <% end %>
39
- <% end %>
40
- <div class="flex justify-between mb-4 text-right">
41
- <% if f.object.new_record? %>
42
- <%= f.button t('add'), class: "btn btn-primary", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> #{t('saving')}"} %>
43
- <% else %>
44
- <%= f.button t('update'), class: "btn btn-primary", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> #{t('saving')}"} %>
45
- <% end %>
46
-
47
- <%= link_to "Cancel", :back, class: "btn btn-link" %>
48
- </div>
49
- <% end %>
1
+ <%= form_for @support_thread,
2
+ url: (@support_thread.persisted? ? help_center.support_thread_path(@support_thread) : help_center.support_threads_path),
3
+ html: { data: {behavior: "comment-form"} } do |f| %>
4
+ <% if @support_thread.errors.any? %>
5
+ <div id="error_explanation">
6
+ <h2><%= pluralize(@support_thread.errors.count, "error") %> prohibited this support_thread from being saved:</h2>
7
+ <ul>
8
+ <% @support_thread.errors.full_messages.each do |message| %>
9
+ <li><%= message %></li>
10
+ <% end %>
11
+ </ul>
12
+ </div>
13
+ <% end %>
14
+ <div class="mb-4">
15
+ <%= f.label :support_category_id, t('choose_a_category') %>
16
+ <%= f.collection_select :support_category_id, SupportCategory.sorted, :id, :name, {include_blank: t('pick_a_category')}, {autofocus: true, class: "form-control form-input"} %>
17
+ </div>
18
+ <div class="mb-4">
19
+ <%= f.label t('title') %>
20
+ <%= f.text_field :title, placeholder: t('how_do_i'), class: "form-control form-input" %>
21
+ </div>
22
+ <div class="mb-4">
23
+ <%= f.label t('position') %>
24
+ <%= f.text_field :position, type: "number", step: "1", min: "0", class: "form-control form-input" %>
25
+ </div>
26
+ <div class="mb-4">
27
+ <%= f.label t('content') %>
28
+ <%= f.rich_text_area :content %>
29
+ </div>
30
+ <% if local_assigns.fetch(:posts, true) %>
31
+ <% if !f.object.new_record? %>
32
+ <%= f.fields_for :support_posts do |p| %>
33
+ <div class="mb-4">
34
+ <%= p.label :body, t('what_help_needed') %>
35
+ <%= p.text_area :body, placeholder: t('add_a_comment'), rows: 10, class: "form-control simplemde", data: { behavior: "comment-body" } %>
36
+ </div>
37
+ <% end %>
38
+ <% end %>
39
+ <% end %>
40
+ <div class="flex justify-between mb-4 text-right">
41
+ <% if f.object.new_record? %>
42
+ <%= f.button t('add'), class: "btn btn-primary", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> #{t('saving')}"} %>
43
+ <% else %>
44
+ <%= f.button t('update'), class: "btn btn-primary", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> #{t('saving')}"} %>
45
+ <% end %>
46
+
47
+ <%= link_to "Cancel", :back, class: "btn btn-link" %>
48
+ </div>
49
+ <% end %>
@@ -1,25 +1,25 @@
1
- <%= cache support_thread do %>
2
- <div class="support-thread">
3
- <div class="flex flex-wrap">
4
- <div class="flex-grow mb-2">
5
- <%= link_to help_center.support_thread_path(support_thread) do %>
6
- <h4>
7
- <%= support_thread.title %>
8
- </h4>
9
- <p class="text-gray-500 hover:text-gray-700"><%= truncate(support_thread.content.to_plain_text, length: 200) %></p>
10
- <div class="thread-details mt-2">
11
- <%= t('content_updated_at', update_time: time_ago_in_words(support_thread.created_at)) %>
12
- </div>
13
- <% end %>
14
- </div>
15
- <% if HelpCenter.enable_comments %>
16
- <div class="sm:w-1/6 pr-4 pl-4 text-center">
17
- <%= link_to help_center.support_thread_path(support_thread), class: "thread-posts-count" do %>
18
- <span class="count"><%= support_thread.support_posts_count %></span>
19
- <small><%= t("post", count: support_thread.support_posts_count) %></small>
20
- <% end %>
21
- </div>
22
- <% end %>
23
- </div>
24
- </div>
25
- <% end %>
1
+ <%= cache support_thread do %>
2
+ <div class="support-thread">
3
+ <div class="flex flex-wrap">
4
+ <div class="flex-grow mb-2">
5
+ <%= link_to help_center.support_thread_path(support_thread) do %>
6
+ <h4>
7
+ <%= support_thread.title %>
8
+ </h4>
9
+ <p class="text-gray-500 hover:text-gray-700"><%= truncate(support_thread.content.to_plain_text, length: 200) %></p>
10
+ <div class="thread-details mt-2">
11
+ <%= t('content_updated_at', update_time: time_ago_in_words(support_thread.created_at)) %>
12
+ </div>
13
+ <% end %>
14
+ </div>
15
+ <% if HelpCenter.enable_comments %>
16
+ <div class="sm:w-1/6 pr-4 pl-4 text-center">
17
+ <%= link_to help_center.support_thread_path(support_thread), class: "thread-posts-count" do %>
18
+ <span class="count"><%= support_thread.support_posts_count %></span>
19
+ <small><%= t("post", count: support_thread.support_posts_count) %></small>
20
+ <% end %>
21
+ </div>
22
+ <% end %>
23
+ </div>
24
+ </div>
25
+ <% end %>
@@ -1,7 +1,7 @@
1
- <%= content_for :title, "Edit Thread" %>
2
-
3
- <h1 class="mb-4 font-bold"><%= t('edit_thread') %></h1>
4
-
5
- <div class="support_post">
6
- <%= render 'form', posts: false %>
7
- </div>
1
+ <%= content_for :title, "Edit Thread" %>
2
+
3
+ <h1 class="mb-4 font-bold"><%= t('edit_thread') %></h1>
4
+
5
+ <div class="support_post">
6
+ <%= render 'form', posts: false %>
7
+ </div>
@@ -1,19 +1,19 @@
1
- <% if @support_threads.none? %>
2
- <div><%= t('search_not_found') %>. <%= t('check_out') %> <%= link_to t('latest_questions'), help_center.support_threads_path %> <%= t('instead') %> </div>
3
- <% else %>
4
- <div class="container mx-auto">
5
- <% if request.url.include?('category') %>
6
- <%# If category, list all articles %>
7
- <div class="w-1/62 text-left p-0">
8
- <h3> <%= @support_threads.first.support_category.name %></h3>
9
- </div>
10
- <hr>
11
- <%= render partial: "help_center/support_threads/support_thread", collection: @support_threads, spacer_template: "shared/spacer" %>
12
- <div class="support-threads-nav text-center">
13
- <%== pagy_nav(@pagy) %>
14
- </div>
15
- <% else %>
16
- <%# Set default index here %>
17
- <% end %>
18
- </div>
19
- <% end %>
1
+ <% if @support_threads.none? %>
2
+ <div><%= t('search_not_found') %>. <%= t('check_out') %> <%= link_to t('latest_questions'), help_center.support_threads_path %> <%= t('instead') %> </div>
3
+ <% else %>
4
+ <div class="container mx-auto">
5
+ <% if request.url.include?('category') %>
6
+ <%# If category, list all articles %>
7
+ <div class="w-1/62 text-left p-0">
8
+ <h3> <%= @support_threads.first.support_category.name %></h3>
9
+ </div>
10
+ <hr>
11
+ <%= render partial: "help_center/support_threads/support_thread", collection: @support_threads, spacer_template: "shared/spacer" %>
12
+ <div class="support-threads-nav text-center">
13
+ <%== pagy_nav(@pagy) %>
14
+ </div>
15
+ <% else %>
16
+ <%# Set default index here %>
17
+ <% end %>
18
+ </div>
19
+ <% end %>
@@ -1,5 +1,5 @@
1
- <h1 class="mb-4 font-bold"><%= t('add_category') %></h1>
2
-
3
- <div class="support_post">
4
- <%= render 'form' %>
5
- </div>
1
+ <h1 class="mb-4 font-bold"><%= t('add_article') %></h1>
2
+
3
+ <div class="support_post">
4
+ <%= render 'form' %>
5
+ </div>
@@ -1,42 +1,29 @@
1
- <div class="container mx-auto">
2
- <div class="flex flex-wrap mb-8">
3
- <% if is_moderator_or_owner?(@support_thread) %>
4
- <div class="mb-4 bg-purple-600 flex w-full px-4 py-2 text-sm justify-end items-center">
5
- <span class="mr-4 text-gray-200"><i class="far fa-sort-amount-down"></i> <%= @support_thread.position %> </span>
6
- <%= link_to icon("fas","pencil") + " Edit", help_center.edit_support_thread_path(@support_thread),
7
- class: "text-gray-200",
8
- data: { toggle: "tooltip", placement: "left" },
9
- title: t('edit_this_thread') %>
10
-
11
- <%= link_to icon("fas","trash") + " Delete", help_center.support_thread_path(@support_thread),
12
- method: :delete,
13
- class: "text-gray-200 ml-4",
14
- data: { toggle: "tooltip", placement: "left", confirm: "Are you sure?" },
15
- title: t('delete_category') %>
16
- </div>
17
- <% end %>
18
- <div class="md:w-full pr-4 pl-41">
19
- <small class="mb-2" style="color: <%= @support_thread.support_category.color %>"><%= link_to @support_thread.support_category.name, help_center.support_category_path(@support_thread.support_category) %> > <%= @support_thread.title %></small>
20
- <h1 class="mb-4 font-bold"><%= icon "fas", "thumb-tack", class: "text-muted" if @support_thread.pinned? %> <%= @support_thread.title %></h1>
21
- </div>
22
-
23
- </div>
24
-
25
- <%= @support_thread.content %>
26
-
27
- <p class="mt-6 italic text-gray-400">Last Updated: <%= @support_thread.updated_at.strftime("%B %e, %Y") %> <p>
28
- <!--
29
- <div class="thread-reaction">
30
- <p>Did this answer your question?</p>
31
- <p class="thread-reaction-links">
32
- <a>😞<a>
33
- <a>😃<a>
34
- </p>
35
- <div>
36
- -->
37
- <% if HelpCenter.enable_comments %>
38
- <hr>
39
- <%= render partial: "help_center/support_posts/support_post", collection: @support_thread.support_posts.includes(:user).sorted %>
40
- <%= render partial: "help_center/support_posts/form" if user_signed_in? %>
41
- <% end %>
42
- </div>
1
+ <div class="container mx-auto">
2
+ <div class="flex flex-wrap mb-8">
3
+ <%= render partial: "shared/thread_actions" if is_moderator_or_owner?(@support_thread)%>
4
+
5
+ <div class="md:w-full pr-4 pl-41">
6
+ <small class="mb-2 tracking-normal font-normal" style="color: <%= @support_thread.support_category.color %>"><%= link_to @support_thread.support_category.name, help_center.support_category_path(@support_thread.support_category) %> > <%= @support_thread.title %></small>
7
+ <h1 class="mb-4 font-bold tracking-normal"><%= icon "fas", "thumb-tack", class: "text-muted" if @support_thread.pinned? %> <%= @support_thread.title %></h1>
8
+ </div>
9
+
10
+ </div>
11
+
12
+ <%= @support_thread.content %>
13
+
14
+ <p class="mt-6 italic text-gray-400">Last Updated: <%= @support_thread.updated_at.strftime("%B %e, %Y") %> <p>
15
+ <!--
16
+ <div class="thread-reaction">
17
+ <p>Did this answer your question?</p>
18
+ <p class="thread-reaction-links">
19
+ <a>😞<a>
20
+ <a>😃<a>
21
+ </p>
22
+ <div>
23
+ -->
24
+ <% if HelpCenter.enable_comments %>
25
+ <hr>
26
+ <%= render partial: "help_center/support_posts/support_post", collection: @support_thread.support_posts.includes(:user).sorted %>
27
+ <%= render partial: "help_center/support_posts/form" if user_signed_in? %>
28
+ <% end %>
29
+ </div>
@@ -1,9 +1,9 @@
1
- <div style="position: relative">
2
- <%= gravatar_image_tag @support_post.user.email, style: "float: left" %>
3
- <div style="margin-left:60px">
4
- <p><strong><%= @support_post.user.name %></strong> <small>commented:</small></p>
5
- <%= formatted_content @support_post.body %>
6
- </div>
7
- </div>
8
- <br />
9
- <p><%= link_to "Reply to this comment", support_thread_url(@support_post.support_thread, anchor: "support_post_#{@support_post.id}"), style: "background:#be2126; color:#fff; text-decoration:none; padding: 10px 20px" %></p>
1
+ <div style="position: relative">
2
+ <%= gravatar_image_tag @support_post.user.email, style: "float: left" %>
3
+ <div style="margin-left:60px">
4
+ <p><strong><%= @support_post.user.name %></strong> <small>commented:</small></p>
5
+ <%= formatted_content @support_post.body %>
6
+ </div>
7
+ </div>
8
+ <br />
9
+ <p><%= link_to "Reply to this comment", support_thread_url(@support_post.support_thread, anchor: "support_post_#{@support_post.id}"), style: "background:#be2126; color:#fff; text-decoration:none; padding: 10px 20px" %></p>
@@ -1,9 +1,9 @@
1
- <div style="position: relative">
2
- <%= gravatar_image_tag @support_post.user.email, style: "float: left" %>
3
- <div style="margin-left:60px">
4
- <p><strong><%= @support_post.user.name %></strong> <small>commented:</small></p>
5
- <%= formatted_content @support_post.body %>
6
- </div>
7
- </div>
8
- <br />
9
- <p><%= link_to "Reply to this comment", support_thread_url(@support_post.support_thread, anchor: "support_post_#{@support_post.id}"), style: "background:#be2126; color:#fff; text-decoration:none; padding: 10px 20px" %></p>
1
+ <div style="position: relative">
2
+ <%= gravatar_image_tag @support_post.user.email, style: "float: left" %>
3
+ <div style="margin-left:60px">
4
+ <p><strong><%= @support_post.user.name %></strong> <small>commented:</small></p>
5
+ <%= formatted_content @support_post.body %>
6
+ </div>
7
+ </div>
8
+ <br />
9
+ <p><%= link_to "Reply to this comment", support_thread_url(@support_post.support_thread, anchor: "support_post_#{@support_post.id}"), style: "background:#be2126; color:#fff; text-decoration:none; padding: 10px 20px" %></p>
@@ -1,128 +1,130 @@
1
- <% if current_user && (current_user.admin? || current_user.moderator?) %>
2
- <div class="fixed bottom-0 w-full z-50 bg-purple-600 text-purple-200 text-sm text-center font-brand-semibold px-4 py-3" role="alert">
3
- You're logged in as <b>help center moderator user</b> (<%= current_user.email %>)</b>
4
- <%= link_to t('add_an_article'), help_center.new_support_thread_path, class: "text-purple-100 hover:no-underline font-semibold underline mr-4 ml-6" %>
5
- <%= link_to t('add_category'), help_center.new_support_category_path, class: "text-purple-100 hover:no-underline font-semibold underline" %>
6
-
7
- <%= link_to "Logout", back_masquerade_path(current_user), class: "text-purple-100 hover:no-underline font-semibold underline ml-6" %>
8
- </div>
9
- <% end %>
10
-
11
- <div class="container mx-auto mt-2">
12
- <div class="flex flex-wrap help_center">
13
- <div class="md:w-1/4 pr-4 pl-4 mb-3">
14
- <div class="relative flex flex-col min-w-0 rounded break-words border bg-white border-1 border-grey-light flex-auto p-6">
15
- <div class="support-thread-filters">
16
- <% SupportCategory.sorted.each do |category| %>
17
- <div class="pb-3">
18
- <%= support_link_to help_center.support_category_path(category) do %>
19
- <div class="mb-2 mt-3">
20
- <span class="font-extrabold">
21
- <%= category.name %>
22
- </span>
23
- </div>
24
- <% end %>
25
- <div class="ml-2 pl-1">
26
- <% threads = SupportThread.where(support_category_id: category.id).order(:position) %>
27
- <% threads.each do |thread| %>
28
- <div class="mb-2">
29
- <%= support_link_to help_center.support_thread_path(thread) do %>
30
- <%= thread.title %>
31
- <% end %>
32
- </div>
33
- <% end %>
34
- </div>
35
- </div>
36
- <% end %>
37
- </div>
38
- <% if HelpCenter.enable_comments %>
39
- <hr />
40
- <div class="support-thread-filters">
41
- <h5>
42
- <strong>
43
- <%= t('filters') %>
44
- </strong>
45
- </h5>
46
- <div>
47
- <%= support_link_to help_center.support_threads_path, exact: true do %>
48
- <%= icon "fa-fw fas", "bars" %>
49
- <%= t('.all_threads') %>
50
- <% end %>
51
- </div>
52
- <% if user_signed_in? %>
53
- <div>
54
- <%= support_link_to help_center.mine_support_threads_path do %><%= icon "fa-fw far", "user-circle" %>
55
- <%= t('.my_questions') %>
56
- <% end %>
57
- </div>
58
- <div>
59
- <%= support_link_to help_center.participating_support_threads_path do %>
60
- <%= icon "fa-fw far", "comments" %>
61
- <%= t('.participating') %>
62
- <% end %>
63
- </div>
64
- <% end %>
65
- <div>
66
- <%= support_link_to help_center.answered_support_threads_path do %>
67
- <%= icon "fa-fw fas", "check" %>
68
- <%= t('.answered') %>
69
- <% end %>
70
- </div>
71
- <div>
72
- <%= support_link_to help_center.unanswered_support_threads_path do %>
73
- <%= icon "fa-fw fas", "question" %>
74
- <%= t('.unanswered') %>
75
- <% end %>
76
- </div>
77
- </div>
78
- <% if @support_thread.present? && @support_thread.persisted? %>
79
- <hr />
80
- <%# User has not posted in the thread or subscribed %>
81
- <h5><%= t('.notifications') %></h5>
82
- <%= link_to help_center.support_thread_notifications_path(@support_thread), method: :post, class: "btn-secondary btn-sm btn-block mb-2" do %>
83
- <% if @support_thread.subscribed? current_user %>
84
- <%= icon "fa-fw fas", "bell-slash" %> <%= t('.unsubscribe') %>
85
- <% else %>
86
- <%= icon "fa-fw fas", "bell" %>
87
- <%= t('.suscribe') %>
88
- <% end %>
89
- <% end %>
90
- <small><%= @support_thread.subscribed_reason(current_user) %></small>
91
- <% end %>
92
- <% end %>
93
- </div>
94
- </div>
95
- <div class="md:w-3/4 pr-4 pl-4 mb-3">
96
- <div class="relative flex flex-col min-w-0 rounded break-words bg-white flex-auto p-6">
97
- <%# Show first article by default on home pag %>
98
- <% if current_page?(help_center_path) %>
99
- <% if SupportThread.all.count > 0 %>
100
- <% @support_thread = SupportThread.all.first %>
101
- <div class="container mx-auto">
102
- <div class="flex flex-wrap mb-8">
103
- <% if is_moderator_or_owner?(@support_thread) %>
104
- <div class="flex w-full pr-4 pl-4 justify-end">
105
- <%= link_to icon("fas","pencil"), help_center.edit_support_thread_path(@support_thread),
106
- class: "text-muted",
107
- data: { toggle: "tooltip", placement: "left" },
108
- title: t('edit_this_thread') %>
109
- </div>
110
- <% end %>
111
- <div class="md:w-full pr-4 pl-41">
112
- <small class="mb-2"><%= support_category_link(@support_thread.support_category) %> > <%= @support_thread.title %></small>
113
- <h1><%= icon "fas", "thumb-tack", class: "text-muted" if @support_thread.pinned? %> <%= @support_thread.title %></h1>
114
- </div>
115
-
116
- </div>
117
- <%= @support_thread.content %>
118
- </div>
119
- <% end %>
120
- <% end %>
121
-
122
- <%= yield %>
123
- </div>
124
- </div>
125
- </div>
126
- </div>
127
-
128
- <% parent_layout("application") %>
1
+
2
+
3
+ <% if current_user && (current_user.admin? || current_user.moderator?) %>
4
+ <div class="container top-0 flex justify-between w-full z-50 bg-blue-600 text-purple-200 text-sm text-center font-brand-semibold px-4 py-3 rounded" role="alert">
5
+ <span class="text-base font-normal">Welcome moderator (<%= current_user.email %>)</span>
6
+ <div>
7
+ <%= link_to t('add_an_article'), help_center.new_support_thread_path, class: "text-gray-100 hover:text-gray-300 hover:no-underline font-semibold underline mr-4 ml-6" %>
8
+ <%= link_to t('add_category'), help_center.new_support_category_path, class: "text-gray-100 hover:text-gray-300 hover:no-underline font-semibold underline" %>
9
+ </div>
10
+ </div>
11
+ <% end %>
12
+
13
+ <div class="container mx-auto mt-2">
14
+ <div class="flex flex-wrap help_center">
15
+ <div class="md:w-1/4 mb-4">
16
+ <div class="relative flex flex-col min-w-0 rounded break-words border bg-white border-1 border-grey-light flex-auto p-6">
17
+ <div class="support-thread-filters">
18
+ <% SupportCategory.sorted.each do |category| %>
19
+ <div class="pb-3">
20
+ <%= support_link_to help_center.support_category_path(category) do %>
21
+ <div class="mb-2 mt-3">
22
+ <span class="font-extrabold">
23
+ <%= category.name %>
24
+ </span>
25
+ </div>
26
+ <% end %>
27
+ <div class="ml-2 pl-1">
28
+ <% threads = SupportThread.where(support_category_id: category.id).order(:position) %>
29
+ <% threads.each do |thread| %>
30
+ <div class="mb-2">
31
+ <%= support_link_to help_center.support_thread_path(thread) do %>
32
+ <%= thread.title %>
33
+ <% end %>
34
+ </div>
35
+ <% end %>
36
+ </div>
37
+ </div>
38
+ <% end %>
39
+ </div>
40
+ <% if HelpCenter.enable_comments %>
41
+ <hr />
42
+ <div class="support-thread-filters">
43
+ <h5>
44
+ <strong>
45
+ <%= t('filters') %>
46
+ </strong>
47
+ </h5>
48
+ <div>
49
+ <%= support_link_to help_center.support_threads_path, exact: true do %>
50
+ <%= icon "fa-fw fas", "bars" %>
51
+ <%= t('.all_threads') %>
52
+ <% end %>
53
+ </div>
54
+ <% if user_signed_in? %>
55
+ <div>
56
+ <%= support_link_to help_center.mine_support_threads_path do %><%= icon "fa-fw far", "user-circle" %>
57
+ <%= t('.my_questions') %>
58
+ <% end %>
59
+ </div>
60
+ <div>
61
+ <%= support_link_to help_center.participating_support_threads_path do %>
62
+ <%= icon "fa-fw far", "comments" %>
63
+ <%= t('.participating') %>
64
+ <% end %>
65
+ </div>
66
+ <% end %>
67
+ <div>
68
+ <%= support_link_to help_center.answered_support_threads_path do %>
69
+ <%= icon "fa-fw fas", "check" %>
70
+ <%= t('.answered') %>
71
+ <% end %>
72
+ </div>
73
+ <div>
74
+ <%= support_link_to help_center.unanswered_support_threads_path do %>
75
+ <%= icon "fa-fw fas", "question" %>
76
+ <%= t('.unanswered') %>
77
+ <% end %>
78
+ </div>
79
+ </div>
80
+ <% if @support_thread.present? && @support_thread.persisted? %>
81
+ <hr />
82
+ <%# User has not posted in the thread or subscribed %>
83
+ <h5><%= t('.notifications') %></h5>
84
+ <%= link_to help_center.support_thread_notifications_path(@support_thread), method: :post, class: "btn-secondary btn-sm btn-block mb-2" do %>
85
+ <% if @support_thread.subscribed? current_user %>
86
+ <%= icon "fa-fw fas", "bell-slash" %> <%= t('.unsubscribe') %>
87
+ <% else %>
88
+ <%= icon "fa-fw fas", "bell" %>
89
+ <%= t('.suscribe') %>
90
+ <% end %>
91
+ <% end %>
92
+ <small><%= @support_thread.subscribed_reason(current_user) %></small>
93
+ <% end %>
94
+ <% end %>
95
+ </div>
96
+ </div>
97
+ <div class="md:w-3/4 pl-4 mb-3">
98
+ <div class="relative flex flex-col min-w-0 rounded break-words bg-white flex-auto p-6">
99
+ <%# Show first article by default on home pag %>
100
+ <% if current_page?(help_center_path) %>
101
+ <% if SupportCategory.all.count > 0 %>
102
+ <% @support_thread = SupportCategory.sorted.first.support_threads.sorted.first %>
103
+ <div class="container mx-auto">
104
+ <div class="flex flex-wrap mb-8">
105
+ <% if is_moderator_or_owner?(@support_thread) %>
106
+ <div class="flex w-full pr-4 pl-4 justify-end">
107
+ <%= link_to icon("fas","pencil"), help_center.edit_support_thread_path(@support_thread),
108
+ class: "text-muted",
109
+ data: { toggle: "tooltip", placement: "left" },
110
+ title: t('edit_this_thread') %>
111
+ </div>
112
+ <% end %>
113
+ <div class="md:w-full pr-4 pl-41">
114
+ <small class="mb-2"><%= support_category_link(@support_thread.support_category) %> > <%= @support_thread.title %></small>
115
+ <h1><%= icon "fas", "thumb-tack", class: "text-muted" if @support_thread.pinned? %> <%= @support_thread.title %></h1>
116
+ </div>
117
+
118
+ </div>
119
+ <%= @support_thread.content %>
120
+ </div>
121
+ <% end %>
122
+ <% end %>
123
+
124
+ <%= yield %>
125
+ </div>
126
+ </div>
127
+ </div>
128
+ </div>
129
+
130
+ <% parent_layout("application") %>