Skip to content

Commit

Permalink
in the machines.html view, there is some mysterious character, trappi…
Browse files Browse the repository at this point in the history
…ng it in a commit #weecodingi, as seen here http://twitpic.com/1tx0gx
  • Loading branch information
ideamonk committed Jun 4, 2010
1 parent cf9e4d1 commit c2f56b1
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 5 deletions.
32 changes: 31 additions & 1 deletion webapp/main.py
Expand Up @@ -99,7 +99,7 @@ def get(self, pagename=None):
values.update( {'total_size':slide_stat.total_size} )

# storage stats
total_micro = (float(values['total_size']) / 1024**2)*100
total_micro = int((float(values['total_size']) / 1024**2)*100)
values.update( {'total_micro': range(total_micro)} )
values.update( {'remaining_micro': range(100-total_micro)} )

Expand Down Expand Up @@ -130,6 +130,36 @@ def get(self, pagename=None):
helpers.render(self, "overview.html",values)
return

if pagename in ['/machines','/machines/']:
# ---------------------------------------------------------------
# Machines Page
# ---------------------------------------------------------------
total_machines = Machines.all().count()
values.update ( {'total_machines': total_machines} )

if total_machines>0:
values.update({'machines_start':Machines.all().order('created').fetch(1)[0].created})
values.update( {'machines':Machines.all().fetch(1000)} )
else:
values.update({'machines_start':'a time unknown'})

helpers.render(self, "machines.html",values)
return

def post(self, pagename=None):
if not users.is_current_user_admin():
self.redirect("/")

if pagename == '/machines/add':
# ---------------------------------------------------------------
# Add Machines
# ---------------------------------------------------------------
name = self.request.get('name')
machine = Machines(name=name, enabled=True, passphrase=helpers.gimme_garbage(12))
machine.put()

self.redirect('/home/machines')



def main():
Expand Down
3 changes: 2 additions & 1 deletion webapp/models.py
Expand Up @@ -13,4 +13,5 @@ class SlideStats(db.Model):
class Machines(db.Model):
name = db.StringProperty()
enabled = db.BooleanProperty()
passphrase = db.StringProperty()
passphrase = db.StringProperty()
created = db.DateTimeProperty(auto_now_add=True)
Binary file modified webapp/models.pyc
Binary file not shown.
8 changes: 7 additions & 1 deletion webapp/static/style.css
Expand Up @@ -89,4 +89,10 @@ body{
#over_stats{
padding:0px 40px;
font-size:1.6em;
}
}

#machine_list input { border: 1px solid #aaa; width:100%;}
#machine_list .m_head { width:auto; margin:0px 20px; font-size:1.4em; }
#machine_list p {text-align:center; }
#machine_list .m_head span { border-right:1px solid #aaa; }
#machine_list p span { display:inline-block; padding:2px 10px; width:15%; }
4 changes: 2 additions & 2 deletions webapp/views/skeleton.html
Expand Up @@ -19,10 +19,10 @@
{% block menu %}
<ul id='topmenu'>
<li>
<a href="#">Overview</a>
<a href="/home">Overview</a>
</li>
<li>
<a href="#">Machines</a>
<a href="/home/machines">Machines</a>
</li>
<li>
<a href="#">History</a>
Expand Down

0 comments on commit c2f56b1

Please sign in to comment.