1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-05 02:39:47 +02:00

Fix columns filter default check value and add filter reset link

This commit is contained in:
Afterster 2014-05-20 06:28:26 +02:00
parent a1e36a6a6f
commit 2498576df4
17 changed files with 109 additions and 48 deletions

View file

@ -0,0 +1,28 @@
// vim:set softtabstop=4 shiftwidth=4 expandtab:
//
// Copyright 2001 - 2014 Ampache.org
// All rights reserved.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License v2
// as published by the Free Software Foundation.
//
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
$(document).ready(function() {
if ($('.tabledata').mediaTable()) {
ResponsiveElements.init();
setTimeout(function() {
$('.tabledata').mediaTable('analyze');
}, 1);
}
});

View file

@ -126,8 +126,6 @@ table.mediaTable tbody th, table.mediaTable td {
position:absolute; position:absolute;
top: 0; top: 0;
right:0; right:0;
opacity: 0.6;
} }
.mediaTableMenu a { .mediaTableMenu a {

View file

@ -76,16 +76,6 @@ http://www.consulenza-web.com/2012/01/mediatable-jquery-plugin/
// Place the wrapper near the table and fill with MediaTable. // Place the wrapper near the table and fill with MediaTable.
wdg.$table.before(wdg.$wrap).appendTo(wdg.$wrap); wdg.$table.before(wdg.$wrap).appendTo(wdg.$wrap);
// Menu initialization logic.
if ( wdg.cfg.menu ) __initMenu( wdg );
// Columns Initialization Loop.
wdg.$table.find('thead th').each(function(i){ __thInit.call( this, i, wdg ); });
// Save widget context into table DOM. // Save widget context into table DOM.
wdg.$table.data( 'MediaTable', wdg ); wdg.$table.data( 'MediaTable', wdg );
@ -98,6 +88,7 @@ http://www.consulenza-web.com/2012/01/mediatable-jquery-plugin/
wdg.$menu = $('<div />'); wdg.$menu = $('<div />');
wdg.$menu.$header = $('<a />'); wdg.$menu.$header = $('<a />');
wdg.$menu.$list = $('<ul />'); wdg.$menu.$list = $('<ul />');
wdg.$menu.$footer = $('<a />');
// Setup menu general properties and append to DOM. // Setup menu general properties and append to DOM.
wdg.$menu wdg.$menu
@ -110,9 +101,14 @@ http://www.consulenza-web.com/2012/01/mediatable-jquery-plugin/
wdg.$wrap.addClass('mediaTableWrapperWithMenu'); wdg.$wrap.addClass('mediaTableWrapperWithMenu');
// Setup menu title (handler) // Setup menu title (handler)
wdg.$menu.$header.attr( 'id', wdg.id + '-header' );
wdg.$menu.$header.text(wdg.cfg.menuTitle); wdg.$menu.$header.text(wdg.cfg.menuTitle);
wdg.$table.before(wdg.$menu); wdg.$table.before(wdg.$menu);
// Setup menu footer
wdg.$menu.$footer.attr( 'id', wdg.id + '-footer' );
wdg.$menu.$footer.text(wdg.cfg.menuReset);
// Bind screen change events to update checkbox status of displayed fields. // Bind screen change events to update checkbox status of displayed fields.
$(window).bind('orientationchange resize',function(){ $(window).bind('orientationchange resize',function(){
wdg.$menu.find('input').trigger('updateCheck'); wdg.$menu.find('input').trigger('updateCheck');
@ -133,12 +129,9 @@ http://www.consulenza-web.com/2012/01/mediatable-jquery-plugin/
e.stopPropagation(); e.stopPropagation();
}); });
}; // EndOf: "__initMenu()" ### }; // EndOf: "__initMenu()" ###
var __thInit = function( i, wdg ) { var __thInit = function( i, wdg ) {
var $th = $(this), var $th = $(this),
id = $th.attr('id'), id = $th.attr('id'),
classes = $th.attr('class'); classes = $th.attr('class');
@ -226,7 +219,51 @@ http://www.consulenza-web.com/2012/01/mediatable-jquery-plugin/
var __analyze = function(i) {
// Get the widget context.
var _this = this;
var wdg = $(this).data( 'MediaTable' );
if ( !wdg ) return;
// Menu initialization logic.
if ( wdg.cfg.menu ) __initMenu( wdg );
// Columns Initialization Loop.
wdg.$table.find('thead th').each(function(i){ __thInit.call( this, i, wdg ); });
wdg.$menu.$list.append(wdg.$menu.$footer);
wdg.$menu.$footer.bind('click',function(){
__reset.call(_this);
});
}
var __reset = function() {
// Get the widget context.
var wdg = $(this).data( 'MediaTable' );
if ( !wdg ) return;
wdg.$table.find('thead th').each(function(i){
var $th = $('#' + wdg.id + '-mediaTableCol-' + i);
var $checkbox = $('#toggle-col-' + wdg.id + '-' + i);
if ($checkbox !== undefined) {
$th.removeAttr('style');
if ( $th.is(':visible') ) {
$checkbox.prop("checked", true);
}
else {
$checkbox.prop("checked", false);
};
var val = $checkbox.val();
var cols = wdg.$table.find("#" + val + ", [headers="+ val +"]");
cols.removeAttr('style');
}
});
}
@ -272,6 +309,7 @@ http://www.consulenza-web.com/2012/01/mediatable-jquery-plugin/
// Teach the widget to create a toggle menu to declare column's visibility // Teach the widget to create a toggle menu to declare column's visibility
menu: true, menu: true,
menuTitle: 'Columns', menuTitle: 'Columns',
menuReset: 'Reset',
t:'e'},arguments[0]); t:'e'},arguments[0]);
// -- default configuration block -- // -- default configuration block --
@ -280,6 +318,12 @@ http://www.consulenza-web.com/2012/01/mediatable-jquery-plugin/
// Items initialization loop: // Items initialization loop:
if ( cfg !== false ) { if ( cfg !== false ) {
// Avoid two initialization
if ($(this).data( 'MediaTable' )) {
return false;
}
$(this).each(function( i ){ __loop.call( this, cfg, i ); }); $(this).each(function( i ){ __loop.call( this, cfg, i ); });
@ -288,6 +332,10 @@ http://www.consulenza-web.com/2012/01/mediatable-jquery-plugin/
// Item actions loop - switch throught actions // Item actions loop - switch throught actions
} else if ( arguments.length ) switch ( arguments[0] ) { } else if ( arguments.length ) switch ( arguments[0] ) {
case 'analyze':
$(this).each(function( i ){ __analyze.call( this, i ); });
break;
case 'destroy': case 'destroy':
$(this).each(function(){ __destroy.call( this ); }); $(this).each(function(){ __destroy.call( this ); });
break; break;

View file

@ -89,10 +89,5 @@ $thcount = 8;
</tr> </tr>
<tfoot> <tfoot>
</table> </table>
<script language="javascript" type="text/javascript"> <script src="<?php echo AmpConfig::get('web_path'); ?>/lib/javascript/tabledata.js" language="javascript" type="text/javascript"></script>
$(document).ready(function() {
$('.tabledata').mediaTable();
ResponsiveElements.init();
});
</script>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>

View file

@ -143,6 +143,8 @@ if (AmpConfig::get('show_played_times')) {
<?php if (AmpConfig::get('show_concerts')) { ?> <?php if (AmpConfig::get('show_concerts')) { ?>
<li><a id="concerts_link" href="#concerts"><?php echo T_('Events'); ?></a></li> <li><a id="concerts_link" href="#concerts"><?php echo T_('Events'); ?></a></li>
<?php } ?> <?php } ?>
<!-- Needed to avoid the 'only one' bug -->
<li></li>
</ul> </ul>
</div> </div>
<div id="tabs_content"> <div id="tabs_content">

View file

@ -85,10 +85,5 @@ $thcount = 8;
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
<script language="javascript" type="text/javascript"> <script src="<?php echo AmpConfig::get('web_path'); ?>/lib/javascript/tabledata.js" language="javascript" type="text/javascript"></script>
$(document).ready(function() {
$('.tabledata').mediaTable();
ResponsiveElements.init();
});
</script>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>

View file

@ -50,5 +50,5 @@
<?php } ?> <?php } ?>
</tbody> </tbody>
</table> </table>
<script language="javascript" type="text/javascript">$('.tabledata').mediaTable();</script> <script src="<?php echo AmpConfig::get('web_path'); ?>/lib/javascript/tabledata.js" language="javascript" type="text/javascript"></script>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?>

View file

@ -61,5 +61,5 @@
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
<script language="javascript" type="text/javascript">$('.tabledata').mediaTable();</script> <script src="<?php echo AmpConfig::get('web_path'); ?>/lib/javascript/tabledata.js" language="javascript" type="text/javascript"></script>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>

View file

@ -59,5 +59,5 @@
<?php } ?> <?php } ?>
</tbody> </tbody>
</table> </table>
<script language="javascript" type="text/javascript">$('.tabledata').mediaTable();</script> <script src="<?php echo AmpConfig::get('web_path'); ?>/lib/javascript/tabledata.js" language="javascript" type="text/javascript"></script>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?>

View file

@ -61,5 +61,5 @@ $web_path = AmpConfig::get('web_path');
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
<script language="javascript" type="text/javascript">$('.tabledata').mediaTable();</script> <script src="<?php echo AmpConfig::get('web_path'); ?>/lib/javascript/tabledata.js" language="javascript" type="text/javascript"></script>
<?php if ($browse->get_show_header()) require AmpConfig::Get('prefix') . '/templates/list_header.inc.php'; ?> <?php if ($browse->get_show_header()) require AmpConfig::Get('prefix') . '/templates/list_header.inc.php'; ?>

View file

@ -62,5 +62,5 @@
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
<script language="javascript" type="text/javascript">$('.tabledata').mediaTable();</script> <script src="<?php echo AmpConfig::get('web_path'); ?>/lib/javascript/tabledata.js" language="javascript" type="text/javascript"></script>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?>

View file

@ -49,5 +49,5 @@
<?php } ?> <?php } ?>
</tbody> </tbody>
</table> </table>
<script language="javascript" type="text/javascript">$('.tabledata').mediaTable();</script> <script src="<?php echo AmpConfig::get('web_path'); ?>/lib/javascript/tabledata.js" language="javascript" type="text/javascript"></script>
<?php UI::show_box_bottom(); ?> <?php UI::show_box_bottom(); ?>

View file

@ -60,5 +60,5 @@
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
<script language="javascript" type="text/javascript">$('.tabledata').mediaTable();</script> <script src="<?php echo AmpConfig::get('web_path'); ?>/lib/javascript/tabledata.js" language="javascript" type="text/javascript"></script>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?>

View file

@ -91,10 +91,5 @@ $thcount = 8;
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
<script language="javascript" type="text/javascript"> <script src="<?php echo AmpConfig::get('web_path'); ?>/lib/javascript/tabledata.js" language="javascript" type="text/javascript"></script>
$(document).ready(function() {
$('.tabledata').mediaTable();
ResponsiveElements.init();
});
</script>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>

View file

@ -76,5 +76,5 @@ foreach ($object_ids as $user_id) {
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
<script language="javascript" type="text/javascript">$('.tabledata').mediaTable();</script> <script src="<?php echo AmpConfig::get('web_path'); ?>/lib/javascript/tabledata.js" language="javascript" type="text/javascript"></script>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>

View file

@ -66,5 +66,5 @@ if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/l
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
<script language="javascript" type="text/javascript">$('.tabledata').mediaTable();</script> <script src="<?php echo AmpConfig::get('web_path'); ?>/lib/javascript/tabledata.js" language="javascript" type="text/javascript"></script>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>

View file

@ -42,5 +42,5 @@
<?php } ?> <?php } ?>
</tbody> </tbody>
</table> </table>
<script language="javascript" type="text/javascript">$('.tabledata').mediaTable();</script> <script src="<?php echo AmpConfig::get('web_path'); ?>/lib/javascript/tabledata.js" language="javascript" type="text/javascript"></script>
<?php UI::show_box_bottom(); ?> <?php UI::show_box_bottom(); ?>