Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #507: Adding resources from multiple pages in the library now works #517

Merged
merged 1 commit into from
Aug 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions cadasta/templates/party/relationship_detail.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
{% extends "spatial/location_wrapper.html" %}
{% load i18n %}

{% block form_script %}
{{ form.media }}
{% include "resources/scripts.html" %}
{% endblock %}

{% block location_panel %}

<div class="col-md-4 detail">
Expand Down
4 changes: 4 additions & 0 deletions cadasta/templates/party/relationship_resources_add.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

{% block page_title %}Add new resource for relationship | {% endblock %}

{% block location_extra_script %}
{% include 'resources/script_add_lib.html' %}
{% endblock %}

{% block modals %}
{% url 'parties:relationship_detail' object.organization.slug object.slug relationship.id as cancel_url %}
{% url 'parties:relationship_resource_new' object.organization.slug object.slug relationship.id as upload_url %}
Expand Down
4 changes: 2 additions & 2 deletions cadasta/templates/party/relationship_resources_new.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

{% block page_title %}Upload new resource for relationship | {% endblock %}

{% block extra_script %}
{% block location_extra_script %}
{{ form.media }}
{% include "resources/scripts.html" %}
{% include "resources/script_upload.html" %}
{% endblock %}

{% block modals %}
Expand Down
5 changes: 4 additions & 1 deletion cadasta/templates/party/resources_add.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@

{% block page_title %}Add new resource for party | {% endblock %}

{% block extra_script %}
{% include 'resources/script_add_lib.html' %}
{% endblock %}

{% block modals %}
{% url 'parties:detail' object.organization.slug object.slug party.id as cancel_url %}
{% url 'parties:resource_new' object.organization.slug object.slug party.id as upload_url %}
{% include 'resources/modal_add_lib.html' %}
{% endblock %}

2 changes: 1 addition & 1 deletion cadasta/templates/party/resources_new.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

{% block extra_script %}
{{ form.media }}
{% include "resources/scripts.html" %}
{% include "resources/script_upload.html" %}
{% endblock %}

{% block modals %}
Expand Down
2 changes: 1 addition & 1 deletion cadasta/templates/resources/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

{% block extra_script %}
{{ form.media }}
{% include "resources/scripts.html" %}
{% include "resources/script_upload.html" %}
{% endblock %}

{% block content %}
Expand Down
4 changes: 4 additions & 0 deletions cadasta/templates/resources/project_add_existing.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

{% block page_title %}Add new resource for project | {% endblock %}

{% block extra_script %}
{% include 'resources/script_add_lib.html' %}
{% endblock %}

{% block modals %}
{% url 'resources:project_list' object.organization.slug object.slug as cancel_url %}
{% url 'resources:project_add_new' object.organization.slug object.slug as upload_url %}
Expand Down
2 changes: 1 addition & 1 deletion cadasta/templates/resources/project_add_new.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

{% block extra_script %}
{{ form.media }}
{% include "resources/scripts.html" %}
{% include "resources/script_upload.html" %}
{% endblock %}

{% block modals %}
Expand Down
17 changes: 17 additions & 0 deletions cadasta/templates/resources/script_add_lib.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<script>
'use strict';
$(function() {
var form = $('.modal form');
form.submit(function() {
var cells = $('.modal .datatable').DataTable().column().nodes();
for (var i = 0; i < cells.length; i++) {
var checkbox = cells[i].childNodes[0];
if (checkbox.checked) {
checkbox.checked = false;
form.append('<input type="hidden" name="' + checkbox.name + '" value="on" />');
}
}
return true;
});
});
</script>
2 changes: 1 addition & 1 deletion cadasta/templates/spatial/location_wrapper.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
$('a[href=' + anchor + ']').tab('show');
});
</script>
{% block form_script %}{% endblock %}
{% block location_extra_script %}{% endblock %}
{% endblock %}

{% block content %}
Expand Down
2 changes: 1 addition & 1 deletion cadasta/templates/spatial/relationship_add.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{% block page_title %}Add new relationship | {% endblock %}

{% block form_script %}
{% block location_extra_script %}
{{ form.media }}
{% endblock %}

Expand Down
6 changes: 5 additions & 1 deletion cadasta/templates/spatial/resources_add.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{% extends "spatial/location_wrapper.html" %}
{% extends "spatial/location_detail.html" %}
{% load i18n %}

{% block page_title %}Add new resource for location | {% endblock %}

{% block location_extra_script %}
{% include 'resources/script_add_lib.html' %}
{% endblock %}

{% block modals %}
{% url 'locations:detail' object.organization.slug object.slug location.id as cancel_url %}
{% url 'locations:resource_new' object.organization.slug object.slug location.id as upload_url %}
Expand Down
6 changes: 3 additions & 3 deletions cadasta/templates/spatial/resources_new.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{% extends "spatial/location_wrapper.html" %}
{% extends "spatial/location_detail.html" %}
{% load i18n %}

{% block page_title %}Upload new resource for location | {% endblock %}

{% block extra_script %}
{% block location_extra_script %}
{{ form.media }}
{% include "resources/scripts.html" %}
{% include "resources/script_upload.html" %}
{% endblock %}

{% block modals %}
Expand Down