var Portal = Class.create();
Portal.prototype = {
initialize: function (options) {
- this.setOptions(options);
- if (!this.options.editorEnabled) return;
+ this.setOptions(options);
+ if (!this.options.editorEnabled) {
+ return;
+ }
- Droppables.add(this.options.blocklist, {
- containment : $A($$("."+this.options.column)),
- hoverclass : this.options.hoverclass,
- overlap : 'horizontal',
- onDrop: function(dragged, dropped) {
- $(dragged).remove();
- }
- });
+ Droppables.add(this.options.blocklist, {
+ containment: $A($$("." + this.options.column)),
+ hoverclass: this.options.hoverclass,
+ overlap: 'horizontal',
+ onDrop: function (dragged, dropped) {
+ $(dragged).remove();
+ }
+ });
- this.createAllSortables();
+ this.createAllSortables();
- this.lastSaveString = "";
+ this.lastSaveString = "";
- this.saveDashboardsState();
+ this.saveDashboardsState();
},
/****************************************************/
var result = "";
var index = 1;
$$("."+this.options.column).each(function (sortable) {
- if ($(sortable).select("."+this.options.block).length == 0) {
+ if ($(sortable).select("."+this.options.block).length === 0) {
$(sortable).select("."+this.options.columnhandle)[0].show();
} else {
$(sortable).select("."+this.options.columnhandle)[0].hide();
}
- if (index > 1) result += ";";
+ if (index > 1) {
+ result += ";";
+ }
result += Sortable.sequence($(sortable).identify());
index++;
});
var firstTime=this.lastSaveString=="";
this.lastSaveString=result;
- if (firstTime) return;
+ if (firstTime) {
+ return;
+ }
try {
if ($(this.options.dashboardstate)) {
var issueKey = issueElt.attr('data-issue-key');
var replaced = $j(htmlResponse);
issueElt.replaceWith(replaced);
- notifyIssueChange(issueKey)
+ notifyIssueChange(issueKey);
}
).fail(function (jqXHR, textStatus) {
closeIssueForm(elt);
// Used for actions defined by plugins
function doPluginIssueAction(elt, action) {
var parameters = {};
- return doIssueAction(elt, action, parameters)
+ return doIssueAction(elt, action, parameters);
}
function assignIssueToMe(elt) {
var parameters = {'me': true};
- return doIssueAction(elt, 'assign', parameters)
+ return doIssueAction(elt, 'assign', parameters);
}
function doIssueTransition(elt, transition) {
var parameters = {'transition': transition};
- return doIssueAction(elt, 'transition', parameters)
+ return doIssueAction(elt, 'transition', parameters);
}
function formDeleteIssueComment(elt) {
Sonar.RecentHistory = function () {
};
-Sonar.RecentHistory.prototype.getRecentHistory = function() {
+Sonar.RecentHistory.prototype.getRecentHistory = function () {
var sonarHistory = localStorage.getItem("sonar_recent_history");
if (sonarHistory == null) {
- sonarHistory = new Array();
+ sonarHistory = [];
} else {
sonarHistory = JSON.parse(sonarHistory);
}
return sonarHistory;
};
-
+
Sonar.RecentHistory.prototype.clear = function () {
localStorage.clear();
};
-
+
Sonar.RecentHistory.prototype.add = function (resourceKey, resourceName, iconPath) {
var sonarHistory = this.getRecentHistory();
-
- if (resourceKey != '') {
+
+ if (resourceKey !== '') {
var newEntry = {'key': resourceKey, 'name': resourceName, 'iconPath': iconPath};
// removes the element of the array if it exists
- for (i = 0; i < sonarHistory.length; i++) {
+ for (var i = 0; i < sonarHistory.length; i++) {
var item = sonarHistory[i];
- if (item['key'] == resourceKey) {
+ if (item['key'] === resourceKey) {
sonarHistory.splice(i, 1);
break;
}
- }
+ }
// then add it to the beginning of the array
sonarHistory.unshift(newEntry);
// and finally slice the array to keep only 10 elements
- sonarHistory = sonarHistory.slice(0,10);
-
+ sonarHistory = sonarHistory.slice(0, 10);
+
localStorage.setItem("sonar_recent_history", JSON.stringify(sonarHistory));
}
};
Sonar.RecentHistory.prototype.populateRecentHistoryPanel = function () {
var historyLinksList = $j('#recent-history-list');
historyLinksList.empty();
-
- var recentHistory = this.getRecentHistory();
- if (recentHistory.length == 0) {
+
+ var recentHistory = this.getRecentHistory();
+ if (recentHistory.length === 0) {
$j("#recent-history").hide();
- } else {
+ } else {
recentHistory.forEach(function (resource) {
historyLinksList.append('<li><img width="16" height="16" src="'
- + baseUrl
- + resource['iconPath']
- + '"><a href="'
- + baseUrl
- + '/dashboard/index/'
- + resource['key']
- + '"> '
- + resource['name']
- + '</a></li>');
+ + baseUrl
+ + resource['iconPath']
+ + '"><a href="'
+ + baseUrl
+ + '/dashboard/index/'
+ + resource['key']
+ + '"> '
+ + resource['name']
+ + '</a></li>');
});
$j("#recent-history").show();
}
function highlight_usages(event){
var isAlreadyHighlighted = false;
var selectedElementClasses = $j(this).attr("class").split(" ");
- if(selectedElementClasses.indexOf("highlighted") != -1) {
+ if(selectedElementClasses.indexOf("highlighted") !== -1) {
isAlreadyHighlighted = true;
}
$j("#" + event.data.id + " span.highlighted").removeClass("highlighted");