Skip to content

Commit

Permalink
Version 3.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jshah4517 committed Nov 15, 2021
1 parent c1129cd commit 341de5e
Show file tree
Hide file tree
Showing 13 changed files with 106 additions and 50 deletions.
2 changes: 1 addition & 1 deletion frontend/css/main.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/css/main.min.css.map

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions frontend/js/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ $(document).ready(function () {
// https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/
$(".sp-comment-text a:not([href^='#'])").attr('target', '_blank').attr('rel', 'noopener');

// Previews for attachments.
App.attachments.loadPreviews('.sp-content');

// Previews for inline images.
var $article = $(".sp-article");
$article.find("img").each(function () {
$(this).addClass("sp-lightbox");
$(this).attr("data-src", $(this).attr('src'));
});
$article.lightGallery({selector: ".sp-lightbox", counter: false});

// Change ordering
$('.sp-comment-ordering').on('change', function () {
// Show loading
Expand Down
32 changes: 24 additions & 8 deletions frontend/js/ticket.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ $(document).ready(function() {
// Load attachment previews
App.attachments.loadPreviews($('.sp-message'));

// Ajax load messages.
$(document).on('click', '.sp-message-text-show-more', function (e) {
$(document)
// Ajax load messages.
.on('click', '.sp-message-text-show-more', function (e) {
e.preventDefault();
e.stopPropagation();

Expand Down Expand Up @@ -39,13 +40,19 @@ $(document).ready(function() {
$this.show();
$message.find('.sp-loading').remove();
});
});

// Open links in a new window/tab. Needs rel="noopener" due to
// https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/
$(document).on('click', '.sp-message-text a', function () {
})
// Download all attachments.
.on('click', '.sp-download-all', function () {
var $attachments = $(this).parents('.sp-message').find('.sp-attachments li');
var filename = $('meta[name="ticket-subject"]').prop('content');

(new ZipFile).create($attachments, filename)
})
// Open links in a new window/tab. Needs rel="noopener" due to
// https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/
.on('click', '.sp-message-text a', function () {
$(this).attr('target', '_blank').attr('rel', 'noopener');
});
});

// Redactor
var instance = $('textarea[name=text]').redactor();
Expand Down Expand Up @@ -265,6 +272,15 @@ $(document).ready(function() {
}
}

// If the browser supports, it enable the download all attachments function.
if (ZipFile.isSupported()) {
$('.sp-message-block').find('ul.sp-attachments').each(function () {
if ($(this).find('li').length > 1) {
$(this).find('.sp-download-all').show();
}
});
}

// Update the last poll time
lastReplyPoll = response.timestamp;
},
Expand Down
10 changes: 9 additions & 1 deletion general/css/redactor.css
Original file line number Diff line number Diff line change
Expand Up @@ -470,4 +470,12 @@ ul.redactor-search li .sp-title {

.redactor-in p {
margin: 0; /* act like breaklines */
}
}

.redactor-in ol ol li {
list-style-type: lower-alpha;
}

.redactor-in ol ol ol li {
list-style-type: lower-roman;
}
2 changes: 1 addition & 1 deletion installer/css/main.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion installer/css/main.min.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion operator/css/main.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion operator/css/main.min.css.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions operator/js/filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@ Filtering.initialise = function () {

$(function () {
// Toggle filtering
$('.toggle-filtering').on('click', function () {
$('.sp-condition-group').toggle();

$('.sp-quick-actions').on('mousedown', 'button.sp-filter-results', function () {
// If we're toggling to show and it's currently empty, insert new condition
if ($('.sp-condition-group').is(':visible') && ! $('.sp-condition-group .condition:visible').length) {
if ($('.sp-condition-group').parent().toggle().is(':visible')
&& ! $('.sp-condition-group .condition:visible').length
) {
$('.sp-condition-group .add-condition').trigger('click');
}
});
Expand Down
1 change: 0 additions & 1 deletion operator/js/newticket.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ $(document).ready(function () {
labelField: 'name',
searchField: 'name',
create: true,
placeholder: Lang.choice('user.organisation', 1),
allowEmptyOption: true,
load: function (query, callback) {
if (! query.length) {
Expand Down
13 changes: 9 additions & 4 deletions operator/js/sidebox.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ $(function () {
toggleSidebox(this);

// The sidebox must have an ID to store the cookie.
if (typeof Cookies !== 'undefined' && typeof $(this).prop('id') !== 'undefined') {
Cookies.set($(this).prop('id'), $(this).hasClass('sp-closed') ? 'sp-collapsed' : 'sp-expanded');
if (typeof Cookies !== 'undefined' && $(this).prop('id')) {
Cookies.set(
$(this).prop('id'),
$(this).hasClass('sp-closed') ? 'sp-collapsed' : 'sp-expanded',
{samesite: 'lax'}
);
}
});

Expand All @@ -31,10 +35,11 @@ $(function () {
toggleSidebar();

// The sidebar must have an ID to store the cookie.
if (typeof Cookies !== 'undefined' && typeof $sidebar.prop('id') !== 'undefined') {
if (typeof Cookies !== 'undefined' && $sidebar.prop('id')) {
Cookies.set(
$sidebar.prop('id'),
$sidebar.hasClass(sidebarClosedState) ? sidebarClosedState : sidebarOpenState
$sidebar.hasClass(sidebarClosedState) ? sidebarClosedState : sidebarOpenState,
{samesite: 'lax'}
);
}
});
Expand Down
69 changes: 43 additions & 26 deletions operator/js/ticket_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -730,35 +730,43 @@ $(document).ready(function() {
});
});

// Show a draft message.
$('#tabMessages').on('click', '.sp-draft-message-title', function () {
var $draft = $(this).parent();
$('#tabMessages')
// Download all attachments.
.on('click', '.sp-download-all', function () {
var $attachments = $(this).parents('ul.sp-attachments').find('li');
var filename = $('.sp-ticket-subject').text();

// Toggle the content area.
$draft.find('.sp-draft-message-content').toggleClass('sp-hidden');
$draft.find('.sp-chevron i').toggleClass('fa-chevron-down fa-chevron-up');
(new ZipFile).create($attachments, filename)
})
// Show a draft message.
.on('click', '.sp-draft-message-title', function () {
var $draft = $(this).parent();

// If it's now closed, we can stop here.
if ($draft.find('.fa-chevron-up').length) {
return;
}
// Toggle the content area.
$draft.find('.sp-draft-message-content').toggleClass('sp-hidden');
$draft.find('.sp-chevron i').toggleClass('fa-chevron-down fa-chevron-up');

// Otherwise, load the message and show it.
return $.get(laroute.route('ticket.operator.message.showJson', {id: $draft.data('message-id')}))
.done(function (ajax) {
// Load draft message.
$draft.find('.sp-draft-message-content-body').html(ajax.data.purified_text);
})
.catch(function (error) {
if (error.status === 404 || error.status === 403) {
$draft.remove();
} else {
// User should retry expanding the draft.
$draft.find('.sp-draft-message-content').toggleClass('sp-hidden');
$draft.find('.sp-chevron i').toggleClass('fa-chevron-down fa-chevron-up');
}
});
});
// If it's now closed, we can stop here.
if ($draft.find('.fa-chevron-up').length) {
return;
}

// Otherwise, load the message and show it.
return $.get(laroute.route('ticket.operator.message.showJson', {id: $draft.data('message-id')}))
.done(function (ajax) {
// Load draft message.
$draft.find('.sp-draft-message-content-body').html(ajax.data.purified_text);
})
.catch(function (error) {
if (error.status === 404 || error.status === 403) {
$draft.remove();
} else {
// User should retry expanding the draft.
$draft.find('.sp-draft-message-content').toggleClass('sp-hidden');
$draft.find('.sp-chevron i').toggleClass('fa-chevron-down fa-chevron-up');
}
});
});

// Apply macro
$('.apply-macro').on('click', function() {
Expand Down Expand Up @@ -1681,6 +1689,15 @@ $(document).ready(function() {
$('form.message-form').trigger("supportpal.polled_messages");
}

// If the browser supports, it enable the download all attachments function.
if (ZipFile.isSupported()) {
$('#tabMessages').find('ul.sp-attachments').each(function () {
if ($(this).find('li').length > 1) {
$(this).find('.sp-download-all').show();
}
});
}

// Show other operators viewing ticket
$('.ticket-viewing').replaceWith(response.data.viewing).show(500);
// Depending on view, add margin to top or bottom of content area if visible (code in mobile.js)
Expand Down

0 comments on commit 341de5e

Please sign in to comment.