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 = $("
").load("/support/issue/create_error", function() { $(".messages>li.error", $(this)).addClass("ui-corner-all").addClass("ui-state-error"); $(".messages>li", $(this)).prepend("  "); - $("#support-spinner").hide(); + dialog.find(".support-spinner").hide(); dialog.find(".messages").remove().end().prepend(this); $("#load-error").show(); @@ -96,11 +96,6 @@ }); - $("div#support .cancel-button").on('click', function() { - root.hide(); - $("#load-error").fadeIn(); - }); - $("div#support .ticket-created").on('click', function() { root.hide(); $("#load-error").fadeIn(); diff --git a/viewshare/templates/support/issue_response.html b/viewshare/templates/support/issue_response.html index e8281c09..6a9bd280 100644 --- a/viewshare/templates/support/issue_response.html +++ b/viewshare/templates/support/issue_response.html @@ -3,9 +3,15 @@ {% block body %}
-

{% trans "Ticket Created" %}

+ + +
{% endblock %} diff --git a/viewshare/templates/support/upload_issue.html b/viewshare/templates/support/upload_issue.html index 19efc8e6..cc62ab05 100644 --- a/viewshare/templates/support/upload_issue.html +++ b/viewshare/templates/support/upload_issue.html @@ -3,17 +3,30 @@ {% load crispy_forms_tags %} {% block body %} -
-

{% trans "Report a Data Loading Problem" %}

-
+
+ + + + + -
+ +
+
+

{% blocktrans %}Requesting ticket, please be patient.{% endblocktrans %}

+
+
{% endblock %} diff --git a/viewshare/templates/upload/datasource_form.html b/viewshare/templates/upload/datasource_form.html index d2cfe583..b5c8202c 100644 --- a/viewshare/templates/upload/datasource_form.html +++ b/viewshare/templates/upload/datasource_form.html @@ -41,7 +41,7 @@
{% block format_error %}{% endblock %}
-
{% trans "If you have a file that you think should work after troubleshooting please Click here to create a support ticket." %}
+
{% trans "If you have a file that you think should work after troubleshooting please Click here to create a support ticket." %}
@@ -54,23 +54,20 @@
-
- -
+
+ {%csrf_token %} {{ form|crispy }}
-
- - -
+
+ + +
- - - -
+ +
@@ -78,11 +75,7 @@ {% if show_error %} -
-
-
-

{% blocktrans %}Requesting ticket, please be patient.{% endblocktrans %}

-
+ {% endif %} {% endblock %}