Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
a292f669
Commit
a292f669
authored
Feb 27, 2019
by
bbaer
Browse files
View Only codecorrection
parent
3d6ef9e4
Pipeline
#1585
passed with stage
in 2 minutes and 25 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
javascript/src/CodeCorrection.js
View file @
a292f669
...
...
@@ -42,6 +42,7 @@ var QfqNS = QfqNS || {};
this
.
users
=
[];
this
.
currentUser
=
{};
this
.
language
=
""
;
this
.
readOnly
=
false
;
this
.
syntaxHighlight
=
{};
};
...
...
@@ -58,22 +59,28 @@ var QfqNS = QfqNS || {};
};
this
.
page
=
page
;
this
.
language
=
this
.
$parent
.
data
(
"
highlight
"
)
||
"
typo3conf/ext/qfq/Resources/Public/Json/javascript.json
"
;
this
.
readOnly
=
this
.
$parent
.
data
(
"
view-only
"
)
||
false
;
this
.
currentUser
=
$container
.
data
(
"
uid
"
);
var
that
=
this
;
if
(
this
.
$target
.
val
())
{
var
jImport
=
$
.
parseJSON
(
this
.
$target
.
val
());
if
(
jImport
.
annotations
)
{
this
.
annotations
=
jImport
.
annotations
;
console
.
log
(
"
[CodeCorrection] Imported Annotations:
"
+
this
.
annotations
.
length
);
}
if
(
jImport
.
users
)
{
this
.
users
=
jImport
.
users
;
console
.
log
(
"
[CodeCorrection] Imported Users:
"
+
this
.
users
.
length
);
if
(
this
.
readOnly
)
{
var
jsonAnnotations
=
this
.
$parent
.
data
(
"
annotations
"
);
this
.
annotations
=
jsonAnnotations
.
annotations
;
this
.
users
=
jsonAnnotations
.
users
;
}
else
{
if
(
this
.
$target
.
val
())
{
var
jImport
=
$
.
parseJSON
(
this
.
$target
.
val
());
if
(
jImport
.
annotations
)
{
this
.
annotations
=
jImport
.
annotations
;
console
.
log
(
"
[CodeCorrection] Imported Annotations:
"
+
this
.
annotations
.
length
);
}
if
(
jImport
.
users
)
{
this
.
users
=
jImport
.
users
;
console
.
log
(
"
[CodeCorrection] Imported Users:
"
+
this
.
users
.
length
);
}
}
}
if
(
this
.
data
.
url
)
{
// Get data of a file and write it to data.text
$
.
get
(
this
.
data
.
url
,
function
(
response
)
{
...
...
@@ -206,8 +213,11 @@ var QfqNS = QfqNS || {};
* @private
*/
n
.
CodeCorrection
.
prototype
.
_buildCommentContainer
=
function
(
$hook
)
{
var
options
=
{
readOnly
:
this
.
readOnly
};
var
commentController
=
new
n
.
CommentController
();
commentController
.
buildContainer
(
$hook
);
commentController
.
buildContainer
(
$hook
,
options
);
commentController
.
setCurrentUser
(
this
.
currentUser
);
return
commentController
;
};
...
...
@@ -350,13 +360,15 @@ var QfqNS = QfqNS || {};
comments
.
commentController
.
toggle
();
comments
.
commentController
.
emitEvent
(
"
new
"
);
}
else
{
comments
.
lineNumber
=
lineCount
;
comments
.
commentController
=
new
n
.
CommentController
();
comments
.
commentController
.
buildContainer
(
$hook
);
comments
.
commentController
.
setCurrentUser
(
this
.
currentUser
);
comments
.
commentController
.
displayEditor
();
this
.
_setListeners
(
comments
.
commentController
);
this
.
annotations
.
push
(
comments
);
if
(
!
this
.
readOnly
)
{
comments
.
lineNumber
=
lineCount
;
comments
.
commentController
=
new
n
.
CommentController
();
comments
.
commentController
.
buildContainer
(
$hook
,
{
readOnly
:
this
.
readOnly
});
comments
.
commentController
.
setCurrentUser
(
this
.
currentUser
);
comments
.
commentController
.
displayEditor
();
this
.
_setListeners
(
comments
.
commentController
);
this
.
annotations
.
push
(
comments
);
}
}
};
...
...
javascript/src/Comment.js
View file @
a292f669
...
...
@@ -30,7 +30,7 @@ var QfqNS = QfqNS || {};
this
.
$comment
=
{};
this
.
$text
=
{};
if
(
arguments
.
length
===
3
)
{
this
.
options
=
{
read
o
nly
:
false
};
this
.
options
=
{
read
O
nly
:
false
};
}
else
{
this
.
options
=
options
;
}
...
...
@@ -81,7 +81,9 @@ var QfqNS = QfqNS || {};
class
:
"
qfqCommentText
"
});
$comment
.
html
(
this
.
comment
.
comment
);
$comment
.
append
(
this
.
_getCommands
());
if
(
!
this
.
options
.
readOnly
)
{
$comment
.
append
(
this
.
_getCommands
());
}
this
.
$text
=
$comment
;
$comment
.
appendTo
(
$commentWrap
);
return
$commentWrap
;
...
...
javascript/src/CommentController.js
View file @
a292f669
...
...
@@ -28,6 +28,7 @@ var QfqNS = QfqNS || {};
this
.
$container
=
{};
this
.
$parent
=
{};
this
.
height
=
"
auto
"
;
this
.
options
=
{};
// Event Emitter is a Library qfq uses to emit custom Events.
this
.
eventEmitter
=
new
EventEmitter
();
};
...
...
@@ -69,10 +70,11 @@ var QfqNS = QfqNS || {};
this
.
_changeHandler
(
event
);
};
n
.
CommentController
.
prototype
.
buildContainer
=
function
(
$hook
)
{
n
.
CommentController
.
prototype
.
buildContainer
=
function
(
$hook
,
options
)
{
var
$container
=
$
(
"
<div />
"
,
{
class
:
"
qfqCommentContainer
"
});
this
.
options
=
options
;
$hook
.
after
(
$container
);
this
.
$container
=
$container
;
};
...
...
@@ -99,7 +101,7 @@ var QfqNS = QfqNS || {};
};
n
.
CommentController
.
prototype
.
addComment
=
function
(
comment
,
user
)
{
var
commentObject
=
new
n
.
Comment
(
comment
,
user
,
this
.
$container
);
var
commentObject
=
new
n
.
Comment
(
comment
,
user
,
this
.
$container
,
this
.
options
);
commentObject
.
display
();
this
.
comments
.
push
(
commentObject
);
this
.
_changeHandler
(
"
new
"
,
commentObject
);
...
...
@@ -129,14 +131,16 @@ var QfqNS = QfqNS || {};
};
n
.
CommentController
.
prototype
.
displayEditor
=
function
()
{
var
editor
=
new
n
.
Editor
();
var
that
=
this
;
var
$editor
=
editor
.
buildEditor
();
editor
.
on
(
"
editor.submit
"
,
function
(
editor
)
{
that
.
_handleEditorSubmit
(
editor
);
});
$editor
.
appendTo
(
this
.
$container
);
editor
.
$textArea
.
focus
();
if
(
!
this
.
options
.
readOnly
)
{
var
editor
=
new
n
.
Editor
();
var
that
=
this
;
var
$editor
=
editor
.
buildEditor
();
editor
.
on
(
"
editor.submit
"
,
function
(
editor
)
{
that
.
_handleEditorSubmit
(
editor
);
});
$editor
.
appendTo
(
this
.
$container
);
editor
.
$textArea
.
focus
();
}
};
n
.
CommentController
.
prototype
.
_handleEditorSubmit
=
function
(
editor
)
{
...
...
javascript/src/Form.js
View file @
a292f669
...
...
@@ -121,6 +121,7 @@ var QfqNS = QfqNS || {};
$
.
post
(
submitUrl
,
this
.
$form
.
serialize
())
.
done
(
this
.
ajaxSuccessHandler
.
bind
(
this
))
.
fail
(
this
.
submitFailureHandler
.
bind
(
this
));
console
.
log
(
this
.
$form
.
serialize
());
};
n
.
Form
.
prototype
.
serialize
=
function
()
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment