diff --git a/viewshare/apps/exhibit/static/dataset/js/models/editor/augmentation-support-issue.js b/viewshare/apps/exhibit/static/dataset/js/models/editor/augmentation-support-issue.js index 07804d94..0ae8e788 100644 --- a/viewshare/apps/exhibit/static/dataset/js/models/editor/augmentation-support-issue.js +++ b/viewshare/apps/exhibit/static/dataset/js/models/editor/augmentation-support-issue.js @@ -37,7 +37,7 @@ define(['jquery', 'observer'], function ($, Observer) { var xhr = $.ajax({ type: 'POST', url: '/support/issue/augmentation/', - data: JSON.stringify(this.toJSON()) + data: this.toJSON() }) .done(this.postAugmentationIssueSuccess.bind(this)) .fail(this.postAugmentationIssueError.bind(this)); @@ -73,7 +73,7 @@ define(['jquery', 'observer'], function ($, Observer) { jsonified.comments = this.comments; jsonified.label = this.label; jsonified.type = this.type; - jsonified.composite = this.composite; + jsonified.composite = this.composite.join(","); return jsonified; } }); diff --git a/viewshare/apps/support/views.py b/viewshare/apps/support/views.py index 8e61caed..6d4c7914 100644 --- a/viewshare/apps/support/views.py +++ b/viewshare/apps/support/views.py @@ -66,12 +66,7 @@ def get(self, request, *args, **kwargs): return render(request, self.create_template, {'form': form}) def post(self, request, *args, **kwargs): - try: - json_post = json.loads(request.body, - parse_float=Decimal) - except ValueError: - return HttpResponseBadRequest('Not a JSON document') - form = self.form_class(json_post) + form = self.form_class(request.POST) if form.is_valid(): return self.create_issue(request, form, *args, **kwargs) return render(request, self.create_template, {'form': form}) @@ -143,6 +138,7 @@ def generate_context(self, request, form, *args, **kwargs): new_slug = str(uuid.uuid4()) exhibit.pk = None exhibit.id = None + exhibit.parent = None exhibit.owner = support exhibit.slug = new_slug exhibit.save() @@ -167,8 +163,11 @@ def generate_context(self, request, form, *args, **kwargs): class DataLoadIssueView(SupportFormView): def generate_context(self, request, form, *args, **kwargs): - source_id = kwargs["source_id"] - source = get_object_or_404(DataSource, uuid=source_id) + owner = kwargs["owner"] + slug = kwargs["slug"] + source = get_object_or_404(DataSource, + exhibit__owner__username=owner, + exhibit__slug=slug) c = super(DataLoadIssueView, self).generate_context(request, form) return dict(c, **{"source": source}) diff --git a/viewshare/static/support/js/load.js b/viewshare/static/support/js/load.js index 2c79cd93..9d2ac672 100644 --- a/viewshare/static/support/js/load.js +++ b/viewshare/static/support/js/load.js @@ -7,65 +7,65 @@ function resetForm() { var dialog = $("div#support"); var form = $("form", dialog); - form.uniform(); var contact_visibility = function() { - if ($("#id_contact_type").val() == "email") { - $("#div_id_contact_phone").hide(); - $("#div_id_contact_email").show().effect("highlight"); - } else if ($("#id_contact_type").val() == "phone") { - $("#div_id_contact_email").hide(); - $("#div_id_contact_phone").show().effect("highlight"); + if (dialog.find("#id_contact_type").val() == "email") { + dialog.find("#div_id_contact_phone").hide(); + dialog.find("#div_id_contact_email").show(); + } else if (dialog.find("#id_contact_type").val() == "phone") { + dialog.find("#div_id_contact_email").hide(); + dialog.find("#div_id_contact_phone").show(); } }; var reason_visibility = function() { - if ($("#id_issue_reason").val() == "other") { - $("#div_id_issue_reason_text").show().effect("highlight"); + if (dialog.find("#id_issue_reason").val() == "other") { + dialog.find("#div_id_issue_reason_text").show(); } else { - $("#div_id_issue_reason_text").hide(); - $("#id_issue_reason_text").val(""); + dialog.find("#div_id_issue_reason_text").hide(); + dialog.find("#id_issue_reason_text").val(""); } }; var format_visibility = function() { - if ($("#id_file_format").val() == "other") { - $("#div_id_file_format_text").show().effect("highlight"); + if (dialog.find("#id_file_format").val() == "other") { + dialog.find("#div_id_file_format_text").show(); } else { - $("#div_id_file_format_text").hide(); - $("#id_file_format_text").val(""); + dialog.find("#div_id_file_format_text").hide(); + dialog.find("#id_file_format_text").val(""); } }; - $("#id_contact_type").change(function() { + dialog.find("#id_contact_type").change(function() { contact_visibility(); }); - $("#id_issue_reason").change(function() { + dialog.find("#id_issue_reason").change(function() { reason_visibility(); }); - $("#id_file_format").change(function() { + dialog.find("#id_file_format").change(function() { format_visibility(); }); form.ajaxForm({ success: function(responseText, statusText, xhr, $form) { - dialog.empty().append($(responseText).find("#issue_create_content")); + dialog.find("#issue_create_content").remove(); + dialog.append($(responseText).find("#issue_create_content")); resetForm(); - $("#support-spinner").hide(); - $("#support").show(); + dialog.find(".support-spinner").hide(); + form.show(); }, beforeSubmit: function(formData, jqForm, options) { - $("#support").hide(); - $("#support-spinner").show(); + form.hide(); + dialog.find(".support-spinner").show(); }, error: function() { var error = $("
{% blocktrans %}Thank you. A support ticket has been generated and sent to the {{SITE_NAME}} support team.{% endblocktrans %}
- +