help_center 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 822478abb6fc4b3e9f6d82893a5b5a606670f0b79931c81d220d651e92ff72ef
4
- data.tar.gz: b237aaa471a31b67516cafb12404c87d9908875ab5fec3b49e9b95286b0370ae
3
+ metadata.gz: 4f6c9fe1c740ee37600538f47459a923864d982d05cc5d43b9831996d6929d7d
4
+ data.tar.gz: 345a03e89686432b20b68aa40a8fbaa9f1e1c9efc83f87cc27f827a71cdfb16a
5
5
  SHA512:
6
- metadata.gz: 5a36811a20fd38536ab42c810acc2dab4e177043a1d3bba0dbf17b01b75de3d9e73ed4fd0fa17efdaccc83d55cbc07207159f3779cf10b1430b49457be617da7
7
- data.tar.gz: da1bd49cc7c3946bab994898358746128f03567c677271e1c80cc1fdee3e0dc57cbc433773ec25c2e5212fd3cf6bea6d4ab168517b8551f37b372c764846bc2f
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 [@support_thread, @support_post],
2
- url: (@support_post.persisted? ? help_center.support_thread_support_post_path(@support_thread, @support_post) : help_center.support_thread_support_posts_path(@support_thread)),
3
- html: { data: { behavior: "comment-form" } } do |f| %>
4
-
5
- <% if @support_post.errors.any? %>
6
- <div id="error_explanation">
7
- <h2><%= pluralize(@support_post.errors.count, "error") %> prohibited this support_post from being saved:</h2>
8
-
9
- <ul>
10
- <% @support_post.errors.full_messages.each do |message| %>
11
- <li><%= message %></li>
12
- <% end %>
13
- </ul>
14
- </div>
15
- <% end %>
16
-
17
- <div class="form-group">
18
- <%= f.text_area :body, placeholder: t('add_a_comment'), rows: 8, class: "form-control simplemde", data: { behavior: "comment-body" } %>
19
- </div>
20
-
21
- <div class="text-right">
22
- <div class="pull-left">
23
- <small>
24
- <%# Describe text formatting options here with a link %>
25
- <%#= link_to "Parsed with Markdown", "https://guides.github.com/features/mastering-markdown/", target: "_blank" %>
26
- </small>
27
- </div>
28
-
29
- <%= f.button "#{f.object.new_record? ? t('comment') : t('update_comment') }", class: "btn btn-primary", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> #{t('saving_comment')}"} %>
30
- </div>
31
-
32
- <% 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,65 +1,57 @@
1
- <%# We don't currently cache the support posts because they have permissions to deal with %>
2
-
3
- <%= content_tag :div, id: dom_id(support_post), class: support_post_classes(support_post) do %>
4
- <div class="card-header">
5
-
6
- <% if is_moderator_or_owner?(support_post) %>
7
- <div class="float-right">
8
- <%= link_to icon("fas","edit"), simple_discussion.edit_support_thread_support_post_path(@support_thread, support_post),
9
- class: "text-muted",
10
- data: { toggle: "tooltip", placement: "left" },
11
- title: t('edit_this_post')
12
- %>
13
- &nbsp;
14
- <%= link_to icon("fas","trash"), simple_discussion.support_thread_support_post_path(@support_thread, support_post),
15
- class: "text-muted",
16
- method: :delete,
17
- data: { toggle: "tooltip", placement: "left", confirm: "Are you sure you want to delete this post?" },
18
- title: t('edit_this_post')
19
- %>
20
- </div>
21
- <% end %>
22
-
23
- <div>
24
- <%= avatar_tag(support_post.user.email) %>
25
-
26
- <strong class="support-post-user">
27
- <%= support_post.user.name %> <%= support_user_badge(support_post.user) %>
28
- </strong>
29
- <small>
30
- <%= t('commented_on') %>
31
- <%= link_to support_post.created_at.strftime("%b %d, %Y"), simple_discussion.support_thread_path(@support_thread, anchor: "support_post_#{support_post.id}") %>:
32
- </small>
33
- </div>
34
- </div>
35
-
36
- <div class="card-body">
37
- <%= formatted_content support_post.body %>
38
- </div>
39
-
40
- <% if @support_thread.solved? && support_post.solved? %>
41
- <div class="card-footer">
42
- <div class="pull-right">
43
- <strong class="text-success"><%= icon("fas","check") %> <%= t('solved') %></strong>
44
-
45
- <% if is_moderator_or_owner?(@support_thread) %>
46
- <small>
47
- <%= link_to t('undo'), simple_discussion.unsolved_support_thread_support_post_path(@support_thread, support_post), method: :put %>
48
- </small>
49
- <% end %>
50
- </div>
51
- </div>
52
-
53
- <% elsif is_moderator_or_owner?(@support_thread) %>
54
- <div class="card-footer">
55
- <div class="pull-right">
56
- <small>
57
- <%= link_to simple_discussion.solved_support_thread_support_post_path(@support_thread, support_post), method: :put do %>
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
+ &nbsp;
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
- <h2><%= content_tag :span, "Pinned", class: "text-muted" if @support_thread.pinned? %> <%= @support_thread.title %></h2>
4
-
5
- <p class="thread-details">
6
- <strong><%= category_link(@support_thread.support_category) %></strong>
7
- • <%= t('asked_time_ago', time: time_ago_in_words(@support_thread.created_at), author: @support_thread.user.name) %>
8
- </p>
9
- </p>
10
-
11
- <br />
12
-
13
- <%= content_tag :div, id: dom_id(@support_post), class: support_post_classes(@support_post) do %>
14
- <div class="card-header">
15
- <div>
16
- <%= avatar_tag(@support_post.user.email) %>
17
- <strong class="support-post-user"><%= @support_post.user.name %></strong>
18
- <small>
19
- <%= t('commented_on')%>
20
- <%= link_to @support_post.created_at.strftime("%b %d, %Y"), simple_discussion.support_thread_url(@support_thread, anchor: "support_post_#{@support_post.id}") %>:
21
- </small>
22
- </div>
23
- </div>
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
- <% if @support_thread.errors.any? %>
6
- <div id="error_explanation">
7
- <h2><%= pluralize(@support_thread.errors.count, "error") %> prohibited this support_thread from being saved:</h2>
8
-
9
- <ul>
10
- <% @support_thread.errors.full_messages.each do |message| %>
11
- <li><%= message %></li>
12
- <% end %>
13
- </ul>
14
- </div>
15
- <% end %>
16
-
17
- <div class="form-group">
18
- <%= f.label :support_category_id, t('choose_a_category') %>
19
- <%= f.collection_select :support_category_id, SupportCategory.sorted, :id, :name, {include_blank: t('pick_a_category')}, {autofocus: true, class: "form-control"} %>
20
- </div>
21
-
22
- <div class="form-group">
23
- <%= f.label t('title') %>
24
- <%= f.text_field :title, placeholder: t('how_do_i'), class: "form-control" %>
25
- </div>
26
-
27
- <div class="form-group">
28
- <%= f.label t('position') %>
29
- <%= f.text_field :position, class: "form-control" %>
30
- </div>
31
-
32
- <div class="form-group">
33
- <%= f.label t('content') %>
34
- <%= f.rich_text_area :content %>
35
- </div>
36
-
37
- <% if local_assigns.fetch(:posts, true) %>
38
- <% if !f.object.new_record? %>
39
- <%= f.fields_for :support_posts do |p| %>
40
- <div class="form-group">
41
- <%= p.label :body, t('what_help_needed') %>
42
- <%= p.text_area :body, placeholder: t('add_a_comment'), rows: 10, class: "form-control simplemde", data: { behavior: "comment-body" } %>
43
- </div>
44
- <% end %>
45
- <% end %>
46
- <% end %>
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="row">
4
-
5
- <div class="col">
6
- <%= link_to help_center.support_thread_path(support_thread) do %>
7
- <h4>
8
- <%= support_thread.title %>
9
- </h4>
10
-
11
- <p class="text-muted"><%= truncate(support_thread.content.to_plain_text, length: 200) %></p>
12
-
13
- <div class="thread-details">
14
- <%= t('content_updated_at', update_time: time_ago_in_words(support_thread.created_at)) %>
15
- </div>
16
- <% end %>
17
- </div>
18
-
19
- <% if HelpCenter.enable_comments %>
20
- <div class="col-sm-1 text-center">
21
- <%= link_to help_center.support_thread_path(support_thread), class: "thread-posts-count" do %>
22
- <span class="count"><%= support_thread.support_posts_count %></span>
23
- <small><%= t("post", count: support_thread.support_posts_count) %></small>
24
- <% end %>
25
- </div>
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
- <div><%= t('search_not_found') %>. <%= t('check_out') %> <%= link_to t('latest_questions'), help_center.support_threads_path %> <%= t('instead') %> </div>
4
-
5
- <% else %>
6
- <div class="container">
7
- <% if request.url.include?('category') %>
8
- <%# If category, list all articles %>
9
- <div class="col-12 text-left p-0">
10
- <h3> <%= @support_threads.first.support_category.name %></h3>
11
- </div>
12
- <%= render partial: "help_center/support_threads/support_thread", collection: @support_threads, spacer_template: "shared/spacer" %>
13
-
14
- <div class="support-threads-nav text-center">
15
- <%= will_paginate @support_threads, url_builder: help_center, renderer: HelpCenter::BootstrapLinkRenderer %>
16
- </div>
17
-
18
- <% else %>
19
- <%# Set default index here %>
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
- <div class="container">
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
- <div style="margin-left:60px">
5
- <p><strong><%= @support_post.user.name %></strong> <small>commented:</small></p>
6
- <%= formatted_content @support_post.body %>
7
- </div>
8
- </div>
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
- <div style="margin-left:60px">
5
- <p><strong><%= @support_post.user.name %></strong> <small>commented:</small></p>
6
- <%= formatted_content @support_post.body %>
7
- </div>
8
- </div>
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-6">
4
- <!-- Title
5
- <div class="row col-md-12">
6
- <h1>
7
- <%= t('documentation') %>
8
- </h1>
9
- </div>
10
- -->
11
-
12
- <div class="row help_center">
13
- <div class="col-md-3 mb-3">
14
-
15
- <div class="card card-body">
16
- <% if current_user && (current_user.admin? || current_user.moderator?) %>
17
- <%= link_to t('add_an_article'), help_center.new_support_thread_path, class: "btn btn-outline-primary btn-block" %>
18
- <hr />
19
- <% end %>
20
-
21
- <div class="support-thread-filters">
22
- <% SupportCategory.sorted.each do |category| %>
23
- <div>
24
- <%= support_link_to help_center.support_category_support_threads_path(category) do %>
25
- <%= category.name %>
26
- <% end %>
27
- <% if @category.present? && @category == category %>
28
- <div class="pl-2">
29
- <% @support_threads.each do |thread| %>
30
- <%= support_link_to help_center.support_thread_path(thread) do %>
31
- <%= thread.title %>
32
- <% end %>
33
- <% end %>
34
- </div>
35
- <% end %>
36
- </div>
37
- <% end %>
38
- </div>
39
-
40
-
41
-
42
- <% if HelpCenter.enable_comments %>
43
- <hr />
44
-
45
-
46
-
47
- <div class="support-thread-filters">
48
- <h5>
49
- <strong>
50
- <%= t('filters') %>
51
- </strong>
52
- </h5>
53
- <div>
54
- <%= support_link_to help_center.support_threads_path, exact: true do %>
55
- <%= icon "fa-fw fas", "bars" %>
56
- <%= t('.all_threads') %>
57
- <% end %>
58
- </div>
59
- <% if user_signed_in? %>
60
- <div>
61
- <%= support_link_to help_center.mine_support_threads_path do %><%= icon "fa-fw far", "user-circle" %>
62
- <%= t('.my_questions') %>
63
- <% end %>
64
- </div>
65
- <div>
66
- <%= support_link_to help_center.participating_support_threads_path do %>
67
- <%= icon "fa-fw far", "comments" %>
68
- <%= t('.participating') %>
69
- <% end %>
70
- </div>
71
- <% end %>
72
- <div>
73
- <%= support_link_to help_center.answered_support_threads_path do %>
74
- <%= icon "fa-fw fas", "check" %>
75
- <%= t('.answered') %>
76
- <% end %>
77
- </div>
78
- <div>
79
- <%= support_link_to help_center.unanswered_support_threads_path do %>
80
- <%= icon "fa-fw fas", "question" %>
81
- <%= t('.unanswered') %>
82
- <% end %>
83
- </div>
84
- </div>
85
-
86
-
87
-
88
- <% if @support_thread.present? && @support_thread.persisted? %>
89
- <hr />
90
-
91
- <%# User has not posted in the thread or subscribed %>
92
- <h5><%= t('.notifications') %></h5>
93
-
94
- <%= link_to help_center.support_thread_notifications_path(@support_thread), method: :post, class: "btn btn-secondary btn-sm btn-block mb-2" do %>
95
- <% if @support_thread.subscribed? current_user %>
96
- <%= icon "fa-fw fas", "bell-slash" %> <%= t('.unsubscribe') %>
97
- <% else %>
98
- <%= icon "fa-fw fas", "bell" %>
99
- <%= t('.suscribe') %>
100
- <% end %>
101
- <% end %>
102
-
103
- <small><%= @support_thread.subscribed_reason(current_user) %></small>
104
- <% end %>
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") %>
@@ -1,3 +1,3 @@
1
1
  module HelpCenter
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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-07-16 00:00:00.000000000 Z
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