Change api for new and recent files

This commit is contained in:
Julia Radzhabova 2020-04-30 18:35:30 +03:00
parent b79d2891ff
commit 9b1aa597c4
7 changed files with 38 additions and 22 deletions

View file

@ -74,15 +74,16 @@
recent: [ recent: [
{ {
title: 'document title', title: 'document title',
image: 'recent icon url',
url: 'document url', url: 'document url',
folder: 'path to document' folder: 'path to document',
}, },
... ...
], ],
templates: [ templates: [
{ {
name: 'template name', title: 'template name', // name - is deprecated
icon: 'template icon url', image: 'template icon url',
url: 'http://...' url: 'http://...'
}, },
... ...

View file

@ -601,9 +601,13 @@ define([
store: new Common.UI.DataViewStore(this.recent), store: new Common.UI.DataViewStore(this.recent),
itemTemplate: _.template([ itemTemplate: _.template([
'<div class="recent-wrap">', '<div class="recent-wrap">',
'<div class="recent-icon"></div>', '<div class="recent-icon"',
'<div class="file-name"><%= Common.Utils.String.htmlEncode(title) %></div>', '<% if ((typeof image !== "undefined") && !_.isEmpty(image)) { %> ',
'<div class="file-info"><%= Common.Utils.String.htmlEncode(folder) %></div>', ' style="background-image: url(<%= image %>);background-position: center;"',
'<% } %>',
'></div>',
'<div class="file-name"><% if (typeof title !== "undefined") {%><%= Common.Utils.String.htmlEncode(title || "") %><% } %></div>',
'<div class="file-info"><% if (typeof folder !== "undefined") {%><%= Common.Utils.String.htmlEncode(folder || "") %><% } %></div>',
'</div>' '</div>'
].join('')) ].join(''))
}); });
@ -655,13 +659,13 @@ define([
'<% _.each(docs, function(item) { %>', '<% _.each(docs, function(item) { %>',
'<div class="thumb-wrap" template="<%= item.url %>">', '<div class="thumb-wrap" template="<%= item.url %>">',
'<div class="thumb"', '<div class="thumb"',
'<% if (!_.isEmpty(item.icon)) { %> ', '<% if (!_.isEmpty(item.image)) { %> ',
' style="background-image: url(<%= item.icon %>);">', ' style="background-image: url(<%= item.image %>);">',
'<% } else { ' + '<% } else { ' +
'print(\"><svg class=\'btn-doc-format\'><use xlink:href=\'#svg-format-blank\'></use></svg>\")' + 'print(\"><svg class=\'btn-doc-format\'><use xlink:href=\'#svg-format-blank\'></use></svg>\")' +
' } %>', ' } %>',
'</div>', '</div>',
'<div class="title"><%= item.name %></div>', '<div class="title"><%= Common.Utils.String.htmlEncode(item.name || item.title || "") %></div>',
'</div>', '</div>',
'<% }) %>', '<% }) %>',
'</div>' '</div>'

View file

@ -197,6 +197,7 @@
width: 102px; width: 102px;
height: 128px; height: 128px;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center;
} }
.title { .title {

View file

@ -510,9 +510,13 @@ define([
store: new Common.UI.DataViewStore(this.recent), store: new Common.UI.DataViewStore(this.recent),
itemTemplate: _.template([ itemTemplate: _.template([
'<div class="recent-wrap">', '<div class="recent-wrap">',
'<div class="recent-icon"></div>', '<div class="recent-icon"',
'<div class="file-name"><%= Common.Utils.String.htmlEncode(title) %></div>', '<% if ((typeof image !== "undefined") && !_.isEmpty(image)) { %> ',
'<div class="file-info"><%= Common.Utils.String.htmlEncode(folder) %></div>', ' style="background-image: url(<%= image %>);background-position: center;"',
'<% } %>',
'></div>',
'<div class="file-name"><% if (typeof title !== "undefined") {%><%= Common.Utils.String.htmlEncode(title || "") %><% } %></div>',
'<div class="file-info"><% if (typeof folder !== "undefined") {%><%= Common.Utils.String.htmlEncode(folder || "") %><% } %></div>',
'</div>' '</div>'
].join('')) ].join(''))
}); });
@ -564,13 +568,13 @@ define([
'<% _.each(docs, function(item) { %>', '<% _.each(docs, function(item) { %>',
'<div class="thumb-wrap" template="<%= item.url %>">', '<div class="thumb-wrap" template="<%= item.url %>">',
'<div class="thumb"', '<div class="thumb"',
'<% if (!_.isEmpty(item.icon)) { %> ', '<% if (!_.isEmpty(item.image)) { %> ',
' style="background-image: url(<%= item.icon %>);">', ' style="background-image: url(<%= item.image %>);">',
'<% } else { ' + '<% } else { ' +
'print(\"><svg class=\'btn-doc-format\'><use xlink:href=\'#svg-format-blank\'></use></svg>\")' + 'print(\"><svg class=\'btn-doc-format\'><use xlink:href=\'#svg-format-blank\'></use></svg>\")' +
' } %>', ' } %>',
'</div>', '</div>',
'<div class="title"><%= item.name %></div>', '<div class="title"><%= Common.Utils.String.htmlEncode(item.name || item.title || "") %></div>',
'</div>', '</div>',
'<% }) %>', '<% }) %>',
'</div>' '</div>'

View file

@ -263,7 +263,8 @@
width: 102px; width: 102px;
height: 128px; height: 128px;
background-repeat: no-repeat; background-repeat: no-repeat;
} background-position: center;
}
.title { .title {
padding-top: 20px; padding-top: 20px;

View file

@ -1324,9 +1324,13 @@ define([
store: new Common.UI.DataViewStore(this.recent), store: new Common.UI.DataViewStore(this.recent),
itemTemplate: _.template([ itemTemplate: _.template([
'<div class="recent-wrap">', '<div class="recent-wrap">',
'<div class="recent-icon"></div>', '<div class="recent-icon"',
'<div class="file-name"><%= Common.Utils.String.htmlEncode(title) %></div>', '<% if ((typeof image !== "undefined") && !_.isEmpty(image)) { %> ',
'<div class="file-info"><%= Common.Utils.String.htmlEncode(folder) %></div>', ' style="background-image: url(<%= image %>);background-position: center;"',
'<% } %>',
'></div>',
'<div class="file-name"><% if (typeof title !== "undefined") {%><%= Common.Utils.String.htmlEncode(title || "") %><% } %></div>',
'<div class="file-info"><% if (typeof folder !== "undefined") {%><%= Common.Utils.String.htmlEncode(folder || "") %><% } %></div>',
'</div>' '</div>'
].join('')) ].join(''))
}); });
@ -1378,13 +1382,13 @@ define([
'<% _.each(docs, function(item) { %>', '<% _.each(docs, function(item) { %>',
'<div class="thumb-wrap" template="<%= item.url %>">', '<div class="thumb-wrap" template="<%= item.url %>">',
'<div class="thumb"', '<div class="thumb"',
'<% if (!_.isEmpty(item.icon)) { %> ', '<% if (!_.isEmpty(item.image)) { %> ',
' style="background-image: url(<%= item.icon %>);">', ' style="background-image: url(<%= item.image %>);">',
'<% } else { ' + '<% } else { ' +
'print(\"><svg class=\'btn-doc-format\'><use xlink:href=\'#svg-format-blank\'></use></svg>\")' + 'print(\"><svg class=\'btn-doc-format\'><use xlink:href=\'#svg-format-blank\'></use></svg>\")' +
' } %>', ' } %>',
'</div>', '</div>',
'<div class="title"><%= item.name %></div>', '<div class="title"><%= Common.Utils.String.htmlEncode(item.name || item.title || "") %></div>',
'</div>', '</div>',
'<% }) %>', '<% }) %>',
'</div>' '</div>'

View file

@ -316,6 +316,7 @@
width: 102px; width: 102px;
height: 128px; height: 128px;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center;
} }
.title { .title {