Skip to content

Commit 2e9c2dc

Browse files
Initial commit
1 parent 7d73abd commit 2e9c2dc

33 files changed

+13939
-1
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/vendor/
2+
/node_modules/
3+
/.idea/
4+
5+
yarn-error.log

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 HelloSebastian
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public function index(Request $request, HelloBootstrapTableFactory $tableFactory
246246
{% extends 'base.html.twig' %}
247247

248248
{% block body %}
249-
{{ hello_bootstrap_table_render_html(table) }}
249+
{{ hello_bootstrap_table_render(table) }}
250250
{% endblock %}
251251
```
252252

assets/app.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
require('bootstrap-table/dist/bootstrap-table.min.css');
2+
require('bootstrap-table/dist/extensions/sticky-header/bootstrap-table-sticky-header.min.css');
3+
require("bootstrap-table/dist/extensions/page-jump-to/bootstrap-table-page-jump-to.min.css");
4+
require('./css/styles.css');
5+
6+
require('bootstrap-table/dist/bootstrap-table.min');
7+
require('bootstrap-table/dist/extensions/export/bootstrap-table-export.min');
8+
require('bootstrap-table/dist/extensions/cookie/bootstrap-table-cookie.min');
9+
require('bootstrap-table/dist/extensions/sticky-header/bootstrap-table-sticky-header.min');
10+
require('bootstrap-table/dist/extensions/toolbar/bootstrap-table-toolbar.min');
11+
require("bootstrap-table/dist/extensions/page-jump-to/bootstrap-table-page-jump-to.min");
12+
require("bootstrap-table/dist/bootstrap-table-locale-all.min");
13+
14+
require("tableexport.jquery.plugin/libs/FileSaver/FileSaver.min");
15+
require("tableexport.jquery.plugin/libs/js-xlsx/xlsx.core.min");
16+
require("tableexport.jquery.plugin/tableExport.min");
17+
18+
require("bootstrap-table/dist/extensions/export/bootstrap-table-export.min");
19+
20+
21+
$(function () {
22+
23+
window.defaultFormatter = function (value) {
24+
return value;
25+
};
26+
27+
window.defaultActionFormatter = function (value) {
28+
const $wrapper = $("<div />");
29+
30+
for (let i = 0; i < value.length; i++) {
31+
const $button = $('<a />');
32+
$button.attr('href', value[i].route);
33+
$button.attr('class', value[i].classNames);
34+
$button.html(value[i].displayName);
35+
$wrapper.append($button);
36+
}
37+
38+
return $wrapper.html();
39+
};
40+
41+
const $table = $(".hello-bootstrap-table");
42+
const $bulkForm = $("#bulk_form");
43+
44+
$table.bootstrapTable('destroy').bootstrapTable({
45+
stickyHeaderOffsetLeft: ($(".hello-bootstrap-table").offset().left - 7) + 'px',
46+
stickyHeaderOffsetRight: ($(".hello-bootstrap-table").offset().left - 7) + 'px',
47+
queryParams: function (params) {
48+
params.isCallback = true;
49+
return params;
50+
}
51+
});
52+
53+
$bulkForm.submit(function (e) {
54+
const selectedRows = $table.bootstrapTable("getSelections");
55+
const hidden = $("#bulk_form input[type=hidden]");
56+
hidden.val(JSON.stringify(selectedRows));
57+
});
58+
59+
});

assets/css/styles.css

Whitespace-only changes.

composer.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "hello-sebastian/hello-bootstrap-table-bundle",
3+
"description": "Symfony Bundle for bootstrap-table",
4+
"type": "symfony-bundle",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "HelloSebastian"
9+
}
10+
],
11+
"autoload": {
12+
"psr-4": {
13+
"HelloSebastian\\HelloBootstrapTableBundle\\": "src/"
14+
}
15+
},
16+
"require-dev": {
17+
"symfony/webpack-encore-bundle": "^1.8"
18+
},
19+
"require": {
20+
"php": ">=7.2.5",
21+
"symfony/property-access": "^5.1",
22+
"sensio/framework-extra-bundle": "^5.1",
23+
"symfony/options-resolver": "^5.1",
24+
"ext-json": "*",
25+
"symfony/orm-pack": "^2.0",
26+
"twig/twig": "^3.2"
27+
}
28+
}

0 commit comments

Comments
 (0)