Comments (8)
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.
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.
@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.
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.
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.
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:
from meteor-cfs-autoform.
@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.
@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)
- How do you add a before insert hook on this?
- Update for deeply nested cfs-file's broken HOT 2
- cfs-files (the multi version) does not work HOT 2
- Customize the ui "field" for multiple files
- this.template is undefined when before hook is a function HOT 1
- Exception in delivering result of invoking 'myServerMethod': Error: [[object Object]]
- file upload not working in IOS simulator
- Before hooks not work
- CfsAutoForm.Hooks.beforeInsert() is called, but after my Meteor.call() to save the form HOT 3
- Not a valid enum value HOT 1
- Error on the exemple code
- File Validation
- How to add an image preview to the update page? HOT 1
- how to display images of a array?
- Validation bug
- How to restrict file type?
- AutoForm 6.0 support. HOT 2
- How to subscribe cfs-files
- Incompatiple when adding cfs:autoform
- update form!!!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meteor-cfs-autoform.