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.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +12 -12
- data/.gitignore +10 -10
- data/CHANGELOG.md +1 -1
- data/CODE_OF_CONDUCT.md +74 -74
- data/Gemfile +6 -6
- data/LICENSE.txt +21 -21
- data/README.md +164 -155
- data/Rakefile +10 -10
- data/app/assets/stylesheets/help_center.scss +139 -119
- data/app/controllers/help_center/application_controller.rb +37 -37
- data/app/controllers/help_center/notifications_controller.rb +19 -19
- data/app/controllers/help_center/support_categories_controller.rb +58 -17
- data/app/controllers/help_center/support_posts_controller.rb +72 -72
- data/app/controllers/help_center/support_threads_controller.rb +16 -6
- data/app/helpers/help_center/support_posts_helper.rb +29 -29
- data/app/helpers/help_center/support_threads_helper.rb +28 -28
- data/app/jobs/help_center/support_post_notification_job.rb +42 -42
- data/app/jobs/help_center/support_thread_notification_job.rb +40 -40
- data/app/mailers/help_center/user_mailer.rb +28 -28
- data/app/models/support_category.rb +13 -13
- data/app/models/support_post.rb +15 -15
- data/app/models/support_subscription.rb +19 -19
- data/app/models/support_thread.rb +85 -85
- data/app/views/help_center/support_categories/_form.html.erb +35 -0
- data/app/views/help_center/support_categories/_support_thread.html.erb +25 -0
- data/app/views/help_center/support_categories/edit.html.erb +7 -0
- data/app/views/help_center/support_categories/index.html.erb +19 -0
- data/app/views/help_center/support_categories/new.html.erb +5 -0
- data/app/views/help_center/support_categories/show.html.erb +20 -0
- data/app/views/help_center/support_threads/_form.html.erb +6 -4
- data/app/views/help_center/support_threads/edit.html.erb +7 -7
- data/app/views/help_center/support_threads/index.html.erb +1 -1
- data/app/views/help_center/support_threads/new.html.erb +5 -5
- data/app/views/help_center/support_threads/show.html.erb +42 -1
- data/app/views/layouts/help_center.html.erb +37 -13
- data/app/views/shared/_spacer.html.erb +1 -1
- data/bin/console +14 -14
- data/bin/setup +8 -8
- data/config/locales/en.yml +55 -52
- data/config/routes.rb +24 -24
- data/db/migrate/20170417012930_create_support_categories.rb +19 -19
- data/db/migrate/20170417012931_create_support_threads.rb +18 -18
- data/db/migrate/20170417012932_create_support_posts.rb +12 -12
- data/db/migrate/20170417012933_create_support_subscriptions.rb +11 -11
- data/help_center.gemspec +29 -29
- data/lib/generators/help_center/controllers_generator.rb +13 -13
- data/lib/generators/help_center/helpers_generator.rb +13 -13
- data/lib/generators/help_center/views_generator.rb +13 -13
- data/lib/help_center.rb +23 -24
- data/lib/help_center/engine.rb +10 -10
- data/lib/help_center/slack.rb +22 -22
- data/lib/help_center/support_user.rb +10 -10
- data/lib/help_center/version.rb +3 -3
- metadata +11 -8
- data/.travis.yml +0 -5
- data/app/views/help_center/support_threads/_article.html.erb +0 -32
- data/lib/help_center/will_paginate.rb +0 -53
data/Rakefile
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
require "bundler/gem_tasks"
|
|
2
|
-
require "rake/testtask"
|
|
3
|
-
|
|
4
|
-
Rake::TestTask.new(:test) do |t|
|
|
5
|
-
t.libs << "test"
|
|
6
|
-
t.libs << "lib"
|
|
7
|
-
t.test_files = FileList["test/**/*_test.rb"]
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
task :default => :test
|
|
1
|
+
require "bundler/gem_tasks"
|
|
2
|
+
require "rake/testtask"
|
|
3
|
+
|
|
4
|
+
Rake::TestTask.new(:test) do |t|
|
|
5
|
+
t.libs << "test"
|
|
6
|
+
t.libs << "lib"
|
|
7
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
task :default => :test
|
|
@@ -1,119 +1,139 @@
|
|
|
1
|
-
@import "font-awesome-sprockets";
|
|
2
|
-
@import "font-awesome";
|
|
3
|
-
|
|
4
|
-
/* Allow pagination to be centered */
|
|
5
|
-
.support-threads-nav nav {
|
|
6
|
-
display: inline-block;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/* Highlight the active navigation item in the sidebar */
|
|
10
|
-
.support-thread-filters {
|
|
11
|
-
a {
|
|
12
|
-
color: #555;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.active {
|
|
16
|
-
color: #
|
|
17
|
-
font-weight:
|
|
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
|
-
font-
|
|
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
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
border
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
1
|
+
@import "font-awesome-sprockets";
|
|
2
|
+
@import "font-awesome";
|
|
3
|
+
|
|
4
|
+
/* Allow pagination to be centered */
|
|
5
|
+
.help_center .support-threads-nav nav {
|
|
6
|
+
display: inline-block;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/* Highlight the active navigation item in the sidebar */
|
|
10
|
+
.help_center .support-thread-filters {
|
|
11
|
+
a {
|
|
12
|
+
color: #555;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.active {
|
|
16
|
+
color: #eee;
|
|
17
|
+
font-weight: 500;
|
|
18
|
+
padding: 0.25rem;
|
|
19
|
+
border-radius: 5px;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* Formatting for the support threads */
|
|
24
|
+
.help_center .support-thread {
|
|
25
|
+
margin-bottom: -20px;
|
|
26
|
+
|
|
27
|
+
h4 {
|
|
28
|
+
margin-bottom: 4px;
|
|
29
|
+
|
|
30
|
+
a {
|
|
31
|
+
color: #222;
|
|
32
|
+
font-size: 16px;
|
|
33
|
+
font-weight: normal;
|
|
34
|
+
line-height: 1.1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.help_center .support-thread-filters a {
|
|
40
|
+
color: #555555;
|
|
41
|
+
display: block;
|
|
42
|
+
|
|
43
|
+
&:hover {
|
|
44
|
+
color: #bfbfbf;
|
|
45
|
+
text-decoration: none
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.help_center .thread-details {
|
|
50
|
+
color: #999;
|
|
51
|
+
font-size: 12px;
|
|
52
|
+
text-transform: uppercase;
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.help_center .thread-reaction {
|
|
58
|
+
background: #eeeeee;
|
|
59
|
+
padding: 1rem;
|
|
60
|
+
text-align: center;
|
|
61
|
+
border-radius: 0.5rem;
|
|
62
|
+
margin-top: 2rem;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.help_center .thread-reaction-links {
|
|
66
|
+
font-size: 2rem;
|
|
67
|
+
margin: 0.25rem;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* Display the support post count above the "posts" text on the index page */
|
|
71
|
+
.help_center .thread-posts-count {
|
|
72
|
+
color: #222;
|
|
73
|
+
text-align: center;
|
|
74
|
+
|
|
75
|
+
span, small {
|
|
76
|
+
display: block;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.count {
|
|
80
|
+
font-size: 1.5em;
|
|
81
|
+
font-weight: 300;
|
|
82
|
+
line-height: 1em;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&:hover {
|
|
86
|
+
color: #222;
|
|
87
|
+
text-decoration: none;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* Formatting for the support posts themselves */
|
|
92
|
+
.help_center .support-post {
|
|
93
|
+
position: relative;
|
|
94
|
+
|
|
95
|
+
/* When the URL anchor matches a post id, highlight that item */
|
|
96
|
+
&:target {
|
|
97
|
+
background-color: rgb(248, 238, 199);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* Fill this out if you want to highlight the OPs posts */
|
|
101
|
+
&.original-poster {
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&.solved {
|
|
105
|
+
border: 2px solid #5cb85c;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* Formatting for the support hr to match card border */
|
|
110
|
+
.help_center hr {
|
|
111
|
+
border: 0;
|
|
112
|
+
border-top: 1px solid rgba(0, 0, 0, 0.125);
|
|
113
|
+
margin: 24px -20px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Forms
|
|
117
|
+
.help_center label {
|
|
118
|
+
margin-bottom: 0.5rem;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.help_center .form-input, .form-select {
|
|
122
|
+
display: block;
|
|
123
|
+
width: 100%;
|
|
124
|
+
font-size: 0.875rem;
|
|
125
|
+
line-height: 1.25rem;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.help_center input[type="color" i] {
|
|
129
|
+
appearance: square-button;
|
|
130
|
+
width: 44px;
|
|
131
|
+
height: 23px;
|
|
132
|
+
background-color: -internal-light-dark(rgb(239, 239, 239), rgb(74, 74, 74));
|
|
133
|
+
cursor: default;
|
|
134
|
+
border-width: 1px;
|
|
135
|
+
border-style: solid;
|
|
136
|
+
border-color: -internal-light-dark(rgb(118, 118, 118), rgb(195, 195, 195));
|
|
137
|
+
border-image: initial;
|
|
138
|
+
padding: 1px 2px;
|
|
139
|
+
}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
class HelpCenter::ApplicationController < ::ApplicationController
|
|
2
|
-
layout "help_center"
|
|
3
|
-
|
|
4
|
-
def page_number
|
|
5
|
-
page = params.fetch(:page, '').gsub(/[^0-9]/, '').to_i
|
|
6
|
-
page = "1" if page.zero?
|
|
7
|
-
page
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def is_moderator_or_owner?(object)
|
|
11
|
-
is_moderator?
|
|
12
|
-
end
|
|
13
|
-
helper_method :is_moderator_or_owner?
|
|
14
|
-
|
|
15
|
-
def is_moderator?
|
|
16
|
-
current_user.respond_to?(:moderator) && current_user.moderator? && current_user.admin?
|
|
17
|
-
end
|
|
18
|
-
helper_method :is_moderator?
|
|
19
|
-
|
|
20
|
-
def require_mod_or_author_for_post!
|
|
21
|
-
unless is_moderator_or_owner?(@support_post)
|
|
22
|
-
redirect_to_root
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def require_mod_or_author_for_thread!
|
|
27
|
-
unless is_moderator_or_owner?(@support_thread)
|
|
28
|
-
redirect_to_root
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
private
|
|
33
|
-
|
|
34
|
-
def redirect_to_root
|
|
35
|
-
redirect_to help_center.root_path
|
|
36
|
-
end
|
|
37
|
-
end
|
|
1
|
+
class HelpCenter::ApplicationController < ::ApplicationController
|
|
2
|
+
layout "help_center"
|
|
3
|
+
|
|
4
|
+
def page_number
|
|
5
|
+
page = params.fetch(:page, '').gsub(/[^0-9]/, '').to_i
|
|
6
|
+
page = "1" if page.zero?
|
|
7
|
+
page
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def is_moderator_or_owner?(object)
|
|
11
|
+
is_moderator?
|
|
12
|
+
end
|
|
13
|
+
helper_method :is_moderator_or_owner?
|
|
14
|
+
|
|
15
|
+
def is_moderator?
|
|
16
|
+
current_user.respond_to?(:moderator) && current_user.moderator? || current_user.respond_to?(:admin) && current_user.admin?
|
|
17
|
+
end
|
|
18
|
+
helper_method :is_moderator?
|
|
19
|
+
|
|
20
|
+
def require_mod_or_author_for_post!
|
|
21
|
+
unless is_moderator_or_owner?(@support_post)
|
|
22
|
+
redirect_to_root
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def require_mod_or_author_for_thread!
|
|
27
|
+
unless is_moderator_or_owner?(@support_thread)
|
|
28
|
+
redirect_to_root
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
private
|
|
33
|
+
|
|
34
|
+
def redirect_to_root
|
|
35
|
+
redirect_to help_center.root_path
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
class HelpCenter::NotificationsController < HelpCenter::ApplicationController
|
|
2
|
-
before_action :authenticate_user!
|
|
3
|
-
before_action :set_support_thread
|
|
4
|
-
|
|
5
|
-
def create
|
|
6
|
-
@support_thread.toggle_subscription(current_user)
|
|
7
|
-
redirect_to help_center.support_thread_path(@support_thread)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def show
|
|
11
|
-
redirect_to help_center.support_thread_path(@support_thread)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
private
|
|
15
|
-
|
|
16
|
-
def set_support_thread
|
|
17
|
-
@support_thread = SupportThread.friendly.find(params[:support_thread_id])
|
|
18
|
-
end
|
|
19
|
-
end
|
|
1
|
+
class HelpCenter::NotificationsController < HelpCenter::ApplicationController
|
|
2
|
+
before_action :authenticate_user!
|
|
3
|
+
before_action :set_support_thread
|
|
4
|
+
|
|
5
|
+
def create
|
|
6
|
+
@support_thread.toggle_subscription(current_user)
|
|
7
|
+
redirect_to help_center.support_thread_path(@support_thread)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def show
|
|
11
|
+
redirect_to help_center.support_thread_path(@support_thread)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def set_support_thread
|
|
17
|
+
@support_thread = SupportThread.friendly.find(params[:support_thread_id])
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -1,17 +1,58 @@
|
|
|
1
|
-
class HelpCenter::SupportCategoriesController < HelpCenter::ApplicationController
|
|
2
|
-
before_action :
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
class HelpCenter::SupportCategoriesController < HelpCenter::ApplicationController
|
|
2
|
+
before_action :authenticate_user!, only: [:edit, :update, :destroy]
|
|
3
|
+
before_action :set_category, only: [:index, :show, :edit, :update, :destroy]
|
|
4
|
+
before_action :require_mod_or_author_for_thread!, only: [:edit, :update, :destroy]
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def index
|
|
8
|
+
@support_threads = SupportThread.where(support_category: @category) if @category.present?
|
|
9
|
+
@support_threads = @support_threads.pinned_first.sorted.includes(:user, :support_category)
|
|
10
|
+
@pagy, @records = pagy(@support_threads)
|
|
11
|
+
render "help_center/support_threads/index"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def new
|
|
15
|
+
@category = SupportCategory.new
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def show
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def create
|
|
22
|
+
@category = SupportCategory.new(support_category_params)
|
|
23
|
+
|
|
24
|
+
if @category.save
|
|
25
|
+
redirect_to help_center.support_threads_path
|
|
26
|
+
else
|
|
27
|
+
render action: :new
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def edit
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def update
|
|
35
|
+
if @category.update(support_category_params)
|
|
36
|
+
redirect_to help_center.support_category_path(@category), notice: I18n.t('your_changes_were_saved')
|
|
37
|
+
else
|
|
38
|
+
render action: :edit
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def destroy
|
|
43
|
+
@category.destroy
|
|
44
|
+
redirect_to help_center.support_threads_path, notice: I18n.t('successfully_deleted')
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
private
|
|
48
|
+
|
|
49
|
+
def set_category
|
|
50
|
+
@category = SupportCategory.friendly.find(params[:id])
|
|
51
|
+
rescue ActiveRecord::RecordNotFound
|
|
52
|
+
redirect_to help_center.support_threads_path
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def support_category_params
|
|
56
|
+
params.require(:support_category).permit(:name, :color, :position)
|
|
57
|
+
end
|
|
58
|
+
end
|