← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~huwshimi/maas/settings-and-more into lp:maas

 

Huw Wilkins has proposed merging lp:~huwshimi/maas/settings-and-more into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~huwshimi/maas/settings-and-more/+merge/95845

This branch tackles a lot of the remaining design work for settings etc. At least trying to get things into a reasonable state to be able to move onto other things. Changes include:

- Added a template tag to check for field types
- Changed form html for checkboxes
- Set spacing for checkboxes
- Set vertical spacing of form fields slightly higher
- Changed order of comissioning form to match wireframes
- Added alt tags to images on settings page
- Added icon to add archive link
- Changed label of maas administrator checkbox on add/edit user pages
- Fixed button positions on add user screen
-- 
https://code.launchpad.net/~huwshimi/maas/settings-and-more/+merge/95845
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~huwshimi/maas/settings-and-more into lp:maas.
=== modified file 'src/maasserver/forms.py'
--- src/maasserver/forms.py	2012-02-29 19:00:41 +0000
+++ src/maasserver/forms.py	2012-03-05 05:57:18 +0000
@@ -119,7 +119,7 @@
 class NewUserCreationForm(UserCreationForm):
     # Add is_superuser field.
     is_superuser = forms.BooleanField(
-        label="Administrator status", required=False)
+        label="MaaS administrator", required=False)
 
     def save(self, commit=True):
         user = super(NewUserCreationForm, self).save(commit=False)
@@ -132,7 +132,7 @@
 class EditUserForm(UserChangeForm):
     # Override the default label.
     is_superuser = forms.BooleanField(
-        label="Administrator status", required=False)
+        label="MaaS administrator", required=False)
 
     class Meta:
         model = User
@@ -182,12 +182,12 @@
 
 class CommissioningForm(ConfigForm):
     """Settings page, CommissioningF section."""
+    check_compatibility = forms.BooleanField(
+        label="Check component compatibility and certification",
+        required=False)
     after_commissioning = forms.ChoiceField(
         choices=NODE_AFTER_COMMISSIONING_ACTION_CHOICES,
         label="After commissioning")
-    check_compatibility = forms.BooleanField(
-        label="Check component compatibility and certification",
-        required=False)
 
 
 class UbuntuForm(ConfigForm):

=== modified file 'src/maasserver/static/css/forms.css'
--- src/maasserver/static/css/forms.css	2012-03-02 06:06:51 +0000
+++ src/maasserver/static/css/forms.css	2012-03-05 05:57:18 +0000
@@ -4,7 +4,7 @@
     padding: 0;
     }
 form li {
-    margin-bottom: 8px;
+    margin-bottom: 16px;
     }
 form li.form-submit {
     padding: 8px 0 0 0;
@@ -19,6 +19,10 @@
     display: block;
     margin-bottom: 4px;
     }
+input,
+select {
+    margin: 0;
+    }
 label .required {
     color: #aea79f;
     }
@@ -26,6 +30,9 @@
     display: block;
     color: #aea79f;
     }
+input[type="checkbox"] {
+    margin-right: 3px;
+    }
 textarea,
 input[type="password"],
 input[type="text"] {

=== modified file 'src/maasserver/static/css/modifiers.css'
--- src/maasserver/static/css/modifiers.css	2012-03-01 06:22:38 +0000
+++ src/maasserver/static/css/modifiers.css	2012-03-05 05:57:18 +0000
@@ -18,3 +18,7 @@
 .right {
     float: right;
     }
+img.icon {
+    vertical-align: text-bottom;
+    margin-right: 3px;
+    }

=== added file 'src/maasserver/static/img/inline_add.png'
Binary files src/maasserver/static/img/inline_add.png	1970-01-01 00:00:00 +0000 and src/maasserver/static/img/inline_add.png	2012-03-05 05:57:18 +0000 differ
=== modified file 'src/maasserver/templates/maasserver/form_field.html'
--- src/maasserver/templates/maasserver/form_field.html	2012-02-22 07:03:13 +0000
+++ src/maasserver/templates/maasserver/form_field.html	2012-03-05 05:57:18 +0000
@@ -1,11 +1,17 @@
+{% load field_type %} 
 <li class="{{ field.html_name }}{% if field.errors %} error{% endif %}">
   <label for="id_{{ field.html_name }}">
+    {% ifequal field|field_type "CheckboxInput" %}
+      {{ field }}
+    {% endifequal %}
     {{ field.label }}
     {% if field.field.required %}
       <span class="required">(required)</span>
     {% endif %}
   </label>
-  {{ field }}
+  {% ifnotequal field|field_type "CheckboxInput" %}
+    {{ field }}
+  {% endifnotequal %}
   <span class="help">{% if field.help_text %}{{ field.help_text }}{% endif %}</span>
   {% if field.errors %}<span class="errors">{{ field.errors }}</span>{% endif %}
 </li>

=== modified file 'src/maasserver/templates/maasserver/settings.html'
--- src/maasserver/templates/maasserver/settings.html	2012-03-02 06:06:51 +0000
+++ src/maasserver/templates/maasserver/settings.html	2012-03-05 05:57:18 +0000
@@ -35,19 +35,19 @@
             <td>{{ user_item.last_login }}</td>
             <td>
               {% if user_item.is_superuser %}
-                <img src="{{ STATIC_URL }}img/yes.png" />
+                <img src="{{ STATIC_URL }}img/yes.png" alt="yes" />
               {% endif %}
             </td>
             <td>
               <a href="{% url 'accounts-edit' user_item.username %}"
                  title="Edit user {{ user_item.username }}">
-                <img src="{{ STATIC_URL }}img/edit.png" />
+                <img src="{{ STATIC_URL }}img/edit.png" alt="edit" />
               </a>
               {% if user != user_item %}
                 <a title="Delete user {{ user_item.username }}"
                    class="delete-user"
                    href="{% url 'accounts-del' user_item.username %}">
-                  <img src="{{ STATIC_URL }}img/delete.png" />
+                  <img src="{{ STATIC_URL }}img/delete.png" alt="delete" />
                 </a>
                 <form method="POST"
                       action="{% url 'accounts-del' user_item.username %}">
@@ -63,6 +63,7 @@
       <a class="button right" href="{% url 'accounts-add' %}">
         Add user
       </a>
+      <div class="clear"></div>
     </div>
     <div id="commissioning" class="block size7 first">
       <h2>Commissioning</h2>
@@ -83,11 +84,14 @@
         {% with field=ubuntu_form.update_from %}
           {% include "maasserver/form_field.html" %}
         {% endwith %}
-        <p>
+        <li>
+          <label>Custom archives</label>
           <a href="{% url "settings-add-archive" %}">
+            <img src="{{ STATIC_URL }}img/inline_add.png" 
+                 alt="Add" class="icon" />
             Add archive for newly provisioned machines
           </a>
-        </p>
+        </li>
         {% with field=ubuntu_form.fallback_master_archive %}
           {% include "maasserver/form_field.html" %}
         {% endwith %}

=== modified file 'src/maasserver/templates/maasserver/user_add.html'
--- src/maasserver/templates/maasserver/user_add.html	2012-02-28 06:50:42 +0000
+++ src/maasserver/templates/maasserver/user_add.html	2012-03-05 05:57:18 +0000
@@ -5,13 +5,13 @@
 {% block page-title %}Add user{% endblock %}
 
 {% block content %}
-  <form action="." method="post">
+  <form action="." method="post" class="block auto-width first">
     <ul>
     {% for field in form %}
       {% include "maasserver/form_field.html" %}
     {% endfor %}
     </ul>
-    <input type="submit" value="Add user" />
-      &nbsp;&nbsp;<a class="link-button" href="{% url 'settings' %}">Cancel</a>
+    <input type="submit" value="+ Add user" class="right" />
+    <a class="link-button" href="{% url 'settings' %}">Cancel</a>
   </form>
 {% endblock %}

=== added directory 'src/maasserver/templatetags'
=== added file 'src/maasserver/templatetags/__init__.py'
=== added file 'src/maasserver/templatetags/field_type.py'
--- src/maasserver/templatetags/field_type.py	1970-01-01 00:00:00 +0000
+++ src/maasserver/templatetags/field_type.py	2012-03-05 05:57:18 +0000
@@ -0,0 +1,11 @@
+# Copyright 2012 Canonical Ltd.  This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+from django import template
+
+register = template.Library()
+
+@register.filter('field_type')
+def field_type(field):
+    type = field.field.widget.__class__.__name__
+    return type