Converted 'admin_history.html' to new template.

This commit is contained in:
Ivan Filippov 2016-04-22 01:06:01 -06:00
parent 26c4606834
commit 0e710c96e4
3 changed files with 159 additions and 141 deletions

View File

View File

@ -1,144 +1,151 @@
{% extends "base.html" %} {% extends "base.html" %} {% block title %}
{% block head %} <title>DNS Control Panel - History</title>
{{ super() }} {% endblock %} {% block dashboard_stat %}
<!-- BEGIN PAGE LEVEL PLUGIN STYLES --> <!-- Content Header (Page header) -->
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='global/plugins/select2/select2.css') }}"/> <section class="content-header">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.css') }}"/> <h1>
<!-- END PAGE LEVEL PLUGIN STYLES --> History <small>Recent PowerDNS-Admin events</small>
</h1>
<!-- BEGIN THEME STYLES --> <ol class="breadcrumb">
<!-- DOC: To use 'rounded corners' style just load 'components-rounded.css' stylesheet instead of 'components.css' in the below style tag --> <li><a href="{{ url_for('dashboard') }}"><i
<link href="{{ url_for('static', filename='global/css/components-md.css') }}" id="style_components" rel="stylesheet" type="text/css"/> class="fa fa-dashboard"></i> Home</a></li>
<link href="{{ url_for('static', filename='global/css/plugins-md.css') }}" rel="stylesheet" type="text/css"/> <li class="active">History</li>
<link href="{{ url_for('static', filename='admin/layout2/css/layout.css') }}" rel="stylesheet" type="text/css"/> </ol>
<link href="{{ url_for('static', filename='admin/layout2/css/themes/grey.css') }}" rel="stylesheet" type="text/css" id="style_color"/> </section>
<link href="{{ url_for('static', filename='admin/layout2/css/custom.css') }}" rel="stylesheet" type="text/css"/> {% endblock %} {% block content %}
<!-- END THEME STYLES --> <section class="content">
{% endblock %} <div class="row">
{% block title %}<title>DNS Control Panel - History</title>{% endblock %} <div class="col-xs-12">
<div class="box">
{% block dashboard_stat %} <div class="box-header">
<!-- BEGIN PAGE HEADER--> <h3 class="box-title">History Management</h3>
<h3 class="page-title"> </div>
History</h3> <div class="box-body clearfix">
<div class="page-bar"> <button type="button" class="btn btn-flat btn-danger pull-right" data-toggle="modal" data-target="#modal_clear_history">
<ul class="page-breadcrumb"> Clear History&nbsp;<i class="fa fa-trash"></i>
<li> </button>
<i class="fa fa-home"></i> </div>
<a href="{{ url_for('dashboard') }}">Home</a> <div class="box-body">
<i class="fa fa-angle-right"></i> <table id="tbl_history" class="table table-bordered table-striped">
</li> <thead>
<li> <tr>
<a href="{{ url_for('admin') }}">Admin</a> <th>Changed by</th>
<i class="fa fa-angle-right"></i> <th>Content</th>
</li> <th>Time</th>
<li> <th>Detail</th>
<a href="#">History</a> </tr>
</li> </thead>
</ul> <tbody>
</div> {% for history in histories %}
<!-- END PAGE HEADER--> <tr class="odd gradeX">
{% endblock %} <td>{{ history.created_by }}</td>
<td>{{ history.msg }}</td>
{% block content %} <td>{{ history.created_on }}</td>
<div class="clearfix"> <td width="6%">
</div> <button type="button" class="btn btn-flat btn-primary history-info-button" value='{{ history.detail|replace("[]","None") }}'>
Info&nbsp;<i class="fa fa-info"></i>
<div class="row"> </button>
<div class="col-md-12"> </td>
<!-- BEGIN HISTORY TABLE --> </tr>
<div class="portlet box blue"> {% endfor %}
<div class="portlet-title"> </tbody>
<div class="caption"> </table>
<i class="fa fa-users"></i> History Management </div>
</div> <!-- /.box-body -->
<div class="tools"> </div>
<a href="javascript:;" class="collapse"> <!-- /.box -->
</a> </div>
<a href="javascript:;" class="reload"> <!-- /.col -->
</a> </div>
</div> <!-- /.row -->
</div> </section>
<div class="portlet-body"> {% endblock %}
<div class="table-toolbar"> {% block extrascripts %}
<div class="row">
<div class="col-md-12">
<div class="btn-group pull-right">
<button id="tbl_history_clear" class="btn red">
Clear History <i class="fa fa-trash"></i>
</button>
</div>
</div>
</div>
</div>
<table class="table table-striped table-hover table-bordered" id="tbl_history">
<thead>
<tr>
<th>
Changed by
</th>
<th>
Content
</th>
<th>
Time
</th>
<th>
Detail
</th>
</tr>
</thead>
<tbody>
{% for history in histories %}
<tr class="odd gradeX">
<td>
{{ history.created_by }}
</td>
<td>
{{ history.msg }}
</td>
<td>
{{ history.created_on }}
</td>
<td width="6%">
<input type="hidden" name="history_detail" value="{{ history.detail }}">
<a class="btn default btn-xs blue history_detail" href="javascript:;"> <i class="fa fa-info"></i>Info</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<!-- END HISTORY TABLE -->
</div>
</div>
<div class="row">
<!-- MORE CONTENT GO HERE -->
</div>
{% endblock %}
{% block scripts %}
{{ super() }}
<!-- BEGIN PAGE LEVEL SCRIPTS -->
<script src="{{ url_for('static', filename='global/scripts/metronic.js') }}" type="text/javascript"></script>
<script src="{{ url_for('static', filename='admin/layout2/scripts/layout.js') }}" type="text/javascript"></script>
<script src="{{ url_for('static', filename='global/plugins/bootbox/bootbox.min.js') }}" type="text/javascript"></script>
<!-- END PAGE LEVEL SCRIPTS -->
<!-- TABLE PLUGINS -->
<script type="text/javascript" src="{{ url_for('static', filename='global/plugins/select2/select2.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='global/plugins/datatables/media/js/jquery.dataTables.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.js') }}"></script>
<script src="{{ url_for('static', filename='admin/pages/scripts/table-managed.js') }}"></script>
<!-- END TABLE PLUGINS -->
<script> <script>
jQuery(document).ready(function() { // set up history data table
Metronic.init(); // init metronic core componets $("#tbl_history").DataTable({
Layout.init(); // init layout "paging" : true,
TableManaged.init(); "lengthChange" : false,
}); "searching" : true,
"ordering" : true,
"info" : true,
"autoWidth" : false
});
$(".history-info-button").click(function() {
var modal = $("#modal_history_info");
var info = $(this).val();
modal.find('.modal-body p').text(info);
modal.modal('show');
});
// ajax call to clear history table
function clearHistoryTable() {
$.ajax({
type : "POST",
url : '/admin/history',
data : '',
contentType : "application/json; charset=utf-8",
crossDomain : true,
dataType : "json",
success : function(data, status, jqXHR) {
},
error : function(jqXHR, status) {
}
});
}
</script> </script>
<!-- END JAVASCRIPTS --> {% endblock %}
{% block modals %}
<!-- Clear History Confirmation Box -->
<div class="modal fade modal-warning" id="modal_clear_history">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">Confirmation</h4>
</div>
<div class="modal-body">
<p>Are you sure you want to remove all history?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left"
data-dismiss="modal">Close</button>
<button type="button" class="btn btn-danger" onclick="clearHistoryTable();location.reload();">Clear
History</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<div class="modal fade" id="modal_history_info">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">History Details</h4>
</div>
<div class="modal-body">
<p></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-right"
data-dismiss="modal">Close</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
{% endblock %} {% endblock %}

View File

@ -16,6 +16,8 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
<!-- Ionicons --> <!-- Ionicons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
<!-- DataTables -->
<link rel="stylesheet" href="{{ url_for('static', filename='adminlte2/plugins/datatables/dataTables.bootstrap.css') }}">
<!-- Theme style --> <!-- Theme style -->
<link rel="stylesheet" href="{{ url_for('static', filename='adminlte2/dist/css/AdminLTE.min.css') }}"> <link rel="stylesheet" href="{{ url_for('static', filename='adminlte2/dist/css/AdminLTE.min.css') }}">
<!-- AdminLTE Skins. Choose a skin from the css/skins <!-- AdminLTE Skins. Choose a skin from the css/skins
@ -272,6 +274,9 @@
</script> </script>
<!-- Bootstrap 3.3.6 --> <!-- Bootstrap 3.3.6 -->
<script src="{{ url_for('static', filename='adminlte2/bootstrap/js/bootstrap.min.js') }}"></script> <script src="{{ url_for('static', filename='adminlte2/bootstrap/js/bootstrap.min.js') }}"></script>
<!-- DataTables -->
<script src="{{ url_for('static', filename='adminlte2/plugins/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ url_for('static', filename='adminlte2/plugins/datatables/dataTables.bootstrap.min.js') }}"></script>
<!-- Morris.js charts --> <!-- Morris.js charts -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<script src="{{ url_for('static', filename='adminlte2/plugins/morris/morris.min.js') }}"></script> <script src="{{ url_for('static', filename='adminlte2/plugins/morris/morris.min.js') }}"></script>
@ -299,6 +304,12 @@
<script src="{{ url_for('static', filename='adminlte2/dist/js/pages/dashboard.js') }}"></script> <script src="{{ url_for('static', filename='adminlte2/dist/js/pages/dashboard.js') }}"></script>
<!-- AdminLTE for demo purposes --> <!-- AdminLTE for demo purposes -->
<script src="{{ url_for('static', filename='adminlte2/dist/js/demo.js') }}"></script> <script src="{{ url_for('static', filename='adminlte2/dist/js/demo.js') }}"></script>
<!-- PowerDNS-Admin custom.js -->
<script src="{{ url_for('static', filename='custom/js/custom.js') }}"></script>
{% endblock %}
{% block extrascripts %}
{% endblock %}
{% block modals %}
{% endblock %} {% endblock %}
</body> </body>
</html> </html>