Skip to content

Commit

Permalink
CTK.ProgressBar handles props properly now
Browse files Browse the repository at this point in the history
git-svn-id: svn://cherokee-project.com/CTK/trunk@5283 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information
alobbs committed Jul 5, 2010
1 parent 3415d22 commit 88c84bb
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions CTK/ProgressBar.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@

import os
from Widget import Widget
from util import props_to_str

HEADERS = [
'<link type="text/css" href="/CTK/css/CTK.css" rel="stylesheet" />',
'<script type="text/javascript" src="/CTK/js/jquery-ui-1.7.2.custom.min.js"></script>'
]

HTML = """
<div id="%(id)s"></div>
<div id="%(id)s" %(props)s></div>
"""

PERCENT_INIT_JS = """
Expand All @@ -39,12 +40,19 @@
class ProgressBar (Widget):
def __init__ (self, props={}):
Widget.__init__ (self)
self.id = "progressbar_%d" %(self.uniq_id)
self.id = "progressbar_%d" %(self.uniq_id)

self.props = props.copy()
if 'class' in props:
self.props['class'] += ' progressbar'
else:
self.props['class'] = 'progressbar'

def Render (self):
render = Widget.Render (self)

props = {'id': self.id}
props = {'id': self.id,
'props': props_to_str (self.props)}

render.html += HTML %(props)
render.js += PERCENT_INIT_JS %(props)
Expand Down

0 comments on commit 88c84bb

Please sign in to comment.