Skip to content

lsa-mis/tdx-feedback_gem

Repository files navigation

TDX Feedback Gem

A Rails engine that provides a seamless, modal-based feedback system for any Rails application. Users can submit feedback without leaving your main application, and the system can integrate with the TDX API for ticket creation when enabled.

Features

  • Modal-based feedback system - No page navigation required
  • Seamless integration - Drop into any Rails application
  • TDX API integration - Optionally creates support tickets (when enabled)
  • Responsive design - Works on all device sizes
  • Customizable styling - Easy to match your app's design
  • Authentication support - Optional user authentication requirement
  • Stimulus-powered - Modern JavaScript framework integration
  • Generator-wired assets - Installer adds the JavaScript and CSS for you

Quick Start

1. Installation

Add to your Gemfile:

gem 'tdx_feedback_gem', git: 'https://github.com/lsa-mis/tdx-feedback_gem.git'

2. Setup

bundle install
rails generate tdx_feedback_gem:install
rails db:migrate

Add the engine to your host app routes (recommended mount path shown):

# config/routes.rb
mount TdxFeedbackGem::Engine => '/tdx_feedback_gem'

Recompile your assets:

bundle exec rake assets:clobber && bundle exec rake dartsass:build
bundle exec rake assets:precompile

That's it! The gem automatically:

  • ✅ Creates the necessary database migration
  • ✅ Sets up the initializer with default configuration
  • ✅ Copies the Stimulus controller to your app
  • ✅ Includes the CSS styles in your asset pipeline
  • ✅ Registers the helper methods globally

3. Configuration (Optional)

Edit config/initializers/tdx_feedback_gem.rb if you need custom settings:

TdxFeedbackGem.configure do |config|
  config.require_authentication = true
  config.enable_ticket_creation = false
  config.oauth_scope = 'tdxticket'
  config.title_prefix = '[Feedback]'

  # TDX API credentials (use Rails credentials or environment variables)
  config.app_id = 31
  config.type_id = 12
  config.status_id = 77
  config.source_id = 8
  config.service_id = 67
  config.responsible_group_id = 631
end

4. Usage

Add to your layout or views:

<%= feedback_system(trigger: :link, text: 'Feedback', class: 'tdx-feedback-footer-link') %>
<%= feedback_system(trigger: :button, text: 'Send Feedback') %>
<%= feedback_footer_link %>
<%= feedback_header_button %>

If you mount the engine at a different path than /tdx_feedback_gem, either:

  • Pass custom URLs via Stimulus values on your trigger element:
    • data-tdx-feedback-new-url-value="/feedback/feedbacks/new"
    • data-tdx-feedback-submit-url-value="/feedback/feedbacks"
  • Or mount at /tdx_feedback_gem to use the controller defaults.

Configuration

The gem automatically resolves configuration from:

  1. Rails Encrypted Credentials (recommended)
  2. Environment Variables
  3. Built-in defaults

Runtime Toggle

Enable/disable TDX ticket creation without redeploying:

export TDX_ENABLE_TICKET_CREATION=true

Documentation

Development

git clone https://github.com/lsa-mis/tdx-feedback_gem.git
cd tdx-feedback_gem
bundle install
bundle exec rspec

Contributing

Bug reports and pull requests are welcome on GitHub.

License

The gem is available as open source under the terms of the MIT License.

About

A gem to be used in LSA Rails applications for creating feedback TDX tickets

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •