WebUI: Refactor ContextMenu class

This commit is contained in:
buinsky
2016-01-20 16:13:54 +03:00
parent 45b68bd46c
commit c003229fcf
4 changed files with 100 additions and 96 deletions

View File

@@ -300,7 +300,6 @@ var DynamicTable = new Class({
else { // else create a new row in the table
var tr = new Element('tr');
tr.addClass("menu-target");
tr['rowId'] = rows[rowPos]['rowId'];
tr._this = this;
@@ -358,7 +357,7 @@ var DynamicTable = new Class({
return false;
});
this.setupTrEvents(tr);
this.setupTr(tr);
for (var j = 0 ; j < this.columns.length; j++) {
var td = new Element('td');
@@ -393,7 +392,7 @@ var DynamicTable = new Class({
}
},
setupTrEvents : function (tr) {},
setupTr : function (tr) {},
updateRow : function (tr, fullUpdate) {
var row = this.rows.get(tr.rowId);
@@ -524,11 +523,12 @@ var TorrentsTable = new Class({
else return 0;
};
// name
// name, category
this.columns['name'].updateTd = function (td, row) {
td.set('html', escapeHtml(this.getRowValue(row)));
};
this.columns['category'].updateTd = this.columns['name'].updateTd;
// size
@@ -706,7 +706,7 @@ var TorrentsTable = new Class({
return filteredRows;
},
setupTrEvents : function (tr) {
setupTr : function (tr) {
tr.addEvent('dblclick', function (e) {
e.stop();
this._this.selectRow(this.rowId);
@@ -718,6 +718,7 @@ var TorrentsTable = new Class({
pauseFN();
return true;
});
tr.addClass("torrentsTableContextMenuTarget");
},
getCurrentTorrentHash : function () {