Skip to content

Commit

Permalink
Makes the JS_to_refresh method slightly more flexible.
Browse files Browse the repository at this point in the history
git-svn-id: svn://cherokee-project.com/CTK/trunk@4772 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information
alobbs committed Apr 8, 2010
1 parent ec7df0b commit fe2d83b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions CTK/Refreshable.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
url: '%(url)s',
async: true,
success: function(msg){
$('#%(id)s').html(msg);
%(selector)s.html(msg);
%(on_success)s
}
});
Expand Down Expand Up @@ -76,8 +76,11 @@ def Render (self):
render.html = HTML %(props)
return render

def JS_to_refresh (self, on_success=''):
props = {'id': self.id,
def JS_to_refresh (self, on_success='', selector=None):
if not selector:
selector = "$('#%s')" %(self.id)

props = {'selector': selector,
'url': self.url,
'on_success': on_success}
return REFRESHABLE_UPDATE_JS %(props)
Expand Down

0 comments on commit fe2d83b

Please sign in to comment.