Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spike on data dashboard; pull in full Bootstrap CSS and JS #131

Merged
merged 1 commit into from
Sep 10, 2020

Conversation

bensheldon
Copy link
Owner

@bensheldon bensheldon commented Sep 7, 2020

Connects to #50

Screen Shot 2020-09-07 at 2 15 48 PM

@bensheldon bensheldon force-pushed the engine_spike branch 3 times, most recently from d21f509 to 20131e4 Compare September 10, 2020 00:47
@bensheldon
Copy link
Owner Author

bensheldon commented Sep 10, 2020

  • Add engine directory to Gemspec
  • Extract ordering to a scope like display_all, so that later can have display_upcoming, display_errored, display_finished.

@bensheldon bensheldon merged commit c842881 into main Sep 10, 2020
@bensheldon bensheldon deleted the engine_spike branch September 10, 2020 22:20
@morgoth
Copy link
Collaborator

morgoth commented Sep 11, 2020

@bensheldon I wanted to try the engine but it doesn't load for me.
I'm using the gem from master branch, but I cannot require "good_job/engine".

I can also see that it is not in load path as stated in https://github.com/bensheldon/good_job/blob/main/good_job.gemspec#L2

> pp $LOAD_PATH.grep /good_job/
=> ["/home/wojtek/.asdf/installs/ruby/2.6.6/lib/ruby/gems/2.6.0/bundler/gems/good_job-c84288185da6/lib"]

Do I need to do some extra setup to make it work?

@bensheldon
Copy link
Owner Author

@morgoth thank you for taking the time to try to get it working. I am investigating.

@bensheldon
Copy link
Owner Author

@morgoth I have a PR (#134) that I think fixes the problem. Could you try it out locally and give me feedback? Here's some preliminary documentation:

  1. Explicitly require the Engine code at the top of your config/application.rb file, immediately after Rails is required. This is necessary because the mountable engine is an optional feature of GoodJob.

    # config/application.rb
    require_relative 'boot'
    
    require 'rails/all'
    require 'good_job/engine' # <= Add this line
    # ...
  2. Mount the engine in your config/routes.rb file. The following will mount it at the example.com/good_job` URL.

    # config/routes.rb
    # ...
    mount GoodJob::Engine => 'good_job'

    Because jobs can potentially contain sensitive information, you should have authorization. For example, using Devise's authenticate helper, that might look like:

    # config/routes.rb
    # ...
    authenticate :user, ->(user) { user.admin? } do
      mount GoodJob::Engine => 'good_job'
    end

Thank you 🙏

@bensheldon bensheldon added the enhancement New feature or request label Sep 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants