Ticket #16212: 16212.better-admin-multiple-sort.4.diff
File 16212.better-admin-multiple-sort.4.diff, 11.3 KB (added by , 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 { 309 309 310 310 /* SORTABLE TABLES */ 311 311 312 thead th { 313 padding: 0; 314 line-height: normal; 315 } 316 312 317 thead th a:link, thead th a:visited { 313 318 color: #666; 314 display: block;315 319 } 316 320 317 321 thead th.sorted { 318 322 background: #c5c5c5 url(../img/nav-bg-selected.gif) top left repeat-x; 319 323 } 320 324 321 table thead th.sorted a { 322 padding-right: 13px; 325 table thead th .text { 326 padding: 2px 5px; 327 } 328 329 table thead th .text a { 330 display: block; 331 cursor: pointer; 332 } 333 334 table thead th.sortable:hover { 335 background: white url(../img/nav-bg-reverse.gif) 0 -5px repeat-x; 323 336 } 324 337 325 t able thead th.ascending a{326 background: url(../img/arrow-up.gif) right .4em no-repeat;338 thead th.sorted a.sortremove { 339 visibility: hidden; 327 340 } 328 341 329 table thead th. descending a{330 background: url(../img/arrow-down.gif) right .4em no-repeat;342 table thead th.sorted:hover a.sortremove { 343 visibility: visible; 331 344 } 332 345 333 table thead th.sorted a span.text { 334 display: block; 335 float: left; 336 cursor: pointer; /* IE needs this */ 346 table thead th.sorted .sortoptions { 347 display: block; 348 padding: 4px 5px 0 5px; 349 float: right; 350 text-align: right; 337 351 } 338 352 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 */ 353 table thead th.sorted .sortposition { 354 font-size: .8em; 355 min-width: 12px; 356 text-align: center; 357 vertical-align: top; 345 358 } 346 359 347 table thead th.sorted a img { 348 vertical-align: top; 360 table thead th.sorted .sortoptions a { 361 width: 14px; 362 height: 12px; 363 display: inline-block; 349 364 } 350 365 351 table thead th.sorted a span.clear { 352 display: block; 353 clear: both; 366 table thead th.sorted .sortoptions a.sortremove { 367 background: url(../img/sorting-icons.gif) -4px -5px no-repeat; 354 368 } 355 369 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 */ 370 table thead th.sorted .sortoptions a.sortremove:hover { 371 background: url(../img/sorting-icons.gif) -4px -27px no-repeat; 362 372 } 363 373 364 #sorting-popup-div table { 365 border-right: 0px; 366 border-left: 0px; 374 table thead th.sorted .sortoptions a.ascending { 375 background: url(../img/sorting-icons.gif) -5px -50px no-repeat; 367 376 } 368 377 369 #sorting-popup-div .reset{370 text-align: center;378 table thead th.sorted .sortoptions a.ascending:hover { 379 background: url(../img/sorting-icons.gif) -5px -72px no-repeat; 371 380 } 372 381 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; 382 table thead th.sorted .sortoptions a.descending { 383 background: url(../img/sorting-icons.gif) -5px -94px no-repeat; 378 384 } 379 385 380 #sorting-popup-div .cancel a { 381 width: 100%; 382 display: block; 386 table thead th.sorted .sortoptions a.descending:hover { 387 background: url(../img/sorting-icons.gif) -5px -115px no-repeat; 383 388 } 384 389 385 390 /* 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 { 80 80 81 81 /* SORTABLE TABLES */ 82 82 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 { 83 table thead th.sorted .sortoptions { 99 84 float: left; 100 85 } 101 86 … … div.colM { 256 241 257 242 .submit-row input { 258 243 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 11 11 <tr> 12 12 {% for header in result_headers %} 13 13 <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="" /> {% 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> 23 25 </th>{% endfor %} 24 26 </tr> 25 27 </thead> … … 33 35 </tbody> 34 36 </table> 35 37 </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 122 38 {% 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): 83 83 """ 84 84 ordering_field_columns = cl.get_ordering_field_columns() 85 85 for i, field_name in enumerate(cl.list_display): 86 admin_order_field = None87 86 text, attr = label_for_field(field_name, cl.model, 88 87 model_admin = cl.model_admin, 89 88 return_attr = True … … def result_headers(cl): 106 105 continue 107 106 108 107 # OK, it is sortable if we got this far 109 th_classes = [ ]108 th_classes = ['sortable'] 110 109 order_type = '' 111 110 new_order_type = 'asc' 112 111 sort_pos = 0