From 71f017b2a6677538f8c3578e33859d4586b5bea1 Mon Sep 17 00:00:00 2001 From: Julien Phalip Date: Wed, 31 Aug 2011 08:07:07 +0000 Subject: [PATCH] Fixed #16059 -- Improved the usability of the admin's vertical and horizontal "filter" widgets, in particular by providing a better visual representation of the buttons' enabled and disabled states, and by providing more elaborate, yet less cluttered, help texts. Note that this commit is an exception to the current tacit rule that javascript code changes should be avoided until a proper javascript testing framework for Django core is in place. This exception is commanded by the fact that it is to fix a recognized usability issue and that the patch has been (manually) extensively tested in IE6+, Chrome, Safari, Firefox and Opera. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16714 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- .../admin/static/admin/css/widgets.css | 72 ++++++++++++++---- .../admin/static/admin/img/selector-add.gif | Bin 606 -> 0 bytes .../static/admin/img/selector-addall.gif | Bin 358 -> 0 bytes .../admin/static/admin/img/selector-icons.gif | Bin 0 -> 2771 bytes .../static/admin/img/selector-remove.gif | Bin 398 -> 0 bytes .../static/admin/img/selector-removeall.gif | Bin 355 -> 0 bytes .../static/admin/img/selector_stacked-add.gif | Bin 612 -> 0 bytes .../admin/img/selector_stacked-remove.gif | Bin 401 -> 0 bytes .../admin/static/admin/js/SelectFilter2.js | 65 +++++++++++----- docs/releases/1.4.txt | 12 +++ 10 files changed, 115 insertions(+), 34 deletions(-) delete mode 100644 django/contrib/admin/static/admin/img/selector-add.gif delete mode 100644 django/contrib/admin/static/admin/img/selector-addall.gif create mode 100644 django/contrib/admin/static/admin/img/selector-icons.gif delete mode 100644 django/contrib/admin/static/admin/img/selector-remove.gif delete mode 100644 django/contrib/admin/static/admin/img/selector-removeall.gif delete mode 100644 django/contrib/admin/static/admin/img/selector_stacked-add.gif delete mode 100644 django/contrib/admin/static/admin/img/selector_stacked-remove.gif diff --git a/django/contrib/admin/static/admin/css/widgets.css b/django/contrib/admin/static/admin/css/widgets.css index 4f4ea0a8f5..14e82c5a07 100644 --- a/django/contrib/admin/static/admin/css/widgets.css +++ b/django/contrib/admin/static/admin/css/widgets.css @@ -17,6 +17,10 @@ margin-bottom: 5px; } +.selector-chosen select { + border-top: none; +} + .selector-available h2, .selector-chosen h2 { border: 1px solid #ccc; } @@ -37,8 +41,9 @@ text-align: left; } -.selector .selector-chosen .selector-filter { - padding: 4px 5px; +.selector .selector-filter label { + width: 16px; + padding: 2px; } .selector .selector-available input { @@ -50,7 +55,7 @@ width: 22px; height: 50px; background: url(../img/chooser-bg.gif) top center no-repeat; - margin: 8em 3px 0 3px; + margin: 10em 5px 0 5px; padding: 0; } @@ -61,7 +66,7 @@ } .selector select { - margin-bottom: 5px; + margin-bottom: 10px; margin-top: 0; } @@ -74,38 +79,66 @@ } .selector-add { - background: url(../img/selector-add.gif) top center no-repeat; + background: url(../img/selector-icons.gif) 0 -161px no-repeat; + cursor: default; margin-bottom: 2px; } +.active.selector-add { + background: url(../img/selector-icons.gif) 0 -187px no-repeat; + cursor: pointer; +} + .selector-remove { - background: url(../img/selector-remove.gif) top center no-repeat; + background: url(../img/selector-icons.gif) 0 -109px no-repeat; + cursor: default; +} + +.active.selector-remove { + background: url(../img/selector-icons.gif) 0 -135px no-repeat; + cursor: pointer; } a.selector-chooseall, a.selector-clearall { - display: block; - width: 6em; + display: inline-block; text-align: left; margin-left: auto; margin-right: auto; font-weight: bold; color: #666; +} + +a.selector-chooseall { + padding: 3px 18px 3px 0; +} + +a.selector-clearall { padding: 3px 0 3px 18px; } -a.selector-chooseall:hover, a.selector-clearall:hover { +a.active.selector-chooseall:hover, a.active.selector-clearall:hover { color: #036; } a.selector-chooseall { - width: 7em; - background: url(../img/selector-addall.gif) left center no-repeat; + background: url(../img/selector-icons.gif) right -263px no-repeat; + cursor: default; +} + +a.active.selector-chooseall { + background: url(../img/selector-icons.gif) right -289px no-repeat; + cursor: pointer; } a.selector-clearall { - background: url(../img/selector-removeall.gif) left center no-repeat; + background: url(../img/selector-icons.gif) left -211px no-repeat; + cursor: default; } +a.active.selector-clearall { + background: url(../img/selector-icons.gif) left -237px no-repeat; + cursor: pointer; +} /* STACKED SELECTORS */ @@ -148,13 +181,24 @@ a.selector-clearall { } .stacked .selector-add { - background-image: url(../img/selector_stacked-add.gif); + background: url(../img/selector-icons.gif) 0 -57px no-repeat; + cursor: default; +} + +.stacked .active.selector-add { + background: url(../img/selector-icons.gif) 0 -83px no-repeat; + cursor: pointer; } .stacked .selector-remove { - background-image: url(../img/selector_stacked-remove.gif); + background: url(../img/selector-icons.gif) 0 -5px no-repeat; + cursor: default; } +.stacked .active.selector-remove { + background: url(../img/selector-icons.gif) 0 -31px no-repeat; + cursor: pointer; +} /* DATE AND TIME */ diff --git a/django/contrib/admin/static/admin/img/selector-add.gif b/django/contrib/admin/static/admin/img/selector-add.gif deleted file mode 100644 index 50132d1c439494a0a19e1d280385f03d3ac5599b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 606 zcmZ?wbhEHb6krfwcoxafw(@M}n)ChZFW!3c{`tGF)3#h)y!U$bf@7^KPS-6uzUAco zS0BDVc=>6^`De|`PR`nSyg_g{XjI&`ak@yUG` zo;EK(J#+ijhQ%lP*I%ezbo}9~&(pSE*?IQS;=MN)@4Gd3=e3%J$D5X(nz`fp(*3u$ zoqaNI*R}d3CpVpX{Q29jre&vU7apIr~bzW=sp-|cz3uWvc? zWa{QC$8Wq`dhpJqjhE{epV)Z(?&i~vr*FGDch`+I#~w`He7Swq*`){W^sT@6^~dl3 z|Nk@49Vq@}VPs&4WY7WG42ly5_T3GUO_4kje3Fi`Y|PEgg2Ei`p1iykJ|h0&z5Zgl z0rM9G$k+=tamfX*T&cAxSkXVyMZhv_>sB}KZDAbD#%4hW4zfg89~5H~^<`z%2RJ`V9$77#OFv^CvqjY0A7XSuxNk>&%VE4w{br3Jf1VK49#UQa3Uc3OT{Z NtIjEA%EiK94FJ;24lMux diff --git a/django/contrib/admin/static/admin/img/selector-addall.gif b/django/contrib/admin/static/admin/img/selector-addall.gif deleted file mode 100644 index d6e7c639bb2ec270122861f054289845281fae26..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 358 zcmZ?wbhEHb6krfwxN64GwdVYqV-FVYy|wM^)3z0-CvU#|?Z@x7m1n1IyE0+p#RUf* z*DpEQwCq&t%5&3q-kG-LYR}pWx1PLjUwNi;)tTmHr>AYX(!J*V^leu=SD$TPd3wsG zD~tDD-+uc3vi-Mqo_}`i`pffoUcPz%`N)+gC$B$Wu={53y7Nb`JiYSZ&EgJ2jU%oBgck}JXFNZEY-hSr6{b%p@TzI-@&-ELR-)%g8_xtzn|NsAIzzr0CvM@3* zm@(*plz{xiz}D;}e*)+h-yWNC)(RZ+$#R@9*pI_UiEW z?CP?Ck95?C|R9>g4S7hI*~?c(b5<>~I>>hs{~^5^I0=I80; z=IGz%@8ag`<>lq%*5<_4=+e^C z#nk1*)a1g{=h4y8!qVf<&(F@z&b-j%ywK&%&CR~h<;={?xXN z&E(0+$+peq$jHdI%ip)m;Iz!+w9MqT%HPMw$F$4hwaenO%j2}k;Izu%vdZJM$=|Zc z;j_rz#Kgq1$KA2V-NVDftj6HN!otD9!KlRGz`(%2zrU)&+P=QNr@`C2yu78s+@-+W zroh{!z}uj}25$81 znTg4wKV*_V0SZ({QZjm6}T8>Lu zxjGjJ)+xulI<9B;qVJnt{R*M#&-Y#bxc995vnxO+na5sZdb#&&u1=qRmR%x-M3#sxVCMpF zM)_t4c82h#EK=5a=bwS9!2+Lmh7dxTW=hHBop%bsr7UTxAq1q7a#@O-V_v!d4{KVP zr4Xc&%0j7s=B=|F-c zK>^HRP9tb=A*~?X*zo{Cb_@eY8{Br=#w+&yb=oDHs5S!M>yn1Bo=p=wh%g8vwPz!3OK2&oU50>;X_7L=3TT*kpXd2@U|| zzzH-UgA6wKNQ2JFZsccxDd4oMPaN%ZBl8p-G`Jj% z!Xz!s6@Vx$Otk~qAx-e$zfEprRTWH%Oow9jPh8 z1m3CnV1VVRVZK`2id^Qo0RTv#I_8(frida+Fa-cpn7{6N>9W&KhwXC5Mh8%;t8RO2 zn#AV20U#K!i1CV{^7`vwfbjhDlL20OW~*Vg8RCjeKKb&83v@RsqKA%(YX!mGJ1TX% z?f(1lGgQMQ!renoAu;r|(vAV(bxFp%-Y;(rJ{gEC?ykUGS|MQ1SAGh$SO z`xWAXPPo7YH&}@5bO=LEFu({nbfIUQ;T~1f0#h!)!a`83KmM4(K z$ic%{Fl7Wlj0F$>$zh=(l4BAgG~y8JPy_OqXA&}4j}D{5KL*8uLCO%IK*sY7t65Ep z1+1dglyQ#%8f1R;yI=m|$Hq3s4+&9X3zc|akPuuV6QpWE3nZ0^OE6#{A&>>DT9v9* z5fW8>+y@dep(X~jU`&~4K`GRv1_m%7Q)=j=Ah~48PF`|LnE(`9w&cl93PFyt7-c0( z$$(6TGL>ynR0ulh%21X~)kfJQsE zvX+74Wih*%%u-+go5?I^I~!WhWFR!36>T3!bDA(#;WVfTL~35F8rHP753YF)Y+@r@ zLCl6WdUP|JNKL9z3lf7sKm!_qhyg+fpax)wp$J6~12EJ;0E4K35;e)e5h$UCg3KTp zUP$W^Brt=tCSwK!Q3NQc0)(;XfGVI+1VOAZ3r4Jf0Du(&D+X(gy*A?y82~H+l#qxkpsX!!5Wy=>p*6(4T*qa3J3^-M79A}f~Wx&T&hA4PFvQ3P}LZ8=m{N+ z!BvF+%s>&;poSt!yVTzL_P4#U0Vc#D4ouhpAqkM0FZQqpUx>pF2{4Eqd=ZA~Vxb9P z@P)bvVgqq7cMn*ozz&!zj^hpl6TZL%CYq3d1nfY)=_QCb(rbhECZGwv$geo$I}J>5 zz`jkGhJg2bUU`UP8arq&7KkekOmJ5o0-i<~?kiw^xt(K0HGWe3p!hdNxXX?bKL8&QBj8J?XD3l~Ic!Z5=ll-6NG+o2uB Zpam_8(T+!#coX3W$0kPo=cNV&06TG~#AN^g literal 0 HcmV?d00001 diff --git a/django/contrib/admin/static/admin/img/selector-remove.gif b/django/contrib/admin/static/admin/img/selector-remove.gif deleted file mode 100644 index 2b9b0a2ac35a2051834bb9a49a7d57aaeebdcb48..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 398 zcmV;90df9ENk%w1VGsZi0M$MK!NI}2yu9=C^R%?Iv9Ynv*4?eOy|A&e#l^+DySw1v z;PCM9vb)91%*?sDx%~b8tgyARva;st@73Jn!^6YAzP`)L%gV~i`T6;>yTq=rvah$l z-QC^j?C`?E!rI!}-rnBp>+8?Y&$F|$v%JQ(wzkK|$N2d8?d|R4>Fx3H@xZ{qud%ZB z_V&`!(&Fap*x1<3&CRj8!??J(+uPg8$;r;n&b76*)z#I=$jG<1x5UK6zrVlr`1}9= z{{R30A^8LW002G!EC2ui01yBW000K7K%dYz*=R~SmZ2~lJ~9pwN1*_@60%NHMxlAX zUK2qgWbklk^e2tm$$Y6>%tp5<1aBx~ID^{#HdGh3{RjW2`-1y|llXdIX?cBNZ+_`frSFT*Tbm`{Jn=f9xc=ztz_wV0- z|Ni~?^XIp2-MVq(#`*K-_wCzv>C&Zd-@aYHe*MaoE4y~>`t<43?%lh$ZQJ(v@#E#o zmmfcV{KtY3(LiF)@D4T0VKnCT(SA zX1)$*HBn6#jwS_7P0<=>4NmpN;)-mGISX90xU|;Ev8_pU4PxOI7UpJ&^3YJ@;Za-V LdE}_8BZD;nhnJNG diff --git a/django/contrib/admin/static/admin/img/selector_stacked-add.gif b/django/contrib/admin/static/admin/img/selector_stacked-add.gif deleted file mode 100644 index 74261696522de5819780082d9d92d75f8ffdb4fc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 612 zcmZ?wbhEHb6krfwcoxdgw({()C+`>Uz23RzeCvwSk6wMQUT~~#(eW)O@4x%}qhZO( z=4B^W9lAAn)1{a1zimDJ=;PO)eQVFX`tbe1%TKd*UVs1P$KQYdUVr@FvFhyR6ZdwU ze>P#`rA;RvPThQ^Vacg^yRJ>!dS%hR+gr{&*>?76|N09vw_ojAb8ha=YxRpy&e(CS zX5q0dryguM`QY`3Zw-r2%-nIkdHLz4Wv6Nu9$&Km_M1=N`!`%%e(?6hjhE^cpICbE zPW_UT?JLi0J9WQr-Gy6EKkPjFXz{*VlQv#%T6(H>;qm&#Ct6mV*>vi0?V{s*E<9;p zb#~+NyGsw;*?ju(++8>N)?b{q|9^%71&Tje7#SEs z8FWCd0L2Ld`@x3LrchxXZVfp-CdTGwF-aChB`GOoO9?O0UN2rZpZN=XRJAypI8=gG zu3D|&6>7p|?7dlrpI>J4W)?;pTi^Y@;vpg82Yh*%1Red)_zN8tI_odX#vXkAI^SWw z8`quLnIE#U3LF+-wUd@+HWGAYV9+`IIYj*f0~?2-=O67a@_!~B5V-KDV{)@!9S?KU zg-$*<4i1Nz9ITzZT>%EXL7SAjj`z#?N@%FQnAjwxsS!|7=*eL;*Vos_$H(O9?cUzr!^6YN%ge8^vckf`>gwvV zyvDP$v)I_!vAV;~&d%H0+sMes)z#I>$;r33x4*x?xVX5rwY9{=#P#_5|Ns9000000 z00000A^8LW002AyEC2ui01yBW000KAK%S5naXdmc6(KMjYAO&AVzD@V4lqm;hLU-| z-jabLRNQE28e){D>0mrlZWF7McDqHrjtjIdGl3s?cnEyf&#j1HCpm1R^ds$Tu?y v2{Xwz1xyMMI@Q+KSVJ%eHQnCb7h_HpIV%Yq94R_BSxrJk53meNO+f%VqdU!B diff --git a/django/contrib/admin/static/admin/js/SelectFilter2.js b/django/contrib/admin/static/admin/js/SelectFilter2.js index b7bc9d5f8f..2eb67e8e1c 100644 --- a/django/contrib/admin/static/admin/js/SelectFilter2.js +++ b/django/contrib/admin/static/admin/js/SelectFilter2.js @@ -5,7 +5,7 @@ Different than SelectFilter because this is coupled to the admin framework. Requires core.js, SelectBox.js and addevent.js. */ - +(function($) { function findForm(node) { // returns the node of the form containing the given node if (node.tagName.toLowerCase() != 'form') { @@ -14,7 +14,7 @@ function findForm(node) { return node; } -var SelectFilter = { +window.SelectFilter = { init: function(field_id, field_name, is_stacked, admin_media_prefix) { if (field_id.match(/__prefix__/)){ // Don't intialize on empty forms. @@ -44,41 +44,42 @@ var SelectFilter = { //
var selector_available = quickElement('div', selector_div, ''); selector_available.className = 'selector-available'; - quickElement('h2', selector_available, interpolate(gettext('Available %s'), [field_name])); - var filter_p = quickElement('p', selector_available, ''); + var title_available = quickElement('h2', selector_available, interpolate(gettext('Available %s') + ' ', [field_name])); + quickElement('img', title_available, '', 'src', admin_media_prefix + 'img/icon-unknown.gif', 'width', '10', 'height', '10', 'class', 'help help-tooltip', 'title', interpolate(gettext('This is the list of available %s. You may add some by selecting them below and then clicking the "Add" button.'), [field_name])); + + var filter_p = quickElement('p', selector_available, '', 'id', field_id + '_filter'); filter_p.className = 'selector-filter'; - var search_filter_label = quickElement('label', filter_p, '', 'for', field_id + "_input", 'style', 'width:16px;padding:2px'); + var search_filter_label = quickElement('label', filter_p, '', 'for', field_id + "_input"); - var search_selector_img = quickElement('img', search_filter_label, '', 'src', admin_media_prefix + 'img/selector-search.gif'); - search_selector_img.alt = gettext("Filter"); + var search_selector_img = quickElement('img', search_filter_label, '', 'src', admin_media_prefix + 'img/selector-search.gif', 'class', 'help-tooltip', 'alt', '', 'title', interpolate(gettext("Type into the filter box to narrow down the list of available %s."), [field_name])); filter_p.appendChild(document.createTextNode(' ')); - var filter_input = quickElement('input', filter_p, '', 'type', 'text'); + var filter_input = quickElement('input', filter_p, '', 'type', 'text', 'placeholder', gettext("Filter")); filter_input.id = field_id + '_input'; + selector_available.appendChild(from_box); - var choose_all = quickElement('a', selector_available, gettext('Choose all'), 'href', 'javascript: (function(){ SelectBox.move_all("' + field_id + '_from", "' + field_id + '_to"); })()'); + var choose_all = quickElement('a', selector_available, gettext('Add all'), 'href', 'javascript: (function(){ SelectBox.move_all("' + field_id + '_from", "' + field_id + '_to"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_add_all_link'); choose_all.className = 'selector-chooseall'; //
    var selector_chooser = quickElement('ul', selector_div, ''); selector_chooser.className = 'selector-chooser'; - var add_link = quickElement('a', quickElement('li', selector_chooser, ''), gettext('Add'), 'href', 'javascript: (function(){ SelectBox.move("' + field_id + '_from","' + field_id + '_to");})()'); + var add_link = quickElement('a', quickElement('li', selector_chooser, ''), gettext('Add'), 'title', gettext('Add'), 'href', 'javascript: (function(){ SelectBox.move("' + field_id + '_from","' + field_id + '_to"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_add_link'); add_link.className = 'selector-add'; - var remove_link = quickElement('a', quickElement('li', selector_chooser, ''), gettext('Remove'), 'href', 'javascript: (function(){ SelectBox.move("' + field_id + '_to","' + field_id + '_from");})()'); + var remove_link = quickElement('a', quickElement('li', selector_chooser, ''), gettext('Remove'), 'title', gettext('Remove'), 'href', 'javascript: (function(){ SelectBox.move("' + field_id + '_to","' + field_id + '_from"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_remove_link'); remove_link.className = 'selector-remove'; //
    var selector_chosen = quickElement('div', selector_div, ''); selector_chosen.className = 'selector-chosen'; - quickElement('h2', selector_chosen, interpolate(gettext('Chosen %s'), [field_name])); - var selector_filter = quickElement('p', selector_chosen, gettext('Select your choice(s) and click ')); - selector_filter.className = 'selector-filter'; - quickElement('img', selector_filter, '', 'src', admin_media_prefix + (is_stacked ? 'img/selector_stacked-add.gif':'img/selector-add.gif'), 'alt', 'Add'); + var title_chosen = quickElement('h2', selector_chosen, interpolate(gettext('Added %s') + ' ', [field_name])); + quickElement('img', title_chosen, '', 'src', admin_media_prefix + 'img/icon-unknown.gif', 'width', '10', 'height', '10', 'class', 'help help-tooltip', 'title', interpolate(gettext('This is the list of added %s. You may remove some by selecting them below and then clicking the "Remove" button.'), [field_name])); + var to_box = quickElement('select', selector_chosen, '', 'id', field_id + '_to', 'multiple', 'multiple', 'size', from_box.size, 'name', from_box.getAttribute('name')); to_box.className = 'filtered'; - var clear_all = quickElement('a', selector_chosen, gettext('Clear all'), 'href', 'javascript: (function() { SelectBox.move_all("' + field_id + '_to", "' + field_id + '_from");})()'); + var clear_all = quickElement('a', selector_chosen, gettext('Remove all'), 'href', 'javascript: (function() { SelectBox.move_all("' + field_id + '_to", "' + field_id + '_from"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_remove_all_link'); clear_all.className = 'selector-clearall'; from_box.setAttribute('name', from_box.getAttribute('name') + '_old'); @@ -86,16 +87,38 @@ var SelectFilter = { // Set up the JavaScript event handlers for the select box filter interface addEvent(filter_input, 'keyup', function(e) { SelectFilter.filter_key_up(e, field_id); }); addEvent(filter_input, 'keydown', function(e) { SelectFilter.filter_key_down(e, field_id); }); - addEvent(from_box, 'dblclick', function() { SelectBox.move(field_id + '_from', field_id + '_to'); }); - addEvent(to_box, 'dblclick', function() { SelectBox.move(field_id + '_to', field_id + '_from'); }); + addEvent(from_box, 'change', function(e) { SelectFilter.refresh_icons(field_id) }); + addEvent(to_box, 'change', function(e) { SelectFilter.refresh_icons(field_id) }); + addEvent(from_box, 'dblclick', function() { SelectBox.move(field_id + '_from', field_id + '_to'); SelectFilter.refresh_icons(field_id); }); + addEvent(to_box, 'dblclick', function() { SelectBox.move(field_id + '_to', field_id + '_from'); SelectFilter.refresh_icons(field_id); }); addEvent(findForm(from_box), 'submit', function() { SelectBox.select_all(field_id + '_to'); }); SelectBox.init(field_id + '_from'); SelectBox.init(field_id + '_to'); // Move selected from_box options to to_box SelectBox.move(field_id + '_from', field_id + '_to'); + + if (!is_stacked) { + // In horizontal mode, give the same height to the two boxes. + $(to_box).height($(filter_p).outerHeight() + $(from_box).outerHeight()); + } + + // Initial icon refresh + SelectFilter.refresh_icons(field_id); + }, + refresh_icons: function(field_id) { + var from = $('#' + field_id + '_from'); + var to = $('#' + field_id + '_to'); + var is_from_selected = from.find('option:selected').length > 0; + var is_to_selected = to.find('option:selected').length > 0; + // Active if at least one item is selected + $('#' + field_id + '_add_link').toggleClass('active', is_from_selected); + $('#' + field_id + '_remove_link').toggleClass('active', is_to_selected); + // Active if the corresponding box isn't empty + $('#' + field_id + '_add_all_link').toggleClass('active', from.find('option').length > 0); + $('#' + field_id + '_remove_all_link').toggleClass('active', to.find('option').length > 0); }, filter_key_up: function(event, field_id) { - from = document.getElementById(field_id + '_from'); + var from = document.getElementById(field_id + '_from'); // don't submit form if user pressed Enter if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) { from.selectedIndex = 0; @@ -109,7 +132,7 @@ var SelectFilter = { return true; }, filter_key_down: function(event, field_id) { - from = document.getElementById(field_id + '_from'); + var from = document.getElementById(field_id + '_from'); // right arrow -- move across if ((event.which && event.which == 39) || (event.keyCode && event.keyCode == 39)) { var old_index = from.selectedIndex; @@ -128,3 +151,5 @@ var SelectFilter = { return true; } } + +})(django.jQuery); diff --git a/docs/releases/1.4.txt b/docs/releases/1.4.txt index 4e59acff3a..df4e663184 100644 --- a/docs/releases/1.4.txt +++ b/docs/releases/1.4.txt @@ -328,6 +328,18 @@ In case your ``ADMIN_MEDIA_PREFIX`` is set to an own domain (e.g. that path. The files were moved from :file:`django/contrib/admin/media/` to :file:`django/contrib/admin/static/admin/`. +Removed admin icons +~~~~~~~~~~~~~~~~~~~ + +As part of an effort to improve the performance and usability of the admin's +vertical and horizontal "filter" widgets, some icon files were removed and +grouped into a single sprite file (``selector-icons.gif``): +``selector-add.gif``, ``selector-addall.gif``, ``selector-remove.gif``, +``selector-removeall.gif``, ``selector_stacked-add.gif`` and +``selector_stacked-remove.gif``. If you used those icons to customize the +admin then you will want to replace them with your own icons or retrieve them +from a previous release. + Compatibility with old signed data ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~