efureev/yii2-tagsinput

This package is abandoned and no longer maintained. No replacement package was suggested.

Bootstrap Tags Input is a jQuery plugin providing a Twitter Bootstrap user interface for managing tags.

Installs: 10

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 1

Open Issues: 0

Type:yii2-extension

0.1.1 2016-09-07 12:59 UTC

This package is auto-updated.

Last update: 2024-04-29 02:42:37 UTC


README

GitHub version Build Status Dependency Status Code Climate Test Coverage

without Model

var inputUsers = $('<input type="text">'),
    users = new Bloodhound({
        datumTokenizer: Bloodhound.tokenizers.obj.whitespace('title'),
        queryTokenizer: Bloodhound.tokenizers.whitespace,
        prefetch      : {
            url   : '/users.json',
            cache : false,
            filter: function (list) {
                return $.map(list, function (users) {
                    return {text: user.name};
                });
            }
        }
    });
hubs.initialize();

inputUsers.tagsinput({
    typeaheadjs: {
        displayKey: 'text',
        trimValue : true,
        valueKey  : 'text',
        name      : 'users',
        source    : users.ttAdapter()
    }
});

with Model

<?= $form->field($model, 'users', ['options' => [
    'class' => 'form-group',
]])->widget(
    \efureev\tagsinput\TagsInput::className(),
    [
        'preJS' => 'var users = new Bloodhound({
            datumTokenizer: Bloodhound.tokenizers.obj.whitespace("title"),
            queryTokenizer: Bloodhound.tokenizers.whitespace,
            prefetch : { url : "/users", cache : false,
                filter: function (list) {
                    return $.map(list, function (user) {
                        return {text: user.name};
                    });
                }
            }
        });',
        'clientOptions' => [
            'typeaheadjs' => [
                'displayKey' => 'text',
                'trimValue'  => true,
                'valueKey'   => 'text',
                'name'       => 'users',
                'source'     => new \yii\web\JsExpression('users.ttAdapter()')
            ]
        ]
    ]
);
?>

Tests

vendor/bin/phpunit