openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 7e6598e8a670d73b7573cd7c11a00b1dfdddc592
parent f4e257beb75a9a054b74f1d0a7a00fe424fa89b0
Author: Jan Dankert <devnull@localhost>
Date:   Sat, 27 Oct 2018 00:09:57 +0200

Neu: Suchfilter für alle Tabellen.

Diffstat:
modules/cms-ui/themes/default/html/views/configuration/show.php | 2+-
modules/cms-ui/themes/default/html/views/grouplist/show.php | 2+-
modules/cms-ui/themes/default/html/views/templatelist/show.php | 2+-
modules/cms-ui/themes/default/html/views/userlist/show.php | 2+-
modules/cms-ui/themes/default/production/combined.min.js | 2+-
modules/template-engine/components/html/table/Table.class.php | 23+++++++++++++----------
modules/template-engine/components/html/table/table.js | 12++++++++++++
modules/template-engine/components/html/table/table.min.js | 4++--
8 files changed, 32 insertions(+), 17 deletions(-)

diff --git a/modules/cms-ui/themes/default/html/views/configuration/show.php b/modules/cms-ui/themes/default/html/views/configuration/show.php @@ -1,6 +1,6 @@ - <table width="100%"> + <div class="table-wrapper"><div class="table-filter"><input type="search" name="filter" placeholder="<?php echo lang('SEARCH_FILTER') ?>" /></div><table width="100%"></div> <tr class="headline"> <td class="help"> <span class="text"><?php echo nl2br(encodeHtml(htmlentities(lang(''.'GLOBAL_NAME'.'')))); ?></span> diff --git a/modules/cms-ui/themes/default/html/views/grouplist/show.php b/modules/cms-ui/themes/default/html/views/grouplist/show.php @@ -2,7 +2,7 @@ - <table width="100%"> + <div class="table-wrapper"><div class="table-filter"><input type="search" name="filter" placeholder="<?php echo lang('SEARCH_FILTER') ?>" /></div><table width="100%"></div> <tr class="headline"> <td> <span class="text"><?php echo nl2br(encodeHtml(htmlentities(lang(''.'name'.'')))); ?></span> diff --git a/modules/cms-ui/themes/default/html/views/templatelist/show.php b/modules/cms-ui/themes/default/html/views/templatelist/show.php @@ -1,6 +1,6 @@ - <table width="100%"> + <div class="table-wrapper"><div class="table-filter"><input type="search" name="filter" placeholder="<?php echo lang('SEARCH_FILTER') ?>" /></div><table width="100%"></div> <tr class="headline"> <td> <span class="text"><?php echo nl2br(encodeHtml(htmlentities(lang(''.'name'.'')))); ?></span> diff --git a/modules/cms-ui/themes/default/html/views/userlist/show.php b/modules/cms-ui/themes/default/html/views/userlist/show.php @@ -2,7 +2,7 @@ - <table width="100%"> + <div class="table-wrapper"><div class="table-filter"><input type="search" name="filter" placeholder="<?php echo lang('SEARCH_FILTER') ?>" /></div><table width="100%"></div> <tr class="headline"> <td> <img class="" title="" src="./modules/cms-ui/themes/default/images/icon_user.png" /> diff --git a/modules/cms-ui/themes/default/production/combined.min.js b/modules/cms-ui/themes/default/production/combined.min.js @@ -11016,7 +11016,7 @@ $(document).on('orViewLoaded',function(event, data) { fill : 'currentColor' } ); } ); } ); -/* ./modules//template-engine/components/html/table/table.min.js */;$(document).on('orViewLoaded',function(t,e){$(t.target).find('table.sortable > tbody').sortable({update:function(a,t){$(t).addClass('loader');var o=[];$(t.item).closest('table.sortable').find('tbody > tr.data').each(function(){var t=$(this).data('id');o.push(t)});var d='./api/',e={};e.action='folder';e.subaction='order';e.token=$('div.action-folder.method-order input[name=token]').attr('value');e.order=o.join(',');e.id=$('div#dialog').data('id');e.output='json';$.ajax({'type':'POST',url:d,data:e,success:function(e,a,o){$(t).removeClass('loader');doResponse(e,a,t)},error:function(t,e,a){alert(a)}})}});$(t.target).find('tr.headline > td > input.checkbox').click(function(){$(this).closest('table').find('tr.data > td > input.checkbox').attr('checked',Boolean($(this).attr('checked')))})}); +/* ./modules//template-engine/components/html/table/table.min.js */;$(document).on('orViewLoaded',function(t,e){$(t.target).find('table.sortable > tbody').sortable({update:function(a,t){$(t).addClass('loader');var o=[];$(t.item).closest('table.sortable').find('tbody > tr.data').each(function(){var t=$(this).data('id');o.push(t)});var i='./api/',e={};e.action='folder';e.subaction='order';e.token=$('div.action-folder.method-order input[name=token]').attr('value');e.order=o.join(',');e.id=$('div#dialog').data('id');e.output='json';$.ajax({'type':'POST',url:i,data:e,success:function(e,a,o){$(t).removeClass('loader');doResponse(e,a,t)},error:function(t,e,a){alert(a)}})}});$(t.target).find('tr.headline > td > input.checkbox').click(function(){$(this).closest('table').find('tr.data > td > input.checkbox').attr('checked',Boolean($(this).attr('checked')))});$(t.target).find('.table-filter > input').keyup(function(){let filterExpression=$(this).val().toLowerCase();$(this).parents('.table-wrapper').find('tr').filter(function(){$(this).toggle($(this).text().toLowerCase().indexOf(filterExpression)>-1)})})}); /* ./modules//template-engine/components/html/column/column.min.js */;$(document).on('orViewLoaded',function(o,n){}); /* ./modules//template-engine/components/html/image/image.min.js */;$(document).on('orViewLoaded',function(o,n){var e=document.querySelectorAll('img.image-icon');SVGInjector(e)}); /* ./modules//template-engine/components/html/group/group.min.js */;$(document).on('orViewLoaded',function(e,o){registerOpenClose($(e.target).find('fieldset.toggle-open-close'))}); diff --git a/modules/template-engine/components/html/table/Table.class.php b/modules/template-engine/components/html/table/Table.class.php @@ -10,16 +10,19 @@ class TableComponent extends Component public function begin() { - echo '<table'; - - if ( !empty($this->class)) - echo ' class="'.$this->htmlvalue($this->class).'"'; - - if ( !empty($this->width)) - echo ' width="'.$this->htmlvalue($this->width).'"'; - - echo '>'; - } + echo '<div class="table-wrapper">'; + echo '<div class="table-filter"><input type="search" name="filter" placeholder="'.$this->htmlvalue('message:SEARCH_FILTER').'" /></div>'; + echo '<table'; + + if ( !empty($this->class)) + echo ' class="'.$this->htmlvalue($this->class).'"'; + + if ( !empty($this->width)) + echo ' width="'.$this->htmlvalue($this->width).'"'; + + echo '>'; + echo '</div>'; + } public function end() { diff --git a/modules/template-engine/components/html/table/table.js b/modules/template-engine/components/html/table/table.js @@ -37,4 +37,16 @@ $(document).on('orViewLoaded',function(event, data) { $(this).closest('table').find('tr.data > td > input.checkbox').attr('checked',Boolean( $(this).attr('checked') ) ); }); + /** + * Table-Filter. + */ + $(event.target).find('.table-filter > input').keyup( function() { + + let filterExpression = $(this).val().toLowerCase(); + + $(this).parents('.table-wrapper').find('tr').filter( function() { + $(this).toggle( $(this).text().toLowerCase().indexOf(filterExpression) > -1 ) + } ); + + } ); }); \ No newline at end of file diff --git a/modules/template-engine/components/html/table/table.min.js b/modules/template-engine/components/html/table/table.min.js @@ -1 +1 @@ -;$(document).on('orViewLoaded',function(t,e){$(t.target).find('table.sortable > tbody').sortable({update:function(a,t){$(t).addClass('loader');var o=[];$(t.item).closest('table.sortable').find('tbody > tr.data').each(function(){var t=$(this).data('id');o.push(t)});var d='./api/',e={};e.action='folder';e.subaction='order';e.token=$('div.action-folder.method-order input[name=token]').attr('value');e.order=o.join(',');e.id=$('div#dialog').data('id');e.output='json';$.ajax({'type':'POST',url:d,data:e,success:function(e,a,o){$(t).removeClass('loader');doResponse(e,a,t)},error:function(t,e,a){alert(a)}})}});$(t.target).find('tr.headline > td > input.checkbox').click(function(){$(this).closest('table').find('tr.data > td > input.checkbox').attr('checked',Boolean($(this).attr('checked')))})});- \ No newline at end of file +;$(document).on('orViewLoaded',function(t,e){$(t.target).find('table.sortable > tbody').sortable({update:function(a,t){$(t).addClass('loader');var o=[];$(t.item).closest('table.sortable').find('tbody > tr.data').each(function(){var t=$(this).data('id');o.push(t)});var i='./api/',e={};e.action='folder';e.subaction='order';e.token=$('div.action-folder.method-order input[name=token]').attr('value');e.order=o.join(',');e.id=$('div#dialog').data('id');e.output='json';$.ajax({'type':'POST',url:i,data:e,success:function(e,a,o){$(t).removeClass('loader');doResponse(e,a,t)},error:function(t,e,a){alert(a)}})}});$(t.target).find('tr.headline > td > input.checkbox').click(function(){$(this).closest('table').find('tr.data > td > input.checkbox').attr('checked',Boolean($(this).attr('checked')))});$(t.target).find('.table-filter > input').keyup(function(){let filterExpression=$(this).val().toLowerCase();$(this).parents('.table-wrapper').find('tr').filter(function(){$(this).toggle($(this).text().toLowerCase().indexOf(filterExpression)>-1)})})});+ \ No newline at end of file