Skip to content

Commit

Permalink
added modal and added support for the multiple-sort extension
Browse files Browse the repository at this point in the history
  • Loading branch information
UtechtDustin committed Feb 8, 2020
1 parent 409d745 commit e73acf4
Show file tree
Hide file tree
Showing 8 changed files with 122 additions and 5 deletions.
51 changes: 51 additions & 0 deletions src/extensions/multiple-sort/bootstrap-table-multiple-sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,53 @@ const bootstrap = {
multipleSortButton: '<button class="button multi-sort" data-target="%s" title="%s">%s</button>',
multipleSortSelect: '<select class="%s %s browser-default">'
}
},
'bootstrap-table': {
icons: {
'plus': 'icon-plus',
'minus': 'icon-minus',
'sort': 'icon-sort-amount-asc'
},
html: {
multipleSortModal: `
<div class="modal" id="%s" aria-labelledby="%sLabel" aria-hidden="true">
<div class="modal-background"></div>
<div class="modal-content" id="%sLabel">
<div class="box">
<h2>%s</h2>
<div class="bootstrap-table">
<div class="fixed-table-toolbar">
<div class="bars">
<div id="toolbar" class="padding-bottom-2">
<button id="add" type="button" class="btn">%s %s</button>
<button id="delete" type="button" class="btn" disabled>%s %s</button>
</div>
</div>
</div>
<div class="fixed-table-container">
<table id="multi-sort" class="table">
<thead>
<tr>
<th></th>
<th><div class="th-inner">%s</div></th>
<th><div class="th-inner">%s</div></th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
<div class="mt-30">
<button type="button" class="btn" data-close>%s</button>
<button type="button" class="btn multi-sort-order-button" data-close>%s</button>
</div>
</div>
</div>
</div>
`,
multipleSortButton: '<button class="btn multi-sort" data-target="%s" title="%s">%s</button>',
multipleSortSelect: '<select class="%s %s browser-default">'
}
}
}[$.fn.bootstrapTable.theme]
$.extend($.fn.bootstrapTable.defaults.icons, bootstrap.icons)
Expand Down Expand Up @@ -528,6 +575,10 @@ BootstrapTable.prototype.initToolbar = function (...args) {
this.$toolbar.find('.multi-sort').on('click', () => {
$(sortModalId).modal()
})
} else if ($.fn.bootstrapTable.theme === 'bootstrap-table') {
this.$toolbar.find('.multi-sort').on('click', () => {
$(sortModalId).addClass('show')
})
} else if ($.fn.bootstrapTable.theme === 'foundation') {
this.$toolbar.find('.multi-sort').on('click', () => {
if (!this.foundationModal) {
Expand Down
8 changes: 8 additions & 0 deletions src/themes/bootstrap-table/bootstrap-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ $.extend($.fn.bootstrapTable.defaults, {
})

$.BootstrapTable = class extends $.BootstrapTable {
init () {
super.init()

$('.modal').on('click', '[data-close]', (e) => {
$(e.delegateTarget).removeClass('show')
})
}

initConstants () {
super.initConstants()

Expand Down
54 changes: 54 additions & 0 deletions src/themes/bootstrap-table/bootstrap-table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,57 @@
}
}
}

.modal {
position: fixed;
display: none;
top: 0;
left: 0;
bottom: 0;
right: 0;

&.show {
display: flex;
}

.btn {
border-radius: 4px;
background-color: $background;
border: 1px solid $btn-border;
padding: 6px 12px;
outline: none;
cursor: pointer;

&.active {
border-color: black;
}
}

.modal-background {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 998;
background-color: rgba(10,10,10,.86);
}

.modal-content {
position: relative;
width: 600px;
margin: 30px auto;
z-index: 999;

.box {
background-color: #fff;
border-radius: 6px;
display: block;
padding: 1.25rem;
}
}
}

.mt-30 {
margin-top: 30px;
}
13 changes: 8 additions & 5 deletions src/themes/bootstrap-table/font.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@font-face {
font-family: 'bootstrap-table';
src: url('fonts/bootstrap-table.eot?gh2p5u');
src: url('fonts/bootstrap-table.eot?gh2p5u#iefix') format('embedded-opentype'),
url('fonts/bootstrap-table.ttf?gh2p5u') format('truetype'),
url('fonts/bootstrap-table.woff?gh2p5u') format('woff'),
url('fonts/bootstrap-table.svg?gh2p5u#bootstrap-table') format('svg');
src: url('fonts/bootstrap-table.eot?9p6kv0');
src: url('fonts/bootstrap-table.eot?9p6kv0#iefix') format('embedded-opentype'),
url('fonts/bootstrap-table.ttf?9p6kv0') format('truetype'),
url('fonts/bootstrap-table.woff?9p6kv0') format('woff'),
url('fonts/bootstrap-table.svg?9p6kv0#bootstrap-table') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
Expand Down Expand Up @@ -63,4 +63,7 @@
}
.icon-trash-2:before {
content: "\e906";
}
.icon-sort-amount-asc:before {
content: "\ea4c";
}
Binary file modified src/themes/bootstrap-table/fonts/bootstrap-table.eot
Binary file not shown.
1 change: 1 addition & 0 deletions src/themes/bootstrap-table/fonts/bootstrap-table.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/themes/bootstrap-table/fonts/bootstrap-table.ttf
Binary file not shown.
Binary file modified src/themes/bootstrap-table/fonts/bootstrap-table.woff
Binary file not shown.

0 comments on commit e73acf4

Please sign in to comment.