OSC / osc_machete_rails

Rails engine + plugin for managing batch simulations (currently OSC specific)
MIT License
0 stars 0 forks source link

Remove "Add Simulation" from rails app template and inject with scaffold. #3

Open brianmcmichael opened 8 years ago

brianmcmichael commented 8 years ago

The Rails Application Template includes a link to "Add Simulation" which is empty.

addsim

This could be removed from the template and then added back in to applicaton.html.erb as a titlized link when the developer calls the scaffold by using Thor's insert_into_file method.

http://www.rubydoc.info/github/wycats/thor/Thor/Actions#insert_into_file-instance_method

addsim2

nickjer commented 8 years ago

I get nervous about apps that have multiple workflows.

You might be able to setup the layout navbar to yield variables passed from the corresponding views with content_for. For example...

Apps / CoolSim / Geometries (+ Add Geometry) Apps / CoolSim / HeatAnalysis (+ Add HeatAnalysis)

and if there is nothing to yield then default to nothing...

Apps / CoolSim

brianmcmichael commented 8 years ago

The developer can remove the links. Right now "Add simulations" is hardcoded and links to "#", so it isn't doing much good.

The scaffold already generates the route as part of it's magic, and we're just providing a link to that route. As it is, there's not a good way to navigate to new controllers after generating them.

nickjer commented 8 years ago

Problem is if he edits the link and then adds a model it will overwrite his changes. Or if he adds a second model it will then overwrite those changes.

brianmcmichael commented 8 years ago

No, I see this as just an insert as part of the scaffold. 1 scaffold == 1 workflow, so running the scaffold would add a new link to the navbar. If there are multiple workflows there would be multiple links. You shouldn't be running a scaffold to create a model.

nickjer commented 8 years ago

When I say model, I secretly mean workflow, hah. I am saying that we have multiple apps with multiple workflows. So we don't want to overwrite the user's html everytime they scaffold a new workflow.

brianmcmichael commented 8 years ago

Basically you put a comment or something into the application template and Thor's 'insert_into_file' method finds that comment and inserts the code, it doesn't change or overwrite anything that's already there.

nickjer commented 8 years ago

I propose we add content_for tags in the workflow scaffold views that manipulate the navbar as such:

image

Maybe remove the My Containers as the Containers in the breadcrumbs will navigate the user to the index page for containers.

This would work for multiple workflows (i.e., Containers and Structures) depending on the route the user goes to.