Class: CybertrainJobsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- CybertrainJobsController
- Defined in:
- docs/api/stubs/generated_app.rb
Overview
What spin run gen writes into gen/controllers.rb for
jobs_page "/admin/jobs", before_action: :require_admin in
config/routes.rb (Cybertrain::Gen::Mapper#jobs_page): the jobs page’s
controller, after the application’s own. It inherits ApplicationController,
so the application’s layout, CSRF protection and helpers apply; the
before_action line is there only when jobs_page names one (without it
the page is open, and spin run gen prints a warning). The guard runs
after ApplicationController’s own callbacks (with generate
authentication, a visitor is sent to sign in first), unless jobs_page
also gives skip_before_action:: then a skip_before_action line leaves
that one inherited callback out. generate authentication draws
jobs_page "/admin/jobs", before_action: :require_admin,
skip_before_action: :require_authentication, so require_admin alone
answers a visitor, with a 404 rather than a redirect that shows the page
exists. The actions hand
the work to Cybertrain::JobsPage; the POST ones redirect back to the page
(303) with a flash notice. retry is a Ruby keyword, so the routes call
<action>_action methods for the row and bulk actions:
| Verb | Path | Action | Method |
|---|---|---|---|
| GET | /admin/jobs |
index |
index |
| POST | /admin/jobs/retry_all |
retry_all |
retry_all_action |
| POST | /admin/jobs/discard_all |
discard_all_failed |
discard_all_failed_action |
| POST | /admin/jobs/:id/retry |
retry |
retry_action |
| POST | /admin/jobs/:id/discard |
discard |
discard_action |
| POST | /admin/jobs/:id/delete |
delete |
delete_action |
Instance Method Summary collapse
-
#delete_action ⇒ nil
Deletes the failed or discarded job
params[:id](Cybertrain::JobsPage.delete_job). -
#discard_action ⇒ nil
Discards the failed job
params[:id](Cybertrain::JobsPage.discard_job). -
#discard_all_failed_action ⇒ nil
Discards every failed job (Cybertrain::JobsPage.discard_all_failed).
-
#index ⇒ nil
The page (Cybertrain::JobsPage.page_html),
?page=N, in the layout. -
#retry_action ⇒ nil
Queues the failed or discarded job
params[:id]again (Cybertrain::JobsPage.retry_job). -
#retry_all_action ⇒ nil
Queues every failed job again (Cybertrain::JobsPage.retry_all).
Instance Method Details
#delete_action ⇒ nil
Deletes the failed or discarded job params[:id]
(Cybertrain::JobsPage.delete_job).
1031 1032 1033 1034 |
# File 'docs/api/stubs/generated_app.rb', line 1031 def delete_action flash[:notice] = Cybertrain::JobsPage.delete_notice(params[:id]) redirect_to "/admin/jobs", status: :see_other end |
#discard_action ⇒ nil
Discards the failed job params[:id] (Cybertrain::JobsPage.discard_job).
1022 1023 1024 1025 |
# File 'docs/api/stubs/generated_app.rb', line 1022 def discard_action flash[:notice] = Cybertrain::JobsPage.discard_notice(params[:id]) redirect_to "/admin/jobs", status: :see_other end |
#discard_all_failed_action ⇒ nil
Discards every failed job (Cybertrain::JobsPage.discard_all_failed).
1005 1006 1007 1008 |
# File 'docs/api/stubs/generated_app.rb', line 1005 def discard_all_failed_action flash[:notice] = Cybertrain::JobsPage.discard_all_failed_notice redirect_to "/admin/jobs", status: :see_other end |
#index ⇒ nil
The page (Cybertrain::JobsPage.page_html), ?page=N, in the layout.
990 991 992 |
# File 'docs/api/stubs/generated_app.rb', line 990 def index render html: Cybertrain::JobsPage.page_html(self, "/admin/jobs") end |
#retry_action ⇒ nil
Queues the failed or discarded job params[:id] again
(Cybertrain::JobsPage.retry_job).
1014 1015 1016 1017 |
# File 'docs/api/stubs/generated_app.rb', line 1014 def retry_action flash[:notice] = Cybertrain::JobsPage.retry_notice(params[:id]) redirect_to "/admin/jobs", status: :see_other end |
#retry_all_action ⇒ nil
Queues every failed job again (Cybertrain::JobsPage.retry_all).
997 998 999 1000 |
# File 'docs/api/stubs/generated_app.rb', line 997 def retry_all_action flash[:notice] = Cybertrain::JobsPage.retry_all_notice redirect_to "/admin/jobs", status: :see_other end |