mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-22 10:08:45 +02:00
N°3649 - Activity panel: Code cleanup
This commit is contained in:
@@ -246,6 +246,7 @@ $(function()
|
||||
{
|
||||
return this.element.attr('data-object-id');
|
||||
},
|
||||
|
||||
// - Helpers on dates
|
||||
/**
|
||||
* Reformat date times to be relative (only if they are not too far in the past)
|
||||
@@ -267,6 +268,7 @@ $(function()
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// - Helpers on tabs
|
||||
/**
|
||||
* @returns {Object} Data on the active tab:
|
||||
@@ -354,6 +356,20 @@ $(function()
|
||||
|
||||
// TODO 3.0.0: Release lock
|
||||
},
|
||||
GetCaseLogRank: function(sCaseLog)
|
||||
{
|
||||
let iIdx = 0;
|
||||
let oCaselogTab = this.element.find(this.js_selectors.tab_toggler +
|
||||
'[data-tab-type="caselog"]' +
|
||||
'[data-caselog-attribute-code="'+ sCaseLog +'"]'
|
||||
);
|
||||
if(oCaselogTab.length > 0 && oCaselogTab.attr('data-caselog-rank'))
|
||||
{
|
||||
iIdx = parseInt(oCaselogTab.attr('data-caselog-rank'));
|
||||
}
|
||||
return iIdx;
|
||||
},
|
||||
|
||||
// - Helpers on messages
|
||||
_OpenMessage: function(oEntryElem)
|
||||
{
|
||||
@@ -374,6 +390,7 @@ $(function()
|
||||
|
||||
this.element.find(this.js_selectors.entry + sExtraSelector)[sCallback](this.css_classes.is_closed);
|
||||
},
|
||||
|
||||
// - Helpers on entries
|
||||
_ApplyEntriesFilters: function()
|
||||
{
|
||||
@@ -430,56 +447,6 @@ $(function()
|
||||
this.element.find(this.js_selectors.entry+'[data-entry-type="'+sEntryType+'"]').addClass(this.css_classes.is_hidden);
|
||||
this._UpdateEntryGroupsVisibility();
|
||||
},
|
||||
_GetNewEntryGroup: function()
|
||||
{
|
||||
let AjaxNewEntryGroupDeferred = jQuery.Deferred();
|
||||
const me = this;
|
||||
var oParams = {
|
||||
'operation' : 'new_entry_group',
|
||||
'caselog_new_entry': sData,
|
||||
'caselog_attcode' : sCaselog,
|
||||
}
|
||||
$.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', oParams, function(data){
|
||||
AjaxNewEntryGroupDeferred.resolve(data);
|
||||
});
|
||||
return AjaxNewEntryGroupDeferred.promise();
|
||||
},
|
||||
_AddEntry: function(sEntry, sOrigin)
|
||||
{
|
||||
let aEntryGroup = this.element.find(this.js_selectors.entry_group)
|
||||
let sAuthorLogin = $(sEntry).attr('data-entry-author-login');
|
||||
if (aEntryGroup.length > 0 && $(aEntryGroup[0]).attr('data-entry-group-author-login') === sAuthorLogin && $(aEntryGroup[0]).attr('data-entry-group-origin') === sOrigin)
|
||||
{
|
||||
$(aEntryGroup[0]).prepend(sEntry);
|
||||
this._ReformatDateTimes();
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO 3.0.0 Create a new entry group
|
||||
window.location.reload();
|
||||
}
|
||||
},
|
||||
AddEntry: function(sEntry, sOrigin)
|
||||
{
|
||||
this._AddEntry(sEntry, sOrigin);
|
||||
},
|
||||
_GetCaseLogRank: function(sCaseLog)
|
||||
{
|
||||
let iIdx = 0;
|
||||
let oCaselogTab = this.element.find(this.js_selectors.tab_toggler +
|
||||
'[data-tab-type="caselog"]' +
|
||||
'[data-caselog-attribute-code="'+ sCaseLog +'"]'
|
||||
);
|
||||
if(oCaselogTab.length > 0 && oCaselogTab.attr('data-caselog-rank'))
|
||||
{
|
||||
iIdx = parseInt(oCaselogTab.attr('data-caselog-rank'));
|
||||
}
|
||||
return iIdx;
|
||||
},
|
||||
GetCaseLogRank: function(sCaseLog)
|
||||
{
|
||||
return this._GetCaseLogRank(sCaseLog);
|
||||
},
|
||||
_UpdateEntryGroupsVisibility: function()
|
||||
{
|
||||
const me = this;
|
||||
@@ -494,6 +461,35 @@ $(function()
|
||||
$(this).removeClass(me.css_classes.is_hidden);
|
||||
}
|
||||
});
|
||||
},
|
||||
_GetNewEntryGroup: function()
|
||||
{
|
||||
let AjaxNewEntryGroupDeferred = jQuery.Deferred();
|
||||
const me = this;
|
||||
var oParams = {
|
||||
'operation' : 'new_entry_group',
|
||||
'caselog_new_entry': sData,
|
||||
'caselog_attcode' : sCaselog,
|
||||
}
|
||||
$.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', oParams, function(data){
|
||||
AjaxNewEntryGroupDeferred.resolve(data);
|
||||
});
|
||||
return AjaxNewEntryGroupDeferred.promise();
|
||||
},
|
||||
AddEntry: function(sEntry, sOrigin)
|
||||
{
|
||||
let aEntryGroup = this.element.find(this.js_selectors.entry_group)
|
||||
let sAuthorLogin = $(sEntry).attr('data-entry-author-login');
|
||||
if (aEntryGroup.length > 0 && $(aEntryGroup[0]).attr('data-entry-group-author-login') === sAuthorLogin && $(aEntryGroup[0]).attr('data-entry-group-origin') === sOrigin)
|
||||
{
|
||||
$(aEntryGroup[0]).prepend(sEntry);
|
||||
this._ReformatDateTimes();
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO 3.0.0 Create a new entry group
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user