AmpersandJS / ampersand

Quickest way to get started with ampersand.
MIT License
812 stars 41 forks source link

CLI-generated form doesn't generate input for `date` properties from the model #101

Open e2jk opened 9 years ago

e2jk commented 9 years ago

A model with these props:

    props: {
        id: 'any',
        abbreviation: ['string', true, ''],
        description: ['string', false, ''],
        notes: ['string', false, ''],
        fromDate: ['date', false, ''],
        toDate: ['date', false, ''],
        numberOfRecords: ['number', false, '']
    },

generates the following form by calling $ ampersand gen form client/models/object.js:

var FormView = require("ampersand-form-view");
var InputView = require("ampersand-input-view");

module.exports = FormView.extend({
    fields: function () {
        return [
            new InputView({
                label: "Abbreviation",
                name: "abbreviation",
                value: this.model.abbreviation || "",
                required: false,
                placeholder: "Abbreviation",
                parent: this
            }),
            new InputView({
                label: "Description",
                name: "description",
                value: this.model.description || "",
                required: false,
                placeholder: "Description",
                parent: this
            }),
            new InputView({
                label: "Notes",
                name: "notes",
                value: this.model.notes || "",
                required: false,
                placeholder: "Notes",
                parent: this
            }),
            new InputView({
                label: "Number Of Records",
                name: "numberOfRecords",
                value: this.model.numberOfRecords || "",
                required: false,
                placeholder: "Number Of Records",
                parent: this
            })
        ];
    }
});

Where are the fromDate and toDate inputs? Note that they are defined as date dataType in the model.

e2jk commented 9 years ago

Note that until now I have only had models that use the dataTypes string, number and date, and have only encountered this issue with date. This issue needs to be checked for the other dataTypes (boolean, array, object, any and custom dataTypes)