svg icons in last open files list

This commit is contained in:
antelle 2016-03-27 09:14:15 +03:00
parent 8b660ca5de
commit 9c9abaae80
3 changed files with 19 additions and 6 deletions

View File

@ -85,14 +85,18 @@ var OpenView = Backbone.View.extend({
getLastOpenFiles: function() {
return this.model.fileInfos.map(function(f) {
var icon = 'file-text';
var storage = f.get('storage');
if (Storage[storage] && Storage[storage].icon) {
icon = Storage[storage].icon;
var storage = Storage[f.get('storage')];
if (storage && storage.icon) {
icon = storage.icon;
}
if (storage && storage.iconSvg) {
icon = null;
}
return {
id: f.get('id'),
name: f.get('name'),
icon: icon
icon: icon,
iconSvg: storage ? storage.iconSvg : undefined
};
});
},

View File

@ -179,7 +179,15 @@
}
@include th { color: muted-color(); }
padding: $base-padding;
&-icon { width: 2em; }
&-icon {
width: 2em;
&--svg>svg {
@include size(1em);
path {
@include th { fill: muted-color(); }
}
}
}
&-text { @include flex-grow(1); }
&-icon-del {
opacity: 0;

View File

@ -63,7 +63,8 @@
<div class="open__last">
{{#each lastOpenFiles as |file|}}
<div class="open__last-item" data-id="{{file.id}}">
<i class="fa fa-{{file.icon}} open__last-item-icon"></i>
{{#if file.icon}}<i class="fa fa-{{file.icon}} open__last-item-icon"></i>{{/if}}
{{#if file.iconSvg}}<div class="open__last-item-icon open__last-item-icon--svg">{{{file.iconSvg}}}</div>{{/if}}
<span class="open__last-item-text">{{file.name}}</span>
<i class="fa fa-times open__last-item-icon-del"></i>
</div>