Skip to content

Commit

Permalink
Merge pull request #1735 from FFxSquall/fixes-document-and-image-editor
Browse files Browse the repository at this point in the history
Refactoring document and image editors
  • Loading branch information
stasguryev committed Jun 1, 2022
2 parents 2da636b + 11e1e41 commit 4057eba
Show file tree
Hide file tree
Showing 32 changed files with 684 additions and 716 deletions.
11 changes: 11 additions & 0 deletions demo/ajaxMap.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,16 @@
}
],
"url": "Case/Reopen"
},
{
"className": "Documents",
"methodName": "GetDocumentRevisions",
"parameters": [
{
"name": "documentId",
"typeName": "System.String"
}
],
"url": "Documents/GetDocumentRevisions"
}
]
20 changes: 20 additions & 0 deletions demo/ajaxStub/ajaxStub.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,26 @@ export default {
}
}
}
case 'Documents/GetDocumentRevisions': {
const responseData = {
success: true,
data: [
{
id: _.guid(),
creatorName: 'Sergey Sergeev',
revisionLink: 'images/image2.jpg',
creationDate: Date.now() + _.random(-100, 100) * 1000 * 60,
revisionIndex: 1
}
]
};

return new Promise(resolve => {
setTimeout(() => {
resolve(responseData);
}, 1000);
});
}
default: {
request.success(response);
}
Expand Down
6 changes: 6 additions & 0 deletions demo/app/DemoConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,12 @@ export default {
description: 'Document editor',
attributesConfig: [commonAttributes.autocommit]
},
{
id: 'ImageEditor',
displayName: 'Image editor',
description: 'Image editor',
attributesConfig: [commonAttributes.autocommit]
},
{
id: 'DurationEditor',
displayName: 'Duration Editor',
Expand Down
72 changes: 72 additions & 0 deletions demo/app/cases/editors/ImageEditor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import CanvasView from 'demoPage/views/CanvasView';

export default function() {
const model = new Backbone.Model({
images: [
{
extension: 'jpg',
id: 'document.3',
name: 'image',
url: 'images/image.jpg',
creator: 'Vladislav Smirnov',
creationDate: '26.08.2019 12:59'
},
{
extension: 'jpg',
id: 'document.4',
name: 'image2',
url: 'images/image2.jpg',
creator: 'Vladislav Smirnov',
creationDate: '26.08.2021 12:59',
isLoading: true
},
{
extension: 'jpg',
id: 'document.5',
name: '4k_16:9_image',
url: 'images/image3.jpg'
},
{
extension: 'webp',
id: 'document.6',
name: 'image4',
url: 'images/image4.webp',
infoWidget: {
text: 'Looong text, very very long tex',
subtext: 'Tony Podkolzin',
picUrl: 'images/VSAvatar.PNG'
}
},
{
extension: 'gif',
id: 'document.7',
name: 'cat',
url: 'images/cat.gif'
},
{
extension: 'gif',
id: 'document.8',
name: 'dance',
url: 'images/dance.gif',
infoWidget: {
text: '05.04.2077 11:30',
subtext: 'Vladislav Smirnov',
picUrl: 'images/VSAvatar.PNG'
}
}
]
});

return new CanvasView({
view: new Core.form.editors.ImageEditor({
model,
key: 'images',
autocommit: true,
displayText: 'Image Editor',
title: 'My images',
uploadUrl: null
}),
presentation: "[ {{#each images}}<div>{ id: '{{this.id}}', name: '{{this.name}}' }{{#unless @last}}, {{/unless}}</div>{{/each}} <div>]</div>",
isEditor: true
});
}
2 changes: 1 addition & 1 deletion dist/localization/localization.de.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/localization/localization.en.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/localization/localization.ru.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion localization/localization.n3
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@

<http://comindware.com/text/core/form/editors/document#hide> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Stanislav Guryev"; l10n:modifiedBy "Stanislav Guryev"; l10n:creationDate "2017-10-09T08:37:32.0599068Z"; l10n:modificationDate "2017-10-09T08:37:40.0835264Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "Hide"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/document#noDocument> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Vasiliy Zorin"; l10n:modifiedBy "Vasiliy Zorin"; l10n:creationDate "2018-12-21T11:11:08.0941682Z"; l10n:modificationDate "2018-12-21T11:44:21.0703266Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "-"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].
<http://comindware.com/text/core/form/editors/document#noDocument> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Vasiliy Zorin"; l10n:modifiedBy "Mikhail F"; l10n:creationDate "2018-12-21T11:11:08.0941682Z"; l10n:modificationDate "2022-05-24T13:20:43.1760076Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "No data to show"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/document#preview> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Pavel Koroteev"; l10n:modifiedBy "Pavel Koroteev"; l10n:creationDate "2019-11-01T11:51:35.3744079Z"; l10n:modificationDate "2019-11-01T11:51:54.1014474Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "Preview"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

Expand Down
2 changes: 2 additions & 0 deletions localization/localization.ru.n3
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@

<http://comindware.com/text/core/form/editors/document#hide> l10n:text [a l10n:Text; l10n:lang l10n:ru; l10n:data "Скрыть"; l10n:originalData "Hide"].

<http://comindware.com/text/core/form/editors/document#noDocument> l10n:text [a l10n:Text; l10n:lang l10n:ru; l10n:data "Нет данных для отображения"; l10n:originalData "No data to show"].

<http://comindware.com/text/core/form/editors/document#preview> l10n:text [a l10n:Text; l10n:lang l10n:ru; l10n:data "Просмотр"; l10n:originalData "Preview"].

<http://comindware.com/text/core/form/editors/document#remove> l10n:text [a l10n:Text; l10n:lang l10n:ru; l10n:data "Удалить"; l10n:originalData "Remove"].
Expand Down
20 changes: 3 additions & 17 deletions resources/styles/baseStyles.css
Original file line number Diff line number Diff line change
Expand Up @@ -378,17 +378,12 @@ svg.svg-grid-icons.svg-icons_flag-none {
flex-wrap: nowrap;
}

.cell > .editor.editor_document > .documents .task-links__i {
margin-bottom: 0;
margin-right: 2em;
}

.cell .documents__text,
.cell .drop-zone__text,
.cell .field-documents__more {
display: none;
}

.cell .documents__drop-zone {
.cell .editor__drop-zone {
height: auto;
position: absolute;
left: 0;
Expand All @@ -401,17 +396,12 @@ svg.svg-grid-icons.svg-icons_flag-none {
font-weight: 900;
}

.cell .editor_empty .documents__drop-zone::before {
.cell .editor_empty .editor__drop-zone::before {
content: "\F0C6";
color: grey;
position: absolute;
}

.cell .documents__wrapper {
padding: 0;
border: none;
}

.layout__popup-view-content > .layout__form-view {
display: flex;
}
Expand All @@ -427,10 +417,6 @@ svg.svg-grid-icons.svg-icons_flag-none {
align-items: flex-start;
}

.task-links__i {
margin-bottom: 10px;
}

.btn.field-documents__more {
width: auto;
text-align: center;
Expand Down
Loading

0 comments on commit 4057eba

Please sign in to comment.