Ticket #16212: 16212.better-admin-multiple-sort.4.diff

File 16212.better-admin-multiple-sort.4.diff, 11.3 KB (added by Julien Phalip, 13 years ago)
  • django/contrib/admin/static/admin/css/base.css

    diff --git a/django/contrib/admin/static/admin/css/base.css b/django/contrib/admin/static/admin/css/base.css
    index 89f2225..0567960 100644
    a b tr.alt {  
    309309
    310310/* SORTABLE TABLES */
    311311
     312thead th {
     313    padding: 0;
     314    line-height: normal;
     315}
     316
    312317thead th a:link, thead th a:visited {
    313318    color: #666;
    314     display: block;
    315319}
    316320
    317321thead th.sorted {
    318322    background: #c5c5c5 url(../img/nav-bg-selected.gif) top left repeat-x;
    319323}
    320324
    321 table thead th.sorted a {
    322     padding-right: 13px;
     325table thead th .text {
     326    padding: 2px 5px;
     327}
     328
     329table thead th .text a {
     330    display: block;
     331    cursor: pointer;
     332}
     333
     334table thead th.sortable:hover {
     335    background: white url(../img/nav-bg-reverse.gif) 0 -5px repeat-x;
    323336}
    324337
    325 table thead th.ascending a {
    326     background: url(../img/arrow-up.gif) right .4em no-repeat;
     338thead th.sorted a.sortremove {
     339    visibility: hidden;
    327340}
    328341
    329 table thead th.descending a {
    330     background: url(../img/arrow-down.gif) right .4em no-repeat;
     342table thead th.sorted:hover a.sortremove {
     343    visibility: visible;
    331344}
    332345
    333 table thead th.sorted a span.text {
    334    display: block;
    335    float: left;
    336    cursor: pointer; /* IE needs this */
     346table thead th.sorted .sortoptions {
     347    display: block;
     348    padding: 4px 5px 0 5px;
     349    float: right;
     350    text-align: right;
    337351}
    338352
    339 table thead th.sorted a span.sortpos {
    340    display: block;
    341    float: right;
    342    font-size: .6em;
    343    text-align: right;
    344    cursor: pointer; /* IE needs this */
     353table thead th.sorted .sortposition {
     354    font-size: .8em;
     355    min-width: 12px;
     356    text-align: center;
     357    vertical-align: top;
    345358}
    346359
    347 table thead th.sorted a img {
    348    vertical-align: top;
     360table thead th.sorted .sortoptions a {
     361    width: 14px;
     362    height: 12px;
     363    display: inline-block;
    349364}
    350365
    351 table thead th.sorted a span.clear {
    352    display: block;
    353    clear: both;
     366table thead th.sorted .sortoptions a.sortremove {
     367    background: url(../img/sorting-icons.gif) -4px -5px no-repeat;
    354368}
    355369
    356 #sorting-popup-div {
    357     display: none;
    358     position: absolute;
    359     background-color: white;
    360     border: 1px solid #ddd;
    361     z-index: 2000; /* more than filters on right */
     370table thead th.sorted .sortoptions a.sortremove:hover {
     371    background: url(../img/sorting-icons.gif) -4px -27px no-repeat;
    362372}
    363373
    364 #sorting-popup-div table {
    365     border-right: 0px;
    366     border-left: 0px;
     374table thead th.sorted .sortoptions a.ascending {
     375    background: url(../img/sorting-icons.gif) -5px -50px no-repeat;
    367376}
    368377
    369 #sorting-popup-div .reset {
    370     text-align: center;
     378table thead th.sorted .sortoptions a.ascending:hover {
     379    background: url(../img/sorting-icons.gif) -5px -72px no-repeat;
    371380}
    372381
    373 #sorting-popup-div .cancel {
    374     font-size: 10px;
    375     background: #e1e1e1 url(../img/nav-bg.gif) 0 50% repeat-x;
    376     border-top: 1px solid #ddd;
    377     text-align: center;
     382table thead th.sorted .sortoptions a.descending {
     383    background: url(../img/sorting-icons.gif) -5px -94px no-repeat;
    378384}
    379385
    380 #sorting-popup-div .cancel a {
    381     width: 100%;
    382     display: block;
     386table thead th.sorted .sortoptions a.descending:hover {
     387    background: url(../img/sorting-icons.gif) -5px -115px no-repeat;
    383388}
    384389
    385390/* ORDERABLE TABLES */
  • django/contrib/admin/static/admin/css/rtl.css

    diff --git a/django/contrib/admin/static/admin/css/rtl.css b/django/contrib/admin/static/admin/css/rtl.css
    index fce6b1a..59e8086 100644
    a b div.breadcrumbs {  
    8080
    8181/* SORTABLE TABLES */
    8282
    83 
    84 table thead th.sorted a {
    85     padding-left: 13px;
    86     padding-right: 0px;
    87 }
    88 
    89 table thead th.ascending a,
    90 table thead th.descending a {
    91     background-position: left;
    92 }
    93 
    94 table thead th.sorted a span.text {
    95    float: right;
    96 }
    97 
    98 table thead th.sorted a span.sortpos {
     83table thead th.sorted .sortoptions {
    9984   float: left;
    10085}
    10186
    div.colM {  
    256241
    257242.submit-row input {
    258243    float: left;
    259 }
    260  No newline at end of file
     244}
  • deleted file django/contrib/admin/static/admin/img/arrow-down.gif

    diff --git a/django/contrib/admin/static/admin/img/arrow-down.gif b/django/contrib/admin/static/admin/img/arrow-down.gif
    deleted file mode 100644
    index a967b9fd5563a0fc2f5fde8ec0f7de3fc8fbc5a9..0000000000000000000000000000000000000000
    GIT binary patch
    literal 0
    HcmV?d00001
  • deleted file literal

    literal 80
    zcmZ?wbhEHb<YZuDSj5I~;>3wfn>L+1d2-{%jW1rjm^pLi|Ns9P7#I|PvM@3LmFNK3
    i3?Q`(%%TyyyiA!oB04G)Te5yh$2@OMO7G-kum%ACMICAY
    
    diff --git a/django/contrib/admin/static/admin/img/arrow-up.gif b/django/contrib/admin/static/admin/img/arrow-up.gif
    deleted file mode 100644
    index 3fe4851399a37337891ccf5452ee5d59bbedeec7..0000000000000000000000000000000000000000
    GIT binary patch
    literal 0
    HcmV?d00001
  • deleted file literal

    literal 838
    zcmZ?wbhEHb<YZuD_|Cv^;>3wfn>L+1d2-{%jW1rjm^pJM!zdUHfe{k|ia%Kx8Gu<q
    z2jpW=o?zfmX5i&8aY$HjkcpK`j>SOX;Q=NFCLWFl0*@NH#f6pb?3n1_z+epkX4f1j
    
    diff --git a/django/contrib/admin/static/admin/img/icon_cog.gif b/django/contrib/admin/static/admin/img/icon_cog.gif
    deleted file mode 100644
    index e390ef2ef5a00858c6dda1974a1f334eddff46be..0000000000000000000000000000000000000000
    GIT binary patch
    literal 0
    HcmV?d00001
  • new file 537

    literal 537
    zcmZ?wbhEHb<Y(YvIOfIB-`_uV>eT7er_Y@`ciy~t^XJcBuwcQ$g$oxgTC{la;w4L#
    zEM2;E*|KHJmoHzjV#TUet5&aGy=KjtwQJX|Teoig`t=(&Y}mMQ<EBlUHgDd%Wy_Xr
    z+qP}rzJ14z9XogK+_h`h?%lih?Afz#-@g6(_a8iX@X(<{M~@yocI?>k<Ht{&IC1ji
    z$y29Joj!f~?Af#D&Yin(;ljm>7cXDFeC5iO8#iv;ym|B1ty{Nm-@bF_&b@p09zJ~d
    z<jIq#PoF+}_Uy%r7cXDFeEs_M+qZAuzkmPf)2Gj$KY#!J{pZi0zkdDt{rmTyKY#xI
    z{rm6VzyE_CDE?$&<YK62&|zX=VBiME2?KjsLw%FIZM}m{Q>PslyS+G*NoT!1voMb!
    zn^BXstOT#Nl7_gDl%X1nlmee5pNt%jh^?T!xK6!=fF_4|y|lQfX`7HLXT27yiX6Yb
    wq^SC8V{R@HWifeaZceo(OLj#*IbMC|PAeuxBQ6HLN%aQ0^=2AQO^poJ0GNkqX#fBK
    
    diff --git a/django/contrib/admin/static/admin/img/sorting-icons.gif b/django/contrib/admin/static/admin/img/sorting-icons.gif
    new file mode 100644
    index 0000000000000000000000000000000000000000..94b59072ddee6e1166a4da09e78fa90ddf4970b0
    GIT binary patch
    literal 371
    zcmZ?wbhEHb6k}*%IKsg2;>C++&z_w<dv@=+>!(hg+Pin}?%lgLZrnIy)1g(XR`svm
    zGk^a4IdkUBoH=vGj2X$3R|a-2{Qv(y1JOY7CkrDxgCK(rNC(JH2G$P=Dt#%L^D<Vg
    z%Xz)bNpZrN=sQZ2ue^&jXghN5S_DU{&9ub_Q!M71-RXWZ+iK<ww<1;%y?xgbk`zlB
    zv#*95na$pH|HF<NzxB7DGaqUAQla@ziNC3?zNxLQty8bFr-iGqzF)tmOLt1`<j#hf
    zwG)G92v$~?FIl>5`HGdRRxf8P<l|eH$H&6HF?b96uI;)zckSM!z2WfTgKLhTIC<*y
    znX~8g843jiF6Ldnd{yuI^_$waZ{O9tf9L$uXU|`}eDzxW$dO~3eC#Y=zU=YZzwN`J
    s1Nj?%>oIJS_SmrCV6*PAMDG;_b9UtOg*H@g7VvXvkudJ!U}Ufc0O?t%KL7v#
  • django/contrib/admin/templates/admin/change_list_results.html

    literal 0
    HcmV?d00001
    
    diff --git a/django/contrib/admin/templates/admin/change_list_results.html b/django/contrib/admin/templates/admin/change_list_results.html
    index b1db647..33db462 100644
    a b  
    1111<tr>
    1212{% for header in result_headers %}
    1313<th scope="col" {{ header.class_attrib }}>
    14   {% if header.sortable %}<a href="{{ header.url_primary }}">{% endif %}
    15   <span class="text">{{ header.text|capfirst }}</span>
    16   {% if header.sortable %}
    17     {% if header.sort_pos > 0 %}<span class="sortpos">
    18       {% if header.sort_pos == 1 %}<img id="primary-sort-icon" src="{% static "admin/img/icon_cog.gif" %}" alt="" />&nbsp;{% endif %}
    19       {{ header.sort_pos }}</span>
    20     {% endif %}
    21     <span class="clear"></span></a>
    22   {% endif %}
     14   {% if header.sortable %}
     15     {% if header.sort_pos > 0 %}
     16       <div class="sortoptions">
     17         <a class="sortremove" href="{{ header.url_remove }}" title="{% trans "Remove this column from sorting" %}"></a>
     18         <span class="sortposition" title="{% trans "Sorting index" %}">{{ header.sort_pos }}</span>
     19         <a href="{{ header.url_toggle }}" class="toggle {% if header.ascending %}ascending{% else %}descending{% endif %}" title="{% trans "Toggle sorting for this column" %}"></a>
     20       </div>
     21     {% endif %}
     22   {% endif %}
     23   <div class="text">{% if header.sortable %}<a href="{{ header.url_primary }}">{{ header.text|capfirst }}</a>{% else %}{{ header.text|capfirst }}{% endif %}</div>
     24   <div class="clear"></div>
    2325</th>{% endfor %}
    2426</tr>
    2527</thead>
     
    3335</tbody>
    3436</table>
    3537</div>
    36 
    37 {# Sorting popup: #}
    38 <div id="sorting-popup-div">
    39 <table>
    40   <caption>
    41    {% trans "Sorting by:" %}
    42   </caption>
    43   <tbody>
    44   {% for header in result_headers|dictsort:"sort_pos" %}
    45     {% if header.sort_pos > 0 %}
    46     <tr>
    47       <td>{{ header.sort_pos }}</td>
    48       <td>{{ header.text|capfirst }}</td>
    49       <td>{% if header.ascending %}{% trans "ascending" %}{% else %}{% trans "descending" %}{% endif %}</td>
    50       <td><a href="{{ header.url_toggle }}">{% trans "toggle" %}</a></td>
    51       <td><a href="{{ header.url_remove }}">{% trans "remove" %}</a></td>
    52     </tr>
    53     {% endif %}
    54   {% endfor %}
    55   </tbody>
    56 </table>
    57 <div class="reset"><a href="{{ reset_sorting_url }}">{% trans "Reset sorting" %}</a></div>
    58 <div class="cancel"><a href="javascript:void" id="sorting-popup-dismiss">{% trans "Cancel" %}</a></div>
    59 </div>
    60 <script type="text/javascript">
    61 <!--
    62 (function($) {
    63     $(document).ready(function() {
    64         var popup = $('#sorting-popup-div');
    65         var img = $('#primary-sort-icon');
    66         /* These next lines seems necessary to prime the popup: */
    67         popup.offset({left:0, top:-1000});
    68         popup.show();
    69         if ($.browser.msie) {
    70             // Can't find a way to make IE autosize the div.
    71             popup.width(300);
    72         }
    73         var popupWidth = popup.width();
    74         popup.hide();
    75 
    76         var visible = false;
    77 
    78         var escHandler = function(ev) {
    79             if (ev.which == 27) {
    80                 hidePopup();
    81                 ev.preventDefault();
    82             }
    83         };
    84 
    85         var showPopup = function() {
    86             var pos = img.offset();
    87             pos.top += img.height();
    88             if (pos.left + popupWidth >
    89                 $(window).width()) {
    90                 pos.left -= popupWidth;
    91             }
    92             popup.show();
    93             popup.offset(pos);
    94             visible = true;
    95             $(document).bind('keyup', escHandler);
    96         };
    97 
    98         var hidePopup = function() {
    99             popup.hide();
    100             visible = false;
    101             $(document).unbind('keyup', escHandler);
    102         };
    103 
    104         $('#primary-sort-icon').click(function(ev) {
    105             ev.preventDefault();
    106             if (visible) {
    107                 hidePopup();
    108             } else {
    109                 showPopup();
    110             }
    111         });
    112 
    113         $('#sorting-popup-dismiss').click(function(ev) {
    114             hidePopup();
    115             ev.preventDefault()
    116         });
    117     });
    118 })(django.jQuery);
    119 //-->
    120 </script>
    121 
    12238{% endif %}
  • django/contrib/admin/templatetags/admin_list.py

    diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py
    index 0f5eafc..125517d 100644
    a b def result_headers(cl):  
    8383    """
    8484    ordering_field_columns = cl.get_ordering_field_columns()
    8585    for i, field_name in enumerate(cl.list_display):
    86         admin_order_field = None
    8786        text, attr = label_for_field(field_name, cl.model,
    8887            model_admin = cl.model_admin,
    8988            return_attr = True
    def result_headers(cl):  
    106105                continue
    107106
    108107        # OK, it is sortable if we got this far
    109         th_classes = []
     108        th_classes = ['sortable']
    110109        order_type = ''
    111110        new_order_type = 'asc'
    112111        sort_pos = 0
Back to Top