1 {% extends
"base.html" %}
8 <link rel=
"stylesheet" href=
"/static/bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css">
11 {% block title_header_big %}
14 {% block left_sidebar %}
16 {% include 'osm/osm_project_left_sidebar.html' %}
21 {% block breadcrumb_body %}
23 <li><a href=
"{% url 'projects:projects_list' %}">Projects
</a></li>
26 {% block content_body %}
30 <div class=
"col-md-12">
33 <div class=
"box-header with-border">
34 <h3 class=
"box-title">Projects
</h3>
35 <div class=
"box-tools">
36 <button type=
"button" class=
"btn btn-default" data-container=
"body"
37 data-toggle=
"tooltip" data-placement=
"top" title=
"New Project"
38 onclick=
"javascript:showModalNewProject()">
39 <i class=
"fa fa-plus"></i> New Project
</button>
42 <div class=
"box-body">
43 <table id=
"projects_table" class=
"table table-bordered table-striped">
49 <th>Modification Date
</th>
50 <th>Creation Date
</th>
55 {% for p in projects %}
59 <a href=
"/projects/switch/{{ p.name }}" >{{ p.name }}
</a>
62 <td>{{ p|get_sub:
"_admin,modified"|get_date}}
</td>
63 <td>{{ p|get_sub:
"_admin,created"|get_date}}
</td>
66 <div class=
"btn-group">
67 <button type=
"button" class=
"btn btn-default dropdown-toggle"
68 data-toggle=
"dropdown" aria-expanded=
"false">Actions
69 <span class=
"fa fa-caret-down"></span></button>
70 <ul class=
"dropdown-menu">
72 onclick=
"javascript:editProject('{% url 'projects:edit_project' project_id=p.name %}')">
73 <i class=
"fa fa-edit"></i> Rename
</a></li>
75 <a href=
"#" onclick=
"javascript:deleteProject('{% url 'projects:delete_project' project_id=p.name%}')" style=
"color:red">
76 <i class=
"fa fa-trash" ></i> Delete
</a>
90 {% include
"modal/project_new.html" %}
91 {% include
"modal/project_edit.html" %}
94 {% block resource_block %}
96 <script src=
"/static/bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
97 <script src=
"/static/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
100 $(document).ready( function () {
101 $('#projects_table').DataTable();
105 function showModalNewProject(){
106 $('#modal_new_project').modal('show');
109 function editProject(url){
110 $(
"#formEditProject").attr(
"action", url);
111 $('#modal_edit_project').modal('show');
114 function deleteProject(url) {
115 bootbox.confirm(
"Are you sure want to delete?", function (result) {
121 "Accept": 'application/json'
125 }).done(function (response,textStatus, jqXHR) {
129 message:
"Project deleted.",
130 callback: function () {
134 }).fail(function(result){
135 var data = result.responseJSON;
136 var title =
"Error " + (data.code ? data.code: 'unknown');
137 var message = data.detail ? data.detail: 'No detail available.';
147 $(document).ready(function () {
148 $(
"#formNewProject").submit(function (event) {
149 event.preventDefault(); //prevent default action
150 var post_url = $(this).attr(
"action"); //get form action url
151 var request_method = $(this).attr(
"method"); //get form GET/POST method
152 var form_data = new FormData(this); //Encode form elements for submission
153 console.log(post_url);
156 type: request_method,
159 "Accept": 'application/json'
163 }).done(function (response,textStatus, jqXHR) {
166 message:
"Project created.",
167 callback: function () {
171 }).fail(function(result){
172 var data = result.responseJSON;
173 var title =
"Error " + (data.code ? data.code: 'unknown');
174 var message = data.detail ? data.detail: 'No detail available.';