Skip to content
Snippets Groups Projects
Commit f4d138a7 authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #91 from greezybacon/issue/redact-live


Make findRichtextBoxes() more reusable

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents 15b9e31d d484e711
No related branches found
No related tags found
No related merge requests found
......@@ -148,7 +148,8 @@ if($ticket->isOverdue())
echo $ticket->getOwnerId(); ?>"
onclick="javascript:
$('#overlay').show();
$('#user-info .body').load(this.href);
$('#user-info .body').load(this.href,
function() { $(this).redactify(); });
$('#user-info').show();
return false;
"><i class="icon-user"></i> <?php
......
......@@ -79,10 +79,11 @@ $(document).ready(function(){
});
getConfig = (function() {
var dfd = $.Deferred();
var dfd = $.Deferred(),
requested = false;
return function() {
if (dfd.state() != 'resolved')
$.ajax({
if (dfd.state() != 'resolved' && !requested)
requested = $.ajax({
url: "ajax.php/config/client",
dataType: 'json',
success: function (json_config) {
......
......@@ -182,8 +182,8 @@ $(function() {
}
el.redactor(options);
},
findRichtextBoxes = function() {
$('.richtext').each(function(i,el) {
findRichtextBoxes = function(context) {
$('.richtext', context||document).each(function(i,el) {
if ($(el).hasClass('ifhtml'))
// Check if html_thread is enabled first
getConfig().then(function(c) {
......@@ -196,5 +196,8 @@ $(function() {
});
};
findRichtextBoxes();
$('#user-info').ajaxComplete(findRichtextBoxes);
$.fn.redactify = function() {
this.each(function(i,e) { findRichtextBoxes(e); });
return this;
}
});
......@@ -459,10 +459,11 @@ $(document).ready(function(){
// NOTE: getConfig should be global
getConfig = (function() {
var dfd = $.Deferred();
var dfd = $.Deferred(),
requested = null;
return function() {
if (dfd.state() != 'resolved')
$.ajax({
if (dfd.state() != 'resolved' && !requested)
requested = $.ajax({
url: "ajax.php/config/scp",
dataType: 'json',
success: function (json_config) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment