Advertisement
mesuutt

Backbone view el

Jun 4th, 2012
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function($){
  2.     VShowroomItem=Backbone.View.extend({
  3.         el:$(".sr-item")
  4.         ,initialize:function(scopeid,owner_id){
  5.             this.el=$('.sr-item:regex(data-owner_id,'+owner_id+')');
  6.             this.owner_scope=scopeid;
  7.             this.owner_id=owner_id;
  8.            
  9.         }
  10.         ,events:{
  11.             'click .send-friendship-req': 'makeJoinReq'
  12.             ,'click .send-msg-to-company':'sendMessage'
  13.         }
  14.         ,sendMessage:function(){
  15.             new MessageHandler(this.owner_scope,this.owner_id,function(c,h){
  16.                 h.show();
  17.             });
  18.         }
  19.        
  20.        
  21.        
  22.     });
  23.  
  24.     $('.sr-item').each(function(i,item){
  25.         var SRItem=new VShowroomItem(scopes['Company'],$(item).dataset("owner_id"));
  26.     });
  27.    
  28.    
  29. })(jQuery);
  30.  
  31. <div class="sr-item" data-owner_id="3">
  32.     <div><span class="send-msg-to-company">Send message</span></div>
  33. </div>
  34.  
  35. <div class="sr-item" data-owner_id="4">
  36.     <div><span class="send-msg-to-company">Send message</span></div>
  37. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement