From 0f94ca10f088cebcfc67e25441be0b64b5429365 Mon Sep 17 00:00:00 2001 From: uurcank Date: Wed, 8 Dec 2021 04:02:03 -0800 Subject: [PATCH] fix merge conflict --- README.md | 322 ++++++++++----------- app/views/shared/_admin_actions.html.erb | 16 +- app/views/shared/_sidebar_actions.html.erb | 42 +-- app/views/shared/_thread_actions.html.erb | 30 +- 4 files changed, 205 insertions(+), 205 deletions(-) diff --git a/README.md b/README.md index 531a4f4..7008753 100644 --- a/README.md +++ b/README.md @@ -1,162 +1,162 @@ -# HelpCenter - -### 📖 Knowledge Base for your Ruby on Rails App - -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. - -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. - -## Requirements - -``` -Rails >= 6.1.4 - -``` - -## Installation - -Before you get started, HelpCenter requires a `User` model in your application (for now). - -Add this line to your application's Gemfile: - -```ruby -gem 'help_center' -``` - -And then execute: - -```bash -bundle -``` - -Install the migrations and migrate: - -```bash -rails help_center:install:migrations -rails db:migrate -``` - -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. - -```ruby -class User < ActiveRecord::Base - include HelpCenter::SupportUser - - def name - "#{first_name} #{last_name}" - end -end -``` - -Next add a `moderator` and `admin` flag to the `User` model. - -```bash -rails g migration AddModeratorToUsers admin:boolean moderator:boolean -rails db:migrate -``` -Only moderators or admins can manage articles. - -``` -if current_user.admin? || current_user.moderator? -``` - -Add the following line to your `config/routes.rb` file: - -```ruby -mount HelpCenter::Engine => "/docs" -``` - -Add routes for active storage with your custom prefix - -```ruby -get "/docs/rails/active_storage/blobs/:signed_id/*filename" => - "active_storage/blobs#show" -get "/docs/rails/active_storage/representations/:signed_blob_id/:variation_key/*filename" => - "active_storage/representations#show" -``` - -## Usage - -To get all the basic functionality, the only thing you need to do is add a link to HelpCenter in your navbar. - -```erb -<%= link_to "Docs", help_center_path %> -``` - -This will take the user to the views inside the Rails engine and that's all you have to do! - -### Customizing - -If you'd like to customize the views that HelpCenter uses, you can install the views to your Rails app: - -```bash -rails g help_center:views -``` - -You can also install a copy of the HelpCenter controllers for advanced customization: - -```bash -rails g help_center:controllers -``` - -Helpers are available for override as well. They are used for rendering the user avatars, text formatting, and more. - -```bash -rails g help_center:helpers -``` - -**NOTE:** Keep in mind that the more customization you do, the tougher gem upgrades will be in the future. - -### User comments & Notifications - -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. - -To turn these off you can do the following in `config/initializers/help_center.rb` - -```ruby -HelpCenter.setup do |config| - config.article_dicussions = false # Default: false - config.send_email_notifications = false # Default: true - config.send_slack_notifications = false # Default: true -end -``` - -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. - - -## Development - -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. - -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). - -## Roadmap / Upcoming features -Your support is appreciated for this project. Consider backing the project via GitHub Sponsors. - -We plan to release following features: - -- Contact form -- Built-in search -- Versioning Support -- Themes -- Dark Mode Support - -## Acknowledgment - -[simple_discussion](https://github.com/excid3/simple_discussion) by [Chris Oliver](https://github.com/excid3) - -[Trix editor](https://github.com/basecamp/trix) by [Basecamp](https://github.com/basecamp) - -[TailwindCSS](https://github.com/basecamp/trix) by [Tailwind Labs](https://github.com/tailwindlabs/tailwindcss) - -## Contributing - -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. - -## License - -The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT). - -## Code of Conduct - +# HelpCenter + +### 📖 Knowledge Base for your Ruby on Rails App + +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. + +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. + +## Requirements + +``` +Rails >= 6.1.4 + +``` + +## Installation + +Before you get started, HelpCenter requires a `User` model in your application (for now). + +Add this line to your application's Gemfile: + +```ruby +gem 'help_center' +``` + +And then execute: + +```bash +bundle +``` + +Install the migrations and migrate: + +```bash +rails help_center:install:migrations +rails db:migrate +``` + +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. + +```ruby +class User < ActiveRecord::Base + include HelpCenter::SupportUser + + def name + "#{first_name} #{last_name}" + end +end +``` + +Next add a `moderator` and `admin` flag to the `User` model. + +```bash +rails g migration AddModeratorToUsers admin:boolean moderator:boolean +rails db:migrate +``` +Only moderators or admins can manage articles. + +``` +if current_user.admin? || current_user.moderator? +``` + +Add the following line to your `config/routes.rb` file: + +```ruby +mount HelpCenter::Engine => "/docs" +``` + +Add routes for active storage with your custom prefix + +```ruby +get "/docs/rails/active_storage/blobs/:signed_id/*filename" => + "active_storage/blobs#show" +get "/docs/rails/active_storage/representations/:signed_blob_id/:variation_key/*filename" => + "active_storage/representations#show" +``` + +## Usage + +To get all the basic functionality, the only thing you need to do is add a link to HelpCenter in your navbar. + +```erb +<%= link_to "Docs", help_center_path %> +``` + +This will take the user to the views inside the Rails engine and that's all you have to do! + +### Customizing + +If you'd like to customize the views that HelpCenter uses, you can install the views to your Rails app: + +```bash +rails g help_center:views +``` + +You can also install a copy of the HelpCenter controllers for advanced customization: + +```bash +rails g help_center:controllers +``` + +Helpers are available for override as well. They are used for rendering the user avatars, text formatting, and more. + +```bash +rails g help_center:helpers +``` + +**NOTE:** Keep in mind that the more customization you do, the tougher gem upgrades will be in the future. + +### User comments & Notifications + +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. + +To turn these off you can do the following in `config/initializers/help_center.rb` + +```ruby +HelpCenter.setup do |config| + config.article_dicussions = false # Default: false + config.send_email_notifications = false # Default: true + config.send_slack_notifications = false # Default: true +end +``` + +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. + + +## Development + +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. + +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). + +## Roadmap / Upcoming features +Your support is appreciated for this project. Consider backing the project via GitHub Sponsors. + +We plan to release following features: + +- Contact form +- Built-in search +- Versioning Support +- Themes +- Dark Mode Support + +## Acknowledgment + +[simple_discussion](https://github.com/excid3/simple_discussion) by [Chris Oliver](https://github.com/excid3) + +[Trix editor](https://github.com/basecamp/trix) by [Basecamp](https://github.com/basecamp) + +[TailwindCSS](https://github.com/basecamp/trix) by [Tailwind Labs](https://github.com/tailwindlabs/tailwindcss) + +## Contributing + +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. + +## License + +The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT). + +## Code of Conduct + 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). \ No newline at end of file diff --git a/app/views/shared/_admin_actions.html.erb b/app/views/shared/_admin_actions.html.erb index 73a7155..739e3e7 100644 --- a/app/views/shared/_admin_actions.html.erb +++ b/app/views/shared/_admin_actions.html.erb @@ -1,9 +1,9 @@ -<% if current_user && (current_user.admin? || current_user.moderator?) %> - +<% if current_user && (current_user.admin? || current_user.moderator?) %> + <% end %> \ No newline at end of file diff --git a/app/views/shared/_sidebar_actions.html.erb b/app/views/shared/_sidebar_actions.html.erb index f3c7299..9d6aa38 100644 --- a/app/views/shared/_sidebar_actions.html.erb +++ b/app/views/shared/_sidebar_actions.html.erb @@ -1,22 +1,22 @@ -
- <% SupportCategory.sorted.each do |category| %> -
"> - -
" > -
    - <% threads = SupportThread.where(support_category_id: category.id).order(:position) %> - <% threads.each do |thread| %> -
  • - <%= link_to help_center.support_thread_path(thread), class: "text-base font-normal text-gray-500 hover:text-gray-700" do %> - <%= thread.title %> - <% end %> -
  • - <% end %> -
-
-
- <% end %> +
+ <% SupportCategory.sorted.each do |category| %> +
"> + +
" > +
    + <% threads = SupportThread.where(support_category_id: category.id).order(:position) %> + <% threads.each do |thread| %> +
  • + <%= link_to help_center.support_thread_path(thread), class: "text-base font-normal text-gray-500 hover:text-gray-700" do %> + <%= thread.title %> + <% end %> +
  • + <% end %> +
+
+
+ <% end %>
\ No newline at end of file diff --git a/app/views/shared/_thread_actions.html.erb b/app/views/shared/_thread_actions.html.erb index 619675a..d140c6f 100644 --- a/app/views/shared/_thread_actions.html.erb +++ b/app/views/shared/_thread_actions.html.erb @@ -1,16 +1,16 @@ -
- <%= @support_thread.position %> - -
- <%= link_to "Edit Article", help_center.edit_support_thread_path(@support_thread), - class: "text-gray-100 underline text-sm", - data: { toggle: "tooltip", placement: "left" }, - title: t('edit_this_thread') %> - - <%= link_to "Delete", help_center.support_thread_path(@support_thread), - method: :delete, - class: "text-gray-100 ml-4 underline text-sm", - data: { confirm: "Are you sure?" }, - title: t('delete_category') %> -
+
+ <%= @support_thread.position %> + +
+ <%= link_to "Edit Article", help_center.edit_support_thread_path(@support_thread), + class: "text-gray-100 underline text-sm", + data: { toggle: "tooltip", placement: "left" }, + title: t('edit_this_thread') %> + + <%= link_to "Delete", help_center.support_thread_path(@support_thread), + method: :delete, + class: "text-gray-100 ml-4 underline text-sm", + data: { confirm: "Are you sure?" }, + title: t('delete_category') %> +
\ No newline at end of file