diff --git a/wagtail/wagtailimages/admin_urls.py b/wagtail/wagtailimages/admin_urls.py
index 1d04bcbfe..44bc61224 100644
--- a/wagtail/wagtailimages/admin_urls.py
+++ b/wagtail/wagtailimages/admin_urls.py
@@ -1,6 +1,6 @@
from django.conf.urls import url
-from wagtail.wagtailimages.views import images, chooser, multiple, focal_point_chooser
+from wagtail.wagtailimages.views import images, chooser, multiple
urlpatterns = [
@@ -20,6 +20,4 @@ urlpatterns = [
url(r'^chooser/(\d+)/$', chooser.image_chosen, name='wagtailimages_image_chosen'),
url(r'^chooser/upload/$', chooser.chooser_upload, name='wagtailimages_chooser_upload'),
url(r'^chooser/(\d+)/select_format/$', chooser.chooser_select_format, name='wagtailimages_chooser_select_format'),
-
- url(r'focal_point_chooser/(\d+)/$', focal_point_chooser.chooser, name='wagtailimages_focal_point_chooser')
]
diff --git a/wagtail/wagtailimages/static/wagtailimages/js/add-multiple.js b/wagtail/wagtailimages/static/wagtailimages/js/add-multiple.js
index ce6d355fa..05c72feb4 100644
--- a/wagtail/wagtailimages/static/wagtailimages/js/add-multiple.js
+++ b/wagtail/wagtailimages/static/wagtailimages/js/add-multiple.js
@@ -97,10 +97,6 @@ $(function(){
// run tagit enhancement
$('.tag_field input', itemElement).tagit(window.tagit_opts);
-
- $('.focal-point-chooser', itemElement).each(function() {
- createFocalPointCooser($(this));
- });
} else {
itemElement.addClass('upload-failure');
$('.right .error_messages', itemElement).append(response.error_message);
diff --git a/wagtail/wagtailimages/static/wagtailimages/js/focal-point-chooser.js b/wagtail/wagtailimages/static/wagtailimages/js/focal-point-chooser.js
index 6d0f385db..60cc8871c 100644
--- a/wagtail/wagtailimages/static/wagtailimages/js/focal-point-chooser.js
+++ b/wagtail/wagtailimages/static/wagtailimages/js/focal-point-chooser.js
@@ -1,52 +1,5 @@
-function createFocalPointCooser($chooser) {
- var $chosenText = $('.chosen-text', $chooser);
- var $focalPointX = $('input.focal_point_x', $chooser);
- var $focalPointY = $('input.focal_point_y', $chooser);
- var $focalPointWidth = $('input.focal_point_width', $chooser);
- var $focalPointHeight = $('input.focal_point_height', $chooser);
- var chooserUrl = $chooser.data('chooserUrl');
-
- $('.action-choose', $chooser).click(function() {
- if (!$chooser.hasClass('blank')) {
- window.focalPointChooserInitial = {
- x: $focalPointX.val(),
- y: $focalPointY.val(),
- w: $focalPointWidth.val(),
- h: $focalPointHeight.val(),
- }
- } else {
- window.focalPointChooserInitial = undefined;
- }
-
- ModalWorkflow({
- 'url': chooserUrl,
- 'responses': {
- 'focalPointChosen': function(focalPointData) {
- $focalPointX.val(focalPointData.x);
- $focalPointY.val(focalPointData.y);
- $focalPointWidth.val(focalPointData.w);
- $focalPointHeight.val(focalPointData.h);
-
- $chosenText.text(focalPointData.x + ", " + focalPointData.y + " " + focalPointData.w + "x" + focalPointData.h);
-
- $chooser.removeClass('blank');
- }
- }
- });
- });
-
- $('.action-clear', $chooser).click(function() {
- $focalPointX.val('');
- $focalPointY.val('');
- $focalPointWidth.val('');
- $focalPointHeight.val('');
-
- $chooser.addClass('blank');
- });
-}
-
$(function() {
- $('.focal-point-chooser').each(function() {
- createFocalPointCooser($(this));
+ $('img.focal-point-chooser').each(function() {
+
});
});
diff --git a/wagtail/wagtailimages/templates/wagtailimages/focal_point_chooser/chooser.html b/wagtail/wagtailimages/templates/wagtailimages/focal_point_chooser/chooser.html
deleted file mode 100644
index aced6b6b8..000000000
--- a/wagtail/wagtailimages/templates/wagtailimages/focal_point_chooser/chooser.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% load wagtailimages_tags i18n %}
-
-{% trans "Choose focal point" as title_str %}
-{% include "wagtailadmin/shared/header.html" with title=title_str %}
-
-
-
- {% image image max-800x600 %}
-
-
Done
-
\ No newline at end of file
diff --git a/wagtail/wagtailimages/templates/wagtailimages/focal_point_chooser/chooser.js b/wagtail/wagtailimages/templates/wagtailimages/focal_point_chooser/chooser.js
deleted file mode 100644
index a01807b14..000000000
--- a/wagtail/wagtailimages/templates/wagtailimages/focal_point_chooser/chooser.js
+++ /dev/null
@@ -1,67 +0,0 @@
-function(modal) {
- var jcapi;
-
- function ajaxifyLinks (context) {
- $('.listing a', context).click(function() {
- modal.loadUrl(this.href);
- return false;
- });
-
- $('.pagination a', context).click(function() {
- var page = this.getAttribute("data-page");
- setPage(page);
- return false;
- });
- }
-
- ajaxifyLinks(modal.body);
-
- // Find image element
- var $image = $('.focal-point-chooser-image img');
-
- // Switch on Jcrop
- $image.Jcrop({}, function() {
- jcapi = this;
- });
-
- // Set initial select box
- if (window.focalPointChooserInitial) {
- var scaleX = {{ image.width }} / $image.width();
- var scaleY = {{ image.height }} / $image.height();
-
- var x = window.focalPointChooserInitial.x / scaleX;
- var y = window.focalPointChooserInitial.y / scaleY;
- var w = window.focalPointChooserInitial.w / scaleX;
- var h = window.focalPointChooserInitial.h / scaleY;
-
- jcapi.setSelect([
- x - w / 2,
- y - h / 2,
- x + w / 2,
- y + h / 2,
- ]);
- }
-
- $('a.choose-focal-point', modal.body).click(function() {
- var selectBox = jcapi.tellSelect();
- var scaleX = {{ image.width }} / $image.width();
- var scaleY = {{ image.height }} / $image.height();
-
- modal.respond('focalPointChosen', {
- x: Math.floor(scaleX * (selectBox.x + selectBox.x2) / 2),
- y: Math.floor(scaleY * (selectBox.y + selectBox.y2) / 2),
- w: Math.floor(scaleX * selectBox.w),
- h: Math.floor(scaleY * selectBox.h),
- });
-
- modal.close();
-
- return false;
- });
-
- $('#id_q').on('input', function() {
- clearTimeout($.data(this, 'timer'));
- var wait = setTimeout(search, 200);
- $(this).data('timer', wait);
- });
-}
\ No newline at end of file
diff --git a/wagtail/wagtailimages/templates/wagtailimages/images/_focal_point_chooser.html b/wagtail/wagtailimages/templates/wagtailimages/images/_focal_point_chooser.html
deleted file mode 100644
index 797444947..000000000
--- a/wagtail/wagtailimages/templates/wagtailimages/images/_focal_point_chooser.html
+++ /dev/null
@@ -1,41 +0,0 @@
-{% load wagtailadmin_tags i18n %}
-
-
-
-
-
-
-
-
- {% if field.errors %}
-
- Invalid input
-
- {% endif %}
-
-
diff --git a/wagtail/wagtailimages/templates/wagtailimages/images/edit.html b/wagtail/wagtailimages/templates/wagtailimages/images/edit.html
index 1a91959fb..53d708afb 100644
--- a/wagtail/wagtailimages/templates/wagtailimages/images/edit.html
+++ b/wagtail/wagtailimages/templates/wagtailimages/images/edit.html
@@ -15,7 +15,6 @@
-
{% endblock %}
@@ -33,10 +32,6 @@
{% if field.name == 'file' %}
{% include "wagtailimages/images/_file_field.html" %}
- {% elif field.name == 'focal_point_x' %}
- {% include "wagtailimages/images/_focal_point_chooser.html" %}
- {% elif field.name == 'focal_point_y' or field.name == 'focal_point_width' or field.name == 'focal_point_height' %}
- {# These fields are included in the focal point chooser above #}
{% elif field.is_hidden %}
{{ field }}
{% else %}
@@ -49,7 +44,7 @@
- {% image image max-800x600 %}
+ {% image image max-800x600 class="focal-point-chooser" %}
{% if url_generator_enabled %}
URL Generator
diff --git a/wagtail/wagtailimages/templates/wagtailimages/multiple/add.html b/wagtail/wagtailimages/templates/wagtailimages/multiple/add.html
index 426ef04fe..066650d83 100644
--- a/wagtail/wagtailimages/templates/wagtailimages/multiple/add.html
+++ b/wagtail/wagtailimages/templates/wagtailimages/multiple/add.html
@@ -7,9 +7,6 @@
{% endcompress %}
{% include "wagtailadmin/shared/tag_field_css.html" %}
-
-
-
{% endblock %}
{% block content %}
@@ -66,11 +63,6 @@
-
-
-
-
-
{% endcompress %}
diff --git a/wagtail/wagtailimages/templates/wagtailimages/multiple/edit_form.html b/wagtail/wagtailimages/templates/wagtailimages/multiple/edit_form.html
index a07fc0d9e..eb39a1bdd 100644
--- a/wagtail/wagtailimages/templates/wagtailimages/multiple/edit_form.html
+++ b/wagtail/wagtailimages/templates/wagtailimages/multiple/edit_form.html
@@ -4,11 +4,7 @@
{% csrf_token %}
{% for field in form %}
- {% if field.name == 'focal_point_x' %}
- {% include "wagtailimages/images/_focal_point_chooser.html" %}
- {% elif field.name == 'focal_point_y' or field.name == 'focal_point_width' or field.name == 'focal_point_height' %}
- {# These fields are included in the focal point chooser above #}
- {% elif field.is_hidden %}
+ {% if field.is_hidden %}
{{ field }}
{% else %}
{% include "wagtailadmin/shared/field_as_li.html" %}
diff --git a/wagtail/wagtailimages/tests.py b/wagtail/wagtailimages/tests.py
index 0142b78e3..85c4f957b 100644
--- a/wagtail/wagtailimages/tests.py
+++ b/wagtail/wagtailimages/tests.py
@@ -1036,54 +1036,3 @@ class TestIssue573(TestCase):
# Try creating a rendition from that image
# This would crash if the bug is present
image.get_rendition('fill-800x600')
-
-
-class TestFocalPointChooserView(TestCase, WagtailTestUtils):
- def setUp(self):
- # Create an image for running tests on
- self.image = Image.objects.create(
- title="Test image",
- file=get_test_image_file(),
- )
-
- # Login
- self.user = self.login()
-
- def test_get(self):
- """
- This tests that the view responds correctly for a user with edit permissions on this image
- """
- # Get
- response = self.client.get(reverse('wagtailimages_focal_point_chooser', args=(self.image.id, )))
-
- # Check response
- self.assertEqual(response.status_code, 200)
- self.assertTemplateUsed(response, 'wagtailimages/focal_point_chooser/chooser.html')
- self.assertTemplateUsed(response, 'wagtailimages/focal_point_chooser/chooser.js')
-
- def test_get_bad_permissions(self):
- """
- This tests that the view gives a 403 if a user without correct permissions attempts to access it
- """
- # Remove privileges from user
- self.user.is_superuser = False
- self.user.user_permissions.add(
- Permission.objects.get(content_type__app_label='wagtailadmin', codename='access_admin')
- )
- self.user.save()
-
- # Get
- response = self.client.get(reverse('wagtailimages_focal_point_chooser', args=(self.image.id, )))
-
- # Check response
- self.assertEqual(response.status_code, 403)
-
- def test_get_bad_image(self):
- """
- This tests that the view gives a 404 if the image doesn't exist
- """
- # Get
- response = self.client.get(reverse('wagtailimages_focal_point_chooser', args=(9999, )))
-
- # Check response
- self.assertEqual(response.status_code, 404)
diff --git a/wagtail/wagtailimages/views/focal_point_chooser.py b/wagtail/wagtailimages/views/focal_point_chooser.py
deleted file mode 100644
index 439c9ca8b..000000000
--- a/wagtail/wagtailimages/views/focal_point_chooser.py
+++ /dev/null
@@ -1,18 +0,0 @@
-from django.shortcuts import get_object_or_404
-from django.contrib.auth.decorators import permission_required
-from django.core.exceptions import PermissionDenied
-
-from wagtail.wagtailadmin.modal_workflow import render_modal_workflow
-from wagtail.wagtailimages.models import get_image_model
-
-
-@permission_required('wagtailadmin.access_admin')
-def chooser(request, image_id):
- image = get_object_or_404(get_image_model(), id=image_id)
-
- if not image.is_editable_by_user(request.user):
- raise PermissionDenied
-
- return render_modal_workflow(request, 'wagtailimages/focal_point_chooser/chooser.html', 'wagtailimages/focal_point_chooser/chooser.js', {
- 'image': image,
- })