Ticket #2569: adminforeign.2.rev6000.diff

File adminforeign.2.rev6000.diff, 3.1 KB (added by Marek Kubica <pythonmailing@…>, 8 years ago)

The adminforeign.2.diff ported to SVN revision 6000

  • contrib/admin/media/js/admin/RelatedObjectLookups.js

     
    6161    }
    6262    win.close();
    6363}
     64
     65function showEditPopup(triggeringLink) {
     66    var name = triggeringLink.id.replace(/^edit_/,'');
     67    name = name.replace(/\./g,'___');
     68    var elem = document.getElementById(name);
     69    if (elem) {
     70        if (elem.nodeName == 'SELECT') {
     71            var id = elem.options[elem.selectedIndex].value
     72            var win = window.open(triggeringLink.href + id + '?_popup=1',name, 'height=500,width=800,resizable=yes,scrollbars=yes');
     73        }
     74    }
     75    return false;
     76}
     77
     78function dismissEditPopup(win, newId, newRepr) {
     79    var name = win.name.replace(/___/g, '.');
     80    var elem = document.getElementById(name);
     81    if(elem) {
     82        if( elem.nodeName == 'SELECT') {
     83            var o = new Option(newRepr, newId);
     84            elem.options[elem.selectedIndex] = o;
     85            o.selected = true;
     86        }
     87    }
     88    win.close();
     89}
  • contrib/admin/templates/widget/one_to_one.html

     
     1{% load admin_modify adminmedia %}
    12{% if add %}{% include "widget/foreign.html" %}{% endif %}
    2 {% if change %}{% if bound_field.existing_display %}&nbsp;<strong>{{ bound_field.existing_display|truncatewords:"14"|escape }}</strong>{% endif %}{% endif %}
     3{% if change %}
     4{% if bound_field.existing_display %}&nbsp;<a href="{{ bound_field.related_url }}{{ bound_field.existing_display}}"><strong>{{ bound_field.existing_display|truncatewords:"14"|escape }}</strong></a>{% endif %}{% endif %}
  • contrib/admin/templates/widget/foreign.html

     
    88    {% endif %}
    99{% else %}
    1010{% if bound_field.needs_add_label %}
    11     <a href="{{ bound_field.related_url }}add/" class="add-another" id="add_{{ bound_field.element_id }}" onclick="return showAddAnotherPopup(this);"> <img src="{% admin_media_prefix %}img/admin/icon_addlink.gif" width="10" height="10" alt="Add Another"/></a>
    12 {% endif %}{% endif %}
     11    <a href="{{ bound_field.related_url }}add/" class="add-another" id="add_{{ bound_field.element_id }}" onclick="return showAddAnotherPopup(this);"> <img src="{% admin_media_prefix %}img/admin/icon_addlink.gif" width="10" height="10" alt="Add Another"/></a>
     12    <a href="{{ bound_field.related_url }}" class="related-lookup" id="edit_{{ bound_field.element_id }}" onclick="return showEditPopup(this);"> <img src="{% admin_media_prefix %}img/admin/selector-search.gif" width="16" height="16" alt="Lookup"></a>
     13 
     14{% endif %}
     15{% endif %}
    1316{% if change %}
    1417    {% if bound_field.field.primary_key %}
    1518        {{ bound_field.original_value }}
Back to Top