added docs CUD

This commit is contained in:
2017-07-23 11:07:51 +02:00
parent fc29d5da24
commit 56605c5166
9 changed files with 264 additions and 13 deletions

View File

@@ -0,0 +1,75 @@
<metal:block use-macro="main_template">
<div metal:fill-slot="content">
<div class="alert alert-danger" tal:condition="message" tal:content="message" />
<div class="row">
<form id="doc_edit-form" action="${url}" method="post" class="form-horizontal">
<div class="form-group">
<label class="control-label col-xs-2" for="intitule">Intitulé</label>
<div class="col-xs-8">
<input class="form-control" type="text" id="intitule" name="intitule" value="${intitule}"
placeholder="40 caractères maximum"
data-fv-notempty="true"
data-fv-notempty-message="L'intitule est obligatoire"
data-fv-stringlength="true"
data-fv-stringlength-max="40"
data-fv-stringlength-message="40 caractères maximum" />
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2" for="doc-text">Texte</label>
<div class="col-xs-8">
<textarea class="form-control" rows="15" cols="40" id="doc-text" name="texte"
data-fv-notempty="true"
data-fv-notempty-message="Le texte est obligatoire"
data-fv-stringlength="true"
data-fv-stringlength-max="30000"
data-fv-stringlength-message="30000 caractères maximum">${texte}
</textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2" for="theme">Thème</label>
<div class="col-xs-4">
<select class="form-control" id="theme" name="theme">
<div tal:repeat="item themes">
<option value="${item}" tal:attributes="selected theme==item and 'selected' or None">${item}</option>
</div>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-8">
<button class="btn btn-primary" type="submit" name="form.submitted">
<span class="glyphicon glyphicon-ok"></span>&nbsp;Enregistrer</button>
<a href="${request.application_url}/doc_view/${doc_id}" class="btn btn-default" role="button">
<span class="glyphicon glyphicon-chevron-left"></span>&nbsp;Annuler</a>
</div>
</div>
<div class="form-group" tal:condition="doc_id<>'0'">
<div class="col-sm-offset-2 col-sm-8">
<button class="btn btn-warning" type="submit" name="form.deleted">
<span class="glyphicon glyphicon-remove"></span>&nbsp;Supprimer</button>
</div>
</div>
</form>
<br />
<br />
</div> <!-- row -->
<script>
$(document).ready(function() {
$('#doc_edit-form').formValidation();
$('form input').on('keypress', function(e) {
return e.which !== 13;
});
});
</script>
</div>
</metal:block>

View File

@@ -0,0 +1,31 @@
<metal:block use-macro="main_template">
<div metal:fill-slot="content">
<div class="row">
<p>
<a href="doc_edit/0" class="btn btn-success" role="button">
<span class="glyphicon glyphicon-plus"></span>&nbsp;
Créér une nouvelle doc</a>
</p>
<table class="table table-condensed table-striped table-bordered">
<tr>
<th>Intitule</th>
<th>Thème</th>
<th>Dernière mise à jour</th>
</tr>
<tr tal:repeat="ligne docs">
<td><a href="doc_view/${ligne.doc_id}">${ligne.intitule}</a></td>
<td>${ligne.theme}</td>
<td><span tal:content="ligne.modif_le.strftime('%d/%m/%Y %H:%M')" /></td>
</tr>
</table>
</div>
<br />
<br />
</div>
</metal:block>

View File

@@ -0,0 +1,21 @@
<metal:block use-macro="main_template">
<div metal:fill-slot="content">
<br />
<a href="${request.application_url}/doc_list" class="btn btn-default" role="button">
<span class="glyphicon glyphicon-chevron-left"></span>&nbsp;Fermer</a>
<a href="${request.application_url}/doc_edit/${doc_id}" class="btn btn-primary" role="button">
<span class="glyphicon glyphicon-pencil"></span>&nbsp;Modifier</a>
<br />
<hr>
<div tal:replace="structure texte">
Page text goes here.
</div>
<hr>
<br />
<br />
<br />
<br />
</div>
</metal:block>

View File

@@ -6,11 +6,10 @@
<head>
<title>${page_title}</title>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=yes" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=yes" />
<!-- Bootstrap core + Plug-ins CSS -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.min.css" rel="stylesheet">
<link href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
<link href="${request.static_url('caotek_mesavoirs:static/dist/datatable/dataTables.bootstrap.css')}" rel="stylesheet" media="all">
<link href="${request.static_url('caotek_mesavoirs:static/dist/formvalidation/css/formValidation.min.css')}" rel="stylesheet">
@@ -21,11 +20,9 @@
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<!-- Bootstrap Fullcalendar plugin -->
<!-- Bootstrap moment plugin -->
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/locale/fr.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/locale/fr.js"></script>
<!-- Bootstrap Datepicker plugin -->
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
<!-- Datatable -->
@@ -57,8 +54,9 @@
</div>
<div class="collapse navbar-collapse" id="myNavbar" tal:condition="not layout.isAnonymous()">
<ul class="nav navbar-nav navbar-right">
<li><a href="${request.application_url}"><span class="glyphicon glyphicon-home"></span>&nbsp;ACTIFS</a></li>
<li><a href="${request.application_url}/allocation"><span class="glyphicon glyphicon-list-alt"></span>&nbsp;ALLOCATION</a></li>
<li><a href="${request.application_url}">ACTIFS</a></li>
<li><a href="${request.application_url}/allocation">ALLOCATION</a></li>
<li><a href="${request.application_url}/doc_list">DOCS</a></li>
${panel('dropdown_menu_panel')}
</ul>
</div>

View File

@@ -4,7 +4,7 @@
<ul class="dropdown-menu">
<li class="dropdown-header">
${logged_in}<br />
Fonction: ${logged_in_fonction}
${logged_in_fonction}
</li>
<li class="divider"></li>