help_center 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +1 -1
- data/CHANGELOG.md +19 -0
- data/README.md +162 -168
- data/app/views/layouts/help_center.html.erb +17 -33
- data/app/views/shared/_admin_actions.html.erb +9 -0
- data/app/views/shared/_sidebar_actions.html.erb +22 -0
- data/app/views/shared/_thread_actions.html.erb +15 -15
- data/lib/help_center/version.rb +1 -1
- metadata +4 -3
- data/app/views/shared/_sidebar.html.erb +0 -66
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c229690f4ea2200eaac22205e66d776fdc1590f05ae1aca8fa6498ddf5d5fa53
|
4
|
+
data.tar.gz: 269c19131ea7c54b07c70ebc46f744926b270880a94bc5368a5a8ea3aa4274fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53a7e667e6010ae88cb43a5bfbdae856f270c5fdbc9a31b57e3092129d353e4c15ff43897eb25bfdf2fc47ebdbea8de8209d2efd875c4bfd5e920a1e46c8a0b9
|
7
|
+
data.tar.gz: 0a5c782fc528a571356f620506a91a750da997ecec8571ad9c7f774df51517f1bfc47add6c367fb9b402128a2253b6a9c38a04b54fefbaf238b945a03a062dcc
|
data/.github/FUNDING.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# These are supported funding model platforms
|
2
2
|
|
3
|
-
github: [
|
3
|
+
github: [uurcank, pasilobus] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
4
4
|
patreon: # Replace with a single Patreon username
|
5
5
|
open_collective: # Replace with a single Open Collective username
|
6
6
|
ko_fi: # Replace with a single Ko-fi username
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
### Unreleased
|
2
2
|
|
3
|
+
* Fixes in form labels
|
4
|
+
* Styling improvements
|
5
|
+
|
6
|
+
### 0.1.0
|
7
|
+
|
8
|
+
* Inherit application layout
|
9
|
+
* Remove logo requirement removed (add the layout file to your views to customize)
|
10
|
+
* Refactor partials
|
11
|
+
|
12
|
+
### 0.0.9
|
13
|
+
|
14
|
+
* [BREAKING] No longer inherits application layout
|
15
|
+
* [BREAKING] Use CDN to install required libraries, skipping asset pipeline
|
16
|
+
* [BREAKING] Layout file requires a logo.svg file in assets, otherwise will break
|
17
|
+
* Upgrade to Tailwind v2.0
|
18
|
+
* New layout design
|
19
|
+
* Togglable sidebar menu
|
20
|
+
* Use Highlight.js for syntax highlighting
|
21
|
+
|
3
22
|
### 0.0.7
|
4
23
|
|
5
24
|
* Improve default styling
|
data/README.md
CHANGED
@@ -1,168 +1,162 @@
|
|
1
|
-
# HelpCenter
|
2
|
-
|
3
|
-
### 📖 Knowledge Base for your Ruby on Rails App
|
4
|
-
|
5
|
-
HelpCenter is a Rails wiki gem with Trix editor support for creating a knowledge base for your project. It includes
|
6
|
-
|
7
|
-
Out of the box, HelpCenter comes with styling for TailwindCSS 2.0 but you're free to customize the UI as much as you like by installing the views and tweaking the HTML.
|
8
|
-
|
9
|
-
## Requirements
|
10
|
-
|
11
|
-
```
|
12
|
-
Rails >= 6.
|
13
|
-
|
14
|
-
```
|
15
|
-
|
16
|
-
## Installation
|
17
|
-
|
18
|
-
Before you get started, HelpCenter requires a `User` model in your application (for now).
|
19
|
-
|
20
|
-
Add this line to your application's Gemfile:
|
21
|
-
|
22
|
-
```ruby
|
23
|
-
gem 'help_center'
|
24
|
-
```
|
25
|
-
|
26
|
-
And then execute:
|
27
|
-
|
28
|
-
```bash
|
29
|
-
bundle
|
30
|
-
```
|
31
|
-
|
32
|
-
Install the migrations and migrate:
|
33
|
-
|
34
|
-
```bash
|
35
|
-
rails help_center:install:migrations
|
36
|
-
rails db:migrate
|
37
|
-
```
|
38
|
-
|
39
|
-
Add HelpCenter to your `User` model. The model **must** have `name` method which will be used to display the user's name on comments & discussions (if enabled). Currently only a model named `User` will work.
|
40
|
-
|
41
|
-
```ruby
|
42
|
-
class User < ActiveRecord::Base
|
43
|
-
include HelpCenter::SupportUser
|
44
|
-
|
45
|
-
def name
|
46
|
-
"#{first_name} #{last_name}"
|
47
|
-
end
|
48
|
-
end
|
49
|
-
```
|
50
|
-
|
51
|
-
Next add a `moderator`
|
52
|
-
|
53
|
-
```bash
|
54
|
-
rails g migration AddModeratorToUsers moderator:boolean
|
55
|
-
rails db:migrate
|
56
|
-
```
|
57
|
-
Only moderators or admins can
|
58
|
-
|
59
|
-
```
|
60
|
-
if current_user.admin? || current_user.moderator?
|
61
|
-
```
|
62
|
-
|
63
|
-
Add the following line to your `config/routes.rb` file:
|
64
|
-
|
65
|
-
```ruby
|
66
|
-
mount HelpCenter::Engine => "/docs"
|
67
|
-
```
|
68
|
-
|
69
|
-
Add routes for active storage with your custom prefix
|
70
|
-
|
71
|
-
```ruby
|
72
|
-
get "/
|
73
|
-
"active_storage/blobs#show"
|
74
|
-
get "/
|
75
|
-
"active_storage/representations#show"
|
76
|
-
```
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
```
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
```bash
|
99
|
-
rails g help_center:
|
100
|
-
```
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
```bash
|
105
|
-
rails g help_center:
|
106
|
-
```
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
```
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
##
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
165
|
-
|
166
|
-
## Code of Conduct
|
167
|
-
|
168
|
-
Everyone interacting in the HelpCenter project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/pasilobus/help_center/blob/master/CODE_OF_CONDUCT.md).
|
1
|
+
# HelpCenter
|
2
|
+
|
3
|
+
### 📖 Knowledge Base for your Ruby on Rails App
|
4
|
+
|
5
|
+
HelpCenter is a Rails wiki gem with Trix editor support for creating a knowledge base for your project. It includes categories, articles, simple moderation, the ability to leave comments to docs and more.
|
6
|
+
|
7
|
+
Out of the box, HelpCenter comes with styling for TailwindCSS 2.0 but you're free to customize the UI as much as you like by installing the views and tweaking the HTML.
|
8
|
+
|
9
|
+
## Requirements
|
10
|
+
|
11
|
+
```
|
12
|
+
Rails >= 6.1.4
|
13
|
+
|
14
|
+
```
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
Before you get started, HelpCenter requires a `User` model in your application (for now).
|
19
|
+
|
20
|
+
Add this line to your application's Gemfile:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
gem 'help_center'
|
24
|
+
```
|
25
|
+
|
26
|
+
And then execute:
|
27
|
+
|
28
|
+
```bash
|
29
|
+
bundle
|
30
|
+
```
|
31
|
+
|
32
|
+
Install the migrations and migrate:
|
33
|
+
|
34
|
+
```bash
|
35
|
+
rails help_center:install:migrations
|
36
|
+
rails db:migrate
|
37
|
+
```
|
38
|
+
|
39
|
+
Add HelpCenter to your `User` model. The model **must** have `name` method which will be used to display the user's name on comments & discussions (if enabled). Currently only a model named `User` will work.
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
class User < ActiveRecord::Base
|
43
|
+
include HelpCenter::SupportUser
|
44
|
+
|
45
|
+
def name
|
46
|
+
"#{first_name} #{last_name}"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
```
|
50
|
+
|
51
|
+
Next add a `moderator` and `admin` flag to the `User` model.
|
52
|
+
|
53
|
+
```bash
|
54
|
+
rails g migration AddModeratorToUsers admin:boolean moderator:boolean
|
55
|
+
rails db:migrate
|
56
|
+
```
|
57
|
+
Only moderators or admins can manage articles.
|
58
|
+
|
59
|
+
```
|
60
|
+
if current_user.admin? || current_user.moderator?
|
61
|
+
```
|
62
|
+
|
63
|
+
Add the following line to your `config/routes.rb` file:
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
mount HelpCenter::Engine => "/docs"
|
67
|
+
```
|
68
|
+
|
69
|
+
Add routes for active storage with your custom prefix
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
get "/docs/rails/active_storage/blobs/:signed_id/*filename" =>
|
73
|
+
"active_storage/blobs#show"
|
74
|
+
get "/docs/rails/active_storage/representations/:signed_blob_id/:variation_key/*filename" =>
|
75
|
+
"active_storage/representations#show"
|
76
|
+
```
|
77
|
+
|
78
|
+
## Usage
|
79
|
+
|
80
|
+
To get all the basic functionality, the only thing you need to do is add a link to HelpCenter in your navbar.
|
81
|
+
|
82
|
+
```erb
|
83
|
+
<%= link_to "Docs", help_center_path %>
|
84
|
+
```
|
85
|
+
|
86
|
+
This will take the user to the views inside the Rails engine and that's all you have to do!
|
87
|
+
|
88
|
+
### Customizing
|
89
|
+
|
90
|
+
If you'd like to customize the views that HelpCenter uses, you can install the views to your Rails app:
|
91
|
+
|
92
|
+
```bash
|
93
|
+
rails g help_center:views
|
94
|
+
```
|
95
|
+
|
96
|
+
You can also install a copy of the HelpCenter controllers for advanced customization:
|
97
|
+
|
98
|
+
```bash
|
99
|
+
rails g help_center:controllers
|
100
|
+
```
|
101
|
+
|
102
|
+
Helpers are available for override as well. They are used for rendering the user avatars, text formatting, and more.
|
103
|
+
|
104
|
+
```bash
|
105
|
+
rails g help_center:helpers
|
106
|
+
```
|
107
|
+
|
108
|
+
**NOTE:** Keep in mind that the more customization you do, the tougher gem upgrades will be in the future.
|
109
|
+
|
110
|
+
### User comments & Notifications
|
111
|
+
|
112
|
+
You can enable user comments and questions for support articles. HelpCenter will attempt to send email and slack notifications for users who leave comments when a new reply posted.
|
113
|
+
|
114
|
+
To turn these off you can do the following in `config/initializers/help_center.rb`
|
115
|
+
|
116
|
+
```ruby
|
117
|
+
HelpCenter.setup do |config|
|
118
|
+
config.article_dicussions = false # Default: false
|
119
|
+
config.send_email_notifications = false # Default: true
|
120
|
+
config.send_slack_notifications = false # Default: true
|
121
|
+
end
|
122
|
+
```
|
123
|
+
|
124
|
+
Slack notifications require you to set `help_center_slack_url` in your `config/secrets.yml`. If you don't have this value set, it will not attempt Slack notifications even if they are enabled.
|
125
|
+
|
126
|
+
|
127
|
+
## Development
|
128
|
+
|
129
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
130
|
+
|
131
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
132
|
+
|
133
|
+
## Roadmap / Upcoming features
|
134
|
+
Your support is appreciated for this project. Consider backing the project via GitHub Sponsors.
|
135
|
+
|
136
|
+
We plan to release following features:
|
137
|
+
|
138
|
+
- Contact form
|
139
|
+
- Built-in search
|
140
|
+
- Versioning Support
|
141
|
+
- Themes
|
142
|
+
- Dark Mode Support
|
143
|
+
|
144
|
+
## Acknowledgment
|
145
|
+
|
146
|
+
[simple_discussion](https://github.com/excid3/simple_discussion) by [Chris Oliver](https://github.com/excid3)
|
147
|
+
|
148
|
+
[Trix editor](https://github.com/basecamp/trix) by [Basecamp](https://github.com/basecamp)
|
149
|
+
|
150
|
+
[TailwindCSS](https://github.com/basecamp/trix) by [Tailwind Labs](https://github.com/tailwindlabs/tailwindcss)
|
151
|
+
|
152
|
+
## Contributing
|
153
|
+
|
154
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/uurcank/help_center This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
155
|
+
|
156
|
+
## License
|
157
|
+
|
158
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
159
|
+
|
160
|
+
## Code of Conduct
|
161
|
+
|
162
|
+
Everyone interacting in the HelpCenter project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/pasilobus/help_center/blob/master/CODE_OF_CONDUCT.md).
|
@@ -1,38 +1,24 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
<script defer src="https://use.fontawesome.com/releases/v5.15.4/js/all.js" crossorigin="anonymous"></script>
|
13
|
-
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/trix/1.3.1/trix.js" crossorigin="anonymous"></script>
|
14
|
-
<link href="https://cdnjs.cloudflare.com/ajax/libs/trix/1.3.1/trix.css" rel="stylesheet">
|
15
|
-
</head>
|
16
|
-
|
17
|
-
<body class="flex h-full overflow-x-hidden font-sans font-normal leading-normal bg-offwhite">
|
1
|
+
|
2
|
+
<style>
|
3
|
+
[data-toggle-open-value="false"] .fa-sort-down {
|
4
|
+
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";
|
5
|
+
-webkit-transform: rotate(270deg);
|
6
|
+
transform: rotate(270deg);
|
7
|
+
}
|
8
|
+
</style>
|
9
|
+
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
|
10
|
+
<script defer src="https://use.fontawesome.com/releases/v5.15.4/js/all.js" crossorigin="anonymous"></script>
|
11
|
+
|
18
12
|
<div class="flex flex-wrap flex-grow items-start justify-between main">
|
19
|
-
|
20
|
-
<div class="top-0 flex justify-between w-full z-50 bg-blue-600 text-purple-200 text-sm text-center font-brand-semibold px-4 py-3" role="alert">
|
21
|
-
<span class="text-base font-normal text-white">Welcome moderators (<%= current_user.email %>)</span>
|
22
|
-
<div>
|
23
|
-
<%= link_to t('add_an_article'), help_center.new_support_thread_path, class: "text-gray-100 hover:text-gray-300 hover:no-underline font-semibold underline mr-4 ml-6" %>
|
24
|
-
<%= link_to t('add_category'), help_center.new_support_category_path, class: "text-gray-100 hover:text-gray-300 hover:no-underline font-semibold underline" %>
|
25
|
-
</div>
|
26
|
-
</div>
|
27
|
-
<% end %>
|
13
|
+
<%= render partial: "shared/admin_actions" %>
|
28
14
|
<div class="flex flex-col w-full px-4 pt-4 md:w-1/5 lg:px-8">
|
29
15
|
<div class="text-lg mb-4">
|
30
16
|
<%= link_to help_center_path do %>
|
31
|
-
|
17
|
+
<h3 class="font-bold">Docs</h3>
|
32
18
|
<% end %>
|
33
19
|
</div>
|
34
20
|
<div>
|
35
|
-
<%= render partial: "shared/
|
21
|
+
<%= render partial: "shared/sidebar_actions" %>
|
36
22
|
</div>
|
37
23
|
</div>
|
38
24
|
<div class="flex flex-col w-full h-full bg-white border-l border-gray-300 md:w-4/5 docs-main">
|
@@ -65,10 +51,8 @@
|
|
65
51
|
</div>
|
66
52
|
</div>
|
67
53
|
|
68
|
-
<link rel="stylesheet"
|
69
|
-
href="//unpkg.com/@highlightjs/cdn-assets@11.3.1/styles/default.min.css">
|
54
|
+
<link rel="stylesheet" href="//unpkg.com/@highlightjs/cdn-assets@11.3.1/styles/default.min.css">
|
70
55
|
<script src="//unpkg.com/@highlightjs/cdn-assets@11.3.1/highlight.min.js"></script>
|
71
56
|
<script>hljs.highlightAll();</script>
|
72
|
-
|
73
|
-
|
74
|
-
|
57
|
+
|
58
|
+
<% parent_layout("application") %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<% if current_user && (current_user.admin? || current_user.moderator?) %>
|
2
|
+
<div class="top-0 flex justify-between w-full z-50 bg-blue-600 text-purple-200 text-sm text-center font-brand-semibold px-4 py-3" role="alert">
|
3
|
+
<span class="text-base font-normal text-white">Welcome moderators (<%= current_user.email %>)</span>
|
4
|
+
<div>
|
5
|
+
<%= link_to t('add_an_article'), help_center.new_support_thread_path, class: "text-gray-100 hover:text-gray-300 hover:no-underline font-semibold underline mr-4 ml-6" %>
|
6
|
+
<%= link_to t('add_category'), help_center.new_support_category_path, class: "text-gray-100 hover:text-gray-300 hover:no-underline font-semibold underline" %>
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<div>
|
2
|
+
<% SupportCategory.sorted.each do |category| %>
|
3
|
+
<div data-controller="toggle" class="py-2 my-1 overflow-x-auto bg-white rounded shadow-inner-sm" data-toggle-open-value="<%= (@category.present? && @category == category) ? "true" : "false" %>">
|
4
|
+
<button class="mb-0 text-gray-700 font-medium text-base hover:text-gray-900" data-action="click->toggle#toggle">
|
5
|
+
<i class="fas fa-sort-down mr-2"></i>
|
6
|
+
<%= category.name %>
|
7
|
+
</button>
|
8
|
+
<div data-toggle-target="toggleable" class="<%= (@category.present? && @category == category) ? "" : "hidden" %>" >
|
9
|
+
<ul class="list-none leading-loose pl-6">
|
10
|
+
<% threads = SupportThread.where(support_category_id: category.id).order(:position) %>
|
11
|
+
<% threads.each do |thread| %>
|
12
|
+
<li>
|
13
|
+
<%= link_to help_center.support_thread_path(thread), class: "text-base font-normal text-gray-500 hover:text-gray-700" do %>
|
14
|
+
<%= thread.title %>
|
15
|
+
<% end %>
|
16
|
+
</li>
|
17
|
+
<% end %>
|
18
|
+
</ul>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
<% end %>
|
22
|
+
</div>
|
@@ -1,16 +1,16 @@
|
|
1
|
-
<div class="bg-blue-400 flex justify-between w-full px-4 py-2 text-base items-center">
|
2
|
-
<span class="mr-4 text-gray-100"><i class="fas fa-sort"></i> <%= @support_thread.position %> </span>
|
3
|
-
|
4
|
-
<div>
|
5
|
-
<%= link_to "Edit Article", help_center.edit_support_thread_path(@support_thread),
|
6
|
-
class: "text-gray-100 underline text-sm",
|
7
|
-
data: { toggle: "tooltip", placement: "left" },
|
8
|
-
title: t('edit_this_thread') %>
|
9
|
-
|
10
|
-
<%= link_to "Delete", help_center.support_thread_path(@support_thread),
|
11
|
-
method: :delete,
|
12
|
-
class: "text-gray-100 ml-4 underline text-sm",
|
13
|
-
data: {
|
14
|
-
title: t('delete_category') %>
|
15
|
-
</div>
|
1
|
+
<div class="bg-blue-400 flex justify-between w-full px-4 py-2 text-base items-center">
|
2
|
+
<span class="mr-4 text-gray-100"><i class="fas fa-sort"></i> <%= @support_thread.position %> </span>
|
3
|
+
|
4
|
+
<div>
|
5
|
+
<%= link_to "Edit Article", help_center.edit_support_thread_path(@support_thread),
|
6
|
+
class: "text-gray-100 underline text-sm",
|
7
|
+
data: { toggle: "tooltip", placement: "left" },
|
8
|
+
title: t('edit_this_thread') %>
|
9
|
+
|
10
|
+
<%= link_to "Delete", help_center.support_thread_path(@support_thread),
|
11
|
+
method: :delete,
|
12
|
+
class: "text-gray-100 ml-4 underline text-sm",
|
13
|
+
data: { confirm: "Are you sure?" },
|
14
|
+
title: t('delete_category') %>
|
15
|
+
</div>
|
16
16
|
</div>
|
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.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ugurcan Kaya
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: font-awesome-sass
|
@@ -114,8 +114,9 @@ files:
|
|
114
114
|
- app/views/help_center/user_mailer/new_post.html.erb
|
115
115
|
- app/views/help_center/user_mailer/new_thread.html.erb
|
116
116
|
- app/views/layouts/help_center.html.erb
|
117
|
+
- app/views/shared/_admin_actions.html.erb
|
117
118
|
- app/views/shared/_category_actions.html.erb
|
118
|
-
- app/views/shared/
|
119
|
+
- app/views/shared/_sidebar_actions.html.erb
|
119
120
|
- app/views/shared/_spacer.html.erb
|
120
121
|
- app/views/shared/_thread_actions.html.erb
|
121
122
|
- bin/console
|
@@ -1,66 +0,0 @@
|
|
1
|
-
<script type="module">
|
2
|
-
import { Application, Controller } from "https://unpkg.com/@hotwired/stimulus/dist/stimulus.js"
|
3
|
-
window.Stimulus = Application.start()
|
4
|
-
|
5
|
-
Stimulus.register("toggle", class extends Controller {
|
6
|
-
static targets = [ "name" ]
|
7
|
-
static targets = ['toggleable']
|
8
|
-
static values = { open: Boolean }
|
9
|
-
|
10
|
-
connect() {
|
11
|
-
this.toggleClass = this.data.get('class') || 'hidden'
|
12
|
-
}
|
13
|
-
|
14
|
-
toggle(event) {
|
15
|
-
event.preventDefault()
|
16
|
-
|
17
|
-
this.openValue = !this.openValue
|
18
|
-
}
|
19
|
-
|
20
|
-
hide(event) {
|
21
|
-
event.preventDefault();
|
22
|
-
|
23
|
-
this.openValue = false;
|
24
|
-
}
|
25
|
-
|
26
|
-
show(event) {
|
27
|
-
event.preventDefault();
|
28
|
-
|
29
|
-
this.openValue = true;
|
30
|
-
}
|
31
|
-
|
32
|
-
openValueChanged() {
|
33
|
-
if (!this.toggleClass) { return }
|
34
|
-
|
35
|
-
this.toggleableTargets.forEach(target => {
|
36
|
-
target.classList.toggle(this.toggleClass)
|
37
|
-
})
|
38
|
-
}
|
39
|
-
|
40
|
-
})
|
41
|
-
</script>
|
42
|
-
|
43
|
-
<div data-controller="toggle">
|
44
|
-
<% SupportCategory.sorted.each do |category| %>
|
45
|
-
<div data-controller="toggle" class="py-2 my-1 overflow-x-auto bg-white rounded shadow-inner-sm" data-toggle-open-value="<%= (@category.present? && @category == category) ? "true" : "false" %>">
|
46
|
-
<button class="mb-0 text-gray-700 font-medium text-base hover:text-gray-900" data-action="click->toggle#toggle">
|
47
|
-
<i class="fas fa-sort-down mr-2"></i>
|
48
|
-
<%= category.name %>
|
49
|
-
</button>
|
50
|
-
<div data-toggle-target="toggleable" class="<%= (@category.present? && @category == category) ? "" : "hidden" %>" >
|
51
|
-
<ul class="list-none leading-loose pl-6">
|
52
|
-
<% threads = SupportThread.where(support_category_id: category.id).order(:position) %>
|
53
|
-
<% threads.each do |thread| %>
|
54
|
-
<li>
|
55
|
-
<%= link_to help_center.support_thread_path(thread), class: "text-base font-normal text-gray-500 hover:text-gray-700" do %>
|
56
|
-
<%= thread.title %>
|
57
|
-
<% end %>
|
58
|
-
</li>
|
59
|
-
<% end %>
|
60
|
-
</ul>
|
61
|
-
</div>
|
62
|
-
</div>
|
63
|
-
|
64
|
-
<% end %>
|
65
|
-
</div>
|
66
|
-
|