Ticket #8163: admin_interface.diff

File admin_interface.diff, 8.3 KB (added by nathan, 16 years ago)
  • admin/media/css/global.css

     
    9797.module blockquote { margin-left:12px; }
    9898.module ul, .module ol { margin-left:1.5em; }
    9999.module h3 { margin-top:.6em; }
    100 .module h2, .module caption { margin:0; padding:2px 5px 3px 5px; font-size:11px; text-align:left; font-weight:bold; background:#7CA0C7 url(../img/admin/default-bg.gif) top left repeat-x; color:white; }
     100.module h2, .module caption, .inline-group h2 { margin:0; padding:2px 5px 3px 5px; font-size:11px; text-align:left; font-weight:bold; background:#7CA0C7 url(../img/admin/default-bg.gif) top left repeat-x; color:white; }
    101101.module table { border-collapse: collapse; }
    102102
    103103/* MESSAGES & ERRORS */
  • admin/media/css/forms.css

     
    5858.vLargeTextField, .vXMLLargeTextField { width:48em; }
    5959.flatpages-flatpage #id_content { height:40.2em; }
    6060.module table .vPositiveSmallIntegerField { width:2.2em; }
     61.vTextField { width:20em; }
     62.vIntegerField { width:5em; }
    6163
    6264/* x unsorted */
    63 .inline-group {padding:10px; padding-bottom:5px; background:#eee; margin:10px 0;}
    64 .inline-group h3.header {margin:-5px -10px 5px -10px; background:#bbb; color:#fff; padding:2px 5px 3px 5px; font-size:11px}
    65 .inline-related {margin-bottom:15px; position:relative;}
    66 .last-related {margin-bottom:0px;}
    67 .inline-related h2 { margin:0; padding:2px 5px 3px 5px; font-size:11px; text-align:left; font-weight:bold;  color:#888; }
    68 .inline-related h2 b {font-weight:normal; color:#aaa;}
    69 .inline-related h2 span.delete {padding-left:20px; position:absolute; top:0px; right:5px;}
    70 .inline-related h2 span.delete label {margin-left:2px; padding-top:1px;}
    71 .inline-related fieldset {background:#fbfbfb;}
    72 .inline-related fieldset.module h2 { margin:0; padding:2px 5px 3px 5px; font-size:11px; text-align:left; font-weight:bold; background:#bcd; color:#fff; }
     65.inline-group {padding:0; border:1px solid #ccc; margin:10px 0;}
     66.inline-group .aligned label { width: 7em; }
     67
     68.inline-related {position:relative;}
     69.inline-related h3 {margin: 0; color:#666; padding:3px 5px; font-size:11px; background:#e1e1e1 url(../img/admin/nav-bg.gif) top left repeat-x; border-bottom:1px solid #ddd;}
     70.inline-related h3 span.delete {padding-left:20px; position:absolute; top:2px; right:10px;}
     71.inline-related h3 span.delete label {margin-left:2px; font-size: 11px;}
     72.inline-related fieldset {margin: 0; background:#fff; border: none; }
     73.inline-related fieldset.module h3 { margin:0; padding:2px 5px 3px 5px; font-size:11px; text-align:left; font-weight:bold; background:#bcd; color:#fff; }
    7374.inline-related.tabular fieldset.module table {width:100%;}
     75.last-related fieldset {border: none;}
    7476
    7577.inline-group .tabular tr.has_original td {padding-top:2em;}
    7678.inline-group .tabular tr td.original { padding:2px 0 0 0; width:0; _position:relative; }
  • admin/options.py

     
    164164        if isinstance(db_field, models.TimeField):
    165165            kwargs['widget'] = widgets.AdminTimeWidget
    166166            return db_field.formfield(**kwargs)
     167       
     168        # For TextFields, add a custom CSS class.
     169        if isinstance(db_field, models.TextField):
     170            kwargs['widget'] = widgets.AdminTextareaWidget
     171            return db_field.formfield(**kwargs)
     172       
     173        # For URLFIelds, add a custom CSS class.
     174        if isinstance(db_field, models.URLField):
     175            kwargs['widget'] = widgets.AdminURLFieldWidget
     176            return db_field.formfield(**kwargs)
     177       
     178        # For IntegerFields, add a custom CSS class.
     179        if isinstance(db_field, models.IntegerField):
     180            kwargs['widget'] = widgets.AdminIntegerFieldWidget
     181            return db_field.formfield(**kwargs)
    167182
     183        # For TextInputs, add a custom CSS class.
     184        if isinstance(db_field, models.CharField):
     185            kwargs['widget'] = widgets.AdminTextInputWidget
     186            return db_field.formfield(**kwargs)
     187   
    168188        # For FileFields and ImageFields add a link to the current file.
    169189        if isinstance(db_field, models.ImageField) or isinstance(db_field, models.FileField):
    170190            kwargs['widget'] = widgets.AdminFileWidget
  • admin/widgets.py

     
    208208
    209209    def id_for_label(self, id_):
    210210        return self.widget.id_for_label(id_)
     211
     212class AdminTextareaWidget(forms.Textarea):
     213    def __init__(self, attrs={}):
     214        super(AdminTextareaWidget, self).__init__(attrs={'class': 'vLargeTextField'})
     215
     216class AdminTextInputWidget(forms.TextInput):
     217    def __init__(self, attrs={}):
     218        super(AdminTextInputWidget, self).__init__(attrs={'class': 'vTextField'})
     219
     220class AdminURLFieldWidget(forms.TextInput):
     221    def __init__(self, attrs={}):
     222        super(AdminURLFieldWidget, self).__init__(attrs={'class': 'vURLField'})
     223
     224class AdminIntegerFieldWidget(forms.TextInput):
     225    def __init__(self, attrs={}):
     226        super(AdminIntegerFieldWidget, self).__init__(attrs={'class': 'vIntegerField'})
     227 No newline at end of file
  • admin/templates/admin/edit_inline/stacked.html

     
    11{% load i18n %}
    22<div class="inline-group">
     3  <h2>{{ inline_admin_formset.opts.verbose_name_plural|title }}</h2>
    34{{ inline_admin_formset.formset.management_form }}
    4 {# <h3 class="header">{{ inline_admin_formset.opts.verbose_name_plural|title }}</h3> #}
    55{{ inline_admin_formset.formset.non_form_errors }}
    66
    77{% for inline_admin_form in inline_admin_formset %}
    88<div class="inline-related {% if forloop.last %}last-related{% endif %}">
    9   <h2><b>{{ inline_admin_formset.opts.verbose_name|title }}:</b>&nbsp;{% if inline_admin_form.original %}{{ inline_admin_form.original }}{% else %} #{{ forloop.counter }}{% endif %}
     9  <h3><b>{{ inline_admin_formset.opts.verbose_name|title }}:</b>&nbsp;{% if inline_admin_form.original %}{{ inline_admin_form.original }}{% else %} #{{ forloop.counter }}{% endif %}
    1010    {% if inline_admin_formset.formset.can_delete and inline_admin_form.original %}<span class="delete">{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}</span>{% endif %}
    11     </h2>
     11  </h3>
    1212  {% if inline_admin_form.show_url %}
    1313  <p><a href="/r/{{ inline_admin_form.original.content_type_id }}/{{ inline_admin_form.original.id }}/">View on site</a></p>
    1414  {% endif %}
  • admin/templates/admin/edit_inline/tabular.html

     
    1919                   
    2020        <tr class="{% cycle row1,row2 %} {% if inline_admin_form.original or inline_admin_form.show_url %}has_original{% endif %}">
    2121
    22         <td class="original">{% if inline_admin_form.original or inline_admin_form.show_url %}<p>
     22        <td class="original">
     23          {% if inline_admin_form.original or inline_admin_form.show_url %}<p>
    2324          {% if inline_admin_form.original %} {{ inline_admin_form.original }}{% endif %}
    2425          {% if inline_admin_form.show_url %}<a href="/r/{{ inline_admin_form.original.content_type_id }}/{{ inline_admin_form.original.id }}/">View on site</a>{% endif %}
    2526            </p>{% endif %}
     
    4647          {% endfor %}
    4748        {% endfor %}
    4849               
    49         {% if inline_admin_formset.formset.can_delete %}<td class="delete">{% if inline_admin_form.original %}{{ inline_admin_form.deletion_field.field }}{% endif %}</td>{% endif %}
     50        {% if inline_admin_formset.formset.can_delete %}
     51          <td class="delete">{% if inline_admin_form.original %}{{ inline_admin_form.deletion_field.field }}{% endif %}</td>
     52        {% endif %}
    5053       
    5154        </tr>
    5255
Back to Top