Changeset d6f5e5
- Timestamp:
- 05/06/2011 10:44:19 PM (14 years ago)
- Branches:
- 2.0.x, develop, extjs4-port, master
- Children:
- 04af89
- Parents:
- 1f3a7b
- git-author:
- Damien Churchill <damoxc@gmail.com> (05/06/2011 10:43:40 PM)
- git-committer:
- Damien Churchill <damoxc@gmail.com> (05/06/2011 10:44:19 PM)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
deluge/ui/web/js/deluge-all/EditTrackersWindow.js
r1f3a7b rd6f5e5 1 1 /*! 2 2 * Deluge.EditTrackers.js 3 * 3 * 4 4 * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> 5 5 * … … 50 50 closeAction: 'hide', 51 51 iconCls: 'x-deluge-edit-trackers', 52 52 53 53 initComponent: function() { 54 54 Deluge.EditTrackersWindow.superclass.initComponent.call(this); 55 55 56 56 this.addButton(_('Cancel'), this.onCancelClick, this); 57 57 this.addButton(_('Ok'), this.onOkClick, this); 58 58 this.addEvents('save'); 59 59 60 60 this.on('show', this.onShow, this); 61 61 this.on('save', this.onSave, this); 62 62 63 63 this.addWindow = new Deluge.AddTrackerWindow(); 64 64 this.addWindow.on('add', this.onAddTrackers, this); … … 92 92 } 93 93 }); 94 94 95 95 this.panel = this.add({ 96 96 margins: '0 0 0 0', … … 129 129 }); 130 130 }, 131 131 132 132 onAddClick: function() { 133 133 this.addWindow.show(); 134 134 }, 135 135 136 136 onAddTrackers: function(trackers) { 137 137 var store = this.list.getStore(); … … 151 151 }, this); 152 152 }, 153 153 154 154 onCancelClick: function() { 155 155 this.hide(); 156 156 }, 157 157 158 158 onEditClick: function() { 159 159 this.editWindow.show(this.list.getSelectedRecords()[0]); 160 160 }, 161 161 162 162 onHide: function() { 163 163 this.list.getStore().removeAll(); … … 167 167 this.editWindow.show(this.list.getRecord(node)); 168 168 }, 169 169 170 170 onOkClick: function() { 171 171 var trackers = []; … … 176 176 }) 177 177 }, this); 178 178 179 179 deluge.client.core.set_torrent_trackers(this.torrentId, trackers, { 180 180 failure: this.onSaveFail, … … 184 184 this.hide(); 185 185 }, 186 186 187 187 onRemoveClick: function() { 188 188 // Remove from the grid 189 189 this.list.getStore().remove(this.list.getSelectedRecords()[0]); 190 190 }, 191 191 192 192 onRequestComplete: function(status) { 193 193 this.list.getStore().loadData(status); 194 194 this.list.getStore().sort('tier', 'ASC'); 195 195 }, 196 196 197 197 onSaveFail: function() { 198 199 }, 200 198 199 }, 200 201 201 onSelect: function(list) { 202 202 if (list.getSelectionCount()) { … … 204 204 } 205 205 }, 206 206 207 207 onShow: function() { 208 208 this.panel.getBottomToolbar().items.get(4).disable(); … … 217 217 onDownClick: function() { 218 218 var r = this.list.getSelectedRecords()[0]; 219 if (!r) return; 220 219 221 r.set('tier', r.get('tier') + 1); 220 r.commit();221 222 r.store.sort('tier', 'ASC'); 223 r.store.commitChanges(); 224 225 this.list.select(r.store.indexOf(r)); 222 226 }, 223 227 224 228 onUpClick: function() { 225 229 var r = this.list.getSelectedRecords()[0]; 230 if (!r) return; 231 226 232 if (r.get('tier') == 0) return; 227 233 r.set('tier', r.get('tier') - 1); 228 r.commit();229 234 r.store.sort('tier', 'ASC'); 235 r.store.commitChanges(); 236 237 this.list.select(r.store.indexOf(r)); 230 238 } 231 239 });
Note:
See TracChangeset
for help on using the changeset viewer.