Commit 7323f313 by Simon Chen

Update the copy for the Publisher course cover image upload

Both the instruction copy and the error feedback copy are changed to better help user understand the image restrictions
EDUCATOR-1954
parent acd2df74
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-12-19 18:41
from __future__ import unicode_literals
import sortedm2m.fields
import stdimage.models
from django.db import migrations
import course_discovery.apps.course_metadata.utils
class Migration(migrations.Migration):
dependencies = [
('course_metadata', '0075_auto_20171211_1922'),
]
operations = [
migrations.AlterField(
model_name='course',
name='image',
field=stdimage.models.StdImageField(blank=True, help_text='Add the course image', null=True, upload_to=course_discovery.apps.course_metadata.utils.UploadToFieldNamePath('uuid', path='media/course/image')),
),
migrations.AlterField(
model_name='program',
name='instructor_ordering',
field=sortedm2m.fields.SortedManyToManyField(blank=True, help_text='This field can be used by API clients to determine the order in which instructors will be displayed on program pages. Instructors in this list should appear before all others associated with this programs courses runs.', to='course_metadata.Person'),
),
]
......@@ -354,7 +354,7 @@ class Course(TimeStampedModel):
'original': (2120, 1192),
'small': (318, 178)
},
help_text=_('Please provide a course preview image')
help_text=_('Add the course image')
)
slug = AutoSlugField(populate_from='key', editable=True)
video = models.ForeignKey(Video, default=None, null=True, blank=True)
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-12-19 18:41
from __future__ import unicode_literals
import stdimage.models
from django.db import migrations, models
import course_discovery.apps.course_metadata.utils
import course_discovery.apps.publisher.validators
class Migration(migrations.Migration):
dependencies = [
('publisher', '0062_auto_20171212_2016'),
]
operations = [
migrations.AlterField(
model_name='course',
name='image',
field=stdimage.models.StdImageField(blank=True, null=True, upload_to=course_discovery.apps.course_metadata.utils.UploadToFieldNamePath('number', path='media/publisher/courses/images'), validators=[course_discovery.apps.publisher.validators.ImageMultiSizeValidator([(2120, 1192), (378, 225)], preferred_size=(1134, 675))]),
),
migrations.AlterField(
model_name='historicalcourse',
name='image',
field=models.TextField(blank=True, max_length=100, null=True, validators=[course_discovery.apps.publisher.validators.ImageMultiSizeValidator([(2120, 1192), (378, 225)], preferred_size=(1134, 675))]),
),
]
......@@ -77,7 +77,7 @@ class Course(TimeStampedModel, ChangedByMixin):
),
blank=True,
null=True,
validators=[ImageMultiSizeValidator([(2120, 1192), (1134, 675), (378, 225)])]
validators=[ImageMultiSizeValidator([(2120, 1192), (378, 225)], preferred_size=(1134, 675))]
)
is_seo_review = models.BooleanField(default=False)
......
......@@ -340,7 +340,12 @@
<br/>
<strong>{% trans "Course Image Guidelines:" %}</strong>
<ul>
<li>{% trans "The image size must be of size 1134 X 675 pixels." %}</li>
<li>
{% trans "New course images must be 1134 X 675 pixels in size. " %}
<a href='http://edx.readthedocs.io/projects/edx-partner-course-staff/en/latest/set_up_course/planning_course_information/image_guidelines.html#course-image-size'>
{% trans "Learn more." %}
</a>
</li>
<li>{% trans "Each course in a sequence must have a unique image." %}</li>
<li>{% trans "The image cannot include text or headlines." %}</li>
<li>{% trans "You must have permission to use the image. Possible image sources include Flickr creative commons, Stock Vault, Stock XCHNG, and iStock Photo." %}</li>
......
......@@ -152,9 +152,9 @@ class CreateCourseViewTests(SiteMixin, TestCase):
Verify that a new course with an invalid image shows the proper error.
"""
image_error = [
'The image you uploaded is of incorrect resolution. ' +
'Course image files must be in one of the following sizes in pixels: ' +
'(2120 X 1192), (1134 X 675), (378 X 225)',
'Invalid image size. The recommended image size is 1134 X 675 pixels. ' +
'Older courses also support image sizes of ' +
'2120 X 1192 px or 378 X 225 px.',
]
self.user.groups.add(Group.objects.get(name=ADMIN_GROUP_NAME))
self._assert_records(1)
......
......@@ -25,29 +25,35 @@ class ImageMultiSizeValidator(ImageSizeValidator):
ImageField Size validator that takes in a list of sizes to validate
Will pass validation if the image is of one of the specified size
"""
def __init__(self, limit_sizes): # pylint: disable=super-init-not-called
self.limit_value = limit_sizes
def __init__(self, supported_sizes, **kwargs): # pylint: disable=super-init-not-called
self.supported_sizes = supported_sizes
self.preferred_size = kwargs.get('preferred_size')
if not self.preferred_size:
self.preferred_size = self.supported_sizes.pop()
def __call__(self, value):
cleaned = self.clean(value)
validated = False
for limit_size in self.limit_value:
limit_sizes = [self.preferred_size]
limit_sizes.extend(self.supported_sizes)
for limit_size in limit_sizes:
if not self.compare(cleaned, limit_size):
validated = True
if not validated:
size_message_array = []
for limit_size in self.limit_value:
size_message_array.append(
'({} X {})'.format(limit_size[0], limit_size[1])
supported_sizes_message_array = []
for size in self.supported_sizes:
supported_sizes_message_array.append(
'{} X {} px'.format(size[0], size[1])
)
params = {
'sizes': ', '.join(size_message_array)
'preferred': '{} X {} pixels'.format(self.preferred_size[0], self.preferred_size[1]),
'supported': ' or '.join(supported_sizes_message_array)
}
raise ValidationError(self.message, code=self.code, params=params)
message = _(
'The image you uploaded is of incorrect resolution. '
'Course image files must be in one of the following sizes in pixels: %(sizes)s'
'Invalid image size. The recommended image size is %(preferred)s. '
'Older courses also support image sizes of %(supported)s.'
)
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-13 16:39+0000\n"
"POT-Creation-Date: 2017-12-20 20:28+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -326,7 +326,7 @@ msgid "People"
msgstr ""
#: apps/course_metadata/models.py
msgid "Please provide a course preview image"
msgid "Add the course image"
msgstr ""
#: apps/course_metadata/models.py
......@@ -1788,7 +1788,11 @@ msgid "Course Image Guidelines:"
msgstr ""
#: apps/publisher/templates/publisher/course_edit_form.html
msgid "The image size must be of size 1134 X 675 pixels."
msgid "New course images must be 1134 X 675 pixels in size. "
msgstr ""
#: apps/publisher/templates/publisher/course_edit_form.html
msgid "Learn more."
msgstr ""
#: apps/publisher/templates/publisher/course_edit_form.html
......@@ -3220,8 +3224,8 @@ msgstr ""
#: apps/publisher/validators.py
#, python-format
msgid ""
"The image you uploaded is of incorrect resolution. Course image files must "
"be in one of the following sizes in pixels: %(sizes)s"
"Invalid image size. The recommended image size is %(preferred)s. Older "
"courses also support image sizes of %(supported)s."
msgstr ""
#: apps/publisher/validators.py
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-13 16:39+0000\n"
"POT-Creation-Date: 2017-12-20 20:28+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-13 16:37+0000\n"
"POT-Creation-Date: 2017-12-20 20:28+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -393,10 +393,8 @@ msgid "People"
msgstr "Péöplé Ⱡ'σяєм ιρѕυ#"
#: apps/course_metadata/models.py
msgid "Please provide a course preview image"
msgstr ""
"Pléäsé prövïdé ä çöürsé prévïéw ïmägé Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, "
"¢σηѕє¢тєтυ#"
msgid "Add the course image"
msgstr "Àdd thé çöürsé ïmägé Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, #"
#: apps/course_metadata/models.py
msgid "Course number format e.g CS002x, BIO1.1x, BIO1.2x"
......@@ -2115,10 +2113,14 @@ msgid "Course Image Guidelines:"
msgstr "Çöürsé Ìmägé Güïdélïnés: Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢ση#"
#: apps/publisher/templates/publisher/course_edit_form.html
msgid "The image size must be of size 1134 X 675 pixels."
msgid "New course images must be 1134 X 675 pixels in size. "
msgstr ""
"Thé ïmägé sïzé müst ßé öf sïzé 1134 X 675 pïxéls. Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт "
"αмєт, ¢σηѕє¢тєтυя α#"
"Néw çöürsé ïmägés müst ßé 1134 X 675 pïxéls ïn sïzé. Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт"
" αмєт, ¢σηѕє¢тєтυя α#"
#: apps/publisher/templates/publisher/course_edit_form.html
msgid "Learn more."
msgstr "Léärn möré. Ⱡ'σяєм ιρѕυм ∂σłσя #"
#: apps/publisher/templates/publisher/course_edit_form.html
msgid "Each course in a sequence must have a unique image."
......@@ -3910,11 +3912,12 @@ msgstr ""
#: apps/publisher/validators.py
#, python-format
msgid ""
"The image you uploaded is of incorrect resolution. Course image files must "
"be in one of the following sizes in pixels: %(sizes)s"
"Invalid image size. The recommended image size is %(preferred)s. Older "
"courses also support image sizes of %(supported)s."
msgstr ""
"Thé ïmägé ýöü üplöädéd ïs öf ïnçörréçt résölütïön. Çöürsé ïmägé fïlés müst "
"ßé ïn öné öf thé föllöwïng sïzés ïn pïxéls: %(sizes)s Ⱡ'σяєм ιρѕ#"
"Ìnvälïd ïmägé sïzé. Thé réçömméndéd ïmägé sïzé ïs %(preferred)s. Öldér "
"çöürsés älsö süppört ïmägé sïzés öf %(supported)s. Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт "
"αмє#"
#: apps/publisher/validators.py
#, python-brace-format
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-13 16:37+0000\n"
"POT-Creation-Date: 2017-12-20 20:28+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment