Hide delete and watched columns in column selector.

Add delete mode to user history tab too.
Some styling changes.
This commit is contained in:
Tim 2015-08-16 23:30:45 +02:00
parent 6b1a57e650
commit 51e1949538
3 changed files with 27 additions and 10 deletions

View file

@ -32,7 +32,7 @@
<th align='left' id="paused_counter">Paused</th> <th align='left' id="paused_counter">Paused</th>
<th align='left' id="stopped">Stopped</th> <th align='left' id="stopped">Stopped</th>
<th align='left' id="duration">Duration</th> <th align='left' id="duration">Duration</th>
<th align='left' id="percent_complete">Watched</th> <th align='left' id="percent_complete"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -63,7 +63,7 @@
} }
} }
history_table = $('#history_table').DataTable(history_table_options); history_table = $('#history_table').DataTable(history_table_options);
var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"> Select columns</i>', buttonClass: 'btn btn-dark' }); var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"> Select columns</i>', buttonClass: 'btn btn-dark', exclude: [0, 10] });
$(colvis.button()).appendTo('div.colvis-button-bar'); $(colvis.button()).appendTo('div.colvis-button-bar');
$('#row-edit-mode').click(function() { $('#row-edit-mode').click(function() {

View file

@ -173,6 +173,7 @@ DOCUMENTATION :: END
<table class="display" id="history_table" width="100%"> <table class="display" id="history_table" width="100%">
<thead> <thead>
<tr> <tr>
<th align='left' id="delete">Delete</th>
<th align='left' id="time">Time</th> <th align='left' id="time">Time</th>
<th align='left' id="friendly_name">User</th> <th align='left' id="friendly_name">User</th>
<th align='left' id="platform">Platform</th> <th align='left' id="platform">Platform</th>
@ -182,7 +183,7 @@ DOCUMENTATION :: END
<th align='left' id="paused_counter">Paused</th> <th align='left' id="paused_counter">Paused</th>
<th align='left' id="stopped">Stopped</th> <th align='left' id="stopped">Stopped</th>
<th align='left' id="duration">Duration</th> <th align='left' id="duration">Duration</th>
<th align='left' id="percent_complete">Watched</th> <th align='left' id="percent_complete"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -254,9 +255,8 @@ DOCUMENTATION :: END
} }
} }
history_table = $('#history_table').DataTable(history_table_options); history_table = $('#history_table').DataTable(history_table_options);
history_table.column(4).visible(false);
var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"> Select columns</i>', buttonClass: 'btn btn-dark' }); var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"> Select columns</i>', buttonClass: 'btn btn-dark', exclude: [0, 10] });
$(colvis.button()).appendTo('div.colvis-button-bar'); $(colvis.button()).appendTo('div.colvis-button-bar');
}); });
</script> </script>
@ -274,7 +274,7 @@ DOCUMENTATION :: END
} }
} }
history_table = $('#history_table').DataTable(history_table_options); history_table = $('#history_table').DataTable(history_table_options);
var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"> Select columns</i>', buttonClass: 'btn btn-dark' }); var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"> Select columns</i>', buttonClass: 'btn btn-dark', exclude: [0, 10] });
$(colvis.button()).appendTo('div.colvis-button-bar'); $(colvis.button()).appendTo('div.colvis-button-bar');
}); });
</script> </script>

View file

@ -156,13 +156,17 @@ from plexpy import helpers
<span class="set-username">${data['friendly_name']}</span> <span class="set-username">${data['friendly_name']}</span>
</strong></span> </strong></span>
</div> </div>
<div class="colvis-button-bar hidden-xs" id="button-bar-history"> <div class="button-bar">
<button class="btn btn-danger" data-toggle="button" aria-pressed="false" autocomplete="off" id="row-edit-mode"><i class="fa fa-trash-o"></i> Delete Mode</button>&nbsp
<div class="colvis-button-bar hidden-xs" id="button-bar-history">
</div>
</div> </div>
</div> </div>
<div class="table-card-back"> <div class="table-card-back">
<table class="display" id="history_table" width="100%"> <table class="display" id="history_table" width="100%">
<thead> <thead>
<tr> <tr>
<th align='left' id="delete">Delete</th>
<th align='left' id="time">Time</th> <th align='left' id="time">Time</th>
<th align='left' id="friendly_name">User</th> <th align='left' id="friendly_name">User</th>
<th align='left' id="platform">Platform</th> <th align='left' id="platform">Platform</th>
@ -172,7 +176,7 @@ from plexpy import helpers
<th align='left' id="paused_counter">Paused</th> <th align='left' id="paused_counter">Paused</th>
<th align='left' id="stopped">Stopped</th> <th align='left' id="stopped">Stopped</th>
<th align='left' id="duration">Duration</th> <th align='left' id="duration">Duration</th>
<th align='left' id="percent_complete">Watched</th> <th align='left' id="percent_complete"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -289,9 +293,9 @@ from plexpy import helpers
} }
} }
history_table = $('#history_table').DataTable(history_table_options); history_table = $('#history_table').DataTable(history_table_options);
history_table.column(1).visible(false); history_table.column(2).visible(false);
var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"> Select columns</i>', buttonClass: 'btn btn-dark' }); var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"> Select columns</i>', buttonClass: 'btn btn-dark', exclude: [0, 10] });
$(colvis.button()).appendTo('#button-bar-history'); $(colvis.button()).appendTo('#button-bar-history');
}); });
@ -339,6 +343,19 @@ from plexpy import helpers
} }
}); });
}); });
// Delete mode button
$('#row-edit-mode').click(function() {
if ($(this).hasClass('active')) {
$('.delete-control').each(function() {
$(this).addClass('hidden');
});
} else {
$('.delete-control').each(function() {
$(this).removeClass('hidden');
});
}
});
}); });
</script> </script>
</%def> </%def>