Theme previews#1692
Conversation
| float: left; | ||
| position: relative; | ||
| background: url(/css/assets/theme_bg.png) top left no-repeat; | ||
| background: url(/images/theme_bg.png) top left no-repeat; |
There was a problem hiding this comment.
Is this correct? Getting a 403 error.
|
|
||
| postRender: function() { | ||
| var previewUrl = '/api/theme/preview/' + this.model.attributes.name + '/' + this.model.attributes.version; | ||
| var $previewLoc = this.$el.find('.theme-preview'); |
There was a problem hiding this comment.
this.$el.find('.theme-preview') can just be written as this.$('.theme-preview')
| statusCode: { | ||
| // if a preview image is found | ||
| 200: function() { | ||
| $previewLoc.prepend('<img src="' + previewUrl + '"alt="Preview image"' + '/>'); |
There was a problem hiding this comment.
Can the alt text be localised please?
Could also switch to the jQuery object syntax if you fancied it:
$previewLoc.prepend($('<img/>', { src: previewUrl, alt: '...' }));|
@canstudios-louisem when accessing the theme picker page with old themes (i.e. those without preview images), I get the following console errors: Would it be possible to handle this scenario on the server-side, without returning an error? |
|
I will change the 404 response to a 204 would be fine and that won't give a console error and is a standard reponse for this kind of thing. |
| }, | ||
|
|
||
| postRender: function() { | ||
| var previewUrl = '/api/theme/preview/' + this.model.attributes.name + '/' + this.model.attributes.version; |
There was a problem hiding this comment.
Very minor but could we use model.get() to access attributes here please, for consistency.
|
@taylortom @tomgreenfield I have made those changes. |
|
Before release we also need to update https://github.com/adaptlearning/adapt_framework/wiki/Developers-Guide:-Theme |
1cbc40b to
1163f7b
Compare
tomgreenfield
left a comment
There was a problem hiding this comment.
Looking good – theme previews are now pulling in fine and the absent ones aren't 404'ing.
I've noticed that the sample image doesn't fit entirely with the current styling. Can we take this opportunity to standardise the image and styling to fit a 16:9 ratio? This would give an optimal resolution of 275 x 155.
It would also be great to fall back to a default icon, like we do in the asset manager.
|
@tomgreenfield I've just tested 16:9 and it's quite short which means you can't really see any components and the header I think we should stay at 275x205. I will add the same default icon as in assets though. |
1163f7b to
3048f3a
Compare
3048f3a to
07ba658
Compare
|
@tomgreenfield and @taylortom do you want to re approve as I've pushed a few things since you did? |
| $previewLoc.prepend($('<img/>', { src: previewUrl, alt: Origin.l10n.t('app.themepreviewalt') })); | ||
| }, | ||
| 204: function() { | ||
| $previewLoc.prepend($('<i/>', { class: 'fa fa-file-image-o' })); |
There was a problem hiding this comment.
There was a problem hiding this comment.
image icon looks more like it is related to assets
There was a problem hiding this comment.
That's fine by me ive asked one of our creatives to see if they know anything better than the paintbrush as im not sure its quite right.
|
|
||
| .theme-list-item { | ||
| height: 175px; | ||
| height: 280px; |
| color:rgb(214, 242, 249); | ||
| font-size: 50px; | ||
| padding-top: 70px; | ||
| padding-left: 116px; |
There was a problem hiding this comment.
Instead of using padding, please can we centre the icon dynamically using a CSS transform?
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);With a set height on the container (205px if we're matching the sample image).
| <div class="theme-header"> | ||
| <div class="display-name"><h4 style="color: {{foreground_color.default}}">{{displayName}}</h4></div> | ||
| <div class="description">{{description}}</div> | ||
| <div class="theme-preview"></div> |
There was a problem hiding this comment.
Please can the preview <div> be moved to sit after the header <div>?
This will allow us to have consistent padding – none on the inner, 20px on the header and none on its children.
| $previewLoc.prepend($('<img/>', { src: previewUrl, alt: Origin.l10n.t('app.themepreviewalt') })); | ||
| }, | ||
| 204: function() { | ||
| $previewLoc.prepend($('<i/>', { class: 'fa fa-file-image-o' })); |
There was a problem hiding this comment.
We need quotes around class since it's a reserved word in JavaScript.
|
@taylortom @tomgreenfield I've pushed an update with those changes. I added the paintbrush but our designer also made this thoughts? I'm not set on either the paintbrush is one less image file tho. |
|
Great thanks @canstudios-louisem, looks good. I have to admit that the linked image icon doesn't mean anything to me, I'd never guess it was related to appearance/theming. Happy to go with the general consensus though. |
tomgreenfield
left a comment
There was a problem hiding this comment.
Sorry, minor comment again!
|
|
||
| &-inner { | ||
| .theme-header { | ||
| padding: 20px 0; |
| $previewLoc.prepend($('<img/>', { src: previewUrl, alt: Origin.l10n.t('app.themepreviewalt') })); | ||
| }, | ||
| 204: function() { | ||
| $previewLoc.prepend($('<i/>', { 'class': 'fa fa-paint-brush' })); |
2886e78 to
a19acf9
Compare
|
sorted @tomgreenfield |



This will search for a file called preview.jpg in the root of your theme and display it on the theme selection screen if there is one.
I will also make a PR to the vanilla theme with a pr for the preview.jpg one of our designers made.