Giter Club home page Giter Club logo

Comments (8)

aldeed avatar aldeed commented on July 4, 2024

This is an add-on package, so the core autoform pkg is not aware of it. I guess we would have to devise a good way to allow external packages to register their own component selector functions. This would be a good improvement in general, since it would separate and harden that code a bit. Currently it just looks at the type, whether there are options, etc. and figures out which template type should be used. Ideally external packages should be able to benefit from the template attribute logic, too.

from meteor-cfs-autoform.

SachaG avatar SachaG commented on July 4, 2024

Oh ok. I think that's the main feature I would need to use Autoform throughout Telescope.

To recap, what I want to do is use quickform to dynamically generate all submit/edit forms so that it becomes possible to add fields to posts or comments just by adding these fields to the schema, without modifying the actual templates.

But I want to use custom components for a few fields (specifically, I'm thinking about a datetime picker) so I guess I'll have to wait until quickform supports them, too.

from meteor-cfs-autoform.

aldeed avatar aldeed commented on July 4, 2024

@SachaG, I've released autoform 4.0.0-rc1 and cfs-autoform 2.0.0-rc1. Using these together, you should be able to get the custom upload control in your quickforms.

Examples:

Collections.Docs = new Mongo.Collection("docs");
Collections.Docs.attachSchema(new SimpleSchema({
  name: {
    type: String
  },
  fileId: {
    type: String,
    autoform: {
      type: "cfs-file",
      collection: "files"
    }
  }
}));

Collections.Docs2 = new Mongo.Collection("docs2");
Collections.Docs2.attachSchema(new SimpleSchema({
  name: {
    type: String
  },
  fileId: {
    type: [String],
    autoform: {
      type: "cfs-files",
      collection: "files"
    }
  }
}));

This makes use of the new autoform component feature, which I haven't yet documented, hence the RC versions. Basically you can register any component to handle a particular type attribute. AutoForm has built-in components for all of the HTML5 input types, plus special ones like "select", "contenteditable", etc. In the case of this package, it's simply adding the "cfs-file" and "cfs-files" types.

from meteor-cfs-autoform.

SachaG avatar SachaG commented on July 4, 2024

Wow, the ability to add type:color and have a color input out of the box is so awesome! I feel like this is a major step towards having reusable UI widgets. History is being made here :)

(Although type:color is probably a bad example because the default widget is really bad. Will probably need to create my own type: betterColor wrapper or something…)

from meteor-cfs-autoform.

aldeed avatar aldeed commented on July 4, 2024

Thanks, the current method for making the custom widgets seems slightly less elegant than I want it to be, but I think it will get there eventually. The tough restructuring part is done, so it should just be incremental improvements from here.

The way it currently works, you can actually register your own type:color control and it will then use that one instead of the built-in/browser's. So you could make a pkg that does that for a "magic shim" effect, or you could register it as betterColor and then have the ability to use either one.

Just gotta get everything documented and tweak a few more aspects...

from meteor-cfs-autoform.

JamesLefrere avatar JamesLefrere commented on July 4, 2024

I just want to chime in and say how damn cool this integration is with the snippet above 👍

Now it can be used with https://atmospherejs.com/yogiben/admin like so:

image

from meteor-cfs-autoform.

SantoshSrinivas79 avatar SantoshSrinivas79 commented on July 4, 2024

@JamesLefrere, I am trying to do this. What were the changes you needed to make to https://atmospherejs.com/yogiben/admin to get this working?

from meteor-cfs-autoform.

aldeed avatar aldeed commented on July 4, 2024

@fountainhead, I released cfs:autoform 2.0.0. No time to test it at the moment, but see the updated readme. It should work with latest admin/autoform.

https://github.com/aldeed/meteor-cfs-autoform

from meteor-cfs-autoform.

Related Issues (20)

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.