diff --git a/TEKDB/TEKDB/admin.py b/TEKDB/TEKDB/admin.py index 0f88970b..97ed754e 100644 --- a/TEKDB/TEKDB/admin.py +++ b/TEKDB/TEKDB/admin.py @@ -185,6 +185,7 @@ class Meta: } fields = '__all__' + class ResourcesMediaEventsForm(forms.ModelForm): class Meta: model = ResourcesMediaEvents @@ -194,6 +195,7 @@ class Meta: 'relationshipdescription': CKEditorWidget } fields = '__all__' + class PlaceAltIndigenousNameForm(forms.ModelForm): class Meta: @@ -556,7 +558,7 @@ class MediaAdmin(RecordAdminProxy, RecordModelAdmin): 'enteredbyname','enteredbydate') fieldsets = ( (None, { - 'fields': (('medianame','mediatype','limitedaccess'),'mediafile','medialink','mediadescription',) + 'fields': (('medianame','mediatype','limitedaccess'),'mediafile','medialink','mediadescription','mediabulkupload',) }), ('Review', { 'fields': ( @@ -808,7 +810,7 @@ class PlacesMediaEventsAdmin(RecordAdminProxy): }) ) form = PlacesMediaEventsForm - + class PlaceAltIndigenousNameAdmin(VersionAdmin): fieldsets = ( ('', { @@ -861,7 +863,7 @@ class ResourceActivityCitationEventsAdmin(RecordAdminProxy): }) ) form = ResourceActivityCitationEventsForm - + class ResourceActivityMediaEventsAdmin(RecordAdminProxy): list_display = ('resourceactivityid','mediaid','enteredbyname','enteredbydate','modifiedbyname','modifiedbydate') fieldsets = ( diff --git a/TEKDB/TEKDB/static/TEKDB/js/record_form.js b/TEKDB/TEKDB/static/TEKDB/js/record_form.js index 4115aa19..7ad7bba2 100644 --- a/TEKDB/TEKDB/static/TEKDB/js/record_form.js +++ b/TEKDB/TEKDB/static/TEKDB/js/record_form.js @@ -72,21 +72,27 @@ loadFormModal = function(module, model, id, action, base_model, base_id, fk_fiel } html +='/?_popup=1">'; $('#form-modal-body').html(html); - $('#popup-iframe-form').load(function(){ + $('#popup-iframe-form').on('load', function() { if (action != 'delete') { - if (action == 'add') { - $('#popup-iframe-form').contents().find('#id_' + fk_field_id).parent().replaceWith(''); - } - // If below only shown for 'add', users could move relationships to new records - // For now I'm not sure this feature is intuitive or desired. - $('#popup-iframe-form').contents().find('#id_' + fk_field_id).hide(); - $('#popup-iframe-form').contents().find('.field-box.field-' + fk_field_id).hide(); - all_buttons = $('#popup-iframe-form').contents().find('.submit-row input'); + if (action == 'add') { + $('#popup-iframe-form').contents().find('#id_' + fk_field_id).parent().replaceWith(''); + } + $('#popup-iframe-form').contents().find('#id_' + fk_field_id).hide(); + $('#popup-iframe-form').contents().find('.field-box.field-' + fk_field_id).hide(); + $('#popup-iframe-form').contents().find('label[for="id_' + fk_field_id + '"]').hide(); + all_buttons = $('#popup-iframe-form').contents().find('.submit-row input'); } else { - all_buttons = $('#popup-iframe-form').contents().find('form div').children(':not([type="hidden"])'); + all_buttons = $('#popup-iframe-form').contents().find('form div').children(':not([type="hidden"])'); } all_buttons.attr('data-toggle', 'modal'); all_buttons.attr('data-target', '#inlineFormModal'); - all_buttons.on('click', function(){iframeButtonClicked(base_model, base_id);}); + all_buttons.on('click', function() { iframeButtonClicked(base_model, base_id); }); }); } + +window.addEventListener('message', function(event) { + // Check for the specific action you expect + if (event.data.action === 'closeAndRefresh') { + window.location.reload(); // Refresh the parent page + } +}); \ No newline at end of file