diff --git a/django/contrib/admin/media/js/admin/DateTimeShortcuts.js b/django/contrib/admin/media/js/admin/DateTimeShortcuts.js
index 016de90..fbaa599 100644
|
a
|
b
|
var DateTimeShortcuts = {
|
| 11 | 11 | calendarLinkName: 'calendarlink',// name of the link that is used to toggle |
| 12 | 12 | clockDivName: 'clockbox', // name of clock <div> that gets toggled |
| 13 | 13 | clockLinkName: 'clocklink', // name of the link that is used to toggle |
| | 14 | shortCutsClass: 'datetimeshortcuts', // class of the clock and cal shortcuts |
| 14 | 15 | admin_media_prefix: '', |
| 15 | 16 | init: function() { |
| 16 | 17 | // Deduce admin_media_prefix by looking at the <script>s in the |
| … |
… |
var DateTimeShortcuts = {
|
| 42 | 43 | |
| 43 | 44 | // Shortcut links (clock icon and "Now" link) |
| 44 | 45 | var shortcuts_span = document.createElement('span'); |
| | 46 | shortcuts_span.className = DateTimeShortcuts.shortCutsClass; |
| 45 | 47 | inp.parentNode.insertBefore(shortcuts_span, inp.nextSibling); |
| 46 | 48 | var now_link = document.createElement('a'); |
| 47 | 49 | now_link.setAttribute('href', "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", new Date().strftime('" + get_format('TIME_INPUT_FORMATS')[0] + "'));"); |
| … |
… |
var DateTimeShortcuts = {
|
| 128 | 130 | |
| 129 | 131 | // Shortcut links (calendar icon and "Today" link) |
| 130 | 132 | var shortcuts_span = document.createElement('span'); |
| | 133 | shortcuts_span.className = DateTimeShortcuts.shortCutsClass; |
| 131 | 134 | inp.parentNode.insertBefore(shortcuts_span, inp.nextSibling); |
| 132 | 135 | var today_link = document.createElement('a'); |
| 133 | 136 | today_link.setAttribute('href', 'javascript:DateTimeShortcuts.handleCalendarQuickLink(' + num + ', 0);'); |
diff --git a/django/contrib/admin/media/js/inlines.js b/django/contrib/admin/media/js/inlines.js
index 518ad9b..b66d6c9 100644
|
a
|
b
|
|
| 34 | 34 | var maxForms = $("#id_" + options.prefix + "-MAX_NUM_FORMS").attr("autocomplete", "off"); |
| 35 | 35 | // only show the add button if we are allowed to add more items |
| 36 | 36 | var showAddButton = ((maxForms.val() == 0) || ((maxForms.val()-totalForms.val()) > 0)); |
| 37 | | var selectedItems = this; |
| 38 | 37 | $(this).each(function(i) { |
| 39 | 38 | $(this).not("." + options.emptyCssClass).addClass(options.formCssClass); |
| 40 | 39 | }); |
diff --git a/django/contrib/admin/templates/admin/edit_inline/stacked.html b/django/contrib/admin/templates/admin/edit_inline/stacked.html
index 6525fe1..c713d4a 100644
|
a
|
b
|
|
| 22 | 22 | (function($) { |
| 23 | 23 | $(document).ready(function() { |
| 24 | 24 | var rows = "#{{ inline_admin_formset.formset.prefix }}-group .inline-related"; |
| 25 | | updateInlineLabel = function(row) { |
| | 25 | var updateInlineLabel = function(row) { |
| 26 | 26 | $(rows).find(".inline_label").each(function(i) { |
| 27 | 27 | var count = i + 1; |
| 28 | 28 | $(this).html($(this).html().replace(/(#\d+)/g, "#" + count)); |
| 29 | 29 | }); |
| 30 | 30 | } |
| | 31 | var reinitDateTimeShortCuts = function() { |
| | 32 | // Reinitialize the calendar and clock widgets by force, yuck. |
| | 33 | if (typeof DateTimeShortcuts != "undefined") { |
| | 34 | $(".datetimeshortcuts").remove(); |
| | 35 | DateTimeShortcuts.init(); |
| | 36 | } |
| | 37 | } |
| 31 | 38 | $(rows).formset({ |
| 32 | 39 | prefix: "{{ inline_admin_formset.formset.prefix }}", |
| 33 | 40 | addText: "{% blocktrans with inline_admin_formset.opts.verbose_name|title as verbose_name %}Add another {{ verbose_name }}{% endblocktrans %}", |
| … |
… |
|
| 36 | 43 | deleteText: "{% trans "Remove" %}", |
| 37 | 44 | emptyCssClass: "empty-form", |
| 38 | 45 | removed: updateInlineLabel, |
| 39 | | added: updateInlineLabel |
| | 46 | added: (function(row) { |
| | 47 | reinitDateTimeShortCuts(); |
| | 48 | updateInlineLabel(row); |
| | 49 | }) |
| 40 | 50 | }); |
| 41 | 51 | }); |
| 42 | 52 | })(jQuery.noConflict()); |
diff --git a/django/contrib/admin/templates/admin/edit_inline/tabular.html b/django/contrib/admin/templates/admin/edit_inline/tabular.html
index 5c69bad..4b722fd 100644
|
a
|
b
|
|
| 68 | 68 | (function($) { |
| 69 | 69 | $(document).ready(function($) { |
| 70 | 70 | var rows = "#{{ inline_admin_formset.formset.prefix }}-group .tabular.inline-related tbody tr"; |
| 71 | | alternatingRows = function(row) { |
| | 71 | var alternatingRows = function(row) { |
| 72 | 72 | $(rows).not(".add-row").removeClass("row1 row2") |
| 73 | 73 | .filter(":even").addClass("row1").end() |
| 74 | 74 | .filter(rows + ":odd").addClass("row2"); |
| 75 | 75 | } |
| | 76 | var reinitDateTimeShortCuts = function() { |
| | 77 | // Reinitialize the calendar and clock widgets by force |
| | 78 | if (typeof DateTimeShortcuts != "undefined") { |
| | 79 | $(".datetimeshortcuts").remove(); |
| | 80 | DateTimeShortcuts.init(); |
| | 81 | } |
| | 82 | } |
| 76 | 83 | $(rows).formset({ |
| 77 | 84 | prefix: "{{ inline_admin_formset.formset.prefix }}", |
| 78 | 85 | addText: "{% blocktrans with inline_admin_formset.opts.verbose_name|title as verbose_name %}Add another {{ verbose_name }}{% endblocktrans %}", |
| … |
… |
|
| 81 | 88 | deleteText: "{% trans "Remove" %}", |
| 82 | 89 | emptyCssClass: "empty-form", |
| 83 | 90 | removed: alternatingRows, |
| 84 | | added: alternatingRows |
| | 91 | added: (function(row) { |
| | 92 | reinitDateTimeShortCuts(); |
| | 93 | alternatingRows(row); |
| | 94 | }) |
| 85 | 95 | }); |
| 86 | 96 | }); |
| 87 | 97 | })(jQuery.noConflict()); |