help_center 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +12 -12
  3. data/.gitignore +10 -10
  4. data/CHANGELOG.md +1 -1
  5. data/CODE_OF_CONDUCT.md +74 -74
  6. data/Gemfile +6 -6
  7. data/LICENSE.txt +21 -21
  8. data/README.md +164 -155
  9. data/Rakefile +10 -10
  10. data/app/assets/stylesheets/help_center.scss +139 -119
  11. data/app/controllers/help_center/application_controller.rb +37 -37
  12. data/app/controllers/help_center/notifications_controller.rb +19 -19
  13. data/app/controllers/help_center/support_categories_controller.rb +58 -17
  14. data/app/controllers/help_center/support_posts_controller.rb +72 -72
  15. data/app/controllers/help_center/support_threads_controller.rb +16 -6
  16. data/app/helpers/help_center/support_posts_helper.rb +29 -29
  17. data/app/helpers/help_center/support_threads_helper.rb +28 -28
  18. data/app/jobs/help_center/support_post_notification_job.rb +42 -42
  19. data/app/jobs/help_center/support_thread_notification_job.rb +40 -40
  20. data/app/mailers/help_center/user_mailer.rb +28 -28
  21. data/app/models/support_category.rb +13 -13
  22. data/app/models/support_post.rb +15 -15
  23. data/app/models/support_subscription.rb +19 -19
  24. data/app/models/support_thread.rb +85 -85
  25. data/app/views/help_center/support_categories/_form.html.erb +35 -0
  26. data/app/views/help_center/support_categories/_support_thread.html.erb +25 -0
  27. data/app/views/help_center/support_categories/edit.html.erb +7 -0
  28. data/app/views/help_center/support_categories/index.html.erb +19 -0
  29. data/app/views/help_center/support_categories/new.html.erb +5 -0
  30. data/app/views/help_center/support_categories/show.html.erb +20 -0
  31. data/app/views/help_center/support_threads/_form.html.erb +6 -4
  32. data/app/views/help_center/support_threads/edit.html.erb +7 -7
  33. data/app/views/help_center/support_threads/index.html.erb +1 -1
  34. data/app/views/help_center/support_threads/new.html.erb +5 -5
  35. data/app/views/help_center/support_threads/show.html.erb +42 -1
  36. data/app/views/layouts/help_center.html.erb +37 -13
  37. data/app/views/shared/_spacer.html.erb +1 -1
  38. data/bin/console +14 -14
  39. data/bin/setup +8 -8
  40. data/config/locales/en.yml +55 -52
  41. data/config/routes.rb +24 -24
  42. data/db/migrate/20170417012930_create_support_categories.rb +19 -19
  43. data/db/migrate/20170417012931_create_support_threads.rb +18 -18
  44. data/db/migrate/20170417012932_create_support_posts.rb +12 -12
  45. data/db/migrate/20170417012933_create_support_subscriptions.rb +11 -11
  46. data/help_center.gemspec +29 -29
  47. data/lib/generators/help_center/controllers_generator.rb +13 -13
  48. data/lib/generators/help_center/helpers_generator.rb +13 -13
  49. data/lib/generators/help_center/views_generator.rb +13 -13
  50. data/lib/help_center.rb +23 -24
  51. data/lib/help_center/engine.rb +10 -10
  52. data/lib/help_center/slack.rb +22 -22
  53. data/lib/help_center/support_user.rb +10 -10
  54. data/lib/help_center/version.rb +3 -3
  55. metadata +11 -8
  56. data/.travis.yml +0 -5
  57. data/app/views/help_center/support_threads/_article.html.erb +0 -32
  58. data/lib/help_center/will_paginate.rb +0 -53
@@ -13,15 +13,15 @@
13
13
  <% end %>
14
14
  <div class="mb-4">
15
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"} %>
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
17
  </div>
18
18
  <div class="mb-4">
19
19
  <%= f.label t('title') %>
20
- <%= f.text_field :title, placeholder: t('how_do_i'), class: "form-control" %>
20
+ <%= f.text_field :title, placeholder: t('how_do_i'), class: "form-control form-input" %>
21
21
  </div>
22
22
  <div class="mb-4">
23
23
  <%= f.label t('position') %>
24
- <%= f.text_field :position, class: "form-control" %>
24
+ <%= f.text_field :position, class: "form-control form-input" %>
25
25
  </div>
26
26
  <div class="mb-4">
27
27
  <%= f.label t('content') %>
@@ -37,11 +37,13 @@
37
37
  <% end %>
38
38
  <% end %>
39
39
  <% end %>
40
- <div class="mb-4 text-right">
40
+ <div class="flex justify-between mb-4 text-right">
41
41
  <% if f.object.new_record? %>
42
42
  <%= f.button t('add'), class: "btn btn-primary", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> #{t('saving')}"} %>
43
43
  <% else %>
44
44
  <%= f.button t('update'), class: "btn btn-primary", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> #{t('saving')}"} %>
45
45
  <% end %>
46
+
47
+ <%= link_to "Cancel", :back, class: "btn btn-link" %>
46
48
  </div>
47
49
  <% end %>
@@ -1,7 +1,7 @@
1
- <%= content_for :title, "Edit Thread" %>
2
-
3
- <h1><%= 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>
@@ -10,7 +10,7 @@
10
10
  <hr>
11
11
  <%= render partial: "help_center/support_threads/support_thread", collection: @support_threads, spacer_template: "shared/spacer" %>
12
12
  <div class="support-threads-nav text-center">
13
- <%= will_paginate @support_threads, url_builder: help_center, renderer: HelpCenter::BootstrapLinkRenderer %>
13
+ <%== pagy_nav(@pagy) %>
14
14
  </div>
15
15
  <% else %>
16
16
  <%# Set default index here %>
@@ -1,5 +1,5 @@
1
- <h1><%= t('add_an_article') %></h1>
2
-
3
- <div class="support_post">
4
- <%= render 'form' %>
5
- </div>
1
+ <h1 class="mb-4 font-bold"><%= t('add_category') %></h1>
2
+
3
+ <div class="support_post">
4
+ <%= render 'form' %>
5
+ </div>
@@ -1 +1,42 @@
1
- <%= render "article" %>
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,24 +1,28 @@
1
- <% @layout = 'website' %>
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 %>
2
10
 
3
11
  <div class="container mx-auto mt-2">
4
12
  <div class="flex flex-wrap help_center">
5
13
  <div class="md:w-1/4 pr-4 pl-4 mb-3">
6
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">
7
- <% if current_user && (current_user.admin? || current_user.moderator?) %>
8
- <%= link_to t('add_an_article'), help_center.new_support_thread_path, class: "btn btn-outline-primary btn-block" %>
9
- <hr />
10
- <% end %>
11
15
  <div class="support-thread-filters">
12
16
  <% SupportCategory.sorted.each do |category| %>
13
17
  <div class="pb-3">
14
- <%= support_link_to help_center.support_category_support_threads_path(category) do %>
18
+ <%= support_link_to help_center.support_category_path(category) do %>
15
19
  <div class="mb-2 mt-3">
16
20
  <span class="font-extrabold">
17
21
  <%= category.name %>
18
22
  </span>
19
23
  </div>
20
24
  <% end %>
21
- <div>
25
+ <div class="ml-2 pl-1">
22
26
  <% threads = SupportThread.where(support_category_id: category.id).order(:position) %>
23
27
  <% threads.each do |thread| %>
24
28
  <div class="mb-2">
@@ -27,7 +31,7 @@
27
31
  <% end %>
28
32
  </div>
29
33
  <% end %>
30
- </div>
34
+ </div>
31
35
  </div>
32
36
  <% end %>
33
37
  </div>
@@ -75,7 +79,7 @@
75
79
  <hr />
76
80
  <%# User has not posted in the thread or subscribed %>
77
81
  <h5><%= t('.notifications') %></h5>
78
- <%= link_to help_center.support_thread_notifications_path(@support_thread), method: :post, class: "btn btn-secondary btn-sm btn-block mb-2" do %>
82
+ <%= link_to help_center.support_thread_notifications_path(@support_thread), method: :post, class: "btn-secondary btn-sm btn-block mb-2" do %>
79
83
  <% if @support_thread.subscribed? current_user %>
80
84
  <%= icon "fa-fw fas", "bell-slash" %> <%= t('.unsubscribe') %>
81
85
  <% else %>
@@ -90,15 +94,35 @@
90
94
  </div>
91
95
  <div class="md:w-3/4 pr-4 pl-4 mb-3">
92
96
  <div class="relative flex flex-col min-w-0 rounded break-words bg-white flex-auto p-6">
93
- <% if request.env['REQUEST_URI'] == "/support" %>
94
- <% if SupportThread.exists?(id: 1) %>
95
- <% @support_thread = SupportThread.find(1) %>
96
- <%= render "help_center/support_threads/article"%>
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>
97
119
  <% end %>
98
120
  <% end %>
121
+
99
122
  <%= yield %>
100
123
  </div>
101
124
  </div>
102
125
  </div>
103
126
  </div>
127
+
104
128
  <% parent_layout("application") %>
@@ -1 +1 @@
1
- <hr/>
1
+ <hr/>
data/bin/console CHANGED
@@ -1,14 +1,14 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "help_center"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "help_center"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup CHANGED
@@ -1,8 +1,8 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -1,52 +1,55 @@
1
- en:
2
- start_a_discussion: Start A Discussion
3
- add: Add
4
- update: Update
5
- add_a_comment: Add A Comment
6
- add_an_article: Add Article
7
- ask_a_question: Ask A Question
8
- asked_time_ago: "Asked %{time} ago by %{author}"
9
- choose_a_category: Choose a Category
10
- comment: Comment
11
- commented_on: Commented on
12
- documentation: Documentation
13
- edit_this_post: Edit this post
14
- edit_this_thread: Edit this thread
15
- edit_thread: Edit thread
16
- filters: Filters
17
- how_do_i: How do I...?
18
- ignoring_thread: You're ignoring this thread.
19
- not_receiving_notifications: Youre not receiving notifications from this thread.
20
- layouts:
21
- simple_discussion:
22
- all_threads: All Threads
23
- answered: Answered
24
- by_category: By Category
25
- my_questions: My Questions
26
- notifications: Notifications
27
- participating: Participating
28
- suscribe: Subscribe
29
- unsubscribe: Unsubscribe
30
- unanswered: Unanswered
31
- pick_a_category: Pick a category...
32
- post:
33
- one: post
34
- other: posts
35
- receiving_notifications_because_subscribed: You're receiving notifications because you've subscribed to this thread.
36
- receiving_notifications_because_posted: You're receiving notifications because you've posted in this thread.
37
- saving_comment: Saving comment...
38
- saving: Saving
39
- this_solved_my_question: This solved my question
40
- title: title
41
- content: content
42
- position: position
43
- what_help_needed: What do you need help with?
44
- ask_your_question: Ask Your Question
45
- update_comment: Update comment
46
- your_changes_were_saved: Your changes were saved
47
- search_not_found: No results found for your search
48
- check_out: Check out
49
- latest_questions: the latest questions
50
- instead: instead?
51
- written_by_author: "Written by %{author}"
52
- content_updated_at: "Updated %{update_time} ago"
1
+ en:
2
+ start_a_discussion: Start A Discussion
3
+ add: Add
4
+ update: Update
5
+ add_a_comment: Add A Comment
6
+ add_an_article: Add Article
7
+ ask_a_question: Ask A Question
8
+ asked_time_ago: "Asked %{time} ago by %{author}"
9
+ choose_a_category: Choose a Category
10
+ comment: Comment
11
+ commented_on: Commented on
12
+ documentation: Documentation
13
+ edit_this_post: Edit this post
14
+ edit_this_thread: Edit this thread
15
+ edit_thread: Edit thread
16
+ edit_category: Edit category
17
+ filters: Filters
18
+ how_do_i: How do I...?
19
+ ignoring_thread: You're ignoring this thread.
20
+ not_receiving_notifications: You’re not receiving notifications from this thread.
21
+ layouts:
22
+ simple_discussion:
23
+ all_threads: All Threads
24
+ answered: Answered
25
+ by_category: By Category
26
+ my_questions: My Questions
27
+ notifications: Notifications
28
+ participating: Participating
29
+ suscribe: Subscribe
30
+ unsubscribe: Unsubscribe
31
+ unanswered: Unanswered
32
+ pick_a_category: Pick a category...
33
+ post:
34
+ one: post
35
+ other: posts
36
+ receiving_notifications_because_subscribed: You're receiving notifications because you've subscribed to this thread.
37
+ receiving_notifications_because_posted: You're receiving notifications because you've posted in this thread.
38
+ saving_comment: Saving comment...
39
+ saving: Saving
40
+ this_solved_my_question: This solved my question
41
+ title: title
42
+ content: content
43
+ position: position
44
+ color: color
45
+ what_help_needed: What do you need help with?
46
+ ask_your_question: Ask Your Question
47
+ update_comment: Update comment
48
+ your_changes_were_saved: Your changes were saved
49
+ successfully_deleted: Successfully deleted
50
+ search_not_found: No results found for your search
51
+ check_out: Check out
52
+ latest_questions: the latest questions
53
+ instead: instead?
54
+ written_by_author: "Written by %{author}"
55
+ content_updated_at: "Updated %{update_time} ago"
data/config/routes.rb CHANGED
@@ -1,24 +1,24 @@
1
- HelpCenter::Engine.routes.draw do
2
- scope module: :help_center do
3
- resources :support_threads, path: :threads do
4
- collection do
5
- get :answered
6
- get :unanswered
7
- get :mine
8
- get :participating
9
- get "category/:id", to: "support_categories#index", as: :support_category
10
- end
11
-
12
- resources :support_posts, path: :posts do
13
- member do
14
- put :solved
15
- put :unsolved
16
- end
17
- end
18
-
19
- resource :notifications
20
- end
21
- end
22
-
23
- root to: "help_center/support_threads#index"
24
- end
1
+ HelpCenter::Engine.routes.draw do
2
+ scope module: :help_center do
3
+ resources :support_categories, path: :categories
4
+ resources :support_threads, path: :articles do
5
+ collection do
6
+ get :answered
7
+ get :unanswered
8
+ get :mine
9
+ get :participating
10
+ end
11
+
12
+ resources :support_posts, path: :posts do
13
+ member do
14
+ put :solved
15
+ put :unsolved
16
+ end
17
+ end
18
+
19
+ resource :notifications
20
+ end
21
+ end
22
+
23
+ root to: "help_center/support_threads#index"
24
+ end
@@ -1,19 +1,19 @@
1
- class CreateSupportCategories < ActiveRecord::Migration[4.2]
2
- def change
3
- create_table :support_categories do |t|
4
- t.string :name, null: false
5
- t.string :slug, null: false
6
- t.string :color, default: "000000"
7
- t.integer :position, default: 0
8
-
9
- t.timestamps
10
- end
11
-
12
- SupportCategory.reset_column_information
13
-
14
- SupportCategory.create(
15
- name: "Getting Started",
16
- color: "#4ea1d3",
17
- )
18
- end
19
- end
1
+ class CreateSupportCategories < ActiveRecord::Migration[4.2]
2
+ def change
3
+ create_table :support_categories do |t|
4
+ t.string :name, null: false
5
+ t.string :slug, null: false
6
+ t.string :color, default: "000000"
7
+ t.integer :position, default: 0
8
+
9
+ t.timestamps
10
+ end
11
+
12
+ SupportCategory.reset_column_information
13
+
14
+ SupportCategory.create(
15
+ name: "Getting Started",
16
+ color: "#4ea1d3",
17
+ )
18
+ end
19
+ end