Deuxième commit
This commit is contained in:
parent
b3717683de
commit
48c8caab41
@ -1,484 +0,0 @@
|
||||
{% import 'admin/layout.html' as layout with context -%}
|
||||
{% import 'admin/static.html' as admin_static with context %}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{% block title %}{% if admin_view.category %}{{ admin_view.category }} - {% endif %}{{ admin_view.name }} -
|
||||
{{ admin_view.admin.name }}{% endblock title %}</title>
|
||||
|
||||
{% block head_meta %}
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="Flask-Admin dashboard login template">
|
||||
<meta name="author" content="Louis Chauvet">
|
||||
{% endblock head_meta %}
|
||||
|
||||
{% block head_css %}
|
||||
<!-- Favicon.ico -->
|
||||
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
|
||||
<!-- Bootstrap 3.3.6 -->
|
||||
<link href="{{ url_for('static',filename='css/bootstrap.min.css') }}" rel="stylesheet">
|
||||
<!-- Font Awesome -->
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css"
|
||||
integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ"
|
||||
crossorigin="anonymous">
|
||||
<!-- Ionicons -->
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
|
||||
<!-- Theme style -->
|
||||
<link href="{{ url_for('static',filename='css/AdminLTE.min.css') }}" rel="stylesheet">
|
||||
<!-- AdminLTE Skins. Choose a skin from the css/skins folder instead of downloading all of them to reduce the load. -->
|
||||
<link href="{{ url_for('static',filename='css/skins/_all-skins.min.css') }}" rel="stylesheet"/>
|
||||
<!-- iCheck -->
|
||||
<link href="{{ url_for('static',filename='plugins/iCheck/flat/blue.css') }}" rel="stylesheet"/>
|
||||
<!-- Morris chart -->
|
||||
<link href="{{ url_for('static',filename='plugins/morris.js/0.5.1/morris.css') }}" rel="stylesheet"/>
|
||||
<!-- jvectormap -->
|
||||
<link href="{{ url_for('static',filename='plugins/jvectormap/1.2.2/jquery-jvectormap-1.2.2.css') }}"
|
||||
rel="stylesheet"/>
|
||||
<!-- Date Picker -->
|
||||
<link href="{{ url_for('static',filename='plugins/datepicker/datepicker3.css') }}" rel="stylesheet"/>
|
||||
<!-- Daterange picker -->
|
||||
<link href="{{ url_for('static',filename='plugins/daterangepicker/2.1.19/daterangepicker.css') }}"
|
||||
rel="stylesheet"/>
|
||||
<!-- bootstrap wysihtml5 - text editor -->
|
||||
<link href="{{ url_for('static',filename='plugins/bootstrap-wysihtml5/0.4.15/bootstrap3-wysihtml5.min.css') }}"
|
||||
rel="stylesheet"/>
|
||||
<!-- Flask-admin admin styles -->
|
||||
<link href="{{ admin_static.url(filename='admin/css/bootstrap3/admin.css', v='1.1.1') }}" rel="stylesheet">
|
||||
{% if admin_view.extra_css %}
|
||||
{% for css_url in admin_view.extra_css %}
|
||||
<link href="{{ css_url }}" rel="stylesheet">
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% endblock head_css %}
|
||||
|
||||
{% block head %}
|
||||
{% endblock head %}
|
||||
|
||||
{% block head_tail %}
|
||||
{% endblock head_tail %}
|
||||
|
||||
</head>
|
||||
<body class="hold-transition skin-black sidebar-mini">
|
||||
|
||||
{% block page_body %}
|
||||
|
||||
<!-- TOP NAVBAR -->
|
||||
<div class="wrapper">
|
||||
{% if current_user.is_authenticated %}
|
||||
<header class="main-header">
|
||||
<!-- Logo -->
|
||||
{% block brand %}
|
||||
<a href="{{ admin_view.admin.url }}" class="logo">
|
||||
<!-- mini logo for sidebar mini 50x50 pixels -->
|
||||
<span class="logo-mini"><img src="{{ url_for('static', filename='favicon.ico') }}"
|
||||
style="height:50px;display: block;"></span>
|
||||
<!-- logo for regular state and mobile devices -->
|
||||
<span class="logo-lg"><img src="{{ url_for('static', filename='favicon.ico') }}"
|
||||
style="height:50px;display: block;float: left;"><b>Alerte 112</b></span>
|
||||
</a>
|
||||
{% endblock brand %}
|
||||
|
||||
<!-- Header Navbar: style can be found in header.less -->
|
||||
<nav class="navbar navbar-static-top">
|
||||
<!-- Sidebar toggle button-->
|
||||
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
|
||||
<span class="fa fa-bars"></span>
|
||||
</a>
|
||||
|
||||
<div class="navbar-custom-menu">
|
||||
<ul class="nav navbar-nav">
|
||||
<!-- Notifications: style can be found in dropdown.less -->
|
||||
<li class="dropdown notifications-menu">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-bell"></i>
|
||||
<span class="label label-warning">{# todo: Nombre de notifications #}</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="header">Vous avez ...{# todo: Nombre de notifications #} notifications.
|
||||
</li>
|
||||
<li>
|
||||
<!-- inner menu: contains the actual data -->
|
||||
<ul class="menu">
|
||||
{# todo: Remplir les notifications
|
||||
notif.address -> Addresse au click sur la notif
|
||||
notif.icon -> icone au format fontawesome
|
||||
notif.color -> coleur au format bootstrap 3
|
||||
{% for notif in notifs %}
|
||||
<li>
|
||||
<a href="{{ notif.address }}">
|
||||
<i class="fa {{ notif.icon }} {{ notif.color }}"></i> {{ notif.content }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %} #}
|
||||
</ul>
|
||||
</li>
|
||||
<li class="footer"><a href="{# Lien vers la page avec toutes les notifications #}">Tout
|
||||
voir</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown user user-menu">
|
||||
{# todo: Remplir les informations d'un utilisateur #}
|
||||
{% block access_control %}
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<!-- The user image in the navbar-->
|
||||
<i class="fa fa-user-circle" style="color: white;;"></i>
|
||||
<!-- hidden-xs hides the username on small devices so only the image appears. -->
|
||||
{# todo: Voir pourquoi le nom de l'utilisateur s'affiche avec la classe hidden-xs #}
|
||||
<!--<span class="hidden-xs">{{ current_user.username }}</span>-->
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- The user image in the menu -->
|
||||
<li class="user-header">
|
||||
<i class="fa fa-user-circle" style="color: white; font-size: 2.5em"></i>
|
||||
|
||||
<p>
|
||||
{{ current_user.username }}
|
||||
</p>
|
||||
</li>
|
||||
<li class="user-footer">
|
||||
<div class="pull-left">
|
||||
<a href="{# {{ user.profilurl }} #}" class="btn btn-default btn-flat">Profil</a>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<a href="{{ url_for('security.logout') }}"
|
||||
class="btn btn-default btn-flat">{{ _("deconnection") }}</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
</li>
|
||||
<!-- Control Sidebar Toggle Button -->
|
||||
<li>
|
||||
<a href="#" data-toggle="control-sidebar"><i class="fa fa-cog"></i></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{% block menu_links %}
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
{{ layout.menu_links() }}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<!-- / TOP NAVBAR -->
|
||||
|
||||
<!-- LEFT MENU -->
|
||||
<aside class="main-sidebar">
|
||||
<!-- sidebar: style can be found in sidebar.less -->
|
||||
<section class="sidebar">
|
||||
<!-- Sidebar user panel -->
|
||||
<div class="user-panel">
|
||||
<div class="pull-left image">
|
||||
<i class="fa fa-user-circle" style="color: white; font-size: 2.5em;"></i>
|
||||
</div>
|
||||
<div class="pull-left info">
|
||||
<p>
|
||||
{{ current_user.username }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- search form -->
|
||||
<form action="{# {{ url_for('admin.search') }} #}" method="get" class="sidebar-form">
|
||||
<div class="input-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="Rechercher...">
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" name="search" id="search-btn" class="btn btn-flat">
|
||||
<i class="fa fa-search"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
<!-- /.search form -->
|
||||
<!-- sidebar menu: : style can be found in sidebar.less -->
|
||||
<ul class="sidebar-menu">
|
||||
<li class="header">{{ _("NAVIGATION") }}</li>
|
||||
{% block main_menu %}
|
||||
{{ layout.menu() }}
|
||||
{% endblock %}
|
||||
{# Exemples de menus:
|
||||
<li>
|
||||
<a href="#">
|
||||
<i class="fa fa-envelope"></i> <span>Mailbox</span>
|
||||
<span class="pull-right-container">
|
||||
<small class="label pull-right bg-yellow">12</small>
|
||||
<small class="label pull-right bg-green">16</small>
|
||||
<small class="label pull-right bg-red">5</small>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="treeview">
|
||||
<a href="#">
|
||||
<i class="fa fa-share"></i> <span>Multilevel</span>
|
||||
<span class="pull-right-container">
|
||||
<i class="fa fa-angle-left pull-right"></i>
|
||||
</span>
|
||||
</a>
|
||||
<ul class="treeview-menu">
|
||||
<li><a href="#"><i class="fa fa-circle-o"></i> Level One</a></li>
|
||||
<li>
|
||||
<a href="#"><i class="fa fa-circle-o"></i> Level One
|
||||
<span class="pull-right-container">
|
||||
<i class="fa fa-angle-left pull-right"></i>
|
||||
</span>
|
||||
</a>
|
||||
<ul class="treeview-menu">
|
||||
<li><a href="#"><i class="fa fa-circle-o"></i> Level Two</a></li>
|
||||
<li>
|
||||
<a href="#"><i class="fa fa-circle-o"></i> Level Two
|
||||
<span class="pull-right-container">
|
||||
<i class="fa fa-angle-left pull-right"></i>
|
||||
</span>
|
||||
</a>
|
||||
<ul class="treeview-menu">
|
||||
<li><a href="#"><i class="fa fa-circle-o"></i> Level Three</a></li>
|
||||
<li><a href="#"><i class="fa fa-circle-o"></i> Level Three</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#"><i class="fa fa-circle-o"></i> Level One</a></li>
|
||||
</ul>
|
||||
</li>#}
|
||||
</ul>
|
||||
</section>
|
||||
<!-- /.sidebar -->
|
||||
</aside>
|
||||
|
||||
<!-- Content Wrapper. Contains page content color white-->
|
||||
<div class="content-wrapper">
|
||||
{% endif %}
|
||||
|
||||
{% block messages %}
|
||||
{{ layout.messages() }}
|
||||
{% endblock messages %}
|
||||
|
||||
{# store the jinja2 context for form_rules rendering logic #}
|
||||
{% set render_ctx = h.resolve_ctx() %}
|
||||
|
||||
|
||||
{% block body %}
|
||||
|
||||
{% endblock body %}
|
||||
|
||||
{% if current_user.is_authenticated %}
|
||||
</div>
|
||||
|
||||
<!-- / Content Wrapper. color white -->
|
||||
<!-- Control Sidebar -->
|
||||
<aside class="control-sidebar control-sidebar-dark">
|
||||
<!-- Create the tabs -->
|
||||
<ul class="nav nav-tabs nav-justified control-sidebar-tabs">
|
||||
<li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-cog"></i></a></li>
|
||||
</ul>
|
||||
<!-- Tab panes -->
|
||||
|
||||
<div class="tab-content">
|
||||
<!-- Stats tab content -->
|
||||
<div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab Content</div>
|
||||
<!-- /.tab-pane -->
|
||||
<!-- Settings tab content -->
|
||||
|
||||
<div class="tab-pane" id="control-sidebar-settings-tab">
|
||||
{# Menu de droite, onglet Général
|
||||
<form method="post">
|
||||
<h3 class="control-sidebar-heading">General Settings</h3>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-sidebar-subheading">
|
||||
Report panel usage
|
||||
<input type="checkbox" class="pull-right" checked>
|
||||
</label>
|
||||
|
||||
<p>
|
||||
Some information about this general settings option
|
||||
</p>
|
||||
</div>
|
||||
<!-- /.form-group -->
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-sidebar-subheading">
|
||||
Allow mail redirect
|
||||
<input type="checkbox" class="pull-right" checked>
|
||||
</label>
|
||||
|
||||
<p>
|
||||
Other sets of options are available
|
||||
</p>
|
||||
</div>
|
||||
<!-- /.form-group -->
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-sidebar-subheading">
|
||||
Expose author name in posts
|
||||
<input type="checkbox" class="pull-right" checked>
|
||||
</label>
|
||||
|
||||
<p>
|
||||
Allow the user to show his name in blog posts
|
||||
</p>
|
||||
</div>
|
||||
<!-- /.form-group -->
|
||||
|
||||
<h3 class="control-sidebar-heading">Chat Settings</h3>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-sidebar-subheading">
|
||||
Show me as online
|
||||
<input type="checkbox" class="pull-right" checked>
|
||||
</label>
|
||||
</div>
|
||||
<!-- /.form-group -->
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-sidebar-subheading">
|
||||
Turn off notifications
|
||||
<input type="checkbox" class="pull-right">
|
||||
</label>
|
||||
</div>
|
||||
<!-- /.form-group -->
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-sidebar-subheading">
|
||||
Delete chat history
|
||||
<a href="javascript:void(0)" class="text-red pull-right"><i
|
||||
class="fa fa-trash-o"></i></a>
|
||||
</label>
|
||||
</div>
|
||||
<!-- /.form-group -->
|
||||
</form>
|
||||
<h3 class="control-sidebar-heading">Recent Activity</h3>
|
||||
<ul class="control-sidebar-menu">
|
||||
<li>
|
||||
<a href="javascript:void(0)">
|
||||
<i class="menu-icon fa fa-birthday-cake bg-red"></i>
|
||||
|
||||
<div class="menu-info">
|
||||
<h4 class="control-sidebar-subheading">Langdon's Birthday</h4>
|
||||
|
||||
<p>Will be 23 on April 24th</p>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:void(0)">
|
||||
<i class="menu-icon fa fa-envelope-o bg-light-blue"></i>
|
||||
|
||||
<div class="menu-info">
|
||||
<h4 class="control-sidebar-subheading">Nora Joined Mailing List</h4>
|
||||
|
||||
<p>nora@example.com</p>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- /.control-sidebar-menu -->
|
||||
|
||||
<h3 class="control-sidebar-heading">Tasks Progress</h3>
|
||||
<ul class="control-sidebar-menu">
|
||||
<li>
|
||||
<a href="javascript:void(0)">
|
||||
<h4 class="control-sidebar-subheading">
|
||||
Custom Template Design
|
||||
<span class="label label-danger pull-right">70%</span>
|
||||
</h4>
|
||||
|
||||
<div class="progress progress-xxs">
|
||||
<div class="progress-bar progress-bar-danger" style="width: 70%"></div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:void(0)">
|
||||
<h4 class="control-sidebar-subheading">
|
||||
Update Resume
|
||||
<span class="label label-success pull-right">95%</span>
|
||||
</h4>
|
||||
|
||||
<div class="progress progress-xxs">
|
||||
<div class="progress-bar progress-bar-success" style="width: 95%"></div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul> #}
|
||||
</div>
|
||||
<!-- /.tab-pane -->
|
||||
</div>
|
||||
</aside>
|
||||
<!-- /.control-sidebar -->
|
||||
<!-- Add the sidebar's background. This div must be placed
|
||||
immediately after the control sidebar -->
|
||||
<div class="control-sidebar-bg"></div>
|
||||
|
||||
<footer class="main-footer">
|
||||
<strong>Copyright © 2018 <a href="https://github.com/Fomys">Louis Chauvet</a></strong> -
|
||||
<strong>Admin LTE Template <a href="http://almsaeedstudio.com">Almsaeed Studio</a>.</strong> All rights
|
||||
reserved.
|
||||
</footer>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
<!-- ./wrapper -->
|
||||
|
||||
{% endblock page_body %}
|
||||
|
||||
{% block tail_js %}
|
||||
<!-- jQuery 2.2.3 -->
|
||||
<script src="{{ url_for('static',filename='plugins/jQuery/jquery-2.2.3.min.js') }}"></script>
|
||||
<!-- jQuery UI 1.11.4 -->
|
||||
<script src="{{ url_for('static', filename='plugins/jQuery/ui/1.11.4/jquery-ui.min.js') }}"></script>
|
||||
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
|
||||
<script>
|
||||
$.widget.bridge('uibutton', $.ui.button);
|
||||
</script>
|
||||
<!-- Bootstrap 3.3.6 -->
|
||||
<script src="{{ url_for('static',filename='js/bootstrap.min.js') }}"></script>
|
||||
<script src="{{ admin_static.url(filename='vendor/select2/select2.min.js', v='3.5.2') }}"
|
||||
type="text/javascript"></script>
|
||||
|
||||
{% if admin_view.extra_js %}
|
||||
{% for js_url in admin_view.extra_js %}
|
||||
<script src="{{ js_url }}" type="text/javascript"></script>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Morris.js charts -->
|
||||
<script src="{{ url_for('static',filename='plugins/raphael/2.1.0/raphael.min.js') }}"></script>
|
||||
<script src="{{ url_for('static',filename='plugins/morris.js/0.5.1/morris.min.js') }}"></script>
|
||||
<!-- Sparkline -->
|
||||
<script src="{{ url_for('static',filename='plugins/jquery.sparkline/2.1.2/jquery.sparkline.min.js') }}"></script>
|
||||
<!-- jvectormap -->
|
||||
<script src="{{ url_for('static',filename='plugins/jvectormap/1.2.2/jquery-jvectormap-1.2.2.min.js') }}"></script>
|
||||
<script src="{{ url_for('static',filename='plugins/jvectormap/1.2.2/jquery-jvectormap-world-mill-en.js') }}"></script>
|
||||
<!-- jQuery Knob Chart -->
|
||||
<script src="{{ url_for('static',filename='plugins/knob/1.2.13/jquery.knob.js') }}"></script>
|
||||
<!-- daterangepicker -->
|
||||
<script src="{{ url_for('static',filename='plugins/moment.js/2.11.2/moment.min.js') }}"></script>
|
||||
<script src="{{ url_for('static',filename='plugins/daterangepicker/2.1.19/daterangepicker.js') }}"></script>
|
||||
<!-- datepicker -->
|
||||
<script src="{{ url_for('static',filename='plugins/datepicker/bootstrap-datepicker.js') }}"></script>
|
||||
<!-- Bootstrap WYSIHTML5 -->
|
||||
<script src="{{ url_for('static',filename='plugins/bootstrap-wysihtml5/0.4.15/bootstrap3-wysihtml5.fontawesome.min.js') }}"></script>
|
||||
<!-- Slimscroll -->
|
||||
<script src="{{ url_for('static',filename='plugins/slimScroll/1.3.8/jquery.slimscroll.min.js') }}"></script>
|
||||
<!-- FastClick -->
|
||||
<script src="{{ url_for('static',filename='plugins/fastclick/fastclick.js') }}"></script>
|
||||
<!-- AdminLTE App -->
|
||||
<script src="{{ url_for('static',filename='js/app.min.js') }}"></script>
|
||||
<!-- AdminLTE for demo purposes -->
|
||||
<script src="{{ url_for('static',filename='js/demo.js') }}"></script>
|
||||
{% if admin_view.name=="Home" %}
|
||||
<script src="{{ url_for('static',filename='js/pages/dashboard.js') }}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% endblock tail_js %}
|
||||
|
||||
{% block tail %}
|
||||
{% endblock tail %}
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,61 +0,0 @@
|
||||
{% extends 'admin/master.html' %}
|
||||
{% block body %}
|
||||
{{ super() }}
|
||||
|
||||
{% if current_user.is_authenticated %}
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
Custom View
|
||||
<small>This is a custom view without DB model</small>
|
||||
</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
|
||||
<li class="active">Custom</li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<section class="content">
|
||||
|
||||
<div class="row">
|
||||
<!-- Left col -->
|
||||
<section class="container">
|
||||
|
||||
Here you can place your custom data without a database dependence. <br>
|
||||
Find this file in templates/admin/ as custom_index.html
|
||||
|
||||
</section>
|
||||
<!-- /.Left col -->
|
||||
|
||||
</div>
|
||||
<!-- /.row (main row) -->
|
||||
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
{% else %}
|
||||
|
||||
<section class="content" style="color: white;text-align: center;height:100%;width: 50%;
|
||||
margin: 0 auto;">
|
||||
<div class="col-sm-12">
|
||||
<h1>Alerte 112 - Administration</h1>
|
||||
<p class="lead">
|
||||
{{ _("Authentification") }}
|
||||
</p>
|
||||
<p>
|
||||
{{_("Pour accéder à l'interface d'administration veuillez utiliser vos identifiants.")}}
|
||||
</p>
|
||||
<p>
|
||||
<a class="btn btn-primary" href="{{ url_for('security.login') }}">{{_("Connection")}}</a>
|
||||
</p>
|
||||
<br>
|
||||
<p>
|
||||
<a class="btn btn-primary" href="/"><i class="glyphicon glyphicon-chevron-left"></i> {{ _("Retour") }}</a>
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<br><br><br><br><br><br><br><br><br>
|
||||
<br><br><br><br><br><br><br><br><br><br>
|
||||
{% endif %}
|
||||
|
||||
{% endblock body %}
|
@ -1,9 +0,0 @@
|
||||
{% extends 'admin/master.html' %}
|
||||
{% import 'admin/lib.html' as lib with context %}
|
||||
|
||||
{% block body %}
|
||||
{% block header %}<h3>{{ header_text }}</h3>{% endblock %}
|
||||
{% block fa_form %}
|
||||
{{ lib.render_form(form, dir_url) }}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
@ -1,189 +0,0 @@
|
||||
{% extends 'admin/master.html' %}
|
||||
{% import 'admin/lib.html' as lib with context %}
|
||||
{% import 'admin/actions.html' as actionslib with context %}
|
||||
|
||||
{% block body %}
|
||||
{% block breadcrums %}
|
||||
<ul class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="{{ get_dir_url('.index_view', path=None) }}">{{ _gettext('Root') }}</a>
|
||||
</li>
|
||||
{% for name, path in breadcrumbs[:-1] %}
|
||||
<li class="breadcrumb-item">
|
||||
<a href="{{ get_dir_url('.index_view', path=path) }}">{{ name }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% if breadcrumbs %}
|
||||
<li class="breadcrumb-item">
|
||||
<a href="{{ get_dir_url('.index_view', path=breadcrumbs[-1][1]) }}">{{ breadcrumbs[-1][0] }}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
||||
{% block file_list_table %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
{% block list_header scoped %}
|
||||
{% if actions %}
|
||||
<th class="list-checkbox-column">
|
||||
<input type="checkbox" name="rowtoggle" class="action-rowtoggle" />
|
||||
</th>
|
||||
{% endif %}
|
||||
{% for column in admin_view.column_list %}
|
||||
<th>
|
||||
{% if admin_view.is_column_sortable(column) %}
|
||||
{% if sort_column == column %}
|
||||
<a href="{{ sort_url(column, True) }}" title="{{ _gettext('Sort by %(name)s', name=column) }}">
|
||||
{{ admin_view.column_label(column) }}
|
||||
{% if sort_desc %}
|
||||
<span class="fas fa-chevron-up"></span>
|
||||
{% else %}
|
||||
<span class="fas fa-chevron-down"></span>
|
||||
{% endif %}
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{{ sort_url(column) }}" title="{{ _gettext('Sort by %(name)s', name=column) }}">{{ admin_view.column_label(column) }}</a>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{ _gettext(admin_view.column_label(column)) }}
|
||||
{% endif %}
|
||||
</th>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for name, path, is_dir, size, date in items %}
|
||||
<tr>
|
||||
{% block list_row scoped %}
|
||||
{% if actions %}
|
||||
<td>
|
||||
{% if not is_dir %}
|
||||
<input type="checkbox" name="rowid" class="action-checkbox" value="{{ path }}" />
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
<td>
|
||||
{% block list_row_actions scoped %}
|
||||
{% if admin_view.can_rename and path and name != '..' %}
|
||||
{%- if admin_view.rename_modal -%}
|
||||
{{ lib.add_modal_button(url=get_url('.rename', path=path, modal=True),
|
||||
title=_gettext('Rename File'),
|
||||
content='<i class="fa fa-pen"></i>') }}
|
||||
{% else %}
|
||||
<a class="icon" href="{{ get_url('.rename', path=path) }}" title="{{ _gettext('Rename File') }}">
|
||||
<i class="fa fa-pen"></i>
|
||||
</a>
|
||||
{%- endif -%}
|
||||
{% endif %}
|
||||
{%- if admin_view.can_delete and path -%}
|
||||
{% if is_dir %}
|
||||
{% if name != '..' and admin_view.can_delete_dirs %}
|
||||
<form class="icon" method="POST" action="{{ get_url('.delete') }}">
|
||||
{{ delete_form.path(value=path) }}
|
||||
{{ delete_form.csrf_token }}
|
||||
<button onclick="return confirm('{{ _gettext('Are you sure you want to delete \\\'%(name)s\\\' recursively?', name=name) }}')">
|
||||
<i class="fas fa-times glyphicon glyphicon-remove"></i>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<form class="icon" method="POST" action="{{ get_url('.delete') }}">
|
||||
{{ delete_form.path(value=path) }}
|
||||
{{ delete_form.csrf_token }}
|
||||
<button onclick="return confirm('{{ _gettext('Are you sure you want to delete \\\'%(name)s\\\'?', name=name) }}')">
|
||||
<i class="fa fa-trash glyphicon glyphicon-trash"></i>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{%- endif -%}
|
||||
{% endblock %}
|
||||
</td>
|
||||
{% if is_dir %}
|
||||
<td colspan="2">
|
||||
<a href="{{ get_dir_url('.index_view', path)|safe }}">
|
||||
<i class="fa fa-folder-o glyphicon glyphicon-folder-close"></i> <span>{{ name }}</span>
|
||||
</a>
|
||||
</td>
|
||||
{% else %}
|
||||
<td>
|
||||
{% if admin_view.can_download %}
|
||||
{%- if admin_view.edit_modal and admin_view.is_file_editable(path) -%}
|
||||
{{ lib.add_modal_button(url=get_file_url(path, modal=True)|safe,
|
||||
btn_class='', content=name) }}
|
||||
{% else %}
|
||||
<a href="{{ get_file_url(path)|safe }}">{{ name }}</a>
|
||||
{%- endif -%}
|
||||
{% else %}
|
||||
{{ name }}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% if admin_view.is_column_visible('size') %}
|
||||
<td>
|
||||
{{ size|filesizeformat }}
|
||||
</td>
|
||||
{% endif %}
|
||||
{% if admin_view.is_column_visible('date') %}
|
||||
<td>
|
||||
{{ timestamp_format(date) }}
|
||||
</td>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block toolbar %}
|
||||
<div class="btn-toolbar">
|
||||
{% if admin_view.can_upload %}
|
||||
<div class="btn-group">
|
||||
{%- if admin_view.upload_modal -%}
|
||||
{{ lib.add_modal_button(url=get_dir_url('.upload', path=dir_path, modal=True),
|
||||
btn_class="btn btn-secondary btn-large",
|
||||
content=_gettext('Upload File')) }}
|
||||
{% else %}
|
||||
<a class="btn btn-secondary btn-large" href="{{ get_dir_url('.upload', path=dir_path) }}">{{ _gettext('Upload File') }}</a>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if admin_view.can_mkdir %}
|
||||
<div class="btn-group">
|
||||
{%- if admin_view.mkdir_modal -%}
|
||||
{{ lib.add_modal_button(url=get_dir_url('.mkdir', path=dir_path, modal=True),
|
||||
btn_class="btn btn-secondary btn-large",
|
||||
content=_gettext('Create Directory')) }}
|
||||
{% else %}
|
||||
<a class="btn btn-secondary btn-large" href="{{ get_dir_url('.mkdir', path=dir_path) }}">{{ _gettext('Create Directory') }}</a>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if actions %}
|
||||
<div class="btn-group">
|
||||
{{ actionslib.dropdown(actions, 'dropdown-toggle btn btn-secondary btn-large') }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block actions %}
|
||||
{{ actionslib.form(actions, get_url('.action_view')) }}
|
||||
{% endblock %}
|
||||
|
||||
{%- if admin_view.rename_modal or admin_view.mkdir_modal
|
||||
or admin_view.upload_modal or admin_view.edit_modal -%}
|
||||
{{ lib.add_modal_window() }}
|
||||
{%- endif -%}
|
||||
{% endblock %}
|
||||
|
||||
{% block tail %}
|
||||
{{ super() }}
|
||||
{{ actionslib.script(_gettext('Please select at least one file.'),
|
||||
actions,
|
||||
actions_confirmation) }}
|
||||
{% endblock %}
|
@ -1,19 +0,0 @@
|
||||
{% import 'admin/static.html' as admin_static with context %}
|
||||
{% import 'admin/lib.html' as lib with context %}
|
||||
|
||||
{% block body %}
|
||||
{# content added to modal-content #}
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
{% block header %}<h3>{{ header_text }}</h3>{% endblock %}
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
{% block fa_form %}
|
||||
{{ lib.render_form(form, dir_url, action=request.url, is_modal=True) }}
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block tail %}
|
||||
<script src="{{ admin_static.url(filename='admin/js/bs3_modal.js', v='1.0.0') }}"></script>
|
||||
{% endblock %}
|
@ -1,260 +0,0 @@
|
||||
{% import 'admin/static.html' as admin_static with context %}
|
||||
|
||||
{# ---------------------- Pager -------------------------- #}
|
||||
{% macro pager(page, pages, generator) -%}
|
||||
{% if pages > 1 %}
|
||||
<ul class="pagination">
|
||||
{% set min = page - 3 %}
|
||||
{% set max = page + 3 + 1 %}
|
||||
|
||||
{% if min < 0 %}
|
||||
{% set max = max - min %}
|
||||
{% endif %}
|
||||
{% if max >= pages %}
|
||||
{% set min = min - max + pages %}
|
||||
{% endif %}
|
||||
|
||||
{% if min < 0 %}
|
||||
{% set min = 0 %}
|
||||
{% endif %}
|
||||
{% if max >= pages %}
|
||||
{% set max = pages %}
|
||||
{% endif %}
|
||||
|
||||
{% if min > 0 %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{ generator(0) }}">«</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="disabled page-item">
|
||||
<a class="page-link" href="javascript:void(0)">«</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if page > 0 %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{ generator(page-1) }}"><</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="disabled page-item">
|
||||
<a class="page-link" href="javascript:void(0)"><</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% for p in range(min, max) %}
|
||||
{% if page == p %}
|
||||
<li class="active page-item">
|
||||
<a class="page-link" href="javascript:void(0)">{{ p + 1 }}</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{ generator(p) }}">{{ p + 1 }}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if page + 1 < pages %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{ generator(page + 1) }}">></a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="disabled page-item">
|
||||
<a class="page-link" href="javascript:void(0)">></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if max < pages %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{ generator(pages - 1) }}">»</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="disabled page-item">
|
||||
<a class="page-link" href="javascript:void(0)">»</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro simple_pager(page, have_next, generator) -%}
|
||||
<ul class="pagination">
|
||||
{% if page > 0 %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{ generator(page - 1) }}"><</a>
|
||||
</li class="page-item">
|
||||
{% else %}
|
||||
<li class="disabled page-item">
|
||||
<a class="page-link" href="{{ generator(0) }}"><</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if have_next %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{ generator(page + 1) }}">></a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="disabled page-item">
|
||||
<a class="page-link" href="{{ generator(page) }}">></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{%- endmacro %}
|
||||
|
||||
{# ---------------------- Modal Window ------------------- #}
|
||||
{% macro add_modal_window(modal_window_id='fa_modal_window', modal_label_id='fa_modal_label') %}
|
||||
<div class="modal fade" id="{{ modal_window_id }}" tabindex="-1" role="dialog"
|
||||
aria-labelledby="{{ modal_label_id }}">
|
||||
<div class="modal-dialog" role="document">
|
||||
{# bootstrap version > 3.1.0 required for this to work #}
|
||||
<div class="modal-content">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro add_modal_button(url='', title='', content='', modal_window_id='fa_modal_window', btn_class='icon') %}
|
||||
<a class="{{ btn_class }}" data-target="#{{ modal_window_id }}" title="{{ title }}" href="{{ url }}"
|
||||
data-toggle="modal">
|
||||
{{ content|safe }}
|
||||
</a>
|
||||
{% endmacro %}
|
||||
|
||||
{# ---------------------- Forms -------------------------- #}
|
||||
{% macro render_field(form, field, kwargs={}, caller=None) %}
|
||||
{% set direct_error = h.is_field_error(field.errors) %}
|
||||
<div class="form-group{{ ' has-error' if direct_error else '' }}">
|
||||
<label for="{{ field.id }}" class="col-md-2 control-label">{{ field.label.text }}
|
||||
{% if h.is_required_form_field(field) %}
|
||||
<strong style="color: red">*</strong>
|
||||
{%- else -%}
|
||||
|
||||
{%- endif %}
|
||||
</label>
|
||||
<div class="{{ kwargs.get('column_class', 'col-md-10') }}">
|
||||
{% set _dummy = kwargs.setdefault('class', 'form-control') %}
|
||||
{{ field(**kwargs)|safe }}
|
||||
{% if field.description %}
|
||||
<p class="help-block">{{ field.description|safe }}</p>
|
||||
{% endif %}
|
||||
{% if direct_error %}
|
||||
<ul class="help-block input-errors">
|
||||
{% for e in field.errors if e is string %}
|
||||
<li>{{ e }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if caller %}
|
||||
{{ caller(form, field, direct_error, kwargs) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro render_header(form, text) %}
|
||||
<h3>{{ text }}</h3>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro render_form_fields(form, form_opts=None) %}
|
||||
{% if form.hidden_tag is defined %}
|
||||
{{ form.hidden_tag() }}
|
||||
{% else %}
|
||||
{% if csrf_token %}
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
||||
{% endif %}
|
||||
{% for f in form if f.widget.input_type == 'hidden' %}
|
||||
{{ f }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if form_opts and form_opts.form_rules %}
|
||||
{% for r in form_opts.form_rules %}
|
||||
{{ r(form, form_opts=form_opts) }}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for f in form if f.widget.input_type != 'hidden' %}
|
||||
{% if form_opts %}
|
||||
{% set kwargs = form_opts.widget_args.get(f.short_name, {}) %}
|
||||
{% else %}
|
||||
{% set kwargs = {} %}
|
||||
{% endif %}
|
||||
{{ render_field(form, f, kwargs) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro form_tag(form=None, action=None) %}
|
||||
<form action="{{ action or '' }}" method="POST" role="form" class="admin-form form-horizontal"
|
||||
enctype="multipart/form-data">
|
||||
{{ caller() }}
|
||||
</form>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro render_form_buttons(cancel_url, extra=None, is_modal=False) %}
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10 submit-row">
|
||||
<input type="submit" class="btn btn-primary" value="{{ _gettext('Save') }}"/>
|
||||
{% if extra %}
|
||||
{{ extra }}
|
||||
{% endif %}
|
||||
{% if cancel_url %}
|
||||
<a href="{{ cancel_url }}" class="btn btn-danger" role="button"
|
||||
{% if is_modal %}data-dismiss="modal"{% endif %}>{{ _gettext('Cancel') }}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro render_form(form, cancel_url, extra=None, form_opts=None, action=None, is_modal=False) -%}
|
||||
{% call form_tag(action=action) %}
|
||||
{{ render_form_fields(form, form_opts=form_opts) }}
|
||||
{{ render_form_buttons(cancel_url, extra, is_modal) }}
|
||||
{% endcall %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro form_css() %}
|
||||
<link href="{{ admin_static.url(filename='vendor/select2/select2.css', v='3.5.2') }}" rel="stylesheet">
|
||||
<link href="{{ admin_static.url(filename='vendor/select2/select2-bootstrap3.css', v='1.4.6') }}" rel="stylesheet">
|
||||
<link href="{{ admin_static.url(filename='vendor/bootstrap-daterangepicker/daterangepicker-bs3.css', v='1.3.22') }}"
|
||||
rel="stylesheet">
|
||||
{% if config.MAPBOX_MAP_ID %}
|
||||
<link href="{{ admin_static.url(filename='vendor/leaflet/leaflet.css', v='1.0.0') }}" rel="stylesheet">
|
||||
<link href="{{ admin_static.url(filename='vendor/leaflet/leaflet.draw.css', v='0.3.2') }}" rel="stylesheet">
|
||||
{% endif %}
|
||||
{% if editable_columns %}
|
||||
<link href="{{ admin_static.url(filename='vendor/x-editable/css/bootstrap3-editable.css', v='1.5.1.1') }}"
|
||||
rel="stylesheet">
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro form_js() %}
|
||||
{% if config.MAPBOX_MAP_ID %}
|
||||
<script>
|
||||
window.MAPBOX_MAP_ID = "{{ config.MAPBOX_MAP_ID }}";
|
||||
{% if config.MAPBOX_ACCESS_TOKEN %}
|
||||
window.MAPBOX_ACCESS_TOKEN = "{{ config.MAPBOX_ACCESS_TOKEN }}";
|
||||
{% endif %}
|
||||
</script>
|
||||
<script src="{{ admin_static.url(filename='vendor/leaflet/leaflet.js', v='1.0.0') }}"></script>
|
||||
<script src="{{ admin_static.url(filename='vendor/leaflet/leaflet.draw.js', v='0.3.2') }}"></script>
|
||||
{% if config.MAPBOX_SEARCH %}
|
||||
<script>
|
||||
window.MAPBOX_SEARCH = "{{ config.MAPBOX_SEARCH }}";
|
||||
</script>
|
||||
<script src="https://maps.googleapis.com/maps/api/js?v=3&libraries=places&key={{ config.get('GOOGLE_MAPS_API_KEY') }}"></script>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<script src="{{ admin_static.url(filename='vendor/bootstrap-daterangepicker/daterangepicker.js', v='1.3.22') }}"></script>
|
||||
{% if editable_columns %}
|
||||
<script src="{{ admin_static.url(filename='vendor/x-editable/js/bootstrap3-editable.min.js', v='1.5.1.1') }}"></script>
|
||||
{% endif %}
|
||||
<script src="{{ admin_static.url(filename='admin/js/form.js', v='1.0.1') }}"></script>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro extra() %}
|
||||
{% if admin_view.can_create %}
|
||||
<input name="_add_another" type="submit" class="btn btn-secondary"
|
||||
value="{{ _gettext('Save and Add Another') }}"/>
|
||||
{% endif %}
|
||||
{% if admin_view.can_edit %}
|
||||
<input name="_continue_editing" type="submit" class="btn btn-secondary"
|
||||
value="{{ _gettext('Save and Continue Editing') }}"/>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
@ -1 +0,0 @@
|
||||
{% extends admin_base_template %}
|
@ -1,30 +0,0 @@
|
||||
{% extends 'admin/master.html' %}
|
||||
{% import 'admin/lib.html' as lib with context %}
|
||||
{% from 'admin/lib.html' import extra with context %} {# backward compatible #}
|
||||
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
{{ lib.form_css() }}
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% block navlinks %}
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ return_url }}">{{ _gettext('List') }}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active " href="javascript:void(0)">{{ _gettext('Create') }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
||||
{% block create_form %}
|
||||
{{ lib.render_form(form, return_url, extra(), form_opts) }}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% block tail %}
|
||||
{{ super() }}
|
||||
{{ lib.form_js() }}
|
||||
{% endblock %}
|
@ -1,54 +0,0 @@
|
||||
{% extends 'admin/master.html' %}
|
||||
{% import 'admin/lib.html' as lib with context %}
|
||||
|
||||
{% block body %}
|
||||
{% block navlinks %}
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ return_url }}">{{ _gettext('List') }}</a>
|
||||
</li>
|
||||
{%- if admin_view.can_create -%}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ get_url('.create_view', url=return_url) }}">{{ _gettext('Create') }}</a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
{%- if admin_view.can_edit -%}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ get_url('.edit_view', id=request.args.get('id'), url=return_url) }}">{{ _gettext('Edit') }}</a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="javascript:void(0)">{{ _gettext('Details') }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
||||
{% block details_search %}
|
||||
<div class="input-group fa_filter_container col-lg-6">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">{{ _gettext('Filter') }}</span>
|
||||
</div>
|
||||
<input id="fa_filter" type="text" class="form-control">
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block details_table %}
|
||||
<table class="table table-hover table-bordered searchable">
|
||||
{% for c, name in details_columns %}
|
||||
<tr>
|
||||
<td>
|
||||
<b>{{ name }}</b>
|
||||
</td>
|
||||
<td>
|
||||
{{ get_value(model, c) }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% block tail %}
|
||||
{{ super() }}
|
||||
<script src="{{ admin_static.url(filename='admin/js/details_filter.js', v='1.0.0') }}"></script>
|
||||
{% endblock %}
|
@ -1,40 +0,0 @@
|
||||
{% extends 'admin/master.html' %}
|
||||
{% import 'admin/lib.html' as lib with context %}
|
||||
{% from 'admin/lib.html' import extra with context %} {# backward compatible #}
|
||||
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
{{ lib.form_css() }}
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% block navlinks %}
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ return_url }}">{{ _gettext('List') }}</a>
|
||||
</li>
|
||||
{%- if admin_view.can_create -%}
|
||||
<li class="nav-item">
|
||||
<a href="{{ get_url('.create_view', url=return_url) }}">{{ _gettext('Create') }}</a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active " href="javascript:void(0)">{{ _gettext('Edit') }}</a>
|
||||
</li>
|
||||
{%- if admin_view.can_view_details -%}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ get_url('.details_view', id=request.args.get('id'), url=return_url) }}">{{ _gettext('Details') }}</a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
||||
{% block edit_form %}
|
||||
{{ lib.render_form(form, return_url, extra(), form_opts) }}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% block tail %}
|
||||
{{ super() }}
|
||||
{{ lib.form_js() }}
|
||||
{% endblock %}
|
@ -1,15 +0,0 @@
|
||||
{% import 'admin/model/inline_list_base.html' as base with context %}
|
||||
|
||||
{% macro render_field(field) %}
|
||||
{{ field }}
|
||||
|
||||
{% if h.is_field_error(field.errors) %}
|
||||
<ul class="help-block input-errors">
|
||||
{% for e in field.errors if e is string %}
|
||||
<li>{{ e }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{{ base.render_inline_fields(field, template, render_field, check) }}
|
@ -1,4 +0,0 @@
|
||||
{% import 'admin/lib.html' as lib with context %}
|
||||
<div class="inline-form-field">
|
||||
{{ lib.render_form_fields(field.form, form_opts=form_opts) }}
|
||||
</div>
|
@ -1,52 +0,0 @@
|
||||
{% macro render_inline_fields(field, template, render, check=None) %}
|
||||
<div class="inline-field" id="{{ field.id }}">
|
||||
{# existing inline form fields #}
|
||||
<div class="inline-field-list">
|
||||
{% for subfield in field %}
|
||||
<div id="{{ subfield.id }}" class="inline-field well well-sm">
|
||||
{%- if not check or check(subfield) %}
|
||||
<legend>
|
||||
<small>
|
||||
{{ field.label.text }} #{{ loop.index }}
|
||||
<div class="pull-right">
|
||||
{% if subfield.get_pk and subfield.get_pk() %}
|
||||
<input type="checkbox" name="del-{{ subfield.id }}" id="del-{{ subfield.id }}"/>
|
||||
<label for="del-{{ subfield.id }}"
|
||||
style="display: inline">{{ _gettext('Delete?') }}</label>
|
||||
{% else %}
|
||||
<a href="javascript:void(0)"
|
||||
value="{{ _gettext('Are you sure you want to delete this record?') }}"
|
||||
class="inline-remove-field"><i
|
||||
class="fa fa-times glyphicon glyphicon-remove"></i></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</small>
|
||||
</legend>
|
||||
<div class='clearfix'></div>
|
||||
{%- endif -%}
|
||||
{{ render(subfield) }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{# template for new inline form fields #}
|
||||
<div class="inline-field-template hide">
|
||||
{% filter forceescape %}
|
||||
<div class="inline-field well well-sm">
|
||||
<legend>
|
||||
<small>{{ _gettext('New') }} {{ field.label.text }}</small>
|
||||
<div class="pull-right">
|
||||
<a href="javascript:void(0)"
|
||||
value="{{ _gettext('Are you sure you want to delete this record?') }}"
|
||||
class="inline-remove-field"><span class="fa fa-times glyphicon glyphicon-remove"></span></a>
|
||||
</div>
|
||||
</legend>
|
||||
<div class='clearfix'></div>
|
||||
{{ render(template) }}
|
||||
</div>
|
||||
{% endfilter %}
|
||||
</div>
|
||||
<a id="{{ field.id }}-button" href="javascript:void(0)" class="btn btn-default"
|
||||
onclick="faForm.addInlineField(this, '{{ field.id }}');">{{ _gettext('Add') }} {{ field.label.text }}</a>
|
||||
</div>
|
||||
{% endmacro %}
|
@ -1,101 +0,0 @@
|
||||
{% macro filter_options(btn_class='dropdown-toggle') %}
|
||||
<button class="btn {{ btn_class }}" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{{ _gettext('Add Filter') }}
|
||||
</button>
|
||||
<ul class="dropdown-menu field-filters">
|
||||
{% for k in filter_groups %}
|
||||
<li class="dropdown-item">
|
||||
<a href="javascript:void(0)" class="filter" onclick="return false;">{{ k }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro export_options(btn_class='dropdown-toggle') %}
|
||||
{% if admin_view.export_types|length > 1 %}
|
||||
<li class="dropdown">
|
||||
<a class="{{ btn_class }}" data-toggle="dropdown" href="javascript:void(0)">
|
||||
{{ _gettext('Export') }}<b class="caret"></b>
|
||||
</a>
|
||||
<ul class="dropdown-menu field-filters">
|
||||
{% for export_type in admin_view.export_types %}
|
||||
<li class="dropdown-item">
|
||||
<a href="{{ get_url('.export', export_type=export_type, **request.args) }}" title="{{ _gettext('Export') }}">{{ _gettext('Export') + ' ' + export_type|upper }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
{% else %}
|
||||
<li>
|
||||
<a href="{{ get_url('.export', export_type=admin_view.export_types[0], **request.args) }}" title="{{ _gettext('Export') }}">{{ _gettext('Export') }}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro filter_form() %}
|
||||
<form id="filter_form" method="GET" action="{{ return_url }}">
|
||||
{% if sort_column is not none %}
|
||||
<input type="hidden" name="sort" value="{{ sort_column }}">
|
||||
{% endif %}
|
||||
{% if sort_desc %}
|
||||
<input type="hidden" name="desc" value="{{ sort_desc }}">
|
||||
{% endif %}
|
||||
{% if search %}
|
||||
<input type="hidden" name="search" value="{{ search }}">
|
||||
{% endif %}
|
||||
{% if page_size != default_page_size %}
|
||||
<input type="hidden" name="page_size" value="{{ page_size }}">
|
||||
{% endif %}
|
||||
<div class="float-right">
|
||||
<button type="submit" class="btn btn-primary" style="display: none">{{ _gettext('Apply') }}</button>
|
||||
{% if active_filters %}
|
||||
<a href="{{ clear_search_url }}" class="btn btn-secondary">{{ _gettext('Reset Filters') }}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<table class="filters"></table>
|
||||
</form>
|
||||
<div class="clearfix"></div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro search_form(input_class="") %}
|
||||
<form method="GET" action="{{ return_url }}" class="form-inline" role="search">
|
||||
{% for flt_name, flt_value in filter_args.items() %}
|
||||
<input type="hidden" name="{{ flt_name }}" value="{{ flt_value }}">
|
||||
{% endfor %}
|
||||
{% if page_size != default_page_size %}
|
||||
<input type="hidden" name="page_size" value="{{ page_size }}">
|
||||
{% endif %}
|
||||
{% if sort_column is not none %}
|
||||
<input type="hidden" name="sort" value="{{ sort_column }}">
|
||||
{% endif %}
|
||||
{% if sort_desc %}
|
||||
<input type="hidden" name="desc" value="{{ sort_desc }}">
|
||||
{% endif %}
|
||||
{% if search %}
|
||||
<div class="input-group">
|
||||
<input type="text" name="search" value="{{ search }}" class="{{ input_class }} form-control" placeholder="{{ _gettext('Search') }}">
|
||||
<div class="input-group-append">
|
||||
<a href="{{ clear_search_url }}" class="input-group-text">
|
||||
<span class="fas fa-times"></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="form-group">
|
||||
<input type="text" name="search" value="" class="{{ input_class }} form-control" placeholder="{{ _gettext('Search') }}">
|
||||
</div>
|
||||
{% endif %}
|
||||
</form>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro page_size_form(generator, btn_class='dropdown-toggle') %}
|
||||
<a class="{{ btn_class }}" data-toggle="dropdown" href="javascript:void(0)">
|
||||
{{ page_size }} {{ _gettext('items') }}<b class="caret"></b>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="dropdown-item"><a href="{{ generator(20) }}">20 {{ _gettext('items') }}</a></li>
|
||||
<li class="dropdown-item"><a href="{{ generator(50) }}">50 {{ _gettext('items') }}</a></li>
|
||||
<li class="dropdown-item"><a href="{{ generator(100) }}">100 {{ _gettext('items') }}</a></li>
|
||||
</ul>
|
||||
{% endmacro %}
|
@ -1,228 +0,0 @@
|
||||
{% extends 'admin/master.html' %}
|
||||
{% import 'admin/lib.html' as lib with context %}
|
||||
{% import 'admin/static.html' as admin_static with context %}
|
||||
{% import 'admin/model/layout.html' as model_layout with context %}
|
||||
{% import 'admin/actions.html' as actionlib with context %}
|
||||
{% import 'admin/model/row_actions.html' as row_actions with context %}
|
||||
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
{{ lib.form_css() }}
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% block model_menu_bar %}
|
||||
<ul class="nav nav-tabs actions-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="javascript:void(0)">
|
||||
{{ _gettext('List') }}{% if count %} ({{ count }}){% endif %}</a>
|
||||
</li>
|
||||
|
||||
{% if admin_view.can_create %}
|
||||
<li class="nav-item">
|
||||
{%- if admin_view.create_modal -%}
|
||||
{{ lib.add_modal_button(url=get_url('.create_view', url=return_url, modal=True), title=_gettext('Create New Record'), content=_gettext('Create')) }}
|
||||
{% else %}
|
||||
<a class="nav-link" href="{{ get_url('.create_view', url=return_url) }}"
|
||||
title="{{ _gettext('Create New Record') }}">{{ _gettext('Create') }}</a>
|
||||
{%- endif -%}
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if admin_view.can_export %}
|
||||
{{ model_layout.export_options() }}
|
||||
{% endif %}
|
||||
|
||||
{% block model_menu_bar_before_filters %}{% endblock %}
|
||||
|
||||
{% if filters %}
|
||||
<li class="dropdown">
|
||||
{{ model_layout.filter_options() }}
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if can_set_page_size %}
|
||||
<li class="dropdown">
|
||||
{{ model_layout.page_size_form(page_size_url) }}
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if actions %}
|
||||
<li class="dropdown">
|
||||
{{ actionlib.dropdown(actions) }}
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if search_supported %}
|
||||
<li>
|
||||
{{ model_layout.search_form() }}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% block model_menu_bar_after_filters %}{% endblock %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
||||
{% if filters %}
|
||||
{{ model_layout.filter_form() }}
|
||||
<div class="clearfix"></div>
|
||||
{% endif %}
|
||||
|
||||
{% block model_list_table %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered table-hover model-list">
|
||||
<thead>
|
||||
<tr>
|
||||
{% block list_header scoped %}
|
||||
{% if actions %}
|
||||
<th class="list-checkbox-column">
|
||||
<input type="checkbox" name="rowtoggle" class="action-rowtoggle"
|
||||
title="{{ _gettext('Select all records') }}"/>
|
||||
</th>
|
||||
{% endif %}
|
||||
{% block list_row_actions_header %}
|
||||
{% if admin_view.column_display_actions %}
|
||||
<th> </th>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% for c, name in list_columns %}
|
||||
{% set column = loop.index0 %}
|
||||
<th class="column-header col-{{ c }}">
|
||||
{% if admin_view.is_sortable(c) %}
|
||||
{% if sort_column == column %}
|
||||
<a href="{{ sort_url(column, True) }}"
|
||||
title="{{ _gettext('Sort by %(name)s', name=name) }}">
|
||||
{{ name }}
|
||||
{% if sort_desc %}
|
||||
<span class="fa fa-chevron-up glyphicon glyphicon-chevron-up"></span>
|
||||
{% else %}
|
||||
<span class="fa fa-chevron-down glyphicon glyphicon-chevron-down"></span>
|
||||
{% endif %}
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{{ sort_url(column) }}"
|
||||
title="{{ _gettext('Sort by %(name)s', name=name) }}">{{ name }}</a>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{ name }}
|
||||
{% endif %}
|
||||
{% if admin_view.column_descriptions.get(c) %}
|
||||
<a class="fa fa-question-circle glyphicon glyphicon-question-sign"
|
||||
title="{{ admin_view.column_descriptions[c] }}"
|
||||
href="javascript:void(0)" data-role="tooltip"
|
||||
></a>
|
||||
{% endif %}
|
||||
</th>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
</tr>
|
||||
</thead>
|
||||
{% for row in data %}
|
||||
<tr>
|
||||
{% block list_row scoped %}
|
||||
{% if actions %}
|
||||
<td>
|
||||
<input type="checkbox" name="rowid" class="action-checkbox"
|
||||
value="{{ get_pk_value(row) }}" title="{{ _gettext('Select record') }}"/>
|
||||
</td>
|
||||
{% endif %}
|
||||
{% block list_row_actions_column scoped %}
|
||||
{% if admin_view.column_display_actions %}
|
||||
<td>
|
||||
{% block list_row_actions scoped %}
|
||||
{% for action in list_row_actions %}
|
||||
{{ action.render_ctx(get_pk_value(row), row) }}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
</td>
|
||||
{%- endif -%}
|
||||
{% endblock %}
|
||||
|
||||
{% for c, name in list_columns %}
|
||||
<td class="col-{{ c }}">
|
||||
{% if admin_view.is_editable(c) %}
|
||||
{% set form = list_forms[get_pk_value(row)] %}
|
||||
{% if form.csrf_token %}
|
||||
{{ form[c](pk=get_pk_value(row), display_value=get_value(row, c), csrf=form.csrf_token._value()) }}
|
||||
{% else %}
|
||||
{{ form[c](pk=get_pk_value(row), display_value=get_value(row, c)) }}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{ get_value(row, c) }}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="999">
|
||||
{% block empty_list_message %}
|
||||
<div class="text-center">
|
||||
{{ admin_view.get_empty_list_message() }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
{% block list_pager %}
|
||||
{% if num_pages is not none %}
|
||||
{{ lib.pager(page, num_pages, pager_url) }}
|
||||
{% else %}
|
||||
{{ lib.simple_pager(page, data|length == page_size, pager_url) }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% block actions %}
|
||||
{{ actionlib.form(actions, get_url('.action_view')) }}
|
||||
{% endblock %}
|
||||
|
||||
{%- if admin_view.edit_modal or admin_view.create_modal or admin_view.details_modal -%}
|
||||
{{ lib.add_modal_window() }}
|
||||
{%- endif -%}
|
||||
{% endblock %}
|
||||
|
||||
{% block tail %}
|
||||
{{ super() }}
|
||||
<script src="{{ admin_static.url(filename='admin/js/filters.js', v='1.0.0') }}"></script>
|
||||
{{ lib.form_js() }}
|
||||
|
||||
{{ actionlib.script(_gettext('Please select at least one record.'),
|
||||
actions,
|
||||
actions_confirmation) }}
|
||||
|
||||
<script language="javascript">
|
||||
(function ($) {
|
||||
$('[data-role=tooltip]').tooltip({
|
||||
html: true,
|
||||
placement: 'bottom'
|
||||
});
|
||||
{% if filter_groups %}
|
||||
var filter = new AdminFilters(
|
||||
'#filter_form', '.field-filters',
|
||||
{{ filter_groups|tojson|safe }},
|
||||
{{ active_filters|tojson|safe }}
|
||||
);
|
||||
{% endif %}
|
||||
})(jQuery);
|
||||
|
||||
// Catch exception when closing dialog with <esc> key
|
||||
// and prevent accidental deletions.
|
||||
function safeConfirm(msg) {
|
||||
try {
|
||||
var isconfirmed = confirm(msg);
|
||||
if (isconfirmed == true) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
@ -1,32 +0,0 @@
|
||||
{% import 'admin/static.html' as admin_static with context %}
|
||||
{% import 'admin/lib.html' as lib with context %}
|
||||
|
||||
{# store the jinja2 context for form_rules rendering logic #}
|
||||
{% set render_ctx = h.resolve_ctx() %}
|
||||
|
||||
{% block body %}
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
|
||||
aria-hidden="true">×</span></button>
|
||||
{% block header_text %}<h3>{{ _gettext('Create New Record') }}</h3>{% endblock %}
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
{# "save and add" button is removed from modal (it won't function properly) #}
|
||||
{% block create_form %}
|
||||
{{ lib.render_form(form, return_url, extra=None, form_opts=form_opts,
|
||||
action=url_for('.create_view', url=return_url),
|
||||
is_modal=True) }}
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block tail %}
|
||||
<script src="{{ admin_static.url(filename='admin/js/bs3_modal.js', v='1.0.0') }}"></script>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
// Apply flask-admin form styles after the modal is loaded
|
||||
window.faForm.applyGlobalStyles(document);
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
@ -1,43 +0,0 @@
|
||||
{% import 'admin/static.html' as admin_static with context %}
|
||||
{% import 'admin/lib.html' as lib with context %}
|
||||
|
||||
{% block body %}
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
|
||||
aria-hidden="true">×</span></button>
|
||||
{% block header_text %}
|
||||
<h3>{{ _gettext('View Record') + ' #' + request.args.get('id') }}</h3>
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
{% block details_search %}
|
||||
<div class="input-group fa_filter_container col-lg-6">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">{{ _gettext('Filter') }}</span>
|
||||
</div>
|
||||
<input id="fa_filter" type="text" class="form-control">
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block details_table %}
|
||||
<table class="table table-hover table-bordered searchable">
|
||||
{% for c, name in details_columns %}
|
||||
<tr>
|
||||
<td>
|
||||
<b>{{ name }}</b>
|
||||
</td>
|
||||
<td>
|
||||
{{ get_value(model, c) }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block tail %}
|
||||
<script src="{{ admin_static.url(filename='admin/js/details_filter.js', v='1.0.0') }}"></script>
|
||||
<script src="{{ admin_static.url(filename='admin/js/bs3_modal.js', v='1.0.0') }}"></script>
|
||||
{% endblock %}
|
@ -1,34 +0,0 @@
|
||||
{% import 'admin/static.html' as admin_static with context %}
|
||||
{% import 'admin/lib.html' as lib with context %}
|
||||
|
||||
{# store the jinja2 context for form_rules rendering logic #}
|
||||
{% set render_ctx = h.resolve_ctx() %}
|
||||
|
||||
{% block body %}
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
|
||||
aria-hidden="true">×</span></button>
|
||||
{% block header_text %}
|
||||
<h3>{{ _gettext('Edit Record') + ' #' + request.args.get('id') }}</h3>
|
||||
{% endblock %}
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
{# "save and continue" button is removed from modal (it won't function properly) #}
|
||||
{% block edit_form %}
|
||||
{{ lib.render_form(form, return_url, extra=None, form_opts=form_opts,
|
||||
action=url_for('.edit_view', id=request.args.get('id'), url=return_url),
|
||||
is_modal=True) }}
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block tail %}
|
||||
<script src="{{ admin_static.url(filename='admin/js/bs3_modal.js', v='1.0.0') }}"></script>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
// Apply flask-admin form styles after the modal is loaded
|
||||
window.faForm.applyGlobalStyles(document);
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
@ -1,39 +0,0 @@
|
||||
{% import 'admin/lib.html' as lib with context %}
|
||||
|
||||
{% macro link(action, url, icon_class=None) %}
|
||||
<a class="" href="{{ url }}" title="{{ action.title or '' }}">
|
||||
<span class="{{ icon_class or action.icon_class }}"></span>
|
||||
</a>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro view_row(action, row_id, row) %}
|
||||
{{ link(action, get_url('.details_view', id=row_id, url=return_url), 'fa fa-eye glyphicon icon-eye-open') }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro view_row_popup(action, row_id, row) %}
|
||||
{{ lib.add_modal_button(url=get_url('.details_view', id=row_id, url=return_url, modal=True), title=action.title, content='<span class="fa fa-eye glyphicon icon-eye-open"></span>') }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro edit_row(action, row_id, row) %}
|
||||
{{ link(action, get_url('.edit_view', id=row_id, url=return_url), 'fa fa-pen') }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro edit_row_popup(action, row_id, row) %}
|
||||
{{ lib.add_modal_button(url=get_url('.edit_view', id=row_id, url=return_url, modal=True), title=action.title, content='<span class="fa fa-pen"></span>') }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro delete_row(action, row_id, row) %}
|
||||
<form class="icon" method="POST" action="{{ get_url('.delete_view') }}">
|
||||
{{ delete_form.id(value=get_pk_value(row)) }}
|
||||
{{ delete_form.url(value=return_url) }}
|
||||
{% if delete_form.csrf_token %}
|
||||
{{ delete_form.csrf_token }}
|
||||
{% elif csrf_token %}
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
||||
{% endif %}
|
||||
<button onclick="return confirm('{{ _gettext('Are you sure you want to delete this record?') }}');"
|
||||
title="Delete record">
|
||||
<span class="fa fa-trash glyphicon icon-trash"></span>
|
||||
</button>
|
||||
</form>
|
||||
{% endmacro %}
|
@ -1,30 +0,0 @@
|
||||
{% extends 'admin/master.html' %}
|
||||
{% import 'admin/lib.html' as lib with context %}
|
||||
{% import 'admin/static.html' as admin_static with context%}
|
||||
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
<link href="{{ admin_static.url(filename='admin/css/bootstrap3/rediscli.css', v='1.0.0') }}" rel="stylesheet">
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="console">
|
||||
<div class="console-container">
|
||||
</div>
|
||||
<div class="console-line">
|
||||
<form action="#">
|
||||
<input type="text"></input>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block tail %}
|
||||
{{ super() }}
|
||||
<script src="{{ admin_static.url(filename='admin/js/rediscli.js', v='1.0.0') }}"></script>
|
||||
<script language="javascript">
|
||||
$(function() {
|
||||
var redisCli = new RedisCli({{ admin_view.get_url('.execute_view')|tojson }});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
@ -1,32 +0,0 @@
|
||||
{% macro render(item, depth=0) %}
|
||||
{% set type = type_name(item) %}
|
||||
|
||||
{% if type == 'tuple' or type == 'list' %}
|
||||
{% if not item %}
|
||||
Empty {{ type }}.
|
||||
{% else %}
|
||||
{% for n in item %}
|
||||
{{ loop.index }}) {{ render(n, depth + 1) }}<br/>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% elif type == 'bool' %}
|
||||
{% if depth == 0 and item %}
|
||||
OK
|
||||
{% else %}
|
||||
<span class="type-bool">{{ item }}</span>
|
||||
{% endif %}
|
||||
{% elif type == 'str' or type == 'unicode' %}
|
||||
"{{ item }}"
|
||||
{% elif type == 'bytes' %}
|
||||
"{{ item.decode('utf-8') }}"
|
||||
{% elif type == 'TextWrapper' %}
|
||||
<pre>{{ item }}</pre>
|
||||
{% elif type == 'dict' %}
|
||||
{% for k, v in item.items() %}
|
||||
{{ loop.index }}) {{ k }} - {{ render(v, depth + 1) }}<br/>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{{ item }}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
{{ render(result) }}
|
@ -1,3 +0,0 @@
|
||||
{% macro url() -%}
|
||||
{{ get_url('admin.static', *varargs, **kwargs) }}
|
||||
{%- endmacro %}
|
@ -1,37 +0,0 @@
|
||||
{% import 'admin/static.html' as admin_static with context %}
|
||||
|
||||
{% macro dropdown(actions, btn_class='btn dropdown-toggle') -%}
|
||||
<a class="{{ btn_class }}" data-toggle="dropdown" href="javascript:void(0)">{{ _gettext('With selected') }}<b
|
||||
class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
{% for p in actions %}
|
||||
<li class="dropdown-item">
|
||||
<a href="javascript:void(0)"
|
||||
onclick="return modelActions.execute('{{ p[0] }}');">{{ _gettext(p[1]) }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro form(actions, url) %}
|
||||
{% if actions %}
|
||||
<form id="action_form" action="{{ url }}" method="POST" style="display: none">
|
||||
{% if action_form.csrf_token %}
|
||||
{{ action_form.csrf_token }}
|
||||
{% elif csrf_token %}
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
||||
{% endif %}
|
||||
{{ action_form.url(value=return_url) }}
|
||||
{{ action_form.action() }}
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro script(message, actions, actions_confirmation) %}
|
||||
{% if actions %}
|
||||
<script src="{{ admin_static.url(filename='admin/js/actions.js', v='1.0.0') }}"></script>
|
||||
<script language="javascript">
|
||||
var modelActions = new AdminModelActions({{ message|tojson|safe }}, {{ actions_confirmation|tojson|safe }});
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
@ -1,113 +0,0 @@
|
||||
{% import 'admin/layout.html' as layout with context -%}
|
||||
{% import 'admin/static.html' as admin_static with context %}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{% block title %}{% if admin_view.category %}{{ admin_view.category }} - {% endif %}{{ admin_view.name }} -
|
||||
{{ admin_view.admin.name }}{% endblock %}</title>
|
||||
{% block head_meta %}
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
{% endblock %}
|
||||
{% block head_css %}
|
||||
<!-- Bootstrap CSS -->
|
||||
<link rel="stylesheet" href="{{ url_for("static", filename="external/bootstrap/4.3.1/css/bootstrap.min.css") }}">
|
||||
<!-- Select2.js CSS -->
|
||||
<link rel="stylesheet" href="{{ url_for("static", filename="external/select2/4.0.6/css/select2.min.css") }}">
|
||||
<!-- Fontawesome -->
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css"
|
||||
integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf"
|
||||
crossorigin="anonymous">
|
||||
{# Extra css for admin pages #}
|
||||
{% if admin_view.extra_css %}
|
||||
{% for css_url in admin_view.extra_css %}
|
||||
<link href="{{ css_url }}" rel="stylesheet">
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<!-- Main css for admin pages -->
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename="admin/css/admin.css") }}">
|
||||
{% endblock %}
|
||||
<link rel="icon" href="{{ url_for('static', filename="admin/favicon.ico") }}"/>
|
||||
{% block head %}
|
||||
{% endblock %}
|
||||
{% block head_tail %}
|
||||
{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
{% block page_body %}
|
||||
<nav class="navbar navbar-dark fixed-top bg-dark flex-md-nowrap p-0 shadow">
|
||||
{% block brand %}
|
||||
<a class="navbar-brand col-sm-3 col-md-2 mr-0" href="{{ admin_view.admin.url }}">
|
||||
<img src="{{ url_for('static', filename="admin/favicon.ico") }}" width="30" height="30"
|
||||
class="d-inline-block align-top" alt="">
|
||||
{{ admin_view.admin.name }}
|
||||
</a>
|
||||
{% endblock %}
|
||||
<input class="form-control form-control-dark w-100" type="text" placeholder="Rechercher" aria-label="Search">
|
||||
<ul class="navbar-nav px-3">
|
||||
<li class="nav-item text-nowrap">
|
||||
<a class="nav-link" href="{# todo: Disconnect link #}">Déconection</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<nav class="col-md-2 d-none d-md-block bg-light sidebar">
|
||||
<div class="sidebar-sticky">
|
||||
{% block main_menu %}
|
||||
<ul class="nav flex-column">
|
||||
{{ layout.menu() }}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
{% block menu_links %}
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
{{ layout.menu_links() }}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
{% block access_control %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</nav>
|
||||
{% block messages %}
|
||||
{{ layout.messages() }}
|
||||
{% endblock %}
|
||||
|
||||
{# store the jinja2 context for form_rules rendering logic #}
|
||||
{% set render_ctx = h.resolve_ctx() %}
|
||||
<main class="col-md-9 ml-sm-auto col-lg-10 px-4" role="main">
|
||||
{% block body %}{% endblock %}
|
||||
</main>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block tail_js %}
|
||||
<!-- jQuery - Slim version (=without AJAX) -->
|
||||
<script src="{{ url_for("static", filename="external/jquery/3.4.0/js/jquery.slim.min.js") }}"></script>
|
||||
<!-- Popper.JS -->
|
||||
<script src="{{ url_for("static", filename="external/popper/1.15.0/js/popper.min.js") }}"></script>
|
||||
<!-- Bootstrap JS -->
|
||||
<script src="{{ url_for("static", filename="external/bootstrap/4.3.1/js/bootstrap.min.js") }}"></script>
|
||||
<!-- Moment.js -->
|
||||
<script src="{{ url_for("static", filename="external/moment/2.24.0/js/moment.min.js") }}"></script>
|
||||
<!-- Select2.js -->
|
||||
<script src="{{ url_for("static", filename="external/select2/4.0.6/js/select2.min.js") }}"></script>
|
||||
|
||||
|
||||
{% if admin_view.extra_js %}
|
||||
{% for js_url in admin_view.extra_js %}
|
||||
<script src="{{ js_url }}" type="text/javascript"></script>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block tail %}
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
@ -1,49 +0,0 @@
|
||||
{% extends 'admin/master.html' %}
|
||||
{% block body %}
|
||||
{{ super() }}
|
||||
|
||||
{% if current_user.is_authenticated %}
|
||||
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
Tableau de bord
|
||||
<small>Panneau de contrôle</small>
|
||||
</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="#"><i class="fa fa-dashboard"></i> Tableau de bord</a></li>
|
||||
<li class="active">Panneau de contrôle</li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<section class="content">
|
||||
{# todo: Fill index page #}
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
{% else %}
|
||||
|
||||
<section class="content" style="color: white;text-align: center;height:100%;width: 50%;
|
||||
margin: 0 auto;">
|
||||
<div class="col-sm-12">
|
||||
<h1>LBI - PiPy</h1>
|
||||
<p class="lead">
|
||||
Connection
|
||||
</p>
|
||||
<p>
|
||||
Pour accéder à l'interface d'administration veuillez utiliser vos identifiants.
|
||||
</p>
|
||||
<p>
|
||||
<a class="btn btn-primary" href="{{ url_for('security.login') }}">Connection</a>
|
||||
</p>
|
||||
<br>
|
||||
<p>
|
||||
<a class="btn btn-primary" href="/"><i class="glyphicon glyphicon-chevron-left"></i> Retour</a>
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<br><br><br><br><br><br><br><br><br>
|
||||
<br><br><br><br><br><br><br><br><br><br>
|
||||
{% endif %}
|
||||
|
||||
{% endblock body %}
|
@ -1,117 +0,0 @@
|
||||
{% macro menu_icon(item) %}
|
||||
{% set icon_type = item.get_icon_type() %}
|
||||
{% if icon_type %}
|
||||
{% set icon_value = item.get_icon_value() %}
|
||||
{% if icon_type == 'fa' %}
|
||||
<i class="fa {{ icon_value }}"></i>
|
||||
{% else %}
|
||||
<i class="{{ icon_value }}"></i>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro menu(menu_root=None) %}
|
||||
{% if menu_root is none %}
|
||||
{% set menu_root = admin_view.admin.menu() %}
|
||||
{% endif %}
|
||||
{% for item in menu_root %}
|
||||
{% if item.is_category() %}
|
||||
{% set children = item.get_children() %}
|
||||
{% if children %}
|
||||
{% set class_name = item.get_class_name() or '' %}
|
||||
{% if item.is_active(admin_view) %}
|
||||
<li class="nav-item active{% if class_name %} {{ class_name }}{% endif %}">
|
||||
{% else %}
|
||||
<li class="nav-item{% if class_name %} {{ class_name }}{% endif %}">
|
||||
{% endif %}
|
||||
{% if item.is_active(admin_view) %}
|
||||
<a href="#{{ item.name|e }}Submenu" data-toggle="collapse" aria-expanded="true"
|
||||
class="dropdown-toggle nav-link">
|
||||
{% else %}
|
||||
<a href="#{{ item.name|e }}Submenu" data-toggle="collapse" aria-expanded="false"
|
||||
class="dropdown-toggle nav-link">
|
||||
{% endif %}
|
||||
{% if item.class_name %}<span class="{{ item.class_name }}"></span> {% endif %}
|
||||
{{ menu_icon(item) }}{{ item.name }}
|
||||
{% if 'dropdown-submenu' in class_name %}
|
||||
<i class="glyphicon glyphicon-chevron-right small"></i>
|
||||
{% else %}
|
||||
<i class="glyphicon glyphicon-chevron-down small"></i>
|
||||
{% endif %}
|
||||
</a>
|
||||
{% if item.is_active(admin_view) %}
|
||||
<ul class="collapse list-unstyled show" id="{{ item.name|e }}Submenu">
|
||||
{% else %}
|
||||
<ul class="collapse list-unstyled" id="{{ item.name|e }}Submenu">
|
||||
{% endif %}
|
||||
{% for child in children %}
|
||||
{% if child.is_category() %}
|
||||
{{ menu(menu_root=[child]) }}
|
||||
{% else %}
|
||||
{% set class_name = child.get_class_name() %}
|
||||
{% if child.is_active(admin_view) %}
|
||||
<li class="nav-item active{% if class_name %} {{ class_name }}{% endif %}">
|
||||
{% else %}
|
||||
<li{% if class_name %} class="{{ class_name }}"{% endif %}>
|
||||
{% endif %}
|
||||
{% if child.is_active(admin_view) %}
|
||||
<a class="nav-link active" href="{{ child.get_url() }}"{% if child.target %}
|
||||
target="{{ child.target }}"{% endif %}>
|
||||
{{ menu_icon(child) }}{{ child.name }}</a>
|
||||
{% else %}
|
||||
<a class="nav-link" href="{{ child.get_url() }}"{% if child.target %}
|
||||
target="{{ child.target }}"{% endif %}>
|
||||
{{ menu_icon(child) }}{{ child.name }}</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if item.is_accessible() and item.is_visible() %}
|
||||
{% set class_name = item.get_class_name() %}
|
||||
<li class="nav-item {% if class_name %} {{ class_name }}{% endif %}">
|
||||
<a class="nav-link{% if item.is_active(admin_view) %} active{% endif %}" href="{{ item.get_url() }}"
|
||||
{% if item.target %}
|
||||
target="{{ item.target }}"{% endif %}>
|
||||
{{ menu_icon(item) }}{{ item.name }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro menu_links(links=None) %}
|
||||
{% if links is none %}
|
||||
{% set links = admin_view.admin.menu_links() %}
|
||||
{% endif %}
|
||||
{% for item in links %}
|
||||
{% if item.is_accessible() and item.is_visible() %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ item.get_url() }}">{{ menu_icon(item) }}{{ item.name }}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro messages() %}
|
||||
{% with messages = get_flashed_messages(with_categories=True) %}
|
||||
{% if messages %}
|
||||
{% for category, m in messages %}
|
||||
{% if category %}
|
||||
{# alert-error changed to alert-danger in bootstrap 3, mapping is for backwards compatibility #}
|
||||
{% set mapping = {'message': 'info', 'error': 'danger'} %}
|
||||
<div class="alert alert-{{ mapping.get(category, category) }} alert-dismissable">
|
||||
{% else %}
|
||||
<div class="alert alert-dismissable">
|
||||
{% endif %}
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
{{ m }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endmacro %}
|
@ -1,257 +0,0 @@
|
||||
{% import 'admin/static.html' as admin_static with context %}
|
||||
|
||||
{# ---------------------- Pager -------------------------- #}
|
||||
{% macro pager(page, pages, generator) -%}
|
||||
{% if pages > 1 %}
|
||||
<ul class="pagination">
|
||||
{% set min = page - 3 %}
|
||||
{% set max = page + 3 + 1 %}
|
||||
|
||||
{% if min < 0 %}
|
||||
{% set max = max - min %}
|
||||
{% endif %}
|
||||
{% if max >= pages %}
|
||||
{% set min = min - max + pages %}
|
||||
{% endif %}
|
||||
|
||||
{% if min < 0 %}
|
||||
{% set min = 0 %}
|
||||
{% endif %}
|
||||
{% if max >= pages %}
|
||||
{% set max = pages %}
|
||||
{% endif %}
|
||||
|
||||
{% if min > 0 %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{ generator(0) }}">«</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="disabled page-item">
|
||||
<a class="page-link" href="javascript:void(0)">«</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if page > 0 %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{ generator(page-1) }}"><</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="disabled page-item">
|
||||
<a class="page-link" href="javascript:void(0)"><</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% for p in range(min, max) %}
|
||||
{% if page == p %}
|
||||
<li class="active page-item">
|
||||
<a class="page-link" href="javascript:void(0)">{{ p + 1 }}</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{ generator(p) }}">{{ p + 1 }}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if page + 1 < pages %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{ generator(page + 1) }}">></a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="disabled page-item">
|
||||
<a class="page-link" href="javascript:void(0)">></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if max < pages %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{ generator(pages - 1) }}">»</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="disabled page-item">
|
||||
<a class="page-link" href="javascript:void(0)">»</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro simple_pager(page, have_next, generator) -%}
|
||||
<ul class="pagination">
|
||||
{% if page > 0 %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{ generator(page - 1) }}"><</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="disabled page-item">
|
||||
<a class="page-link" href="{{ generator(0) }}"><</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if have_next %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{ generator(page + 1) }}">></a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="disabled page-item">
|
||||
<a class="page-link" href="{{ generator(page) }}">></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{%- endmacro %}
|
||||
|
||||
{# ---------------------- Modal Window ------------------- #}
|
||||
{% macro add_modal_window(modal_window_id='fa_modal_window', modal_label_id='fa_modal_label') %}
|
||||
<div class="modal fade" id="{{ modal_window_id }}" tabindex="-1" role="dialog"
|
||||
aria-labelledby="{{ modal_label_id }}">
|
||||
<div class="modal-dialog" role="document">
|
||||
{# bootstrap version > 3.1.0 required for this to work #}
|
||||
<div class="modal-content">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro add_modal_button(url='', title='', content='', modal_window_id='fa_modal_window', btn_class='icon') %}
|
||||
<a class="{{ btn_class }}" data-target="#{{ modal_window_id }}" title="{{ title }}" href="{{ url }}"
|
||||
data-toggle="modal">
|
||||
{{ content|safe }}
|
||||
</a>
|
||||
{% endmacro %}
|
||||
|
||||
{# ---------------------- Forms -------------------------- #}
|
||||
{% macro render_field(form, field, kwargs={}, caller=None) %}
|
||||
{% set direct_error = h.is_field_error(field.errors) %}
|
||||
<div class="form-group{{ ' has-error' if direct_error else '' }}">
|
||||
<label for="{{ field.id }}" class="col-md-3 control-label">{{ field.label.text }}
|
||||
{% if h.is_required_form_field(field) %}
|
||||
<strong style="color: red">*</strong>
|
||||
{%- else -%}
|
||||
|
||||
{%- endif %}
|
||||
</label>
|
||||
<div class="{{ kwargs.get('column_class', 'col-md-10') }}">
|
||||
{% set _dummy = kwargs.setdefault('class', 'form-control') %}
|
||||
{{ field(**kwargs)|safe }}
|
||||
{% if field.description %}
|
||||
<p class="help-block">{{ field.description|safe }}</p>
|
||||
{% endif %}
|
||||
{% if direct_error %}
|
||||
<ul class="help-block input-errors">
|
||||
{% for e in field.errors if e is string %}
|
||||
<li>{{ e }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if caller %}
|
||||
{{ caller(form, field, direct_error, kwargs) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro render_header(form, text) %}
|
||||
<h3>{{ text }}</h3>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro render_form_fields(form, form_opts=None) %}
|
||||
{% if form.hidden_tag is defined %}
|
||||
{{ form.hidden_tag() }}
|
||||
{% else %}
|
||||
{% if csrf_token %}
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
||||
{% endif %}
|
||||
{% for f in form if f.widget.input_type == 'hidden' %}
|
||||
{{ f }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if form_opts and form_opts.form_rules %}
|
||||
{% for r in form_opts.form_rules %}
|
||||
{{ r(form, form_opts=form_opts) }}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for f in form if f.widget.input_type != 'hidden' %}
|
||||
{% if form_opts %}
|
||||
{% set kwargs = form_opts.widget_args.get(f.short_name, {}) %}
|
||||
{% else %}
|
||||
{% set kwargs = {} %}
|
||||
{% endif %}
|
||||
{{ render_field(form, f, kwargs) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro form_tag(form=None, action=None) %}
|
||||
<form action="{{ action or '' }}" method="POST" role="form" class="admin-form form-horizontal"
|
||||
enctype="multipart/form-data">
|
||||
{{ caller() }}
|
||||
</form>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro render_form_buttons(cancel_url, extra=None, is_modal=False) %}
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10 submit-row">
|
||||
<input type="submit" class="btn btn-primary" value="{{ _gettext('Save') }}"/>
|
||||
{% if extra %}
|
||||
{{ extra }}
|
||||
{% endif %}
|
||||
{% if cancel_url %}
|
||||
<a href="{{ cancel_url }}" class="btn btn-danger" role="button"
|
||||
{% if is_modal %}data-dismiss="modal"{% endif %}>{{ _gettext('Cancel') }}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro render_form(form, cancel_url, extra=None, form_opts=None, action=None, is_modal=False) -%}
|
||||
{% call form_tag(action=action) %}
|
||||
{{ render_form_fields(form, form_opts=form_opts) }}
|
||||
{{ render_form_buttons(cancel_url, extra, is_modal) }}
|
||||
{% endcall %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro form_css() %}
|
||||
<link href="{{ url_for("static", filename="external/select2/4.0.6/css/select2.min.css") }}" rel="stylesheet">
|
||||
<link href="{{ url_for("static", filename="external/daterangepicker/3.0.4/css/daterangepicker.css") }}"
|
||||
rel="stylesheet">
|
||||
{% if config.MAPBOX_MAP_ID %}
|
||||
<link href="{{ url_for("static", filename="external/leaflet/1.4.0/css/leaflet.css") }}" rel="stylesheet">
|
||||
{% endif %}
|
||||
{% if editable_columns %}
|
||||
<link href="{{ url_for("static", filename="external/bootstrap-editable/1.5.3-bs4/css/bootstrap-editable.css") }}"
|
||||
rel="stylesheet">
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro form_js() %}
|
||||
{% if config.MAPBOX_MAP_ID %}
|
||||
<script>
|
||||
window.MAPBOX_MAP_ID = "{{ config.MAPBOX_MAP_ID }}";
|
||||
{% if config.MAPBOX_ACCESS_TOKEN %}
|
||||
window.MAPBOX_ACCESS_TOKEN = "{{ config.MAPBOX_ACCESS_TOKEN }}";
|
||||
{% endif %}
|
||||
</script>
|
||||
<script src="{{ url_for("static", filename='external/leaflet/1.4.0/js/leaflet.js', v='1.0.0') }}"></script>
|
||||
{% if config.MAPBOX_SEARCH %}
|
||||
<script>
|
||||
window.MAPBOX_SEARCH = "{{ config.MAPBOX_SEARCH }}";
|
||||
</script>
|
||||
<script src="https://maps.googleapis.com/maps/api/js?v=3&libraries=places&key={{ config.get('GOOGLE_MAPS_API_KEY') }}"></script>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<script src="{{ url_for("static", filename="external/daterangepicker/3.0.4/js/daterangepicker.js") }}"></script>
|
||||
{% if editable_columns %}
|
||||
<script src="{{ url_for("static", filename="external/bootstrap-editable/1.5.3-bs4/js/bootstrap-editable.js") }}"></script>
|
||||
{% endif %}
|
||||
<script src="{{ url_for("static", filename="admin/js/form.js") }}"></script>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro extra() %}
|
||||
{% if admin_view.can_create %}
|
||||
<input name="_add_another" type="submit" class="btn btn-secondary"
|
||||
value="{{ _gettext('Save and Add Another') }}"/>
|
||||
{% endif %}
|
||||
{% if admin_view.can_edit %}
|
||||
<input name="_continue_editing" type="submit" class="btn btn-secondary"
|
||||
value="{{ _gettext('Save and Continue Editing') }}"/>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
@ -1,30 +0,0 @@
|
||||
{% extends 'admin/master.html' %}
|
||||
{% import 'admin/lib.html' as lib with context %}
|
||||
{% from 'admin/lib.html' import extra with context %} {# backward compatible #}
|
||||
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
{{ lib.form_css() }}
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% block navlinks %}
|
||||
<ul class="nav nav-tabs actions-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ return_url }}">{{ _gettext('List') }}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active " href="javascript:void(0)">{{ _gettext('Create') }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
||||
{% block create_form %}
|
||||
{{ lib.render_form(form, return_url, extra(), form_opts) }}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% block tail %}
|
||||
{{ super() }}
|
||||
{{ lib.form_js() }}
|
||||
{% endblock %}
|
@ -1,40 +0,0 @@
|
||||
{% extends 'admin/master.html' %}
|
||||
{% import 'admin/lib.html' as lib with context %}
|
||||
{% from 'admin/lib.html' import extra with context %} {# backward compatible #}
|
||||
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
{{ lib.form_css() }}
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% block navlinks %}
|
||||
<ul class="nav nav-tabs actions-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ return_url }}">{{ _gettext('List') }}</a>
|
||||
</li>
|
||||
{%- if admin_view.can_create -%}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ get_url('.create_view', url=return_url) }}">{{ _gettext('Create') }}</a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active " href="javascript:void(0)">{{ _gettext('Edit') }}</a>
|
||||
</li>
|
||||
{%- if admin_view.can_view_details -%}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ get_url('.details_view', id=request.args.get('id'), url=return_url) }}">{{ _gettext('Details') }}</a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
||||
{% block edit_form %}
|
||||
{{ lib.render_form(form, return_url, extra(), form_opts) }}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% block tail %}
|
||||
{{ super() }}
|
||||
{{ lib.form_js() }}
|
||||
{% endblock %}
|
@ -1,57 +0,0 @@
|
||||
{% macro render_inline_fields(field, template, render, check=None) %}
|
||||
<div class="inline-field" id="{{ field.id }}">
|
||||
{# existing inline form fields #}
|
||||
{% for subfields in field|batch(2, ' ') %}
|
||||
<div class="row inline-field-list">
|
||||
{% for subfield in subfields %}
|
||||
<div class="col-sm-6">
|
||||
<div id="{{ subfield.id }}" class="card well well-sm">
|
||||
{%- if not check or check(subfield) %}
|
||||
<div class="card-header">
|
||||
{{ field.label.text }} #{{ loop.index }}
|
||||
</div>
|
||||
{%- endif -%}
|
||||
<div class="card-body">
|
||||
{{ render(subfield) }}
|
||||
{% if subfield.get_pk and subfield.get_pk() %}
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="del-{{ subfield.id }}"
|
||||
id="del-{{ subfield.id }}"/>
|
||||
<label class="form-check-label" for="del-{{ subfield.id }}"
|
||||
style="display: inline">{{ _gettext('Delete?') }}</label>
|
||||
</div>
|
||||
{% else %}
|
||||
<a href="javascript:void(0)"
|
||||
value="{{ _gettext('Are you sure you want to delete this record?') }}"
|
||||
class="inline-remove-field"><i
|
||||
class="fa fa-times glyphicon glyphicon-remove"></i></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{# template for new inline form fields #}
|
||||
<div class="inline-field-template hide">
|
||||
{% filter forceescape %}
|
||||
<div class="col-sm-6">
|
||||
<div class="card well well-sm">
|
||||
<div class="card-header">
|
||||
{{ _gettext('New') }} {{ field.label.text }}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{{ render(template) }}
|
||||
<a href="javascript:void(0)"
|
||||
value="{{ _gettext('Are you sure you want to delete this record?') }}"
|
||||
class="inline-remove-field"><span class="fa fa-times glyphicon glyphicon-remove"></span></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfilter %}
|
||||
</div>
|
||||
<a id="{{ field.id }}-button" href="javascript:void(0)" class="btn btn-default"
|
||||
onclick="faForm.addInlineField(this, '{{ field.id }}');">{{ _gettext('Add') }} {{ field.label.text }}</a>
|
||||
</div>
|
||||
{% endmacro %}
|
@ -1,119 +0,0 @@
|
||||
{%- macro filter_options(btn_class='dropdown-toggle') -%}
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
|
||||
aria-expanded="false">
|
||||
{{ _gettext('Add Filter') }}
|
||||
</a>
|
||||
<ul class="dropdown-menu field-filters">
|
||||
{%- for k in filter_groups -%}
|
||||
<li class="dropdown-item">
|
||||
<a href="javascript:void(0)" class="filter" onclick="return false;">{{ k }}</a>
|
||||
</li>
|
||||
{%- endfor -%}
|
||||
</ul>
|
||||
</li>
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro export_options(btn_class='dropdown-toggle') -%}
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link {{ btn_class }}" data-toggle="dropdown" href="javascript:void(0)">
|
||||
{{ _gettext('Export') }}<b class="caret"></b>
|
||||
</a>
|
||||
<ul class="dropdown-menu field-filters">
|
||||
{%- for export_type in admin_view.export_types -%}
|
||||
<li class="dropdown-item">
|
||||
<a href="{{ get_url('.export', export_type=export_type, **request.args) }}"
|
||||
title="{{ _gettext('Export') }}">{{ _gettext('Export') + ' ' + export_type|upper }}</a>
|
||||
</li>
|
||||
{%- endfor -%}
|
||||
</ul>
|
||||
</li>
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro filter_form() -%}
|
||||
<form id="filter_form" method="GET" action="{{ return_url }}">
|
||||
{%- if sort_column is not none -%}
|
||||
<input type="hidden" class="form-control" name="sort" value="{{ sort_column }}">
|
||||
{%- endif -%}
|
||||
{%- if sort_desc -%}
|
||||
<input type="hidden" class="form-control" name="desc" value="{{ sort_desc }}">
|
||||
{%- endif -%}
|
||||
{%- if search -%}
|
||||
<input type="hidden" class="form-control" name="search" value="{{ search }}">
|
||||
{%- endif -%}
|
||||
{%- if page_size != default_page_size -%}
|
||||
<input type="hidden" class="form-control" name="page_size" value="{{ page_size }}">
|
||||
{%- endif -%}
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary" style="display: none">{{ _gettext('Apply') }}</button>
|
||||
{%- if active_filters -%}
|
||||
<a href="{{ clear_search_url }}" class="btn btn-default">{{ _gettext('Reset Filters') }}</a>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
|
||||
<table class="filters"></table>
|
||||
</form>
|
||||
<div class="clearfix"></div>
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro search_form(input_class="") -%}
|
||||
<form method="GET" action="{{ return_url }}" class="form-inline" role="search">
|
||||
{%- for flt_name, flt_value in filter_args.items() -%}
|
||||
<input type="hidden" name="{{ flt_name }}" value="{{ flt_value }}">
|
||||
{%- endfor -%}
|
||||
{%- if page_size != default_page_size -%}
|
||||
<input type="hidden" name="page_size" value="{{ page_size }}">
|
||||
{%- endif -%}
|
||||
{%- if sort_column is not none -%}
|
||||
<input type="hidden" name="sort" value="{{ sort_column }}">
|
||||
{%- endif -%}
|
||||
{%- if sort_desc -%}
|
||||
<input type="hidden" name="desc" value="{{ sort_desc }}">
|
||||
{%- endif -%}
|
||||
{%- if search -%}
|
||||
<div class="input-group">
|
||||
<input type="text" name="search" value="{{ search }}" class="{{ input_class }} form-control"
|
||||
placeholder="{{ _gettext('Search') }}">
|
||||
<div class="input-group-append">
|
||||
<a href="{{ clear_search_url }}" class="input-group-text">
|
||||
<span class="fas fa-times"></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{%- else -%}
|
||||
<div class="form-group">
|
||||
<input type="text" name="search" value="" class="{{ input_class }} form-control"
|
||||
placeholder="{{ _gettext('Search') }}">
|
||||
</div>
|
||||
{%- endif -%}
|
||||
</form>
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro page_size_form(generator, btn_class='dropdown-toggle') -%}
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link {{ btn_class }}" data-toggle="dropdown" href="javascript:void(0)">
|
||||
{{ page_size }} {{ _gettext('items') }}<b class="caret"></b>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="dropdown-item"><a href="{{ generator(20) }}">20 {{ _gettext('items') }}</a></li>
|
||||
<li class="dropdown-item"><a href="{{ generator(50) }}">50 {{ _gettext('items') }}</a></li>
|
||||
<li class="dropdown-item"><a href="{{ generator(100) }}">100 {{ _gettext('items') }}</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro actions(actions) -%}
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle{{ btn_class }}" data-toggle="dropdown" href="javascript:void(0)">
|
||||
{{ _gettext('With selected') }}<b class="caret"></b>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
{%- for p in actions -%}
|
||||
<li class="dropdown-item">
|
||||
<a href="javascript:void(0)"
|
||||
onclick="return modelActions.execute('{{ p[0] }}');">{{ _gettext(p[1]) }}</a>
|
||||
</li>
|
||||
{%- endfor -%}
|
||||
</ul>
|
||||
</li>
|
||||
{%- endmacro -%}
|
@ -1,222 +0,0 @@
|
||||
{%- extends 'admin/master.html' -%}
|
||||
{%- import 'admin/lib.html' as lib with context -%}
|
||||
{%- import 'admin/static.html' as admin_static with context -%}
|
||||
{%- import 'admin/model/layout.html' as model_layout with context -%}
|
||||
{%- import 'admin/actions.html' as actionlib with context -%}
|
||||
{%- import 'admin/model/row_actions.html' as row_actions with context -%}
|
||||
|
||||
{%- block head -%}
|
||||
{{ super() }}
|
||||
{{ lib.form_css() }}
|
||||
{%- endblock -%}
|
||||
|
||||
{%- block body -%}
|
||||
{%- block model_menu_bar -%}
|
||||
<ul class="nav nav-tabs actions-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="javascript:void(0)">
|
||||
{{ _gettext('List') }}{%- if count -%} ({{ count }}){%- endif -%}</a>
|
||||
</li>
|
||||
|
||||
{%- if admin_view.can_create -%}
|
||||
<li class="nav-item">
|
||||
{%- if admin_view.create_modal -%}
|
||||
{{ lib.add_modal_button(url=get_url('.create_view', url=return_url, modal=True), title=_gettext('Create New Record'), content=_gettext('Create')) }}
|
||||
{%- else -%}
|
||||
<a class="nav-link" href="{{ get_url('.create_view', url=return_url) }}"
|
||||
title="{{ _gettext('Create New Record') }}">{{ _gettext('Create') }}</a>
|
||||
{%- endif -%}
|
||||
</li>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if admin_view.can_export -%}
|
||||
{{ model_layout.export_options() }}
|
||||
{%- endif -%}
|
||||
|
||||
{%- block model_menu_bar_before_filters -%}{%- endblock -%}
|
||||
|
||||
{%- if filters -%}
|
||||
{{ model_layout.filter_options() }}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if can_set_page_size -%}
|
||||
{{ model_layout.page_size_form(page_size_url) }}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if actions -%}
|
||||
{{ model_layout.actions(actions) }}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if search_supported -%}
|
||||
<li>
|
||||
{{ model_layout.search_form() }}
|
||||
</li>
|
||||
{%- endif -%}
|
||||
{%- block model_menu_bar_after_filters -%}{%- endblock -%}
|
||||
</ul>
|
||||
{%- endblock -%}
|
||||
|
||||
{%- if filters -%}
|
||||
{{ model_layout.filter_form() }}
|
||||
<div class="clearfix"></div>
|
||||
{%- endif -%}
|
||||
|
||||
{%- block model_list_table -%}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered table-hover model-list">
|
||||
<thead>
|
||||
<tr>
|
||||
{%- block list_header scoped -%}
|
||||
{%- if actions -%}
|
||||
<th class="list-checkbox-column">
|
||||
<input type="checkbox" name="rowtoggle" class="action-rowtoggle"
|
||||
title="{{ _gettext('Select all records') }}"/>
|
||||
</th>
|
||||
{%- endif -%}
|
||||
{%- block list_row_actions_header -%}
|
||||
{%- if admin_view.column_display_actions -%}
|
||||
<th> </th>
|
||||
{%- endif -%}
|
||||
{%- endblock -%}
|
||||
{%- for c, name in list_columns -%}
|
||||
{%- set column = loop.index0 -%}
|
||||
<th class="column-header col-{{ c }}">
|
||||
{%- if admin_view.is_sortable(c) -%}
|
||||
{%- if sort_column == column -%}
|
||||
<a href="{{ sort_url(column, True) }}"
|
||||
title="{{ _gettext('Sort by %(name)s', name=name) }}">
|
||||
{{ name }}
|
||||
{%- if sort_desc -%}
|
||||
<span class="fa fa-chevron-up glyphicon glyphicon-chevron-up"></span>
|
||||
{%- else -%}
|
||||
<span class="fa fa-chevron-down glyphicon glyphicon-chevron-down"></span>
|
||||
{%- endif -%}
|
||||
</a>
|
||||
{%- else -%}
|
||||
<a href="{{ sort_url(column) }}"
|
||||
title="{{ _gettext('Sort by %(name)s', name=name) }}">{{ name }}</a>
|
||||
{%- endif -%}
|
||||
{%- else -%}
|
||||
{{ name }}
|
||||
{%- endif -%}
|
||||
{%- if admin_view.column_descriptions.get(c) -%}
|
||||
<a class="fa fa-question-circle glyphicon glyphicon-question-sign"
|
||||
title="{{ admin_view.column_descriptions[c] }}"
|
||||
href="javascript:void(0)" data-role="tooltip"
|
||||
></a>
|
||||
{%- endif -%}
|
||||
</th>
|
||||
{%- endfor -%}
|
||||
{%- endblock -%}
|
||||
</tr>
|
||||
</thead>
|
||||
{%- for row in data -%}
|
||||
<tr>
|
||||
{%- block list_row scoped -%}
|
||||
{%- if actions -%}
|
||||
<td>
|
||||
<input type="checkbox" name="rowid" class="action-checkbox"
|
||||
value="{{ get_pk_value(row) }}" title="{{ _gettext('Select record') }}"/>
|
||||
</td>
|
||||
{%- endif -%}
|
||||
{%- block list_row_actions_column scoped -%}
|
||||
{%- if admin_view.column_display_actions -%}
|
||||
<td class="actions">
|
||||
{%- block list_row_actions scoped -%}
|
||||
{%- for action in list_row_actions -%}
|
||||
{{ action.render_ctx(get_pk_value(row), row) }}
|
||||
{%- endfor -%}
|
||||
{%- endblock -%}
|
||||
</td>
|
||||
{%- endif -%}
|
||||
{%- endblock -%}
|
||||
|
||||
{%- for c, name in list_columns -%}
|
||||
<td class="col-{{ c }}">
|
||||
{%- if admin_view.is_editable(c) -%}
|
||||
{%- set form = list_forms[get_pk_value(row)] -%}
|
||||
{%- if form.csrf_token -%}
|
||||
{{ form[c](pk=get_pk_value(row), display_value=get_value(row, c), csrf=form.csrf_token._value()) }}
|
||||
{%- else -%}
|
||||
{{ form[c](pk=get_pk_value(row), display_value=get_value(row, c)) }}
|
||||
{%- endif -%}
|
||||
{%- else -%}
|
||||
{{ get_value(row, c) }}
|
||||
{%- endif -%}
|
||||
</td>
|
||||
{%- endfor -%}
|
||||
{%- endblock -%}
|
||||
</tr>
|
||||
{%- else -%}
|
||||
<tr>
|
||||
<td colspan="999">
|
||||
{%- block empty_list_message -%}
|
||||
<div class="text-center">
|
||||
{{ admin_view.get_empty_list_message() }}
|
||||
</div>
|
||||
{%- endblock -%}
|
||||
</td>
|
||||
</tr>
|
||||
{%- endfor -%}
|
||||
</table>
|
||||
</div>
|
||||
{%- block list_pager -%}
|
||||
{%- if num_pages is not none -%}
|
||||
{{ lib.pager(page, num_pages, pager_url) }}
|
||||
{%- else -%}
|
||||
{{ lib.simple_pager(page, data|length == page_size, pager_url) }}
|
||||
{%- endif -%}
|
||||
{%- endblock -%}
|
||||
{%- endblock -%}
|
||||
|
||||
{%- block actions -%}
|
||||
{{ actionlib.form(actions, get_url('.action_view')) }}
|
||||
{%- endblock -%}
|
||||
|
||||
{%- if admin_view.edit_modal or admin_view.create_modal or admin_view.details_modal -%}
|
||||
{{ lib.add_modal_window() }}
|
||||
{%- endif -%}
|
||||
{%- endblock -%}
|
||||
|
||||
{%- block tail -%}
|
||||
{{ super() }}
|
||||
<script src="{{ admin_static.url(filename='admin/js/filters.js', v='1.0.0') }}"></script>
|
||||
{{ lib.form_js() }}
|
||||
|
||||
{{ actionlib.script(_gettext('Please select at least one record.'),
|
||||
actions,
|
||||
actions_confirmation) }}
|
||||
|
||||
<script language="javascript">
|
||||
(function ($) {
|
||||
$('[data-role=tooltip]').tooltip({
|
||||
html: true,
|
||||
placement: 'bottom'
|
||||
});
|
||||
{%- if filter_groups -%}
|
||||
var filter = new AdminFilters(
|
||||
'#filter_form', '.field-filters',
|
||||
{{ filter_groups|tojson|safe }},
|
||||
{{ active_filters|tojson|safe }}
|
||||
);
|
||||
{%- endif -%}
|
||||
})(jQuery);
|
||||
|
||||
// Catch exception when closing dialog with <esc> key
|
||||
// and prevent accidental deletions.
|
||||
function safeConfirm(msg) {
|
||||
try {
|
||||
var isconfirmed = confirm(msg);
|
||||
if (isconfirmed == true) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{%- endblock -%}
|
@ -1,39 +0,0 @@
|
||||
{% import 'admin/lib.html' as lib with context %}
|
||||
|
||||
{% macro link(action, url, icon_class=None) %}
|
||||
<a class="btn btn-info" href="{{ url }}" title="{{ action.title or '' }}">
|
||||
<span class="{{ icon_class or action.icon_class }}"></span>
|
||||
</a>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro view_row(action, row_id, row) %}
|
||||
{{ link(action, get_url('.details_view', id=row_id, url=return_url), 'fa fa-eye glyphicon icon-eye-open') }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro view_row_popup(action, row_id, row) %}
|
||||
{{ lib.add_modal_button(url=get_url('.details_view', id=row_id, url=return_url, modal=True), title=action.title, content='<span class="fa fa-eye glyphicon icon-eye-open"></span>') }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro edit_row(action, row_id, row) %}
|
||||
{{ link(action, get_url('.edit_view', id=row_id, url=return_url), 'fa fa-pen') }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro edit_row_popup(action, row_id, row) %}
|
||||
{{ lib.add_modal_button(url=get_url('.edit_view', id=row_id, url=return_url, modal=True), title=action.title, content='<span class="fa fa-pen"></span>') }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro delete_row(action, row_id, row) %}
|
||||
<form method="POST" action="{{ get_url('.delete_view') }}">
|
||||
{{ delete_form.id(value=get_pk_value(row)) }}
|
||||
{{ delete_form.url(value=return_url) }}
|
||||
{% if delete_form.csrf_token %}
|
||||
{{ delete_form.csrf_token }}
|
||||
{% elif csrf_token %}
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
||||
{% endif %}
|
||||
<button onclick="return confirm('{{ _gettext('Are you sure you want to delete this record?') }}');"
|
||||
title="Delete record" class="btn btn-danger">
|
||||
<span class="fa fa-trash glyphicon icon-trash"></span>
|
||||
</button>
|
||||
</form>
|
||||
{% endmacro %}
|
@ -7,10 +7,10 @@ from flask_babelex import Babel
|
||||
from flask_security import Security, SQLAlchemyUserDatastore
|
||||
from flask_uploads import patch_request_class
|
||||
|
||||
from LBI_PiPy.blueprints.admin import admin
|
||||
from LBI_PiPy.blueprints.api import api, api_0_0_1
|
||||
from LBI_PiPy.models import db, User, Role
|
||||
from LBI_PiPy.views import main_bp
|
||||
from PDMI.blueprints.admin import admin
|
||||
from PDMI.blueprints.api import api, api_0_0_1
|
||||
from PDMI.models import db, User, Role
|
||||
from PDMI.views import main_bp
|
||||
|
||||
# Config mimetype
|
||||
mimetypes.add_type('text/css', '.css')
|
||||
@ -19,7 +19,7 @@ mimetypes.add_type('text/javascript', '.js')
|
||||
server = Flask(__name__)
|
||||
|
||||
# Load config
|
||||
server.config.from_object('LBI_PiPy.config')
|
||||
server.config.from_object('PDMI.config')
|
||||
|
||||
# Create database
|
||||
db.init_app(server)
|
@ -7,7 +7,7 @@ from flask_security import current_user
|
||||
from werkzeug.exceptions import abort
|
||||
from werkzeug.utils import redirect
|
||||
|
||||
from LBI_PiPy.models import db, User, Module, ModuleVersion, Role
|
||||
from PDMI.models import db, Users, Modules, ModuleVersions, Roles
|
||||
|
||||
|
||||
# from server.main import security
|
||||
@ -99,11 +99,10 @@ class IndexView(AdminIndexView):
|
||||
admin = Admin( # server,
|
||||
index_view=IndexView(menu_icon_type='fa',
|
||||
menu_icon_value='fa-home', ),
|
||||
name='LBI_PiPy',
|
||||
name='PDMI',
|
||||
template_mode='bootstrap4-left',
|
||||
category_icon_classes={
|
||||
'Jeu': 'fa fa-gamepad',
|
||||
'Configuration': 'fa fa-tools',
|
||||
'Administration': 'fa fa-tools',
|
||||
},
|
||||
endpoint='administration',
|
||||
disconnect_route="security.logout",
|
||||
@ -111,7 +110,7 @@ admin = Admin( # server,
|
||||
)
|
||||
|
||||
admin.add_view(SuperUserView(
|
||||
User,
|
||||
Users,
|
||||
db.session,
|
||||
menu_icon_type='fa',
|
||||
menu_icon_value='fa-users',
|
||||
@ -121,7 +120,7 @@ admin.add_view(SuperUserView(
|
||||
))
|
||||
|
||||
admin.add_view(RolesView(
|
||||
Role,
|
||||
Roles,
|
||||
db.session,
|
||||
menu_icon_type='fa',
|
||||
menu_icon_value='fa-users',
|
||||
@ -131,7 +130,7 @@ admin.add_view(RolesView(
|
||||
))
|
||||
|
||||
admin.add_view(ModuleView(
|
||||
Module,
|
||||
Modules,
|
||||
db.session,
|
||||
menu_icon_type="fa",
|
||||
menu_icon_value="fa-gears",
|
@ -1,9 +1,9 @@
|
||||
from flask_restful import Api
|
||||
|
||||
from LBI_PiPy.blueprints.api.download import ApiIndex, ApiModuleList, ApiModuleVersions, ApiModuleGet
|
||||
from PDMI.blueprints.api.download import ApiIndex, ApiModuleList, ApiModuleVersions, ApiModuleGet
|
||||
|
||||
# Current version
|
||||
api = Api(prefix="/api/c")
|
||||
api = Api(prefix="/api/current")
|
||||
|
||||
api.add_resource(ApiIndex, '/',
|
||||
endpoint='api.download.index')
|
@ -4,7 +4,7 @@ import shutil
|
||||
from flask import send_from_directory
|
||||
from flask_restful import Resource, abort
|
||||
|
||||
from LBI_PiPy.models import Module
|
||||
from PDMI.models import Module
|
||||
|
||||
|
||||
class ApiIndex(Resource):
|
@ -1,14 +1,16 @@
|
||||
import os
|
||||
|
||||
# ======================================================================================================================
|
||||
# ===================================================== general ========================================================
|
||||
# ======================================================================================================================
|
||||
# Secret key for decode cookies, generate new one for prod server, never share it
|
||||
SECRET_KEY = "SECRET_KEY"
|
||||
SECRET_KEY = "SECRET_KEY" # TODO
|
||||
# Enable debug mode
|
||||
DEBUG = True
|
||||
DEBUG = True # TODO
|
||||
# ======================================================================================================================
|
||||
# =================================================== sqlalchemy =======================================================
|
||||
# ======================================================================================================================
|
||||
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:sfkr4m37@localhost:3307/lbi_pipy'
|
||||
SQLALCHEMY_DATABASE_URI = os.environ["DATABASE_URI"]
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||
|
||||
# ======================================================================================================================
|
||||
@ -20,7 +22,7 @@ SECURITY_URL_PREFIX = "/admin"
|
||||
# Pasword config
|
||||
SECURITY_PASSWORD_HASH = "pbkdf2_sha512"
|
||||
# Secret salt for password, generate new one for prod server, never share it
|
||||
SECURITY_PASSWORD_SALT = "ATGUOHAELKiubahiughaerGOJAEGj"
|
||||
SECURITY_PASSWORD_SALT = "ATGUOHAELKiubahiughaerGOJAEGj" # TODO
|
||||
|
||||
# Urls for login/logout/register
|
||||
SECURITY_LOGIN_URL = "/login/"
|
||||
@ -35,7 +37,7 @@ SECURITY_POST_REGISTER_VIEW = "/admin/"
|
||||
# Features
|
||||
SECURITY_REGISTERABLE = True
|
||||
# todo: How can I activate that properly?
|
||||
SECURITY_SEND_REGISTER_EMAIL = False
|
||||
SECURITY_SEND_REGISTER_EMAIL = False # TODO
|
||||
|
||||
# ======================================================================================================================
|
||||
# =================================================== flask-babel ======================================================
|
@ -7,13 +7,13 @@ db = SQLAlchemy()
|
||||
|
||||
roles_users = db.Table(
|
||||
'roles_users',
|
||||
db.Column('user_id', db.Integer(), db.ForeignKey('user.id', ondelete='CASCADE')),
|
||||
db.Column('role_id', db.Integer(), db.ForeignKey('role.id', ondelete='CASCADE'))
|
||||
db.Column('user_id', db.Integer(), db.ForeignKey('users.id', ondelete='CASCADE')),
|
||||
db.Column('role_id', db.Integer(), db.ForeignKey('roles.id', ondelete='CASCADE'))
|
||||
)
|
||||
|
||||
|
||||
class Role(db.Model, RoleMixin):
|
||||
__tablename__ = "role"
|
||||
class Roles(db.Model, RoleMixin):
|
||||
__tablename__ = "roles"
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
name = db.Column(db.String(80), unique=True)
|
||||
description = db.Column(db.String(255))
|
||||
@ -22,30 +22,30 @@ class Role(db.Model, RoleMixin):
|
||||
return self.name
|
||||
|
||||
|
||||
class Module(db.Model):
|
||||
__tablename__ = "module"
|
||||
class Modules(db.Model):
|
||||
__tablename__ = "modules"
|
||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||
name = db.Column(db.String(400))
|
||||
versions = db.relationship('ModuleVersion', backref='module', lazy=True)
|
||||
versions = db.relationship('ModuleVersions', backref='modules', lazy=True)
|
||||
|
||||
|
||||
class ModuleVersion(db.Model):
|
||||
__tablename__ = "moduleversion"
|
||||
class ModuleVersions(db.Model):
|
||||
__tablename__ = "moduleversions"
|
||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||
version = db.Column(db.String(10))
|
||||
module_id = db.Column(db.Integer, db.ForeignKey('module.id'), nullable=False)
|
||||
module_id = db.Column(db.Integer, db.ForeignKey('modules.id'), nullable=False)
|
||||
|
||||
|
||||
class User(db.Model, UserMixin):
|
||||
__tablename__ = "user"
|
||||
class Users(db.Model, UserMixin):
|
||||
__tablename__ = "users"
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
date_created = db.Column(db.DateTime, default=datetime.datetime.utcnow)
|
||||
username = db.Column(db.String(400))
|
||||
email = db.Column(db.String(400), unique=True)
|
||||
password = db.Column(db.String(400))
|
||||
active = db.Column(db.Boolean)
|
||||
roles = db.relationship('Role', secondary=roles_users,
|
||||
backref=db.backref('user', lazy='dynamic'))
|
||||
roles = db.relationship('Roles', secondary=roles_users,
|
||||
backref=db.backref('users', lazy='dynamic'))
|
||||
|
||||
def __repr__(self):
|
||||
return str(self.username)
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
@ -1,19 +1,16 @@
|
||||
<!doctype html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<title>LBI_PiPy</title>
|
||||
<title>PDMI - Python Discord Module Index</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="LBI_PiPy">
|
||||
<meta name="description" content="PDMI - Python Discord Module Index">
|
||||
<meta name="author" content="Louis Chauvet">
|
||||
<!-- Favicon.ico -->
|
||||
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
|
||||
<!-- Bootstrap 4 si besoin
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
|
||||
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">-->
|
||||
</head>
|
||||
<body>
|
||||
<a href="{{ url_for("admin.index") }}">Connection à la gestion des modules</a><br/>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user