help_center 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/help_center/support_threads_controller.rb +72 -72
- data/app/views/help_center/support_posts/_form.html.erb +47 -32
- data/app/views/help_center/support_posts/_support_post.html.erb +57 -65
- data/app/views/help_center/support_posts/edit.html.erb +23 -28
- data/app/views/help_center/support_threads/_article.html.erb +32 -0
- data/app/views/help_center/support_threads/_form.html.erb +47 -56
- data/app/views/help_center/support_threads/_support_thread.html.erb +25 -30
- data/app/views/help_center/support_threads/index.html.erb +19 -23
- data/app/views/help_center/support_threads/show.html.erb +1 -39
- data/app/views/help_center/user_mailer/new_post.html.erb +9 -12
- data/app/views/help_center/user_mailer/new_thread.html.erb +9 -12
- data/app/views/layouts/help_center.html.erb +104 -120
- data/lib/help_center/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f6c9fe1c740ee37600538f47459a923864d982d05cc5d43b9831996d6929d7d
|
4
|
+
data.tar.gz: 345a03e89686432b20b68aa40a8fbaa9f1e1c9efc83f87cc27f827a71cdfb16a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 603ce4a8a89f20b7af0815ef80d00c4f098ad13a0305158e3641634bded0659aa352e0c2f41326c0b64bb04b2fed94275f47d2f9cdc072af0da6b4c208dd63d8
|
7
|
+
data.tar.gz: 5f92da7cf0a359f0ad4b646af71f6f59ead8a38a2ea6dc33d92ff4cec0bcddc834cdea15cb884b3a1d0c00843565a65ed40cf808f3bba486357cf73046af54b4
|
@@ -1,72 +1,72 @@
|
|
1
|
-
class HelpCenter::SupportThreadsController < HelpCenter::ApplicationController
|
2
|
-
before_action :authenticate_user!, only: [:mine, :participating, :new, :create]
|
3
|
-
before_action :set_support_thread, only: [:show, :edit, :update]
|
4
|
-
before_action :require_mod_or_author_for_thread!, only: [:edit, :update]
|
5
|
-
|
6
|
-
def index
|
7
|
-
@support_threads = SupportThread.pinned_first.sorted.includes(:user, :support_category).paginate(page: page_number)
|
8
|
-
end
|
9
|
-
|
10
|
-
def answered
|
11
|
-
@support_threads = SupportThread.solved.sorted.includes(:user, :support_category).paginate(page: page_number)
|
12
|
-
render action: :index
|
13
|
-
end
|
14
|
-
|
15
|
-
def unanswered
|
16
|
-
@support_threads = SupportThread.unsolved.sorted.includes(:user, :support_category).paginate(page: page_number)
|
17
|
-
render action: :index
|
18
|
-
end
|
19
|
-
|
20
|
-
def mine
|
21
|
-
@support_threads = SupportThread.where(user: current_user).sorted.includes(:user, :support_category).paginate(page: page_number)
|
22
|
-
render action: :index
|
23
|
-
end
|
24
|
-
|
25
|
-
def participating
|
26
|
-
@support_threads = SupportThread.includes(:user, :support_category).joins(:support_posts).where(support_posts: { user_id: current_user.id }).distinct(support_posts: :id).sorted.paginate(page: page_number)
|
27
|
-
render action: :index
|
28
|
-
end
|
29
|
-
|
30
|
-
def show
|
31
|
-
@support_post = SupportPost.new
|
32
|
-
@support_post.user = current_user
|
33
|
-
end
|
34
|
-
|
35
|
-
def new
|
36
|
-
@support_thread = SupportThread.new
|
37
|
-
@support_thread.support_posts.new
|
38
|
-
end
|
39
|
-
|
40
|
-
def create
|
41
|
-
@support_thread = current_user.support_threads.new(support_thread_params)
|
42
|
-
@support_thread.support_posts.each{ |post| post.user_id = current_user.id }
|
43
|
-
|
44
|
-
if @support_thread.save
|
45
|
-
HelpCenter::SupportThreadNotificationJob.perform_later(@support_thread)
|
46
|
-
redirect_to help_center.support_thread_path(@support_thread)
|
47
|
-
else
|
48
|
-
render action: :new
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def edit
|
53
|
-
end
|
54
|
-
|
55
|
-
def update
|
56
|
-
if @support_thread.update(support_thread_params)
|
57
|
-
redirect_to help_center.support_thread_path(@support_thread), notice: I18n.t('your_changes_were_saved')
|
58
|
-
else
|
59
|
-
render action: :edit
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
private
|
64
|
-
|
65
|
-
def set_support_thread
|
66
|
-
@support_thread = SupportThread.friendly.find(params[:id])
|
67
|
-
end
|
68
|
-
|
69
|
-
def support_thread_params
|
70
|
-
params.require(:support_thread).permit(:title, :content, :support_category_id, support_posts_attributes: [:body])
|
71
|
-
end
|
72
|
-
end
|
1
|
+
class HelpCenter::SupportThreadsController < HelpCenter::ApplicationController
|
2
|
+
before_action :authenticate_user!, only: [:mine, :participating, :new, :create]
|
3
|
+
before_action :set_support_thread, only: [:show, :edit, :update]
|
4
|
+
before_action :require_mod_or_author_for_thread!, only: [:edit, :update]
|
5
|
+
|
6
|
+
def index
|
7
|
+
@support_threads = SupportThread.pinned_first.sorted.includes(:user, :support_category).paginate(page: page_number)
|
8
|
+
end
|
9
|
+
|
10
|
+
def answered
|
11
|
+
@support_threads = SupportThread.solved.sorted.includes(:user, :support_category).paginate(page: page_number)
|
12
|
+
render action: :index
|
13
|
+
end
|
14
|
+
|
15
|
+
def unanswered
|
16
|
+
@support_threads = SupportThread.unsolved.sorted.includes(:user, :support_category).paginate(page: page_number)
|
17
|
+
render action: :index
|
18
|
+
end
|
19
|
+
|
20
|
+
def mine
|
21
|
+
@support_threads = SupportThread.where(user: current_user).sorted.includes(:user, :support_category).paginate(page: page_number)
|
22
|
+
render action: :index
|
23
|
+
end
|
24
|
+
|
25
|
+
def participating
|
26
|
+
@support_threads = SupportThread.includes(:user, :support_category).joins(:support_posts).where(support_posts: { user_id: current_user.id }).distinct(support_posts: :id).sorted.paginate(page: page_number)
|
27
|
+
render action: :index
|
28
|
+
end
|
29
|
+
|
30
|
+
def show
|
31
|
+
@support_post = SupportPost.new
|
32
|
+
@support_post.user = current_user
|
33
|
+
end
|
34
|
+
|
35
|
+
def new
|
36
|
+
@support_thread = SupportThread.new
|
37
|
+
@support_thread.support_posts.new
|
38
|
+
end
|
39
|
+
|
40
|
+
def create
|
41
|
+
@support_thread = current_user.support_threads.new(support_thread_params)
|
42
|
+
@support_thread.support_posts.each{ |post| post.user_id = current_user.id }
|
43
|
+
|
44
|
+
if @support_thread.save
|
45
|
+
HelpCenter::SupportThreadNotificationJob.perform_later(@support_thread)
|
46
|
+
redirect_to help_center.support_thread_path(@support_thread)
|
47
|
+
else
|
48
|
+
render action: :new
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def edit
|
53
|
+
end
|
54
|
+
|
55
|
+
def update
|
56
|
+
if @support_thread.update(support_thread_params)
|
57
|
+
redirect_to help_center.support_thread_path(@support_thread), notice: I18n.t('your_changes_were_saved')
|
58
|
+
else
|
59
|
+
render action: :edit
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def set_support_thread
|
66
|
+
@support_thread = SupportThread.friendly.find(params[:id])
|
67
|
+
end
|
68
|
+
|
69
|
+
def support_thread_params
|
70
|
+
params.require(:support_thread).permit(:title, :content, :position, :support_category_id, support_posts_attributes: [:body])
|
71
|
+
end
|
72
|
+
end
|
@@ -1,32 +1,47 @@
|
|
1
|
-
<%= form_for
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
<
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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"} %>
|
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" %>
|
21
|
+
</div>
|
22
|
+
<div class="mb-4">
|
23
|
+
<%= f.label t('position') %>
|
24
|
+
<%= f.text_field :position, class: "form-control" %>
|
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="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
|
+
</div>
|
47
|
+
<% end %>
|
@@ -1,65 +1,57 @@
|
|
1
|
-
<%# We don't currently cache the support posts because they have permissions to deal with %>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
<%= support_post.
|
28
|
-
</
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
<%= icon("fas","fas","check") %>
|
59
|
-
<%= t('this_solved_my_question') %>
|
60
|
-
<% end %>
|
61
|
-
</small>
|
62
|
-
</div>
|
63
|
-
</div>
|
64
|
-
<% end %>
|
65
|
-
<% end %>
|
1
|
+
<%# We don't currently cache the support posts because they have permissions to deal with %>
|
2
|
+
<%= content_tag :div, id: dom_id(support_post), class: support_post_classes(support_post) do %>
|
3
|
+
<div class="py-3 px-6 mb-0 bg-grey-lighter border-b-1 border-grey-light text-grey-darkest">
|
4
|
+
<% if is_moderator_or_owner?(support_post) %>
|
5
|
+
<div class="float-right">
|
6
|
+
<%= link_to icon("fas","edit"), simple_discussion.edit_support_thread_support_post_path(@support_thread, support_post),
|
7
|
+
class: "text-muted",
|
8
|
+
data: { toggle: "tooltip", placement: "left" },
|
9
|
+
title: t('edit_this_post')
|
10
|
+
%>
|
11
|
+
|
12
|
+
<%= link_to icon("fas","trash"), simple_discussion.support_thread_support_post_path(@support_thread, support_post),
|
13
|
+
class: "text-muted",
|
14
|
+
method: :delete,
|
15
|
+
data: { toggle: "tooltip", placement: "left", confirm: "Are you sure you want to delete this post?" },
|
16
|
+
title: t('edit_this_post')
|
17
|
+
%>
|
18
|
+
</div>
|
19
|
+
<% end %>
|
20
|
+
<div>
|
21
|
+
<%= avatar_tag(support_post.user.email) %>
|
22
|
+
<strong class="support-post-user">
|
23
|
+
<%= support_post.user.name %> <%= support_user_badge(support_post.user) %>
|
24
|
+
</strong>
|
25
|
+
<small>
|
26
|
+
<%= t('commented_on') %>
|
27
|
+
<%= link_to support_post.created_at.strftime("%b %d, %Y"), simple_discussion.support_thread_path(@support_thread, anchor: "support_post_#{support_post.id}") %>:
|
28
|
+
</small>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
<div class="flex-auto p-6">
|
32
|
+
<%= formatted_content support_post.body %>
|
33
|
+
</div>
|
34
|
+
<% if @support_thread.solved? && support_post.solved? %>
|
35
|
+
<div class="py-3 px-6 bg-grey-lighter border-t-1 border-grey-light">
|
36
|
+
<div class="pull-right">
|
37
|
+
<strong class="text-green"><%= icon("fas","check") %> <%= t('solved') %></strong>
|
38
|
+
<% if is_moderator_or_owner?(@support_thread) %>
|
39
|
+
<small>
|
40
|
+
<%= link_to t('undo'), simple_discussion.unsolved_support_thread_support_post_path(@support_thread, support_post), method: :put %>
|
41
|
+
</small>
|
42
|
+
<% end %>
|
43
|
+
</div>
|
44
|
+
</div>
|
45
|
+
<% elsif is_moderator_or_owner?(@support_thread) %>
|
46
|
+
<div class="py-3 px-6 bg-grey-lighter border-t-1 border-grey-light">
|
47
|
+
<div class="pull-right">
|
48
|
+
<small>
|
49
|
+
<%= link_to simple_discussion.solved_support_thread_support_post_path(@support_thread, support_post), method: :put do %>
|
50
|
+
<%= icon("fas","fas","check") %>
|
51
|
+
<%= t('this_solved_my_question') %>
|
52
|
+
<% end %>
|
53
|
+
</small>
|
54
|
+
</div>
|
55
|
+
</div>
|
56
|
+
<% end %>
|
57
|
+
<% end %>
|
@@ -1,28 +1,23 @@
|
|
1
|
-
<p><small><%= link_to "← Back to the thread", help_center.support_thread_path(@support_thread) %></small></p>
|
2
|
-
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
<
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
<div class="card-body">
|
26
|
-
<%= render "form" %>
|
27
|
-
</div>
|
28
|
-
<% end %>
|
1
|
+
<p><small><%= link_to "← Back to the thread", help_center.support_thread_path(@support_thread) %></small></p>
|
2
|
+
<h2><%= content_tag :span, "Pinned", class: "text-muted" if @support_thread.pinned? %> <%= @support_thread.title %></h2>
|
3
|
+
<p class="thread-details">
|
4
|
+
<strong><%= category_link(@support_thread.support_category) %></strong>
|
5
|
+
• <%= t('asked_time_ago', time: time_ago_in_words(@support_thread.created_at), author: @support_thread.user.name) %>
|
6
|
+
</p>
|
7
|
+
</p>
|
8
|
+
<br />
|
9
|
+
<%= content_tag :div, id: dom_id(@support_post), class: support_post_classes(@support_post) do %>
|
10
|
+
<div class="py-3 px-6 mb-0 bg-grey-lighter border-b-1 border-grey-light text-grey-darkest">
|
11
|
+
<div>
|
12
|
+
<%= avatar_tag(@support_post.user.email) %>
|
13
|
+
<strong class="support-post-user"><%= @support_post.user.name %></strong>
|
14
|
+
<small>
|
15
|
+
<%= t('commented_on')%>
|
16
|
+
<%= link_to @support_post.created_at.strftime("%b %d, %Y"), simple_discussion.support_thread_url(@support_thread, anchor: "support_post_#{@support_post.id}") %>:
|
17
|
+
</small>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
<div class="flex-auto p-6">
|
21
|
+
<%= render "form" %>
|
22
|
+
</div>
|
23
|
+
<% end %>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<div class="container mx-auto">
|
2
|
+
<div class="flex flex-wrap mb-8">
|
3
|
+
<% if current_user && current_user.admin? %>
|
4
|
+
<div class="flex w-full pr-4 pl-4 justify-end">
|
5
|
+
<%= link_to icon("fas","pencil"), help_center.edit_support_thread_path(@support_thread),
|
6
|
+
class: "text-muted",
|
7
|
+
data: { toggle: "tooltip", placement: "left" },
|
8
|
+
title: t('edit_this_thread') %>
|
9
|
+
</div>
|
10
|
+
<% end %>
|
11
|
+
<div class="md:w-full pr-4 pl-41">
|
12
|
+
<small class="mb-2"><%= support_category_link(@support_thread.support_category) %> > <%= @support_thread.title %></small>
|
13
|
+
<h1><%= icon "fas", "thumb-tack", class: "text-muted" if @support_thread.pinned? %> <%= @support_thread.title %></h1>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
</div>
|
17
|
+
<%= @support_thread.content %>
|
18
|
+
<!--
|
19
|
+
<div class="thread-reaction">
|
20
|
+
<p>Did this answer your question?</p>
|
21
|
+
<p class="thread-reaction-links">
|
22
|
+
<a>😞<a>
|
23
|
+
<a>😃<a>
|
24
|
+
</p>
|
25
|
+
<div>
|
26
|
+
-->
|
27
|
+
<% if HelpCenter.enable_comments %>
|
28
|
+
<hr>
|
29
|
+
<%= render partial: "help_center/support_posts/support_post", collection: @support_thread.support_posts.includes(:user).sorted %>
|
30
|
+
<%= render partial: "help_center/support_posts/form" if user_signed_in? %>
|
31
|
+
<% end %>
|
32
|
+
</div>
|
@@ -1,56 +1,47 @@
|
|
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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
<
|
8
|
-
|
9
|
-
|
10
|
-
<%
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
<%= f.
|
20
|
-
|
21
|
-
|
22
|
-
<div class="
|
23
|
-
<%= f.label t('
|
24
|
-
<%= f.text_field :
|
25
|
-
</div>
|
26
|
-
|
27
|
-
|
28
|
-
<%= f.
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
<% end %>
|
46
|
-
|
47
|
-
|
48
|
-
<div class="form-group text-right">
|
49
|
-
<% if f.object.new_record? %>
|
50
|
-
<%= f.button t('add'), class: "btn btn-primary", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> #{t('saving')}"} %>
|
51
|
-
<% else %>
|
52
|
-
<%= f.button t('update'), class: "btn btn-primary", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> #{t('saving')}"} %>
|
53
|
-
<% end %>
|
54
|
-
</div>
|
55
|
-
|
56
|
-
<% 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"} %>
|
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" %>
|
21
|
+
</div>
|
22
|
+
<div class="mb-4">
|
23
|
+
<%= f.label t('position') %>
|
24
|
+
<%= f.text_field :position, class: "form-control" %>
|
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="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
|
+
</div>
|
47
|
+
<% end %>
|
@@ -1,30 +1,25 @@
|
|
1
|
-
<%= cache support_thread do %>
|
2
|
-
<div class="support-thread">
|
3
|
-
<div class="
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
<% end %>
|
27
|
-
|
28
|
-
</div>
|
29
|
-
</div>
|
30
|
-
<% 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,23 +1,19 @@
|
|
1
|
-
<% if @support_threads.none? %>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
<%
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
<% end %>
|
22
|
-
</div>
|
23
|
-
<% 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
|
+
<%= will_paginate @support_threads, url_builder: help_center, renderer: HelpCenter::BootstrapLinkRenderer %>
|
14
|
+
</div>
|
15
|
+
<% else %>
|
16
|
+
<%# Set default index here %>
|
17
|
+
<% end %>
|
18
|
+
</div>
|
19
|
+
<% end %>
|
@@ -1,39 +1 @@
|
|
1
|
-
|
2
|
-
<div class="row">
|
3
|
-
<div class="col-md-11">
|
4
|
-
<small class="mb-2"><%= support_category_link(@support_thread.support_category) %> > <%= @support_thread.title %></small>
|
5
|
-
<h1><%= icon "fas", "thumb-tack", class: "text-muted" if @support_thread.pinned? %> <%= @support_thread.title %></h1>
|
6
|
-
</div>
|
7
|
-
|
8
|
-
<% if is_moderator_or_owner?(@support_thread) %>
|
9
|
-
<div class="col-md-1">
|
10
|
-
<%= link_to icon("fas","pencil"), help_center.edit_support_thread_path(@support_thread),
|
11
|
-
class: "text-muted",
|
12
|
-
data: { toggle: "tooltip", placement: "left" },
|
13
|
-
title: t('edit_this_thread') %>
|
14
|
-
</div>
|
15
|
-
<% end %>
|
16
|
-
|
17
|
-
</div>
|
18
|
-
|
19
|
-
<p class="thread-details d-flex">
|
20
|
-
<%= t('written_by_author', author: @support_thread.user.name) %>
|
21
|
-
<small><%= t('content_updated_at', update_time: time_ago_in_words(@support_thread.updated_at)) %></small>
|
22
|
-
</p>
|
23
|
-
|
24
|
-
<%= @support_thread.content %>
|
25
|
-
|
26
|
-
<div class="thread-reaction">
|
27
|
-
<p>Did this answer your question?</p>
|
28
|
-
<p class="thread-reaction-links">
|
29
|
-
<a>😞<a>
|
30
|
-
<a>😃<a>
|
31
|
-
</p>
|
32
|
-
<div>
|
33
|
-
|
34
|
-
<% if HelpCenter.enable_comments %>
|
35
|
-
<hr>
|
36
|
-
<%= render partial: "help_center/support_posts/support_post", collection: @support_thread.support_posts.includes(:user).sorted %>
|
37
|
-
<%= render partial: "help_center/support_posts/form" if user_signed_in? %>
|
38
|
-
<% end %>
|
39
|
-
</div>
|
1
|
+
<%= render "article" %>
|
@@ -1,12 +1,9 @@
|
|
1
|
-
<div style="position: relative">
|
2
|
-
<%= gravatar_image_tag @support_post.user.email, style: "float: left" %>
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<br />
|
11
|
-
|
12
|
-
<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,12 +1,9 @@
|
|
1
|
-
<div style="position: relative">
|
2
|
-
<%= gravatar_image_tag @support_post.user.email, style: "float: left" %>
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<br />
|
11
|
-
|
12
|
-
<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,120 +1,104 @@
|
|
1
|
-
<% @layout = 'website' %>
|
2
|
-
|
3
|
-
<div class="container mt-
|
4
|
-
|
5
|
-
<div class="
|
6
|
-
<
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<
|
50
|
-
<%=
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
<%=
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
<%= icon "fa-fw fas", "
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
<% end %>
|
106
|
-
</div>
|
107
|
-
|
108
|
-
</div>
|
109
|
-
|
110
|
-
<div class="col-md-9 mb-3">
|
111
|
-
|
112
|
-
<div class="card card-body">
|
113
|
-
<%= yield %>
|
114
|
-
</div>
|
115
|
-
|
116
|
-
</div>
|
117
|
-
</div>
|
118
|
-
</div>
|
119
|
-
|
120
|
-
<% parent_layout("application") %>
|
1
|
+
<% @layout = 'website' %>
|
2
|
+
|
3
|
+
<div class="container mx-auto mt-2">
|
4
|
+
<div class="flex flex-wrap help_center">
|
5
|
+
<div class="md:w-1/4 pr-4 pl-4 mb-3">
|
6
|
+
<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
|
+
<div class="support-thread-filters">
|
12
|
+
<% SupportCategory.sorted.each do |category| %>
|
13
|
+
<div class="pb-3">
|
14
|
+
<%= support_link_to help_center.support_category_support_threads_path(category) do %>
|
15
|
+
<div class="mb-2 mt-3">
|
16
|
+
<span class="font-extrabold">
|
17
|
+
<%= category.name %>
|
18
|
+
</span>
|
19
|
+
</div>
|
20
|
+
<% end %>
|
21
|
+
<div>
|
22
|
+
<% threads = SupportThread.where(support_category_id: category.id).order(:position) %>
|
23
|
+
<% threads.each do |thread| %>
|
24
|
+
<div class="mb-2">
|
25
|
+
<%= support_link_to help_center.support_thread_path(thread) do %>
|
26
|
+
<%= thread.title %>
|
27
|
+
<% end %>
|
28
|
+
</div>
|
29
|
+
<% end %>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
<% end %>
|
33
|
+
</div>
|
34
|
+
<% if HelpCenter.enable_comments %>
|
35
|
+
<hr />
|
36
|
+
<div class="support-thread-filters">
|
37
|
+
<h5>
|
38
|
+
<strong>
|
39
|
+
<%= t('filters') %>
|
40
|
+
</strong>
|
41
|
+
</h5>
|
42
|
+
<div>
|
43
|
+
<%= support_link_to help_center.support_threads_path, exact: true do %>
|
44
|
+
<%= icon "fa-fw fas", "bars" %>
|
45
|
+
<%= t('.all_threads') %>
|
46
|
+
<% end %>
|
47
|
+
</div>
|
48
|
+
<% if user_signed_in? %>
|
49
|
+
<div>
|
50
|
+
<%= support_link_to help_center.mine_support_threads_path do %><%= icon "fa-fw far", "user-circle" %>
|
51
|
+
<%= t('.my_questions') %>
|
52
|
+
<% end %>
|
53
|
+
</div>
|
54
|
+
<div>
|
55
|
+
<%= support_link_to help_center.participating_support_threads_path do %>
|
56
|
+
<%= icon "fa-fw far", "comments" %>
|
57
|
+
<%= t('.participating') %>
|
58
|
+
<% end %>
|
59
|
+
</div>
|
60
|
+
<% end %>
|
61
|
+
<div>
|
62
|
+
<%= support_link_to help_center.answered_support_threads_path do %>
|
63
|
+
<%= icon "fa-fw fas", "check" %>
|
64
|
+
<%= t('.answered') %>
|
65
|
+
<% end %>
|
66
|
+
</div>
|
67
|
+
<div>
|
68
|
+
<%= support_link_to help_center.unanswered_support_threads_path do %>
|
69
|
+
<%= icon "fa-fw fas", "question" %>
|
70
|
+
<%= t('.unanswered') %>
|
71
|
+
<% end %>
|
72
|
+
</div>
|
73
|
+
</div>
|
74
|
+
<% if @support_thread.present? && @support_thread.persisted? %>
|
75
|
+
<hr />
|
76
|
+
<%# User has not posted in the thread or subscribed %>
|
77
|
+
<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 %>
|
79
|
+
<% if @support_thread.subscribed? current_user %>
|
80
|
+
<%= icon "fa-fw fas", "bell-slash" %> <%= t('.unsubscribe') %>
|
81
|
+
<% else %>
|
82
|
+
<%= icon "fa-fw fas", "bell" %>
|
83
|
+
<%= t('.suscribe') %>
|
84
|
+
<% end %>
|
85
|
+
<% end %>
|
86
|
+
<small><%= @support_thread.subscribed_reason(current_user) %></small>
|
87
|
+
<% end %>
|
88
|
+
<% end %>
|
89
|
+
</div>
|
90
|
+
</div>
|
91
|
+
<div class="md:w-3/4 pr-4 pl-4 mb-3">
|
92
|
+
<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
|
+
<% end %>
|
98
|
+
<% end %>
|
99
|
+
<%= yield %>
|
100
|
+
</div>
|
101
|
+
</div>
|
102
|
+
</div>
|
103
|
+
</div>
|
104
|
+
<% parent_layout("application") %>
|
data/lib/help_center/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: help_center
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ugurcan Kaya
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: font-awesome-sass
|
@@ -114,6 +114,7 @@ files:
|
|
114
114
|
- app/views/help_center/support_posts/_form.html.erb
|
115
115
|
- app/views/help_center/support_posts/_support_post.html.erb
|
116
116
|
- app/views/help_center/support_posts/edit.html.erb
|
117
|
+
- app/views/help_center/support_threads/_article.html.erb
|
117
118
|
- app/views/help_center/support_threads/_form.html.erb
|
118
119
|
- app/views/help_center/support_threads/_support_thread.html.erb
|
119
120
|
- app/views/help_center/support_threads/edit.html.erb
|