Git Product home page Git Product logo

symfony-collection's Introduction

A2LiX JS - symfony-collection

Manage your Symfony Form collection simply with vanilla JS

npm version

Install

As first thing you need to pull the package using yarn or npm

yarn add @a2lix/symfony-collection

or

npm install @a2lix/symfony-collection

Then you can either import it in your files using ES6

import a2lix_lib from '@a2lix/symfony-collection/src/a2lix_sf_collection';

or symlink/copy/move it in a folder and reference it directly in a script tag

How to

After you loaded the dist version of a2lix_sf_collection.min.js file or imported through ES6 method, init a2lix_lib.sfCollection, optionnaly with custom configuration.

Default configuration:

a2lix_lib.sfCollection.init({
    collectionsSelector: 'form div[data-prototype]',
    manageRemoveEntry: true,
    lang: {
      add: 'Add',
      remove: 'Remove'
    }
})

Example

<script src="__PATH_TO__a2lix_sf_collection.min.js"></script>

<script>
// A global initialization on all Symfony Form collection with manageRemoveEntry feature enable
a2lix_lib.sfCollection.init()


// OR a custom initialization with restricted scope of Symfony Form collection with manageRemoveEntry feature disable
a2lix_lib.sfCollection.init({
    collectionsSelector: 'form div[data-a2lix-collection]',
    manageRemoveEntry: false
})
</script>

Contribute help

docker run -it --rm --user $(id -u):$(id -g) --name a2lix_nodejs -v "$PWD":/usr/src/app -w /usr/src/app node:alpine npm install
docker run -it --rm --user $(id -u):$(id -g) --name a2lix_nodejs -v "$PWD":/usr/src/app -w /usr/src/app node:alpine npm run build

Demo

See Demo project.

symfony-collection's People

Contributors

webda2l avatar phaberest avatar dop3 avatar romainlegouverneur avatar

Watchers

James Cloos avatar

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.