Git Product home page Git Product logo

generators's Issues

Admin scaffold

We can provide an administration module like django to consume all CRUD files, and create a default user table for authentication?

Camel Case models break scaffolded views in coffee mode

I need a table for 'packages'. Initializing with --coffee, it won't let me make that table, saying it's a reserved word. It will create it happily if the project is javascript, but I want coffee, and I don't see a NOT coffee switch for the scaffolding.

So I renamed it 'appPackage', trying to stick to javascripty formatting.

That breaks the view--at least, the add view, with:

12| h1 New apppackage
13|
> 14| - var form = formFor(apppackage, {action: pathTo.apppackages(), method: 'POST', id: "apppackage_form", class: 'form-horizontal'})
15|
16| != form.begin()
17| include _form

It looks like the schema and models are keeping the CamelCase, but the views are lowercasing everything?

---- Comment from Anatoliy ----
There's no way to correct this behavior currently using generators. But I
agree this makes life harder sometimes. To fix it need to come up with some
naming convention in model/crud generator. For example always assume model
is camelCase singular word. And then just produce all forms used in app:
lowerCase first camelcase singular for instance name, upperCase first
camelcase singilar for class name, lowerCase first plural for collections.
It also may require some fixes in routing helpers generators. Probably it
worth opening issue in co-generators package.

---- Comment from Neil ----
There's never going to be a way to always get automated plurals and casing correct; there're just too many mutations. It might be simpler in other languages, but English at least is about 90% edge-cases.

I would vote for the above (assume camelCase singular), but possibly with override options (-plural xxxx). .NET uses a -tablename option. -collection, or similar might be good options.

Generated helpers aren't recognized until renamed to [controller]_helper.js

When helpers are generated for a controller, they do not include the _helper suffix.

For example when post crud is created, a file called [projecthome]/app/helpers/posts.js is created. However, it does not show up in the view until it is renamed to [projecthome]/app/helpers/posts_helper.js.

Although the _helper seems redundant, it's currently required in order for the function to be recognized.

crud generators ending with 's' blow up

compound generate crud status

fs.js:338
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^
Error: ENOENT, no such file or directory '/data/home/nbryant/src/nodeapps/compound/cv/app/views/status/_form.ejs'

The controller is named incorrectly (singular statu_controller, rather than plural) and internally refers to 'statu'. Model is correct.

If I pluralize the command (compound g crud statuses), the controller, handler, etc all look correct, and only the model file is wrong (plural filename, plural object internally)... but there is only the one file to fix.

I took a stab at finding the problem, but didn't really get anywhere in the time I have. I see vendor/inflection.js and the rules look OK, but I'm not certain... are the first regexes stripping off 's' at the end of a word?

I've tried this with several other nouns: octopus, alias, bus, and all fail when scaffolded in the singular. Nouns not ending in 's' (ox, person, matrix) all work as expected.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.