Ensure clean disply of blurb on homepage. Monthly pick admin form limits blurb to 200 chars. Blurb gets vertically truncated when more than 4 lines. (bug 715577)
This commit is contained in:
Родитель
76749b0414
Коммит
162b059f48
|
@ -189,12 +189,14 @@ class OAuthConsumerForm(happyforms.ModelForm):
|
||||||
|
|
||||||
class MonthlyPickForm(happyforms.ModelForm):
|
class MonthlyPickForm(happyforms.ModelForm):
|
||||||
image = forms.CharField(required=False)
|
image = forms.CharField(required=False)
|
||||||
|
blurb = forms.CharField(max_length=200,
|
||||||
|
widget=forms.Textarea(attrs={'cols': 20,
|
||||||
|
'rows': 2}))
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = MonthlyPick
|
model = MonthlyPick
|
||||||
widgets = {
|
widgets = {
|
||||||
'addon': forms.TextInput(),
|
'addon': forms.TextInput(),
|
||||||
'blurb': forms.Textarea(attrs={'cols': 20, 'rows': 2})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1121,6 +1121,14 @@ class TestMonthlyPick(amo.tests.TestCase):
|
||||||
eq_(MonthlyPick.objects.count(), 2)
|
eq_(MonthlyPick.objects.count(), 2)
|
||||||
eq_(MonthlyPick.objects.all()[1].locale, '')
|
eq_(MonthlyPick.objects.all()[1].locale, '')
|
||||||
|
|
||||||
|
def test_insert_long_blurb(self):
|
||||||
|
dupe = initial(self.f)
|
||||||
|
dupe.update(id='', blurb='x' * 201, locale='en-US')
|
||||||
|
data = formset(initial(self.f), dupe, initial_count=1)
|
||||||
|
r = self.client.post(self.url, data)
|
||||||
|
eq_(r.context['form'].errors[1]['blurb'][0],
|
||||||
|
'Ensure this value has at most 200 characters (it has 201).')
|
||||||
|
|
||||||
def test_success_update(self):
|
def test_success_update(self):
|
||||||
d = initial(self.f)
|
d = initial(self.f)
|
||||||
d.update(locale='fr')
|
d.update(locale='fr')
|
||||||
|
|
|
@ -178,6 +178,9 @@
|
||||||
max-height: 120px;
|
max-height: 120px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.blurb > p {
|
||||||
|
height: 68px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.html-rtl #monthly .thumb {
|
.html-rtl #monthly .thumb {
|
||||||
|
|
|
@ -31,6 +31,7 @@ function initPromos($context) {
|
||||||
});
|
});
|
||||||
$('.addons h3', $promos).truncate({dir: 'h'});
|
$('.addons h3', $promos).truncate({dir: 'h'});
|
||||||
$('.addons .desc', $promos).truncate({dir: 'v'});
|
$('.addons .desc', $promos).truncate({dir: 'v'});
|
||||||
|
$('#monthly .blurb > p').truncate({dir: 'v'});
|
||||||
$('.install', $promos).installButton();
|
$('.install', $promos).installButton();
|
||||||
});
|
});
|
||||||
$('.toplist .name').truncate({showTitle: true});
|
$('.toplist .name').truncate({showTitle: true});
|
||||||
|
|
|
@ -61,6 +61,7 @@ function initTrunc() {
|
||||||
// Trim the add-on title and description text to fit.
|
// Trim the add-on title and description text to fit.
|
||||||
$('.htruncate').truncate({dir: 'h'});
|
$('.htruncate').truncate({dir: 'h'});
|
||||||
$('.vtruncate').truncate({dir: 'v'});
|
$('.vtruncate').truncate({dir: 'v'});
|
||||||
|
$('#monthly .blurb > p').truncate({dir: 'v'});
|
||||||
$(window).resize(debounce(function() {
|
$(window).resize(debounce(function() {
|
||||||
$('.htruncate').truncate({dir: 'h'});
|
$('.htruncate').truncate({dir: 'h'});
|
||||||
$('.vtruncate').truncate({dir: 'v'});
|
$('.vtruncate').truncate({dir: 'v'});
|
||||||
|
|
Загрузка…
Ссылка в новой задаче