Skip to content
Snippets Groups Projects
Commit bf63c077 authored by Sebastien's avatar Sebastien
Browse files

Refactore : rename PopupPanelEdition elements

parent bfcfddcf
No related branches found
No related tags found
1 merge request!98refresh the mosaic on annotation modification
...@@ -6,7 +6,7 @@ function convertToTime(seconds) { ...@@ -6,7 +6,7 @@ function convertToTime(seconds) {
return minutes + ":" + remainingSeconds; return minutes + ":" + remainingSeconds;
} }
function PanelInputEditor(data) { function PanelEdition(data) {
this.tag = data.tag; this.tag = data.tag;
this.readonlyDiv = undefined; this.readonlyDiv = undefined;
this.editDiv = undefined; this.editDiv = undefined;
...@@ -14,14 +14,14 @@ function PanelInputEditor(data) { ...@@ -14,14 +14,14 @@ function PanelInputEditor(data) {
this.popupPanelWidget = data.popupPanelWidget; this.popupPanelWidget = data.popupPanelWidget;
} }
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
PanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { PanelEdition.prototype.appendInputEditorDiv = function (parentDiv) {
} }
PanelInputEditor.prototype.closeEdition = function () { PanelEdition.prototype.closeEdition = function () {
this.popupPanelWidget.setCurrentOpenedInput(undefined); this.popupPanelWidget.setCurrentOpenedInput(undefined);
this.editDiv?.hide(); this.editDiv?.hide();
this.readonlyDiv?.show(); this.readonlyDiv?.show();
} }
PanelInputEditor.prototype.openEdition = function () { PanelEdition.prototype.openEdition = function () {
this.popupPanelWidget.ensureLastOpenedEditionClosed(); this.popupPanelWidget.ensureLastOpenedEditionClosed();
if (this.canEdit) { if (this.canEdit) {
this.popupPanelWidget.setCurrentOpenedInput(this); this.popupPanelWidget.setCurrentOpenedInput(this);
...@@ -32,11 +32,11 @@ PanelInputEditor.prototype.openEdition = function () { ...@@ -32,11 +32,11 @@ PanelInputEditor.prototype.openEdition = function () {
} }
} }
function AnnotationNamePanelInputEditor(data) { function AnnotationNamePanelEdition(data) {
PanelInputEditor.call(this, data); PanelEdition.call(this, data);
} }
AnnotationNamePanelInputEditor.prototype = Object.create(PanelInputEditor.prototype); AnnotationNamePanelEdition.prototype = Object.create(PanelEdition.prototype);
AnnotationNamePanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { AnnotationNamePanelEdition.prototype.appendInputEditorDiv = function (parentDiv) {
let that = this; let that = this;
this.readonlyDiv = $('<div>'); this.readonlyDiv = $('<div>');
this.readonlyDiv this.readonlyDiv
...@@ -82,7 +82,7 @@ AnnotationNamePanelInputEditor.prototype.appendInputEditorDiv = function (parent ...@@ -82,7 +82,7 @@ AnnotationNamePanelInputEditor.prototype.appendInputEditorDiv = function (parent
parentDiv.append(this.editDiv); parentDiv.append(this.editDiv);
} }
} }
AnnotationNamePanelInputEditor.prototype.closeEdition = function () { AnnotationNamePanelEdition.prototype.closeEdition = function () {
if (this.canEdit) { if (this.canEdit) {
let newValue = this.editDiv.val(); let newValue = this.editDiv.val();
this.editDiv.val(newValue); this.editDiv.val(newValue);
...@@ -100,14 +100,14 @@ AnnotationNamePanelInputEditor.prototype.closeEdition = function () { ...@@ -100,14 +100,14 @@ AnnotationNamePanelInputEditor.prototype.closeEdition = function () {
$('#popupNom').html('+ Add a name').addClass("empty"); $('#popupNom').html('+ Add a name').addClass("empty");
} }
} }
PanelInputEditor.prototype.closeEdition.call(this); PanelEdition.prototype.closeEdition.call(this);
} }
function AuthorPanelInputEditor(data) { function AnnotationAuthorPanelEdition(data) {
PanelInputEditor.call(this, data); PanelEdition.call(this, data);
} }
AuthorPanelInputEditor.prototype = Object.create(PanelInputEditor.prototype); AnnotationAuthorPanelEdition.prototype = Object.create(PanelEdition.prototype);
AuthorPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { AnnotationAuthorPanelEdition.prototype.appendInputEditorDiv = function (parentDiv) {
let that = this; let that = this;
this.readonlyDiv = $('<div>'); this.readonlyDiv = $('<div>');
this.readonlyDiv.addClass('popupRightItem') this.readonlyDiv.addClass('popupRightItem')
...@@ -152,7 +152,7 @@ AuthorPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { ...@@ -152,7 +152,7 @@ AuthorPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) {
parentDiv.append(this.editDiv); parentDiv.append(this.editDiv);
} }
} }
AuthorPanelInputEditor.prototype.closeEdition = function () { AnnotationAuthorPanelEdition.prototype.closeEdition = function () {
if (this.canEdit) { if (this.canEdit) {
let newValue = this.editDiv.val(); let newValue = this.editDiv.val();
this.editDiv.val(newValue); this.editDiv.val(newValue);
...@@ -170,14 +170,14 @@ AuthorPanelInputEditor.prototype.closeEdition = function () { ...@@ -170,14 +170,14 @@ AuthorPanelInputEditor.prototype.closeEdition = function () {
this.readonlyDiv.html('+ Add an author').addClass("empty"); this.readonlyDiv.html('+ Add an author').addClass("empty");
} }
} }
PanelInputEditor.prototype.closeEdition.call(this); PanelEdition.prototype.closeEdition.call(this);
} }
function TCPanelInputEditor(data) { function AnnotationTCPanelEdition(data) {
PanelInputEditor.call(this, data); PanelEdition.call(this, data);
} }
TCPanelInputEditor.prototype = Object.create(PanelInputEditor.prototype); AnnotationTCPanelEdition.prototype = Object.create(PanelEdition.prototype);
TCPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { AnnotationTCPanelEdition.prototype.appendInputEditorDiv = function (parentDiv) {
function onlyNumber(event) { function onlyNumber(event) {
$(this).val($(this).val().replace(/[^0-9]/g, '')); $(this).val($(this).val().replace(/[^0-9]/g, ''));
...@@ -293,7 +293,7 @@ TCPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { ...@@ -293,7 +293,7 @@ TCPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) {
parentDiv.append(this.editDiv); parentDiv.append(this.editDiv);
} }
} }
TCPanelInputEditor.prototype.closeEdition = function () { AnnotationTCPanelEdition.prototype.closeEdition = function () {
if (this.canEdit) { if (this.canEdit) {
let isNaN = (maybeNaN) => maybeNaN!=maybeNaN; let isNaN = (maybeNaN) => maybeNaN!=maybeNaN;
let ensureNotNaN = (text, defaultValue = 0) => { let ensureNotNaN = (text, defaultValue = 0) => {
...@@ -336,14 +336,14 @@ TCPanelInputEditor.prototype.closeEdition = function () { ...@@ -336,14 +336,14 @@ TCPanelInputEditor.prototype.closeEdition = function () {
window.app.rekall.Rekall('pubSub').publish('tag.tc.updated', {tag: this.tag}); window.app.rekall.Rekall('pubSub').publish('tag.tc.updated', {tag: this.tag});
} }
} }
PanelInputEditor.prototype.closeEdition.call(this); PanelEdition.prototype.closeEdition.call(this);
} }
function CommentPanelInputEditor(data) { function AnnotationCommentPanelEdition(data) {
PanelInputEditor.call(this, data); PanelEdition.call(this, data);
} }
CommentPanelInputEditor.prototype = Object.create(PanelInputEditor.prototype); AnnotationCommentPanelEdition.prototype = Object.create(PanelEdition.prototype);
CommentPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { AnnotationCommentPanelEdition.prototype.appendInputEditorDiv = function (parentDiv) {
let that = this; let that = this;
this.readonlyDiv = $('<div>'); this.readonlyDiv = $('<div>');
this.readonlyDiv.addClass('popupRightItem') this.readonlyDiv.addClass('popupRightItem')
...@@ -381,7 +381,7 @@ CommentPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { ...@@ -381,7 +381,7 @@ CommentPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) {
parentDiv.append(this.editDiv); parentDiv.append(this.editDiv);
} }
} }
CommentPanelInputEditor.prototype.closeEdition = function () { AnnotationCommentPanelEdition.prototype.closeEdition = function () {
if (this.canEdit) { if (this.canEdit) {
let newValue = this.editDiv.val(); let newValue = this.editDiv.val();
this.editDiv.val(newValue); this.editDiv.val(newValue);
...@@ -400,14 +400,14 @@ CommentPanelInputEditor.prototype.closeEdition = function () { ...@@ -400,14 +400,14 @@ CommentPanelInputEditor.prototype.closeEdition = function () {
this.readonlyDiv.html('+ Add an author').addClass("empty"); this.readonlyDiv.html('+ Add an author').addClass("empty");
} }
} }
PanelInputEditor.prototype.closeEdition.call(this); PanelEdition.prototype.closeEdition.call(this);
} }
function LinkPanelInputEditor(data) { function AnnotationLinkPanelEdition(data) {
PanelInputEditor.call(this, data); PanelEdition.call(this, data);
} }
LinkPanelInputEditor.prototype = Object.create(PanelInputEditor.prototype); AnnotationLinkPanelEdition.prototype = Object.create(PanelEdition.prototype);
LinkPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { AnnotationLinkPanelEdition.prototype.appendInputEditorDiv = function (parentDiv) {
let that = this; let that = this;
this.readonlyDiv = $('<div>'); this.readonlyDiv = $('<div>');
this.readonlyDiv.addClass('popupRightItem') this.readonlyDiv.addClass('popupRightItem')
...@@ -457,7 +457,7 @@ LinkPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { ...@@ -457,7 +457,7 @@ LinkPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) {
parentDiv.append(this.editDiv); parentDiv.append(this.editDiv);
} }
} }
LinkPanelInputEditor.prototype.closeEdition = function () { AnnotationLinkPanelEdition.prototype.closeEdition = function () {
if (this.canEdit) { if (this.canEdit) {
let newValue = this.editDiv.val(); let newValue = this.editDiv.val();
newValue = newValue.trim(); newValue = newValue.trim();
...@@ -480,14 +480,14 @@ LinkPanelInputEditor.prototype.closeEdition = function () { ...@@ -480,14 +480,14 @@ LinkPanelInputEditor.prototype.closeEdition = function () {
this.readonlyDiv.html('+ Add a Link').addClass("empty"); this.readonlyDiv.html('+ Add a Link').addClass("empty");
} }
} }
PanelInputEditor.prototype.closeEdition.call(this); PanelEdition.prototype.closeEdition.call(this);
} }
function SpeedPanelInputEditor(data) { function AnnotationSpeedPanelEdition(data) {
PanelInputEditor.call(this, data); PanelEdition.call(this, data);
} }
SpeedPanelInputEditor.prototype = Object.create(PanelInputEditor.prototype); AnnotationSpeedPanelEdition.prototype = Object.create(PanelEdition.prototype);
SpeedPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { AnnotationSpeedPanelEdition.prototype.appendInputEditorDiv = function (parentDiv) {
let that = this; let that = this;
this.readonlyDiv = $('<form>'); this.readonlyDiv = $('<form>');
this.readonlyDiv.addClass('popupRightItem') this.readonlyDiv.addClass('popupRightItem')
...@@ -625,7 +625,7 @@ SpeedPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { ...@@ -625,7 +625,7 @@ SpeedPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) {
parentDiv.append(this.readonlyDiv); parentDiv.append(this.readonlyDiv);
} }
SpeedPanelInputEditor.prototype.closeEdition = function () { AnnotationSpeedPanelEdition.prototype.closeEdition = function () {
if (this.canEdit) { if (this.canEdit) {
let newValue = this.readonlyDiv.children('input:checked').val(); let newValue = this.readonlyDiv.children('input:checked').val();
if (this.tag.getMetadata('Rekall->Speed') !== newValue) { if (this.tag.getMetadata('Rekall->Speed') !== newValue) {
...@@ -637,20 +637,20 @@ SpeedPanelInputEditor.prototype.closeEdition = function () { ...@@ -637,20 +637,20 @@ SpeedPanelInputEditor.prototype.closeEdition = function () {
} }
} }
} }
SpeedPanelInputEditor.prototype.openEdition = function () { AnnotationSpeedPanelEdition.prototype.openEdition = function () {
this.popupPanelWidget.ensureLastOpenedEditionClosed(); this.popupPanelWidget.ensureLastOpenedEditionClosed();
if (this.canEdit) { if (this.canEdit) {
this.popupPanelWidget.setCurrentOpenedInput(this); this.popupPanelWidget.setCurrentOpenedInput(this);
} }
} }
function TagPanelInputEditor(data) { function AnnotationTagPanelEdition(data) {
PanelInputEditor.call(this, data); PanelEdition.call(this, data);
this.annotationInputTemplate = $('<input class="" type="checkbox" id="" value="">') this.annotationInputTemplate = $('<input class="" type="checkbox" id="" value="">')
this.annotationLabelTemplate = $('<label class="" for=""></label>') this.annotationLabelTemplate = $('<label class="" for=""></label>')
} }
TagPanelInputEditor.prototype = Object.create(PanelInputEditor.prototype); AnnotationTagPanelEdition.prototype = Object.create(PanelEdition.prototype);
TagPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { AnnotationTagPanelEdition.prototype.appendInputEditorDiv = function (parentDiv) {
let that = this; let that = this;
function getLabelArray(tag) { function getLabelArray(tag) {
...@@ -738,7 +738,7 @@ TagPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { ...@@ -738,7 +738,7 @@ TagPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) {
} }
parentDiv.append(this.readonlyDiv); parentDiv.append(this.readonlyDiv);
} }
TagPanelInputEditor.prototype.save = function () { AnnotationTagPanelEdition.prototype.save = function () {
if (this.canEdit) { if (this.canEdit) {
let newValue = ''; let newValue = '';
this.readonlyDiv this.readonlyDiv
...@@ -759,12 +759,12 @@ TagPanelInputEditor.prototype.save = function () { ...@@ -759,12 +759,12 @@ TagPanelInputEditor.prototype.save = function () {
} }
} }
} }
TagPanelInputEditor.prototype.closeEdition = function () { AnnotationTagPanelEdition.prototype.closeEdition = function () {
if (this !== this.popupPanelWidget.getCurrentOpenedInput()) if (this !== this.popupPanelWidget.getCurrentOpenedInput())
this.popupPanelWidget.ensureLastOpenedEditionClosed(); this.popupPanelWidget.ensureLastOpenedEditionClosed();
this.save(); this.save();
} }
TagPanelInputEditor.prototype.openEdition = function () { AnnotationTagPanelEdition.prototype.openEdition = function () {
if (this !== this.popupPanelWidget.getCurrentOpenedInput()) { if (this !== this.popupPanelWidget.getCurrentOpenedInput()) {
this.popupPanelWidget.ensureLastOpenedEditionClosed(); this.popupPanelWidget.ensureLastOpenedEditionClosed();
if (this.canEdit) { if (this.canEdit) {
...@@ -946,25 +946,25 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) { ...@@ -946,25 +946,25 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) {
}) })
popupRightTd.append(closePopupDiv); popupRightTd.append(closePopupDiv);
let projectNameInput = new AnnotationNamePanelInputEditor(commonDataForPanels) let projectNameInput = new AnnotationNamePanelEdition(commonDataForPanels)
projectNameInput.appendInputEditorDiv(popupRightTd); projectNameInput.appendInputEditorDiv(popupRightTd);
let projectAuthorInput = new AuthorPanelInputEditor(commonDataForPanels); let projectAuthorInput = new AnnotationAuthorPanelEdition(commonDataForPanels);
projectAuthorInput.appendInputEditorDiv(popupRightTd); projectAuthorInput.appendInputEditorDiv(popupRightTd);
let tcInput = new TCPanelInputEditor(commonDataForPanels); let tcInput = new AnnotationTCPanelEdition(commonDataForPanels);
tcInput.appendInputEditorDiv(popupRightTd); tcInput.appendInputEditorDiv(popupRightTd);
let commentPanel = new CommentPanelInputEditor(commonDataForPanels); let commentPanel = new AnnotationCommentPanelEdition(commonDataForPanels);
commentPanel.appendInputEditorDiv(popupRightTd); commentPanel.appendInputEditorDiv(popupRightTd);
let linkPanel = new LinkPanelInputEditor(commonDataForPanels); let linkPanel = new AnnotationLinkPanelEdition(commonDataForPanels);
linkPanel.appendInputEditorDiv(popupRightTd); linkPanel.appendInputEditorDiv(popupRightTd);
let speedPanel = new SpeedPanelInputEditor(commonDataForPanels); let speedPanel = new AnnotationSpeedPanelEdition(commonDataForPanels);
speedPanel.appendInputEditorDiv(popupRightTd); speedPanel.appendInputEditorDiv(popupRightTd);
let tagPanel = new TagPanelInputEditor(commonDataForPanels); let tagPanel = new AnnotationTagPanelEdition(commonDataForPanels);
tagPanel.appendInputEditorDiv(popupRightTd); tagPanel.appendInputEditorDiv(popupRightTd);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment