diff --git a/docs/api/topics/comm.rst b/docs/api/topics/comm.rst index 3740db4f3ab..d7d67fdad45 100644 --- a/docs/api/topics/comm.rst +++ b/docs/api/topics/comm.rst @@ -113,7 +113,7 @@ Thread "id": 5, "name": "Test App (kinkajou3969)", "review_url": "/reviewers/apps/review/test-app-kinkajou3969/", - "thumbnail_url": "/media/img/icons/no-preview.png", + "thumbnail_url": "/tmp/uploads/previews/thumbs/0/37.png?modified=1362762723", "url": "/app/test-app-kinkajou3969/" }, "created": "2013-06-14T11:54:24", diff --git a/lib/utils.py b/lib/utils.py index e9ac197677e..d30f078f872 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -57,12 +57,13 @@ def static_url(url): If the URL starts with https:// or http://, then no changes are made. """ prefix = { - 'ADDON_ICONS_DEFAULT_URL': settings.MEDIA_URL, + 'ICONS_DEFAULT_URL': settings.MEDIA_URL, 'ADDON_ICON_URL': settings.STATIC_URL, 'PREVIEW_THUMBNAIL_URL': settings.STATIC_URL, 'PREVIEW_FULL_URL': settings.STATIC_URL, 'PRODUCT_ICON_URL': settings.MEDIA_URL, - 'WEBAPPS_RECEIPT_URL': settings.SITE_URL + 'WEBAPPS_RECEIPT_URL': settings.SITE_URL, + 'WEBSITE_ICON_URL': settings.STATIC_URL, } value = getattr(settings, url) diff --git a/media/css/devreg/landing.styl b/media/css/devreg/landing.styl deleted file mode 100644 index a125ef637ee..00000000000 --- a/media/css/devreg/landing.styl +++ /dev/null @@ -1,118 +0,0 @@ -@import 'lib'; - -#phases { - background-color: #FAF2BD; - border-radius: 7px; - box-shadow: 1px 1px 1px #E1D58C inset, -1px -1px 0 #FFFFFF inset; - margin-bottom: 2em; - overflow: hidden; - padding: 1.2em; - - h2 { - color: #6E6D6D; - font-size: 1.8em; - font-weight: bold; - margin: 0; - text-shadow: 1px 1px 0 #FFFFFF; - border-bottom: 1px solid #D9D9B2; - padding: 0 0 0.3em; - - strong { - color: darken($red, 10%); - } - } - - p { - margin-top: 1em; - color: #707070; - line-height: 1.3em; - } - - .phase-desc { - float: left; - width: 35%; - } - - #timeline { - width: 65%; - margin-top: 1.5em; - overflow: hidden; - float: left; - - > div { - width: 25%; - position: relative; - float: left; - color: #787144; - text-align: center; - font-size: .9em; - text-shadow: 1px 1px 0 #fff; - - span { - font-size: .9em; - opacity: .7; - display: block; - padding-top: 5px; - } - - &:before, &:after { - content: " "; - display: block; - float: left; - height: 14px; - position: absolute; - top: 8px; - width: 50%; - background-image: url(../../img/hub/phase.png); - } - &:before { - left: 0; - } - &:after { - right: 0; - } - } - .bubble { - background-image: url(../../img/hub/phase.png); - background-repeat: repeat-x; - margin: auto; - position: relative; - z-index: 10; - padding-bottom: 1em; - } - #bubble1 { - .bubble { - height: 30px; - width: 28px; - } - &:before { background: none; } - &:after { background-position: 0 -51px; } - } - #bubble2 { - .bubble { - height: 30px; - width: 27px; - background-position: -28px 0; - } - &:before { background-position: 0 -51px; } - &:after { background-position: 0 -85px; } - } - #bubble3 { - .bubble { - height: 30px; - width: 27px; - background-position: -54px 0; - } - &:before, &:after { background-position: 0 -85px; } - } - #bubble4 { - .bubble { - height: 30px; - width: 27px; - background-position: -80px 0; - } - &:before { background-position: 0 -85px; } - &:after { background: none; } - } - } -} diff --git a/media/img/hub/assetback.png b/media/img/hub/assetback.png deleted file mode 100644 index ce3f6f95102..00000000000 Binary files a/media/img/hub/assetback.png and /dev/null differ diff --git a/media/img/hub/default-128.png b/media/img/hub/default-128.png new file mode 100644 index 00000000000..c3ca6eb32d4 Binary files /dev/null and b/media/img/hub/default-128.png differ diff --git a/media/img/hub/default-48.png b/media/img/hub/default-48.png new file mode 100644 index 00000000000..c6f4e3c3fc0 Binary files /dev/null and b/media/img/hub/default-48.png differ diff --git a/media/img/hub/headzilla.png b/media/img/hub/headzilla.png deleted file mode 100644 index 6af1ffd20da..00000000000 Binary files a/media/img/hub/headzilla.png and /dev/null differ diff --git a/media/img/hub/phase.png b/media/img/hub/phase.png deleted file mode 100644 index 394e6f94ee5..00000000000 Binary files a/media/img/hub/phase.png and /dev/null differ diff --git a/media/js/devreg/devhub.js b/media/js/devreg/devhub.js index 26b71738d69..da91a9aadef 100644 --- a/media/js/devreg/devhub.js +++ b/media/js/devreg/devhub.js @@ -776,8 +776,6 @@ function initUploadIcon() { $('#id_unsaved_icon_data').val(file.dataURL); $('#icons_default input:checked').attr('checked', false); - $('input[name="icon_type"][value="'+file.type+'"]') - .attr('checked', true); }, upload_start = function(e, file) { diff --git a/mkt/asset_bundles.py b/mkt/asset_bundles.py index b0aa990e3d2..1bd851fc06f 100644 --- a/mkt/asset_bundles.py +++ b/mkt/asset_bundles.py @@ -44,9 +44,6 @@ # Tables. 'css/devreg/data-grid.styl', - # Landing page - 'css/devreg/landing.styl', - # "Manage ..." pages. 'css/devreg/manage.styl', 'css/devreg/prose.styl', diff --git a/mkt/constants/base.py b/mkt/constants/base.py index 62bc0b5d07f..6bb2de87f05 100644 --- a/mkt/constants/base.py +++ b/mkt/constants/base.py @@ -163,7 +163,7 @@ MAX_CATEGORIES = 2 # Icon sizes we want to generate and expose in the API. -APP_ICON_SIZES = [32, 48, 64, 128] +CONTENT_ICON_SIZES = [32, 48, 64, 128] # Preview upload sizes [thumb, full] ADDON_PREVIEW_SIZES = [(200, 150), (700, 525)] diff --git a/mkt/developers/forms.py b/mkt/developers/forms.py index 8350c39be40..724e97e2b3a 100644 --- a/mkt/developers/forms.py +++ b/mkt/developers/forms.py @@ -48,12 +48,10 @@ from mkt.translations.models import Translation from mkt.translations.widgets import TranslationTextarea, TransTextarea from mkt.versions.models import Version -from mkt.webapps.forms import clean_slug, icons from mkt.webapps.models import (AddonUser, BlockedSlug, IARCInfo, Preview, Webapp) from mkt.webapps.tasks import (index_webapps, set_storefront_data, update_manifests) -from mkt.webapps.widgets import IconWidgetRenderer from . import tasks @@ -509,9 +507,6 @@ class Meta: models = Webapp fields = ('name', 'slug') - def clean_slug(self): - return clean_slug(self.cleaned_data['slug'], self.instance) - class AppFormBasic(AddonFormBase): """Form to edit basic app info.""" @@ -676,9 +671,6 @@ def clean(self): class AppFormMedia(AddonFormBase): - icon_type = forms.CharField( - required=False, - widget=forms.RadioSelect(renderer=IconWidgetRenderer, choices=[])) icon_upload_hash = forms.CharField(required=False) unsaved_icon_data = forms.CharField(required=False, widget=forms.HiddenInput) @@ -687,13 +679,6 @@ class Meta: model = Webapp fields = ('icon_upload_hash', 'icon_type') - def __init__(self, *args, **kwargs): - super(AppFormMedia, self).__init__(*args, **kwargs) - - # Add icons here so we only read the directory when - # AppFormMedia is actually being used. - self.fields['icon_type'].widget.choices = icons() - def save(self, addon, commit=True): if self.cleaned_data['icon_upload_hash']: upload_hash = self.cleaned_data['icon_upload_hash'] @@ -704,7 +689,7 @@ def save(self, addon, commit=True): remove_icons(destination) tasks.resize_icon.delay(upload_path, destination, - mkt.APP_ICON_SIZES, + mkt.CONTENT_ICON_SIZES, set_modified_on=[addon]) return super(AppFormMedia, self).save(commit) diff --git a/mkt/developers/tasks.py b/mkt/developers/tasks.py index 01a7e8fbc9a..d54d206524d 100644 --- a/mkt/developers/tasks.py +++ b/mkt/developers/tasks.py @@ -139,7 +139,7 @@ def _hash_file(fd): @post_request_task @set_modified_on def resize_icon(src, dst, sizes, locally=False, **kw): - """Resizes addon icons.""" + """Resizes addon/websites icons.""" log.info('[1@None] Resizing icon: %s' % dst) try: for s in sizes: @@ -160,7 +160,7 @@ def resize_icon(src, dst, sizes, locally=False, **kw): log.info('Icon resizing completed for: %s' % dst) return {'icon_hash': icon_hash} except Exception, e: - log.error("Error saving addon icon: %s; %s" % (e, dst)) + log.error("Error resizing icon: %s; %s" % (e, dst)) @task @@ -283,23 +283,27 @@ def get_content_and_check_size(response, max_size): return content -def save_icon(webapp, content): +def save_icon(obj, icon_content): + """ + Saves the icon for `obj` to its final destination. `obj` can be an app or a + website. + """ tmp_dst = os.path.join(settings.TMP_PATH, 'icon', uuid.uuid4().hex) with storage.open(tmp_dst, 'wb') as fd: - fd.write(content) + fd.write(icon_content) - dirname = webapp.get_icon_dir() - destination = os.path.join(dirname, '%s' % webapp.id) + dirname = obj.get_icon_dir() + destination = os.path.join(dirname, '%s' % obj.pk) remove_icons(destination) - resize_icon(tmp_dst, destination, mkt.APP_ICON_SIZES, - set_modified_on=[webapp]) + resize_icon(tmp_dst, destination, mkt.CONTENT_ICON_SIZES, + set_modified_on=[obj]) # Need to set the icon type so .get_icon_url() works # normally submit step 4 does it through AppFormMedia, # but we want to beat them to the punch. # resize_icon outputs pngs, so we know it's 'image/png' - webapp.icon_type = 'image/png' - webapp.save() + obj.icon_type = 'image/png' + obj.save() @post_request_task diff --git a/mkt/developers/templates/developers/apps/forms_shared/media.html b/mkt/developers/templates/developers/apps/forms_shared/media.html index e719570e5a8..e81f9c23f00 100644 --- a/mkt/developers/templates/developers/apps/forms_shared/media.html +++ b/mkt/developers/templates/developers/apps/forms_shared/media.html @@ -84,7 +84,7 @@
{{ preload.addon.description|truncate(length=150) }}