VIM accounts part of the project view

Change-Id: I58992f1fd42dcf78b2db33a285af1b8032a954db
Signed-off-by: lombardof <flombardo@cnit.it>
diff --git a/vimhandler/template/vim_create.html b/vimhandler/template/vim_create.html
index a68527e..4368735 100644
--- a/vimhandler/template/vim_create.html
+++ b/vimhandler/template/vim_create.html
@@ -12,14 +12,14 @@
 {% endblock %}
 {% block left_sidebar %}
 
-    {% include 'left_sidebar_base.html' %}
+    {% include 'osm/osm_project_left_sidebar.html' %}
 
 {% endblock %}
 
 
 {% block breadcrumb_body %}
     {{ block.super }}
-    <li><a href="{% url 'vim:list' %}">VIMS</a></li>
+    <li><a href="{% url 'projects:vims:list' project_id=project_id %}">VIMS</a></li>
 {% endblock %}
 
 {% block content_body %}
@@ -27,7 +27,7 @@
 
     <div class="row">
         <div class="col-md-12">
-            <form action='{% url "vim:create" %}' method="post">
+            <form action='{% url "projects:vims:create" project_id=project_id  %}' method="post">
                 {% csrf_token %}
                 <div class="box">
                     <div class="box-header with-border">
@@ -175,7 +175,7 @@
 
                     </div>
                     <div class="box-footer">
-                        <button onclick="location.href='{% url 'vim:list' %}'" class="btn btn-default pull-left">Back to
+                        <button onclick="location.href='{% url 'projects:vims:list' project_id=project_id%}'" class="btn btn-default pull-left">Back to
                             VIM Accounts
                         </button>
                         <button class="btn btn-primary pull-right">Create</button>
diff --git a/vimhandler/template/vim_list.html b/vimhandler/template/vim_list.html
index 08a64a0..753cb46 100644
--- a/vimhandler/template/vim_list.html
+++ b/vimhandler/template/vim_list.html
@@ -12,14 +12,14 @@
 {% endblock %}
 {% block left_sidebar %}
 
-    {% include 'left_sidebar_base.html' %}
+   {% include 'osm/osm_project_left_sidebar.html' %}
 
 {% endblock %}
 
 
 {% block breadcrumb_body %}
     {{ block.super }}
-    <li><a href="{% url 'vim:list' %}">VIMS</a></li>
+    <li><a href="{% url "projects:vims:list"  project_id=project_id %}">VIMS</a></li>
 {% endblock %}
 
 {% block content_body %}
@@ -33,7 +33,7 @@
                 <div class="box-header with-border">
                     <h3 class="box-title">Registered VIM</h3>
                     <div class="box-tools">
-                        <a href='{% url "vim:create" %}' class="btn btn-block btn-primary btn-sm"><i
+                        <a href='{% url "projects:vims:create"  project_id=project_id %}' class="btn btn-block btn-primary btn-sm"><i
                                 class="fa fa-plus"></i><span> New VIM</span></a>
                     </div>
                 </div>
@@ -64,10 +64,10 @@
                                 <td>
                                     <div class="btn-group">
                                         <button type="button" class="btn btn-default"
-                                                onclick="location.href='{% url "vim:show" vim_id=p|get:"_id" %}'" data-toggle="tooltip" data-placement="top" data-container="body" title="Show Info"><i
+                                                onclick="location.href='{% url "projects:vims:show"  project_id=project_id vim_id=p|get:"_id" %}'" data-toggle="tooltip" data-placement="top" data-container="body" title="Show Info"><i
                                                 class="fa fa-info"></i></button>
                                         <button type="button" class="btn btn-default"
-                                                onclick="javascript:deleteVim('{{ p|get:"_id" }}')" data-toggle="tooltip" data-placement="top" data-container="body" title="Delete"><i
+                                                onclick="javascript:deleteVim('{% url "projects:vims:delete"  project_id=project_id vim_id=p|get:"_id" %}')" data-toggle="tooltip" data-placement="top" data-container="body" title="Delete"><i
                                                 class="fa fa-trash-o" ></i></button>
                                     </div>
                                 </td>
@@ -89,10 +89,10 @@
 
     <script>
 
-        function deleteVim(vim_uuid) {
+        function deleteVim(url) {
             bootbox.confirm("Are you sure want to delete?", function (result) {
                 if (result) {
-                    location.href = '/vims/' + vim_uuid + '/delete'
+                    location.href = url//'/vims/' + vim_uuid + '/delete'
                 }
             })
         }
diff --git a/vimhandler/template/vim_show.html b/vimhandler/template/vim_show.html
index cc796e2..74e816a 100644
--- a/vimhandler/template/vim_show.html
+++ b/vimhandler/template/vim_show.html
@@ -1,24 +1,6 @@
 {% extends "base.html" %}
 {% load get %}
 {% load staticfiles %}
-{% block head_base %}
-    {% with skin_css="AdminLTE/dist/css/skins/skin-purple.min.css"%}
-        {{ block.super }}
-    {% endwith %}
-{% endblock %}
-
-{% block body %}
-    {% with skin="purple"%}
-        {{ block.super }}
-    {% endwith %}
-{% endblock %}
-{% block logo_sidebar %}
-    {% with logo_mini="assets/img/osm_small_logo.png" logo="assets/img/OSM-logo.png" %}
-        {{ block.super }}
-    {% endwith %}
-{% endblock %}
-
-
 
 {% block head_block %}
     {{ block.super }}
@@ -29,14 +11,14 @@
 {% endblock %}
 {% block left_sidebar %}
 
-    {% include 'left_sidebar_base.html' %}
+    {% include 'osm/osm_project_left_sidebar.html' %}
 
 {% endblock %}
 
 
 {% block breadcrumb_body %}
     {{ block.super }}
-    <li><a href="{% url 'vim:list' %}">VIMS</a></li>
+    <li><a href="{% url 'projects:vims:list' project_id=project_id%}">VIMS</a></li>
 {% endblock %}
 
 {% block content_body %}
@@ -139,7 +121,7 @@
             </div>
             <div class="box-footer">
                 <div class="">
-                    <button onclick="location.href='{% url 'vim:list' %}'" class="btn btn-primary">Back to VIM Accounts</button>
+                    <button onclick="location.href='{% url 'projects:vims:list' project_id=project_id%}'" class="btn btn-primary">Back to VIM Accounts</button>
                 </div>
             </div>
         </div>
diff --git a/vimhandler/views.py b/vimhandler/views.py
index 19b58ad..28c264c 100644
--- a/vimhandler/views.py
+++ b/vimhandler/views.py
@@ -24,19 +24,22 @@
 logging.basicConfig(level=logging.DEBUG)
 log = logging.getLogger('view.py')
 
+
 @login_required
-def list(request):
+def list(request, project_id):
     client = Client()
     result = client.vim_list()
     print result
     result = {
+        "project_id": project_id,
         "datacenters": result
     }
     return __response_handler(request, result, 'vim_list.html')
 
+
 @login_required
-def create(request):
-    result = {}
+def create(request, project_id):
+    result = {'project_id': project_id}
     if request.method == 'GET':
         return __response_handler(request, result, 'vim_create.html')
     else:
@@ -67,24 +70,25 @@
                 print e
         result = client.vim_create(vim_data)
         # TODO  'vim:show', to_redirect=True, vim_id=vim_id
-        return __response_handler(request, result, 'vim:list', to_redirect=True)
+        return __response_handler(request, result, 'projects:vims:list', to_redirect=True, project_id=project_id)
 
 @login_required
-def delete(request, vim_id=None):
+def delete(request, project_id, vim_id=None):
     try:
         client = Client()
         del_res = client.vim_delete(vim_id)
     except Exception as e:
         log.exception(e)
-    return __response_handler(request, {}, 'vim:list', to_redirect=True)
+    return __response_handler(request, {}, 'projects:vims:list', to_redirect=True, project_id=project_id)
 
 @login_required
-def show(request, vim_id=None):
+def show(request, project_id, vim_id=None):
     client = Client()
     datacenter = client.vim_get(vim_id)
     print datacenter
     return __response_handler(request, {
-        "datacenter": datacenter
+        "datacenter": datacenter,
+        "project_id": project_id
     }, 'vim_show.html')