From a90c709d3b22fed55767e829614b8ac33f898c0a Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Sat, 27 Sep 2008 17:20:05 +0000 Subject: [PATCH] add some documentation --- .../templates/ajax/static/js/deluge-bars.js | 56 ++++++++++++++++--- 1 file changed, 48 insertions(+), 8 deletions(-) diff --git a/deluge/ui/webui/templates/ajax/static/js/deluge-bars.js b/deluge/ui/webui/templates/ajax/static/js/deluge-bars.js index 2c1a227f9..2621b87e1 100644 --- a/deluge/ui/webui/templates/ajax/static/js/deluge-bars.js +++ b/deluge/ui/webui/templates/ajax/static/js/deluge-bars.js @@ -42,6 +42,16 @@ Deluge.Widgets.StatusBar = new Class({ }); +/* + Class: Deluge.Wdigets.Labels + Class to manage the filtering labels in the sidebar + + Example: + labels = new Deluge.Widgets.Labels(); + + Returns: + An instance of the class wrapped about the labels div +*/ Deluge.Widgets.Labels = new Class({ Extends: Widgets.Base, @@ -54,14 +64,17 @@ Deluge.Widgets.Labels = new Class({ this.filters = {}; }, - labelClicked: function(e) { - this.currentFilter.removeClass('activestate'); - this.filterType = e.filter; - this.filterName = e.name; - this.currentFilter = e.target; - e.target.addClass('activestate'); - }, - + /* + Property: update + Takes thes filters part of the update_ui rpc call and + performs the required changes on the filtering + + Arguments: + filters - A dictionary of the available filters + + Example: + labels.update({'state': [['All', '3'], ['Downloading', '2']]); + */ update: function(filters) { $each(filters, function(values, name) { if ($defined(this.filters[name])) { @@ -80,6 +93,23 @@ Deluge.Widgets.Labels = new Class({ } } }, this); + }, + + /* + Property: labelClicked + + Arguments: + e - The event args + + Example: + labelSection.addEvent('labelClicked', this.bound.labelClicked); + */ + labelClicked: function(e) { + this.currentFilter.removeClass('activestate'); + this.filterType = e.filter; + this.filterName = e.name; + this.currentFilter = e.target; + e.target.addClass('activestate'); } }); @@ -163,6 +193,16 @@ Deluge.Widgets.LabelSection = new Class({ }); }, + /* + Property: clicked + Event handler for when a list item is clicked + + Arguments: + e - The event args + + Example: + listItem.addEvent('click', this.clicked.bindWithEvent(this)); + */ clicked: function(e) { e.filter = e.target.retrieve('filterName'); e.name = this.name