Amber: [CLI] Show view too simple

Created on 3 Feb 2018  路  10Comments  路  Source: amberframework/amber

Description

The show view created by the scaffold generator is too simple, it just lists each field in the model in separate paragraphs. It would be better to lay out the show view in a table with a row for each field in the model and the capitalized field name in a TH element and the data in a TD element in each row.

Alternatively as a series of bootstrap rows with a column for the field name and a column for the field data.

Steps to Reproduce

amber generate scaffold MyModel

Versions

0.6.5

cli

Most helpful comment

@damianham It doesn't make sense to me to put the show view in a table, as scaffolding isn't actually considered to be final production code, just a starting point to make your job easier. As it currently stands Amber scaffolding is already less simple than Rails scaffolding. If anything is done to made show look better I think it should still be down with div, span, p etc to make modifications easier. Due to the complexity of tables a lot more code would have to be changed just to make a couple things look different.

All 10 comments

@damianham Thank you for open this issue!

I was thinking on implementing more advanced dashboard or admin page (like django does) using _"amber shards"_ based on Amber::CLI. So, developers would add "amber-dashboard" dependency and then execute bin/dashboard generate, just like amber-saludo does, see: https://github.com/amberframework/amber/issues/573#issuecomment-362360783

I think generating scaffold from different template formats via plugins is a good idea, and maybe the existing scaffold generate should delegate to a default plugin. So would the dashboard present a web page where the developer could choose default options for scaffold generation, ORM, database URL etc? (Sorry I never used django so I don't know what the django dashboard or admin page does)

@damianham feel free to submit a PR :)

@eliasjpr soon as I get a chance I will do.

@damianham It doesn't make sense to me to put the show view in a table, as scaffolding isn't actually considered to be final production code, just a starting point to make your job easier. As it currently stands Amber scaffolding is already less simple than Rails scaffolding. If anything is done to made show look better I think it should still be down with div, span, p etc to make modifications easier. Due to the complexity of tables a lot more code would have to be changed just to make a couple things look different.

@elorest my point is that if the scaffolding produces something that is prettier then there will be less remedial work to turn it into production code. Granted tables are not everyones favourite hence I also suggested using divs and bootstrap classes since we already have bootstrap in the app. I think the best way to do this is with plugins and a configuration item that identifies which plugin to use. Soon as I get a chance I will get onto it.

Been thinking about this and how about we introduce the concept of recipes into amber generate similar to the way that Yoeman generator works. We could have recipes for apps and also for individual components. A recipe could be a recipe created and supported by amber community in a well known location or it could be a URL to a git repository although there might be security issues allowing any URL.

@damianham as long as the contents of the recipe are signed or hashed in a predictable way, I don't think arbitrary urls is a problem.

@damianham
FYI: I am porting "activescaffold". It is still in beta phase and there are many restrictions, but I am glad if you interested in it. 馃樅
https://github.com/maiha/active-scaffold.cr/wiki/CASE:-Natural-key

@maiha to be honest with you I don't think that will be that useful as it breaks the No Hidden Code principle. The point of a scaffold generator is to flesh out basic code that you can use as a starting point for your models, controllers and views. With ActiveScaffold it remains hidden within the gem and instead you supply configuration. I am not a fan basically but don't let me pour cold water on your efforts - much appreciated.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yorci picture yorci  路  6Comments

faustinoaq picture faustinoaq  路  5Comments

drujensen picture drujensen  路  6Comments

blankoworld picture blankoworld  路  7Comments

faustinoaq picture faustinoaq  路  5Comments