Skip to content

Commit 1307d31

Browse files
committed
Merge pull request #10 from Lykegenes/bootstrap-table
Bootstrap table
2 parents 5299344 + 022f38c commit 1307d31

32 files changed

+1076
-1055
lines changed

.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.blade.php]
12+
indent_style = space
13+
indent_size = 2
14+
15+
[*.yml]
16+
indent_style = space
17+
indent_size = 2

.php_cs

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?php
2+
3+
use Symfony\CS\Config\Config;
4+
use Symfony\CS\FixerInterface;
5+
use Symfony\CS\Finder\DefaultFinder;
6+
7+
$fixers = [
8+
'blankline_after_open_tag',
9+
'braces',
10+
'concat_without_spaces',
11+
'double_arrow_multiline_whitespaces',
12+
'duplicate_semicolon',
13+
'elseif',
14+
'empty_return',
15+
'encoding',
16+
'eof_ending',
17+
'extra_empty_lines',
18+
'function_call_space',
19+
'function_declaration',
20+
'include',
21+
'indentation',
22+
'join_function',
23+
'line_after_namespace',
24+
'linefeed',
25+
'list_commas',
26+
'logical_not_operators_with_successor_space',
27+
'lowercase_constants',
28+
'lowercase_keywords',
29+
'method_argument_space',
30+
'multiline_array_trailing_comma',
31+
'multiline_spaces_before_semicolon',
32+
'multiple_use',
33+
'namespace_no_leading_whitespace',
34+
'no_blank_lines_after_class_opening',
35+
'no_empty_lines_after_phpdocs',
36+
'object_operator',
37+
'operators_spaces',
38+
'parenthesis',
39+
'phpdoc_indent',
40+
'phpdoc_inline_tag',
41+
'phpdoc_no_access',
42+
'phpdoc_no_package',
43+
'phpdoc_scalar',
44+
'phpdoc_short_description',
45+
'phpdoc_to_comment',
46+
'phpdoc_trim',
47+
'phpdoc_type_to_var',
48+
'phpdoc_var_without_name',
49+
'remove_leading_slash_use',
50+
'remove_lines_between_uses',
51+
'return',
52+
'self_accessor',
53+
'short_array_syntax',
54+
'short_echo_tag',
55+
'short_tag',
56+
'single_array_no_trailing_comma',
57+
'single_blank_line_before_namespace',
58+
'single_line_after_imports',
59+
'single_quote',
60+
'spaces_before_semicolon',
61+
'spaces_cast',
62+
'standardize_not_equal',
63+
'ternary_spaces',
64+
'trailing_spaces',
65+
'trim_array_spaces',
66+
'unalign_equals',
67+
'unary_operators_spaces',
68+
'unused_use',
69+
'visibility',
70+
'whitespacy_lines',
71+
];
72+
73+
return Config::create()
74+
->finder(DefaultFinder::create()->in(__DIR__))
75+
->fixers($fixers)
76+
->level(FixerInterface::NONE_LEVEL)
77+
->setUsingCache(true);

.styleci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
preset: laravel
2+
3+
risky: false
4+
5+
linting: true
6+
7+
finder:
8+
exclude:
9+
- "config"
10+
- "lang"
11+
- "tests"
12+
- "views"

.travis.yml

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,45 @@
11
language: php
22

3+
sudo: false
4+
35
php:
4-
- 5.5
56
- 5.6
67
- 7.0
78
- hhvm
89

10+
cache:
11+
directories:
12+
- vendor
13+
- $HOME/.composer/cache
14+
15+
env:
16+
global:
17+
- setup=basic
18+
- COMPOSER_DISCARD_CHANGES=true
19+
- COMPOSER_NO_INTERACTION=1
20+
- COMPOSER_DISABLE_XDEBUG_WARN=1
21+
22+
matrix:
23+
include:
24+
- php: 5.6
25+
env: setup=lowest
26+
- php: 5.6
27+
env: setup=stable
28+
929
before_install:
10-
- travis_retry composer self-update
30+
- if [ -n "$GH_TOKEN" ]; then composer config github-oauth.github.com ${GH_TOKEN}; fi;
31+
- composer self-update && composer -V
1132

1233
install:
13-
- travis_retry composer install --prefer-source --no-interaction
34+
- if [[ $setup = 'basic' ]]; then travis_retry composer update --prefer-dist; fi
35+
- if [[ $setup = 'stable' ]]; then travis_retry composer update --prefer-dist --prefer-stable; fi
36+
- if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --prefer-stable --prefer-lowest; fi
1437

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

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

2244
notifications:
2345
email:

README.md

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
[![Latest Version on Packagist][ico-version]][link-packagist]
44
[![Software License][ico-license]](LICENSE.md)
55
[![Build Status][ico-travis]][link-travis]
6-
[![Coverage Status][ico-scrutinizer]][link-scrutinizer]
7-
[![Codacy Badge][ico-codacy]][link-codacy]
6+
[![Code Coverage][ico-coveralls]][link-coveralls]
87
[![Total Downloads][ico-downloads]][link-downloads]
98

10-
This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what
11-
PSRs you support to avoid any confusion with users and contributors.
9+
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.
1210

1311
## Install
1412

@@ -19,16 +17,19 @@ composer require lykegenes/laravel-datagrid-builder
1917
```
2018

2119
Then, add this to your Service Providers :
20+
2221
``` php
2322
Lykegenes\DatagridBuilder\ServiceProvider::class,
2423
```
2524

2625
...and this to your Aliases :
26+
2727
``` php
2828
'DatagridBuilder' => Lykegenes\DatagridBuilder\Facades\DatagridBuilder::class,
2929
```
3030

3131
Optionally, you can publish and edit the configuration file :
32+
3233
``` bash
3334
php artisan vendor:publish --provider="Lykegenes\DatagridBuilder\ServiceProvider" --tag=config
3435
```
@@ -37,12 +38,6 @@ php artisan vendor:publish --provider="Lykegenes\DatagridBuilder\ServiceProvider
3738

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

40-
## Testing
41-
42-
``` bash
43-
composer test
44-
```
45-
4641
## Credits
4742

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

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

55-
[ico-version]: https://img.shields.io/packagist/v/lykegenes/laravel-datagrid-builder.svg?style=flat-square
56-
[ico-license]: https://img.shields.io/packagist/l/lykegenes/laravel-datagrid-builder.svg?style=flat-square
57-
[ico-travis]: https://img.shields.io/travis/Lykegenes/laravel-datagrid-builder/master.svg?style=flat-square
58-
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/lykegenes/laravel-datagrid-builder.svg?style=flat-square
59-
[ico-codacy]: https://api.codacy.com/project/badge/ff95c3e5360649638c61f2834bffd8b2
60-
[ico-downloads]: https://img.shields.io/packagist/dt/lykegenes/laravel-datagrid-builder.svg?style=flat-square
50+
[ico-version]: https://img.shields.io/packagist/v/lykegenes/laravel-datagrid-builder.svg
51+
[ico-license]: https://img.shields.io/packagist/l/lykegenes/laravel-datagrid-builder.svg
52+
[ico-travis]: https://img.shields.io/travis/Lykegenes/laravel-datagrid-builder/master.svg
53+
[ico-coveralls]: https://img.shields.io/coveralls/Lykegenes/laravel-datagrid-builder.svg
54+
[ico-downloads]: https://img.shields.io/packagist/dt/lykegenes/laravel-datagrid-builder.svg
6155

6256
[link-packagist]: https://packagist.org/packages/lykegenes/laravel-datagrid-builder
6357
[link-travis]: https://travis-ci.org/Lykegenes/laravel-datagrid-builder
64-
[link-scrutinizer]: https://scrutinizer-ci.com/g/lykegenes/laravel-datagrid-builder/code-structure
65-
[link-codacy]: https://www.codacy.com/app/Lykegenes/laravel-datagrid-builder
58+
[link-coveralls]: https://coveralls.io/github/Lykegenes/laravel-datagrid-builder
6659
[link-downloads]: https://packagist.org/packages/lykegenes/laravel-datagrid-builder
6760
[link-author]: https://github.com/lykegenes
6861
[link-contributors]: ../../contributors

composer.json

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
"illuminate/http": "~5.1"
2222
},
2323
"require-dev": {
24-
"phpunit/phpunit" : "4.*",
24+
"phpunit/phpunit" : "~5.2",
2525
"mockery/mockery": "0.9.*",
26-
"orchestra/testbench": "~3.0",
27-
"codacy/coverage": "dev-master"
26+
"orchestra/testbench": "~3.1",
27+
"satooshi/php-coveralls": "~1.0",
28+
"illuminate/foundation": "^5.1.3"
2829
},
2930
"autoload": {
3031
"psr-4": {
@@ -34,11 +35,6 @@
3435
"src/RenderingHelpers.php"
3536
]
3637
},
37-
"autoload-dev": {
38-
"classmap": [
39-
"tests/DatagridBuilderTestCase.php"
40-
]
41-
},
4238
"scripts": {
4339
"test": "phpunit"
4440
},

config/config.php

Lines changed: 44 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -11,48 +11,55 @@
1111
| HTML elements that will be generated.
1212
|
1313
*/
14-
'default_css' => [
15-
// Will be appended to the <table> element
16-
'datagrid_class' => 'table table-condensed table-hover table-striped',
14+
'datagrid_defaults' => [
15+
'view' => 'datagrid-builder::datagrid',
16+
'attr' => [
17+
// HTML & CSS
18+
'data-classes' => 'table table-striped table-bordered table-hover',
1719

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

22-
/*
23-
|--------------------------------------------------------------------------
24-
| Available Views
25-
|--------------------------------------------------------------------------
26-
|
27-
| This array contains all the views that can be used to properly
28-
| generate a datagrid.
29-
|
30-
*/
31-
'views' => [
32-
// For client-side processing
33-
'client_datagrid' => 'datagrid-builder::clientDatagrid',
28+
// Sorting
29+
'data-sortable' => true, // False to disable sortable of all columns.
30+
31+
// Pagination
32+
'data-pagination' => true,
33+
'data-side-pagination' => 'client', // 'client' or 'server' with Ajax
34+
'data-page-size' => 10,
35+
'data-page-list' => '[5, 10, 20, 50, All]',
3436

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

38-
// For the table headers
39-
'column' => 'datagrid-builder::column',
41+
// UI
42+
'data-locale' => 'en-US',
43+
'data-show-refresh' => true,
44+
'data-show-toggle' => false, // Toggle for the card view
45+
'data-show-columns' => true, // Menu to show/hide columns.
46+
'data-show-footer' => false, // A summary footer, for totals and such.
47+
],
4048
],
4149

42-
/*
43-
|--------------------------------------------------------------------------
44-
| Default Datagrid View
45-
|--------------------------------------------------------------------------
46-
|
47-
| Set the default view that will be used when generating a datagrid.
48-
| Use one of the keys from the 'views' array above.
49-
|
50-
*/
51-
'default_datagrid_view' => 'client_datagrid',
50+
'column_defaults' => [
51+
'view' => 'datagrid-builder::column',
52+
'attr' => [
53+
'data-sortable' => true,
54+
'data-order' => 'asc',
55+
'data-visible' => true,
56+
'data-searchable' => true,
57+
'data-class' => null, // The column class name.
58+
'data-field' => null, // The column field name.
59+
'data-title' => null, // The column header title text.
60+
],
61+
],
5262

53-
/**
54-
* jQuery Bootgrid assets location
55-
*/
5663
/*
5764
|--------------------------------------------------------------------------
5865
| Assets Location
@@ -65,7 +72,7 @@
6572
| that you already included it.
6673
|
6774
*/
68-
'css_url' => '//cdnjs.cloudflare.com/ajax/libs/jquery-bootgrid/1.3.1/jquery.bootgrid.min.css',
69-
'js_url' => '//cdnjs.cloudflare.com/ajax/libs/jquery-bootgrid/1.3.1/jquery.bootgrid.min.js',
75+
'css_url' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.9.1/bootstrap-table.min.css',
76+
'js_url' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.9.1/bootstrap-table.min.js',
7077

7178
];

phpunit.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
<directory>./tests/</directory>
1616
</testsuite>
1717
</testsuites>
18+
<testsuites>
19+
<testsuite name="Integration">
20+
<directory>./tests/Integration</directory>
21+
</testsuite>
22+
</testsuites>
1823
<filter>
1924
<whitelist addUncoveredFilesFromWhitelist="false">
2025
<directory suffix=".php">./src/</directory>

0 commit comments

Comments
 (0)