Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
9b84cb5
Update Readme
patricksamson Nov 4, 2015
8371b14
Let's stash this for now
patricksamson Jan 30, 2016
657c0e8
Revert "Let's stash this for now"
patricksamson Jan 30, 2016
27c65c8
Fixed it!
patricksamson Jan 30, 2016
7290d59
Default settings are working properly now
patricksamson Jan 30, 2016
f2e9743
Added formatters
patricksamson Feb 11, 2016
4d71d78
Code styling and update Travis
patricksamson Feb 11, 2016
ec275cb
Applied fixes from StyleCI
patricksamson Feb 11, 2016
7a45bad
Merge pull request #9 from Lykegenes/analysis-Xka7EA
patricksamson Feb 11, 2016
2a8d83a
Remove old views
patricksamson Feb 12, 2016
19fdeda
Add some basic test
patricksamson Feb 16, 2016
eea875a
More tests with columns
patricksamson Feb 16, 2016
3fe5104
Test rendering helpers
patricksamson Feb 16, 2016
9e4c67b
fix dev dependencies
patricksamson Feb 16, 2016
39e8987
Added moar tests
patricksamson Feb 17, 2016
a85464d
bump to phpunit ~5.2
patricksamson Feb 17, 2016
f0e05ce
test Travis beta Trusty builds
patricksamson Feb 18, 2016
20bdb9d
Revert "test Travis beta Trusty builds"
patricksamson Feb 18, 2016
c65613e
Add tests
patricksamson Feb 19, 2016
526d8ca
Add more tests
patricksamson Feb 19, 2016
9e80345
Add more tests
patricksamson Feb 19, 2016
37ee15b
Add more tests
patricksamson Feb 19, 2016
992be81
Add more tests
patricksamson Feb 19, 2016
46ae00b
Add more tests
patricksamson Feb 19, 2016
adc5af5
Added more tests
patricksamson Feb 19, 2016
76f5c7b
cleanup and added tests
patricksamson Feb 19, 2016
dcafc7a
added more tests
patricksamson Feb 19, 2016
1574199
cleanup unused objects
patricksamson Feb 19, 2016
710c16f
more tests
patricksamson Feb 19, 2016
5b3b8a8
Update Readme
patricksamson Feb 19, 2016
022f38c
Merge remote-tracking branch 'refs/remotes/origin/master' into bootst…
patricksamson Feb 19, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.blade.php]
indent_style = space
indent_size = 2

[*.yml]
indent_style = space
indent_size = 2
77 changes: 77 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

use Symfony\CS\Config\Config;
use Symfony\CS\FixerInterface;
use Symfony\CS\Finder\DefaultFinder;

$fixers = [
'blankline_after_open_tag',
'braces',
'concat_without_spaces',
'double_arrow_multiline_whitespaces',
'duplicate_semicolon',
'elseif',
'empty_return',
'encoding',
'eof_ending',
'extra_empty_lines',
'function_call_space',
'function_declaration',
'include',
'indentation',
'join_function',
'line_after_namespace',
'linefeed',
'list_commas',
'logical_not_operators_with_successor_space',
'lowercase_constants',
'lowercase_keywords',
'method_argument_space',
'multiline_array_trailing_comma',
'multiline_spaces_before_semicolon',
'multiple_use',
'namespace_no_leading_whitespace',
'no_blank_lines_after_class_opening',
'no_empty_lines_after_phpdocs',
'object_operator',
'operators_spaces',
'parenthesis',
'phpdoc_indent',
'phpdoc_inline_tag',
'phpdoc_no_access',
'phpdoc_no_package',
'phpdoc_scalar',
'phpdoc_short_description',
'phpdoc_to_comment',
'phpdoc_trim',
'phpdoc_type_to_var',
'phpdoc_var_without_name',
'remove_leading_slash_use',
'remove_lines_between_uses',
'return',
'self_accessor',
'short_array_syntax',
'short_echo_tag',
'short_tag',
'single_array_no_trailing_comma',
'single_blank_line_before_namespace',
'single_line_after_imports',
'single_quote',
'spaces_before_semicolon',
'spaces_cast',
'standardize_not_equal',
'ternary_spaces',
'trailing_spaces',
'trim_array_spaces',
'unalign_equals',
'unary_operators_spaces',
'unused_use',
'visibility',
'whitespacy_lines',
];

return Config::create()
->finder(DefaultFinder::create()->in(__DIR__))
->fixers($fixers)
->level(FixerInterface::NONE_LEVEL)
->setUsingCache(true);
12 changes: 12 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
preset: laravel

risky: false

linting: true

finder:
exclude:
- "config"
- "lang"
- "tests"
- "views"
36 changes: 29 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,45 @@
language: php

sudo: false

php:
- 5.5
- 5.6
- 7.0
- hhvm

cache:
directories:
- vendor
- $HOME/.composer/cache

env:
global:
- setup=basic
- COMPOSER_DISCARD_CHANGES=true
- COMPOSER_NO_INTERACTION=1
- COMPOSER_DISABLE_XDEBUG_WARN=1

matrix:
include:
- php: 5.6
env: setup=lowest
- php: 5.6
env: setup=stable

before_install:
- travis_retry composer self-update
- if [ -n "$GH_TOKEN" ]; then composer config github-oauth.github.com ${GH_TOKEN}; fi;
- composer self-update && composer -V

install:
- travis_retry composer install --prefer-source --no-interaction
- if [[ $setup = 'basic' ]]; then travis_retry composer update --prefer-dist; fi
- if [[ $setup = 'stable' ]]; then travis_retry composer update --prefer-dist --prefer-stable; fi
- if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --prefer-stable --prefer-lowest; fi

script:
- if [ "$TRAVIS_PHP_VERSION" == "7.0" ] || [ "$TRAVIS_PHP_VERSION" == "hhvm" ]; then phpunit; fi
- if [ "$TRAVIS_PHP_VERSION" != "7.0" ] && [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then phpunit --coverage-text --coverage-clover=coverage.clover; fi
- vendor/bin/phpunit --coverage-clover build/logs/clover.xml

after_script:
- if [ "$TRAVIS_PHP_VERSION" != "7.0" ] && [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then php vendor/bin/codacycoverage clover coverage.clover; fi
after_success:
- travis_retry php vendor/bin/coveralls

notifications:
email:
Expand Down
29 changes: 11 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
[![Latest Version on Packagist][ico-version]][link-packagist]
[![Software License][ico-license]](LICENSE.md)
[![Build Status][ico-travis]][link-travis]
[![Coverage Status][ico-scrutinizer]][link-scrutinizer]
[![Codacy Badge][ico-codacy]][link-codacy]
[![Code Coverage][ico-coveralls]][link-coveralls]
[![Total Downloads][ico-downloads]][link-downloads]

This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what
PSRs you support to avoid any confusion with users and contributors.
The package is a Laravel wrapper for [Bootstrap Table](https://github.com/wenzhixin/bootstrap-table) JS library. It allows you to quickly build reusable Datatables in your frontend and bind your API as its data source. Notable features are Sorting, Searching, Hide/Show columns, Pagination, and personalized columns.

## Install

Expand All @@ -19,16 +17,19 @@ composer require lykegenes/laravel-datagrid-builder
```

Then, add this to your Service Providers :

``` php
Lykegenes\DatagridBuilder\ServiceProvider::class,
```

...and this to your Aliases :

``` php
'DatagridBuilder' => Lykegenes\DatagridBuilder\Facades\DatagridBuilder::class,
```

Optionally, you can publish and edit the configuration file :

``` bash
php artisan vendor:publish --provider="Lykegenes\DatagridBuilder\ServiceProvider" --tag=config
```
Expand All @@ -37,12 +38,6 @@ php artisan vendor:publish --provider="Lykegenes\DatagridBuilder\ServiceProvider

See the [WIKI](https://github.com/Lykegenes/laravel-datagrid-builder/wiki)

## Testing

``` bash
composer test
```

## Credits

- [Patrick Samson][link-author]
Expand All @@ -52,17 +47,15 @@ composer test

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

[ico-version]: https://img.shields.io/packagist/v/lykegenes/laravel-datagrid-builder.svg?style=flat-square
[ico-license]: https://img.shields.io/packagist/l/lykegenes/laravel-datagrid-builder.svg?style=flat-square
[ico-travis]: https://img.shields.io/travis/Lykegenes/laravel-datagrid-builder/master.svg?style=flat-square
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/lykegenes/laravel-datagrid-builder.svg?style=flat-square
[ico-codacy]: https://api.codacy.com/project/badge/ff95c3e5360649638c61f2834bffd8b2
[ico-downloads]: https://img.shields.io/packagist/dt/lykegenes/laravel-datagrid-builder.svg?style=flat-square
[ico-version]: https://img.shields.io/packagist/v/lykegenes/laravel-datagrid-builder.svg
[ico-license]: https://img.shields.io/packagist/l/lykegenes/laravel-datagrid-builder.svg
[ico-travis]: https://img.shields.io/travis/Lykegenes/laravel-datagrid-builder/master.svg
[ico-coveralls]: https://img.shields.io/coveralls/Lykegenes/laravel-datagrid-builder.svg
[ico-downloads]: https://img.shields.io/packagist/dt/lykegenes/laravel-datagrid-builder.svg

[link-packagist]: https://packagist.org/packages/lykegenes/laravel-datagrid-builder
[link-travis]: https://travis-ci.org/Lykegenes/laravel-datagrid-builder
[link-scrutinizer]: https://scrutinizer-ci.com/g/lykegenes/laravel-datagrid-builder/code-structure
[link-codacy]: https://www.codacy.com/app/Lykegenes/laravel-datagrid-builder
[link-coveralls]: https://coveralls.io/github/Lykegenes/laravel-datagrid-builder
[link-downloads]: https://packagist.org/packages/lykegenes/laravel-datagrid-builder
[link-author]: https://github.com/lykegenes
[link-contributors]: ../../contributors
12 changes: 4 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
"illuminate/http": "~5.1"
},
"require-dev": {
"phpunit/phpunit" : "4.*",
"phpunit/phpunit" : "~5.2",
"mockery/mockery": "0.9.*",
"orchestra/testbench": "~3.0",
"codacy/coverage": "dev-master"
"orchestra/testbench": "~3.1",
"satooshi/php-coveralls": "~1.0",
"illuminate/foundation": "^5.1.3"
},
"autoload": {
"psr-4": {
Expand All @@ -34,11 +35,6 @@
"src/RenderingHelpers.php"
]
},
"autoload-dev": {
"classmap": [
"tests/DatagridBuilderTestCase.php"
]
},
"scripts": {
"test": "phpunit"
},
Expand Down
81 changes: 44 additions & 37 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,55 @@
| HTML elements that will be generated.
|
*/
'default_css' => [
// Will be appended to the <table> element
'datagrid_class' => 'table table-condensed table-hover table-striped',
'datagrid_defaults' => [
'view' => 'datagrid-builder::datagrid',
'attr' => [
// HTML & CSS
'data-classes' => 'table table-striped table-bordered table-hover',

// Will be appended to all the <th> elements
'column_class' => 'table-column',
],
// Data
'data-url' => null,
'data-method' => 'GET',
'data-cache' => true, // Cache Ajax requests.
'data-flat' => true, // requires the "Flat JSON" extension; flattens to a single-level array.
'data-data-field' => 'data', // Which JSON attribute contains the data array?
'data-id-field' => 'id', // Indicate which field is an identity field.

/*
|--------------------------------------------------------------------------
| Available Views
|--------------------------------------------------------------------------
|
| This array contains all the views that can be used to properly
| generate a datagrid.
|
*/
'views' => [
// For client-side processing
'client_datagrid' => 'datagrid-builder::clientDatagrid',
// Sorting
'data-sortable' => true, // False to disable sortable of all columns.

// Pagination
'data-pagination' => true,
'data-side-pagination' => 'client', // 'client' or 'server' with Ajax
'data-page-size' => 10,
'data-page-list' => '[5, 10, 20, 50, All]',

// For server-side processing
'server_datagrid' => 'datagrid-builder::serverDatagrid',
// Search
'data-search' => true,
'data-search-time-out' => 250, // Wait for X ms after last input before firing the search.

// For the table headers
'column' => 'datagrid-builder::column',
// UI
'data-locale' => 'en-US',
'data-show-refresh' => true,
'data-show-toggle' => false, // Toggle for the card view
'data-show-columns' => true, // Menu to show/hide columns.
'data-show-footer' => false, // A summary footer, for totals and such.
],
],

/*
|--------------------------------------------------------------------------
| Default Datagrid View
|--------------------------------------------------------------------------
|
| Set the default view that will be used when generating a datagrid.
| Use one of the keys from the 'views' array above.
|
*/
'default_datagrid_view' => 'client_datagrid',
'column_defaults' => [
'view' => 'datagrid-builder::column',
'attr' => [
'data-sortable' => true,
'data-order' => 'asc',
'data-visible' => true,
'data-searchable' => true,
'data-class' => null, // The column class name.
'data-field' => null, // The column field name.
'data-title' => null, // The column header title text.
],
],

/**
* jQuery Bootgrid assets location
*/
/*
|--------------------------------------------------------------------------
| Assets Location
Expand All @@ -65,7 +72,7 @@
| that you already included it.
|
*/
'css_url' => '//cdnjs.cloudflare.com/ajax/libs/jquery-bootgrid/1.3.1/jquery.bootgrid.min.css',
'js_url' => '//cdnjs.cloudflare.com/ajax/libs/jquery-bootgrid/1.3.1/jquery.bootgrid.min.js',
'css_url' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.9.1/bootstrap-table.min.css',
'js_url' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.9.1/bootstrap-table.min.js',

];
5 changes: 5 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
<directory>./tests/</directory>
</testsuite>
</testsuites>
<testsuites>
<testsuite name="Integration">
<directory>./tests/Integration</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="false">
<directory suffix=".php">./src/</directory>
Expand Down
Loading