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: [
{
title: 'document title',
image: 'recent icon url',
url: 'document url',
folder: 'path to document'
folder: 'path to document',
},
...
],
templates: [
{
name: 'template name',
icon: 'template icon url',
title: 'template name', // name - is deprecated
image: 'template icon url',
url: 'http://...'
},
...

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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