Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom type definition directions #622

Closed
armellarcier opened this issue Aug 26, 2015 · 4 comments
Closed

Custom type definition directions #622

armellarcier opened this issue Aug 26, 2015 · 4 comments

Comments

@armellarcier
Copy link
Contributor

Hey all!
I need directions to create a custom field type.
I store arrays of json objects in one of my models and I need a field to sort that array.
It would basically display a sortable list.
Problem is, the directions given in doc/Custom-types.md don't say in what environment to work.
Should I fork admin-config and add my new type in there, then fork ng-admin, update the admin-config dependency to match my repository and build the minified js??

As you can see, I'm pretty lost here.

Thanks in advance and cheers to your work!

@armellarcier
Copy link
Contributor Author

The this I'm trying to accomplish is "pretty simple" : a sortable reference_many field type with the possibility of having objects of different types (entity) in the reference array :

The feed gives me :

{
    "appId": "55e00f7c7a988f9660cdc442",
    "name": "First category",
    "categories": null,
    "children": [
      {
        "type": "category",
        "id": "55e013727a988f9660cdc446"
      },
      {
        "type": "category",
        "id": "55e013907a988f9660cdc448"
      },
      {
        "type": "post",
        "id": "55e013b17a988f9660cdc449"
      },
      {
        "type": "post",
        "id": "55e013b97a988f9660cdc44a"
      }
    ],
    "id": "55e0135a7a988f9660cdc445"
  }

And I need to display each object of children in a sortable list and be able to save that array.
as you can see, type references the entity the object refers to.

I guess I have to create a custom field type but I don't know whether I'll need to for both ng-admin and ng-config or just extend a view...

@sylvainlap
Copy link

+1

@fzaninotto
Copy link
Member

This really depends on which tools you're using (requirejs, browserify, webpack). Let me work on an example for webpack and publish it so that you can see a reference implementation.

@armellarcier
Copy link
Contributor Author

yay! I guess I'll need to work on sources and build on the fly then? Thanks! I'm really looking forward to this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants