/*jslint white:true, regexp: true, nomen: true, devel: true, undef: true, browser: true, continue: true, sloppy: true, forin: true, newcap: true, plusplus: true, maxerr: 50, indent: 4 */\r
/*global kiwi */\r
+_kiwi.view.Member = Backbone.View.extend({\r
+ tagName: "li",\r
+ initialize: function (options) {\r
+ this.model.bind('change', this.render, this);\r
+ this.render();\r
+ },\r
+ render: function () {\r
+ var $this = this.$el,\r
+ prefix_css_class = (this.model.get('modes') || []).join(' ');\r
+\r
+ $this.addClass('mode ' + prefix_css_class);\r
+ $this.html('<a class="nick"><span class="prefix">' + this.model.get("prefix") + '</span>' + this.model.get("nick") + '</a>');\r
+ $this.data('member', this.model);\r
+ return this;\r
+ }\r
+});\r
\r
_kiwi.view.MemberList = Backbone.View.extend({\r
tagName: "ul",\r
$(this.el).appendTo('#kiwi .memberlists');\r
},\r
render: function () {\r
- var $this = $(this.el);\r
+ var $this = this.$el;\r
$this.empty();\r
this.model.forEach(function (member) {\r
- var prefix_css_class = (member.get('modes') || []).join(' ');\r
- $('<li class="mode ' + prefix_css_class + '"><a class="nick"><span class="prefix">' + member.get("prefix") + '</span>' + member.get("nick") + '</a></li>')\r
- .appendTo($this)\r
- .data('member', member);\r
+ $this.append(member.view.el);\r
});\r
+ return this;\r
},\r
nickClick: function (event) {\r
var $target = $(event.currentTarget).parent('li'),\r
member = $target.data('member'),\r
userbox;\r
- \r
+\r
event.stopPropagation();\r
\r
// If the userbox already exists here, hide it\r