← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/maas/maas-templates-fixes into lp:maas

 

Raphaël Badin has proposed merging lp:~rvb/maas/maas-templates-fixes into lp:maas with lp:~rvb/maas/maas-security-model as a prerequisite.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~rvb/maas/maas-templates-fixes/+merge/89842

This branch:
- fixes up the #user-nav links so that they are displayed inline
- wires up the user-nav actions to login/logout
- cleans up the node_list and index templates: node_list is a list of all the nodes, index should be a dashboard (not yet implemented)

-- 
https://code.launchpad.net/~rvb/maas/maas-templates-fixes/+merge/89842
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/maas/maas-templates-fixes into lp:maas.
=== modified file 'src/maasserver/static/css/layout.css'
--- src/maasserver/static/css/layout.css	2012-01-24 06:28:39 +0000
+++ src/maasserver/static/css/layout.css	2012-01-24 08:40:29 +0000
@@ -23,6 +23,10 @@
 #user-nav a {
     color: #333;
     }
+#user-nav li {
+    float: right;
+    padding-right: 15px;
+    }
 #header {
     background-color: #dd4814;
     border-radius: 0 0 8px 8px;
@@ -61,4 +65,4 @@
     margin: 10px;
     padding: 20px;
     background-color: #AEA79F;
-}
+    }

=== modified file 'src/maasserver/templates/maasserver/base.html'
--- src/maasserver/templates/maasserver/base.html	2012-01-24 06:28:39 +0000
+++ src/maasserver/templates/maasserver/base.html	2012-01-24 08:40:29 +0000
@@ -7,30 +7,31 @@
     <link rel="stylesheet" href="{{ STATIC_URL }}css/ubuntu-webfonts.css" />
     <title>{% block title %}MaaS{% endblock %}</title>
     {% block js-conf %}{% include "maasserver/js-conf.html" %}{% endblock %}
-    {% block header %}{% endblock %}
+    {% block head %}{% endblock %}
 </head>
 <body>
-    <div id="page">
-        <div id="wrapper">
-            <ul id="user-nav" class="nav">
-                <li>{{ request.user.username }}</li>
-                <li><a href="">Logout</a></li>
-            </ul>
-            <div id="body">
-                <div id="header">
-                    <ul id="main-nav" class="nav">
-                        <li class="{% block nav-active-dashboard %}{% endblock %}"><a href="{% url index %}">Dashboard</a></li>
-                        <li class="{% block nav-active-nodes %}{% endblock %}"><a href="">Nodes</a></li>
-                    </ul>
-                    <h1>My MaaS</h1>
-                    <div class="clear"></div>
-                </div>
-                <div id="content">
-                    {% block content %}
-                    {% endblock %}
-                </div>
-            </div>
-        </div>
+  <div id="page">
+    <div id="wrapper">
+    {% block user-nav %}
+      {% include "maasserver/user-nav.html" %}
+    {% endblock %}
+    <div id="body">
+      <div id="header">
+      {% block header %}
+        <ul id="main-nav" class="nav">
+          <li class="{% block nav-active-index %}{% endblock %}">
+            <a href="{% url index %}">Dashboard</a>
+          </li>
+          <li class="{% block nav-active-node-list %}{% endblock %}">
+            <a href="{% url node-list %}">Nodes</a>
+         </li>
+        </ul>
+        <h1>MaaS Cluster</h1>
+        <div class="clear"></div>
+      {% endblock %}
+      </div>
+      <div id="content">{% block content %}{% endblock %}</div>
     </div>
+  </div>
 </body>
 </html>

=== modified file 'src/maasserver/templates/maasserver/index.html'
--- src/maasserver/templates/maasserver/index.html	2012-01-24 08:40:29 +0000
+++ src/maasserver/templates/maasserver/index.html	2012-01-24 08:40:29 +0000
@@ -1,25 +1,10 @@
 {% extends "maasserver/base.html" %}
 
+{% block nav-active-index %}active{% endblock %}
+
 {% block content %}
   <h2>{{ node_list|length }} node{{ node_list|length|pluralize }} in this cluster</h2>
-  {% if node_list|length %}
-    <table>
-      <thead>
-        <tr>
-          <td>System ID</td>
-          <td>Hostname</td>
-          <td>MAC</td>
-          <td>Status</td>
-        </tr>
-      </thead>
-      {% for node in node_list %}
-      <tr>
-        <td>{{ node.system_id }}</td>
-        <td>{{ node.hostname }}</td>
-        <td>{{ node.mac_address_set }}</td>
-        <td>{{ node.status }}</td>
-      </tr>
-      {% endfor %}
-    </table>
-  {% endif%}
+  <form method="GET" action="{% url node-create %}">
+    <input type="submit" value="Add Node" />
+  </form>
 {% endblock %}

=== modified file 'src/maasserver/templates/maasserver/node_form.html'
--- src/maasserver/templates/maasserver/node_form.html	2012-01-24 06:28:39 +0000
+++ src/maasserver/templates/maasserver/node_form.html	2012-01-24 08:40:29 +0000
@@ -3,14 +3,14 @@
 {% block nav-active-nodes %}active{% endblock %}
 
 {% block content %}
-  <h2>Add a node:</h2>
+  <h2>Add node to this cluster</h2>
     <form action="." method="post">
       <table>
-        {{ form.as_p }}
+        {{ form.as_table }}
+        <tr class="submit-row">
+          <td></td>
+          <td><input type="submit" value="+Add node" /></td></tr>
       </table>
-      <tr>
-        <input type="submit" value="save" />
-      </tr>
     </form>
 {% endblock %}
 

=== modified file 'src/maasserver/templates/maasserver/node_list.html'
--- src/maasserver/templates/maasserver/node_list.html	2012-01-24 06:28:39 +0000
+++ src/maasserver/templates/maasserver/node_list.html	2012-01-24 08:40:29 +0000
@@ -1,15 +1,30 @@
 {% extends "maasserver/base.html" %}
 
-{% block nav-active-dashboard %}active{% endblock %}
+{% block nav-active-node-list %}active{% endblock %}
 
 {% block content %}
-  <h2>Nodes</h2>
-  <ul>
-    {% for node in node_list %}
-      <li>{{ node }}</li>
-    {% empty %}
-      <li>No nodes</li>
-    {% endfor %}
-  </ul>
-  <a href="{% url node-create %}">Create a node</a>
+  <h2>{{ node_list|length }} node{{ node_list|length|pluralize }} in this cluster</h2>
+  {% if node_list|length %}
+    <table>
+      <thead>
+        <tr>
+          <td>System ID</td>
+          <td>Hostname</td>
+          <td>MAC</td>
+          <td>Status</td>
+        </tr>
+      </thead>
+      {% for node in node_list %}
+        <tr>
+        <td>{{ node.system_id }}</td>
+        <td>{{ node.hostname }}</td>
+        <td>{{ node.mac_address_set }}</td>
+        <td>{{ node.status }}</td>
+        </tr>
+      {% endfor %}
+    </table>
+  {% endif%}
+  <form method="GET" action="{% url node-create %}">
+    <input type="submit" value="Add Node" />
+  </form>
 {% endblock %}

=== added file 'src/maasserver/templates/maasserver/user-nav.html'
--- src/maasserver/templates/maasserver/user-nav.html	1970-01-01 00:00:00 +0000
+++ src/maasserver/templates/maasserver/user-nav.html	2012-01-24 08:40:29 +0000
@@ -0,0 +1,8 @@
+<ul id="user-nav" class="nav">
+  {% if user.is_authenticated %}
+  <li><a href="{% url logout %}">Logout</a></li>
+  <li>{{ user.username }}</li>
+  {% else %}
+  <li><a href="{% url login %}">Login</a></li>
+  {% endif %}
+</ul>