TaxonWorks Docs
Guide
Develop
About
Start a project
Cite
API
Bug report
Contact
  • Docs
  • Code
  • API
  • English
  • Español
Guide
Develop
About
Start a project
Cite
API
Bug report
Contact
  • Docs
  • Code
  • API
  • English
  • Español
  • Develop
    • Overview
    • Contributing
    • Install
      • Development
        • Overview
        • Native
          • Operating Systems
          • Arch Linux
          • macOS
          • Ubuntu 22.04
          • Ubuntu 24.04
          • Windows 10 with WSL2
        • Docker
          • Build and push the development container to Docker
          • Docker
          • Windows 10 with WSL2
      • Production
        • Overview
        • Kubernetes
          • Overview
        • Capistrano
          • Overview
      • Overview
    • Code
      • Overview
      • Development Environment
      • Features
        • Scenarios
        • Scaffolding
        • Help bubbles
        • Rake task
        • Radial
        • TaxonWorks task
        • Tests
      • Conventions
      • Contributing
      • Troubleshoot
      • Roadmap
    • Data
      • Overview
      • Models
      • Tables
This site uses VuePress, a static site generator

TaxonWorks task

You can stub all the basic code for a new task using a generator. The result of this call is a new blank card in Tasks that leads you to a new blank interface. See the code base for more.

rails generate taxon_works:task ...

To create a Vue.js-based stub use the --vue flag. When using this parameter do not include method params:

rails generate taxon_works:task print_labels labels/ --vue

You can use -p to "practice" running the generator (no files are written/changed).

As in the model-generating case, if you're developing using Docker then you'll be running bin/rails generate from a Docker app shell.

  • If you're on linux or mac then any new files created by the command will be owned by root in your local taxonworks folder. See Scaffolding a new model for a command to fix that.

Non-Vue.js-based tasks use the standard Rails routes/controller/views directory structure.

Vue.js app files, on the other hand, are located in app/javascript/vue/tasks/ - for example the generator command above will create a file app/javascript/vue/tasks/labels/print_labels/app.vue where you can start writing your Vue app.

Another difference: while pure-Rails tasks will typically get access to controller data via html.erb files, Vue-based tasks will instead retrieve that data via ajax calls to controller actions which will return json data from json.jbuilder view files. Those data-fetching ajax routines are referred to as endpoints, e.g. Otu endpoints for retrieving Otu-related data can be found in app/javascript/vue/routes/endpoints/Otu.js. If you're writing a task related to a new model, one of your first tasks will likely be creating new endpoints for your model so that you can retrieve data for your task.

  • If your task uses an id query parameter to load content related to that id, the TaxonWorks convention is to name the query parameter <model>_id. Thus the Browse Otus task, for example, uses a query parameter of the form ?otu_id=1 to browse to the Otu with id 1.
Edit this page
Last Updated:
Contributors: mjy
Prev
Radial
Next
Tests