OSC / ood_appkit

https://osc.github.io/Open-OnDemand/
MIT License
1 stars 2 forks source link

Provide custom "starting page" for OOD Appkit apps #29

Open ericfranz opened 7 years ago

ericfranz commented 7 years ago

We removed generating the "static pages" for About that would display initially via the Rails application template. The result is a newly created app, running the template, results in this page once gems are installed:

These directions are incorrect/incomplete for our environment.

Instead of generating static pages, we can just have the rails application template have root point to a controller/view that is embedded in ood_appkit.

  1. design and add a "static" starting page (controller + erb)
  2. update rails application template to set the root route to this page

    Other options/thoughts:

Instead of doing this, if we took Jeremy's suggestion with a default table for workflows etc., we could initialize with 2 tables (using STI) for both jobs and workflows and provide default index etc. pages in ood_appkit that use this. Similar to how devise works, the views would be in ood_appkit and the user could just generate and create models (without any generators required).

Then the starting page could be the index page instead (the start of a working application).

This would make a "pre-built" app much more appealing, because to build a simple app, theoretically, you would just need to copy, run rake db:migrate or rake db:setup, and then:

  1. add and modify models
  2. add corresponding job templates

This is getting closer to a version of BatchSim, though.

┆Issue is synchronized with this Asana task by Unito

brianmcmichael commented 7 years ago

Devise contains views within the gem, but also includes a feature to copy those views into the app for modification. We should assume that our default views will be unsatisfactory for a developer and provide the option to write them into the file, if we go this route.

ericfranz commented 7 years ago

If config.rb doesn't have a root route specified, is it possible to have a default one specified by an engine?

brianmcmichael commented 7 years ago

I haven't found a way to do this via an engine. I looked into how Devise does it and they modify an app's config/routes.rb file to point to the Devise controller when using the rails generate devise MODEL command.

ericfranz commented 7 years ago

Just a guess. A rails engine that isn't namespace isolated should be able specify a root route in the engine's config/routes.rb file and perhaps this will become the default if no root route is specified in the application's config/routes.rb. Not sure.

ericfranz commented 7 years ago

Actually I don't think my suggestion would work. While engines that are not isolated share models, controllers, and helpers with the application itself, there is no mention of routes defined in an engine working this way: http://edgeapi.rubyonrails.org/classes/Rails/Engine.html

ericfranz commented 7 years ago

Can an engine detect if there is a root route set, and if not, set it during initialization?

ericfranz commented 7 years ago

Define a root in rails engine to specify towards the end so the user routes.rb specifies it, that is used, otherwise this is used.