UX: category images have no sizes (#6662)
This commit is contained in:
parent
03deda2147
commit
1da265db11
|
@ -4,7 +4,10 @@
|
||||||
<div class='category-box-heading'>
|
<div class='category-box-heading'>
|
||||||
<a href={{c.url}}>
|
<a href={{c.url}}>
|
||||||
{{#if c.uploaded_logo.url}}
|
{{#if c.uploaded_logo.url}}
|
||||||
{{cdn-img src=c.uploaded_logo.url class="logo"}}
|
{{cdn-img src=c.uploaded_logo.url
|
||||||
|
class="logo"
|
||||||
|
width=c.uploaded_logo.width
|
||||||
|
height=c.uploaded_logo.height}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<h3>
|
<h3>
|
||||||
|
|
|
@ -3,7 +3,11 @@
|
||||||
<div class='category-box-inner'>
|
<div class='category-box-inner'>
|
||||||
<div class="category-logo">
|
<div class="category-logo">
|
||||||
{{#if c.uploaded_logo.url}}
|
{{#if c.uploaded_logo.url}}
|
||||||
{{cdn-img src=c.uploaded_logo.url class="logo"}}
|
{{cdn-img
|
||||||
|
src=c.uploaded_logo.url
|
||||||
|
class="logo"
|
||||||
|
width=c.uploaded_logo.width
|
||||||
|
height=c.uploaded_logo.height}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<div class="category-details">
|
<div class="category-details">
|
||||||
|
@ -25,7 +29,11 @@
|
||||||
{{#each c.subcategories as |sc|}}
|
{{#each c.subcategories as |sc|}}
|
||||||
<a class="subcategory" href={{sc.url}}>
|
<a class="subcategory" href={{sc.url}}>
|
||||||
<span class="subcategory-image-placeholder">
|
<span class="subcategory-image-placeholder">
|
||||||
{{cdn-img src=sc.uploaded_logo.url class="logo"}}
|
{{cdn-img
|
||||||
|
src=c.uploaded_logo.url
|
||||||
|
class="logo"
|
||||||
|
width=c.uploaded_logo.width
|
||||||
|
height=c.uploaded_logo.height}}
|
||||||
</span>
|
</span>
|
||||||
<span class="subcategory-link">{{sc.name}}</span>
|
<span class="subcategory-link">{{sc.name}}</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -8,6 +8,10 @@
|
||||||
<span class="category-name">{{dir-span category.name}}</span>
|
<span class="category-name">{{dir-span category.name}}</span>
|
||||||
</div>
|
</div>
|
||||||
{{#if category.uploaded_logo.url}}
|
{{#if category.uploaded_logo.url}}
|
||||||
<div>{{cdn-img src=category.uploaded_logo.url class="category-logo"}}</div>
|
{{cdn-img
|
||||||
|
src=category.uploaded_logo.url
|
||||||
|
class="category-logo"
|
||||||
|
width=category.uploaded_logo.width
|
||||||
|
height=category.uploaded_logo.height}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
{{#if src}}
|
{{#if src}}
|
||||||
<img src={{cdnSrc}} class={{class}}>
|
<img src={{cdnSrc}} class={{class}} width={{width}} height={{height}}>
|
||||||
{{/if}}
|
{{/if}}
|
|
@ -3,7 +3,11 @@
|
||||||
|
|
||||||
<section class='category-heading'>
|
<section class='category-heading'>
|
||||||
{{#if category.uploaded_logo.url}}
|
{{#if category.uploaded_logo.url}}
|
||||||
{{cdn-img src=category.uploaded_logo.url class="category-logo"}}
|
{{cdn-img
|
||||||
|
src=category.uploaded_logo.url
|
||||||
|
class="category-logo"
|
||||||
|
width=category.uploaded_logo.width
|
||||||
|
height=category.uploaded_logo.height}}
|
||||||
{{#if category.description}}
|
{{#if category.description}}
|
||||||
<p>{{{dir-span category.description}}}</p>
|
<p>{{{dir-span category.description}}}</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
display: block;
|
display: block;
|
||||||
|
width: auto;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
margin: 0 auto 1em auto;
|
margin: 0 auto 1em auto;
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,6 +222,7 @@ button.dismiss-read {
|
||||||
}
|
}
|
||||||
|
|
||||||
.category-logo {
|
.category-logo {
|
||||||
|
width: auto;
|
||||||
max-height: 150px;
|
max-height: 150px;
|
||||||
float: left;
|
float: left;
|
||||||
margin: 0.25em 1em 0.5em 0;
|
margin: 0.25em 1em 0.5em 0;
|
||||||
|
|
|
@ -480,6 +480,7 @@ ol.category-breadcrumb {
|
||||||
|
|
||||||
.category-logo {
|
.category-logo {
|
||||||
display: block;
|
display: block;
|
||||||
|
width: auto;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
max-height: 150px;
|
max-height: 150px;
|
||||||
padding: 8px 0;
|
padding: 8px 0;
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
class CategoryUploadSerializer < ApplicationSerializer
|
class CategoryUploadSerializer < ApplicationSerializer
|
||||||
attributes :id, :url
|
attributes :id, :url, :width, :height
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
describe CategoryUploadSerializer do
|
||||||
|
|
||||||
|
let(:upload) { Fabricate(:upload) }
|
||||||
|
let(:subject) { described_class.new(upload, root: false) }
|
||||||
|
|
||||||
|
it 'should include width and height' do
|
||||||
|
expect(subject.width).to eq(upload.width)
|
||||||
|
expect(subject.height).to eq(upload.height)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in New Issue