Skip to content

Commit

Permalink
fix(styles): issue #101 editing issue/comment/note
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed Nov 3, 2018
1 parent 4793c31 commit 46ab7e8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/public/js/angularjs/controllers/singleTicket.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ define(['angular', 'underscore', 'jquery', 'uikit', 'modules/socket', 'modules/n
var form = $('form#edit-issue-form');
if (!form.isValid(null, null, false)) return true;
var issue = form.find('textarea#issueText').val();
issue = '<p>' + issue + '</p>';

socket.ui.setTicketIssue(id, issue);
}
};
Expand Down
2 changes: 0 additions & 2 deletions src/public/js/pages/singleTicket.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ define('pages/singleTicket', [
if (id.length > 0) {
var comment = $($event.currentTarget).find('textarea#commentText').val();
var commentId = $($event.currentTarget).attr('data-commentId');
comment = '<p>' + comment + '</p>';

socketClient.ui.setCommentText(id, commentId, comment);
}
Expand Down Expand Up @@ -112,7 +111,6 @@ define('pages/singleTicket', [
if (id.length > 0) {
var note = $($event.currentTarget).find('textarea#noteText').val();
var noteId = $($event.currentTarget).attr('data-noteId');
note = '<p>' + note + '</p>';

socketClient.ui.setNoteText(id, noteId, note);
}
Expand Down
16 changes: 13 additions & 3 deletions src/socketserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,10 @@ var socketServer = function(ws) {
var ownerId = socket.request.user._id;
var ticketSchema = require('./models/ticket');
if (_.isUndefined(ticketId) || _.isUndefined(issue)) return true;
issue = issue.replace(/(\r\n|\n\r|\r|\n)/g, '<br>');

marked.setOptions({
breaks: true
});
var markedIssue = marked(issue);

ticketSchema.getTicketById(ticketId, function(err, ticket) {
Expand All @@ -438,7 +441,11 @@ var socketServer = function(ws) {
var comment = data.commentText;
var ticketSchema = require('./models/ticket');
if (_.isUndefined(ticketId) || _.isUndefined(commentId) || _.isUndefined(comment)) return true;
comment = comment.replace(/(\r\n|\n\r|\r|\n)/g, '<br>');

marked.setOptions({
breaks: true
});

var markedComment = marked(comment);

ticketSchema.getTicketById(ticketId, function(err, ticket) {
Expand Down Expand Up @@ -485,7 +492,10 @@ var socketServer = function(ws) {
var note = data.noteText;
var ticketSchema = require('./models/ticket');
if (_.isUndefined(ticketId) || _.isUndefined(noteId) || _.isUndefined(note)) return true;
note = note.replace(/(\r\n|\n\r|\r|\n)/g, '<br>');

marked.setOptions({
breaks: true
});
var markedNote = marked(note);

ticketSchema.getTicketById(ticketId, function(err, ticket) {
Expand Down

0 comments on commit 46ab7e8

Please sign in to comment.